1 /* @source ensintron **********************************************************
2 **
3 ** Ensembl Intron functions
4 **
5 ** @author Copyright (C) 1999 Ensembl Developers
6 ** @author Copyright (C) 2006 Michael K. Schuster
7 ** @version $Revision: 1.28 $
8 ** @modified 2009 by Alan Bleasby for incorporation into EMBOSS core
9 ** @modified $Date: 2013/02/17 13:07:37 $ by $Author: mks $
10 ** @@
11 **
12 ** This library is free software; you can redistribute it and/or
13 ** modify it under the terms of the GNU Lesser General Public
14 ** License as published by the Free Software Foundation; either
15 ** version 2.1 of the License, or (at your option) any later version.
16 **
17 ** This library is distributed in the hope that it will be useful,
18 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 ** Lesser General Public License for more details.
21 **
22 ** You should have received a copy of the GNU Lesser General Public
23 ** License along with this library; if not, write to the Free Software
24 ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
25 ** MA 02110-1301, USA.
26 **
27 ******************************************************************************/
28
29 /* ========================================================================= */
30 /* ============================= include files ============================= */
31 /* ========================================================================= */
32
33 #include "ensintron.h"
34 #include "ensexon.h"
35 #include "enstranscript.h"
36
37
38
39
40 /* ========================================================================= */
41 /* =============================== constants =============================== */
42 /* ========================================================================= */
43
44
45
46
47 /* ========================================================================= */
48 /* =========================== global variables ============================ */
49 /* ========================================================================= */
50
51
52
53
54 /* ========================================================================= */
55 /* ============================= private data ============================== */
56 /* ========================================================================= */
57
58
59
60
61 /* ========================================================================= */
62 /* =========================== private constants =========================== */
63 /* ========================================================================= */
64
65 /* @conststatic intronsupportingevidenceKType *********************************
66 **
67 ** The Ensembl Intron Supporting Evidence type member is enumerated in both,
68 ** the SQL table definition and the data structure. The following strings are
69 ** used for conversion in database operations and correspond to
70 ** EnsEIntronsupportingevidenceType and the
71 ** 'intron_supporting_evidence.score_type' field.
72 **
73 ******************************************************************************/
74
75 static const char *const intronsupportingevidenceKType[] =
76 {
77 "",
78 "NONE",
79 "DEPTH",
80 (const char *) NULL
81 };
82
83
84
85
86 /* @conststatic intronsupportingevidenceadaptorKTablenames ********************
87 **
88 ** Array of Ensembl Intron Supporting Evidence Adaptor SQL table names
89 **
90 ******************************************************************************/
91
92 static const char *const intronsupportingevidenceadaptorKTablenames[] =
93 {
94 "intron_supporting_evidence",
95 (const char *) NULL
96 };
97
98
99
100
101 /* @conststatic intronsupportingevidenceadaptorKColumnnames *******************
102 **
103 ** Array of Ensembl Intron Supporting Evidence Adaptor SQL column names
104 **
105 ******************************************************************************/
106
107 static const char *const intronsupportingevidenceadaptorKColumnnames[] =
108 {
109 "intron_supporting_evidence.intron_supporting_evidence_id",
110 "intron_supporting_evidence.seq_region_id",
111 "intron_supporting_evidence.seq_region_start",
112 "intron_supporting_evidence.seq_region_end",
113 "intron_supporting_evidence.seq_region_strand",
114 "intron_supporting_evidence.analysis_id",
115 "intron_supporting_evidence.hit_name",
116 "intron_supporting_evidence.score",
117 "intron_supporting_evidence.score_type",
118 "intron_supporting_evidence.is_splice_canonical",
119 (const char *) NULL
120 };
121
122
123
124
125 /* ========================================================================= */
126 /* =========================== private variables =========================== */
127 /* ========================================================================= */
128
129
130
131
132 /* ========================================================================= */
133 /* =========================== private functions =========================== */
134 /* ========================================================================= */
135
136 static EnsPIntron intronNewCpyFeatures(EnsPIntron intron);
137
138 static AjBool intronsupportingevidenceadaptorFetchAllbyStatement(
139 EnsPBaseadaptor ba,
140 const AjPStr statement,
141 EnsPAssemblymapper am,
142 EnsPSlice slice,
143 AjPList ises);
144
145
146
147
148 /* ========================================================================= */
149 /* ======================= All functions by section ======================== */
150 /* ========================================================================= */
151
152
153
154
155 /* @filesection ensintron *****************************************************
156 **
157 ** @nam1rule ens Function belongs to the Ensembl library.
158 **
159 ******************************************************************************/
160
161
162
163
164 /* @datasection [EnsPIntron] Ensembl Intron ***********************************
165 **
166 ** @nam2rule Intron Functions for manipulating Ensembl Intron objects
167 **
168 ** @cc Bio::EnsEMBL::Intron
169 ** @cc CVS Revision: 1.22
170 ** @cc CVS Tag: branch-ensembl-68
171 **
172 ******************************************************************************/
173
174
175
176
177 /* @section constructors ******************************************************
178 **
179 ** All constructors return a new Ensembl Intron by pointer.
180 ** It is the responsibility of the user to first destroy any previous
181 ** Intron. The target pointer does not need to be initialised to
182 ** NULL, but it is good programming practice to do so anyway.
183 **
184 ** @fdata [EnsPIntron]
185 **
186 ** @nam3rule New Constructor
187 ** @nam4rule Cpy Constructor with existing object
188 ** @nam4rule Ini Constructor with initial values
189 ** @nam4rule Ref Constructor by incrementing the use counter
190 **
191 ** @argrule Cpy intron [const EnsPIntron] Ensembl Intron
192 ** @argrule Ini exon1 [EnsPExon] Ensembl Exon 1
193 ** @argrule Ini exon2 [EnsPExon] Ensembl Exon 2
194 ** @argrule Ini analysis [EnsPAnalysis] Ensembl Analysis
195 ** @argrule Ref intron [EnsPIntron] Ensembl Intron
196 **
197 ** @valrule * [EnsPIntron] Ensembl Intron or NULL
198 **
199 ** @fcategory new
200 ******************************************************************************/
201
202
203
204
205 /* @func ensIntronNewCpy ******************************************************
206 **
207 ** Object-based constructor function, which returns an independent object.
208 **
209 ** @param [r] intron [const EnsPIntron] Ensembl Intron
210 **
211 ** @return [EnsPIntron] Ensembl Intron or NULL
212 **
213 ** @release 6.4.0
214 ** @@
215 ******************************************************************************/
216
ensIntronNewCpy(const EnsPIntron intron)217 EnsPIntron ensIntronNewCpy(const EnsPIntron intron)
218 {
219 EnsPIntron pthis = NULL;
220
221 if (!intron)
222 return NULL;
223
224 AJNEW0(pthis);
225
226 pthis->Feature = ensFeatureNewRef(intron->Feature);
227 pthis->PreviousExon = ensExonNewRef(intron->PreviousExon);
228 pthis->NextExon = ensExonNewRef(intron->NextExon);
229 pthis->Use = 1U;
230
231 return pthis;
232 }
233
234
235
236
237 /* @func ensIntronNewIni ******************************************************
238 **
239 ** Default constructor for an Ensembl Intron with initial values.
240 **
241 ** @cc Bio::EnsEMBL::Intron::new
242 ** @param [u] exon1 [EnsPExon] Ensembl Exon 1
243 ** @param [u] exon2 [EnsPExon] Ensembl Exon 2
244 ** @param [uN] analysis [EnsPAnalysis] Ensembl Analysis
245 **
246 ** @return [EnsPIntron] Ensembl Intron or NULL
247 **
248 ** @release 6.4.0
249 ** @@
250 ******************************************************************************/
251
ensIntronNewIni(EnsPExon exon1,EnsPExon exon2,EnsPAnalysis analysis)252 EnsPIntron ensIntronNewIni(EnsPExon exon1,
253 EnsPExon exon2,
254 EnsPAnalysis analysis)
255 {
256 ajint strand = 0;
257
258 ajuint start = 0U;
259 ajuint end = 0U;
260
261 AjPStr seqname1 = NULL;
262 AjPStr seqname2 = NULL;
263
264 EnsPFeature feature = NULL;
265 EnsPFeature feature1 = NULL;
266 EnsPFeature feature2 = NULL;
267
268 EnsPIntron intron = NULL;
269
270 EnsPSlice slice1 = NULL;
271 EnsPSlice slice2 = NULL;
272
273 if (ajDebugTest("ensIntronNewIni"))
274 {
275 ajDebug("ensIntronNewIni\n"
276 " exon1 %p\n"
277 " exon2 %p\n"
278 " analysis %p\n",
279 exon1,
280 exon2,
281 analysis);
282
283 ensExonTrace(exon1, 1);
284 ensExonTrace(exon2, 1);
285 }
286
287 if (!exon1)
288 return NULL;
289
290 if (!exon2)
291 return NULL;
292
293 feature1 = ensExonGetFeature(exon1);
294 feature2 = ensExonGetFeature(exon2);
295
296 slice1 = ensFeatureGetSlice(feature1);
297 slice2 = ensFeatureGetSlice(feature2);
298
299 seqname1 = ensFeatureGetSequencename(feature1);
300 seqname2 = ensFeatureGetSequencename(feature2);
301
302 /* Both Exon objects have to be on the same Slice or sequence name. */
303
304 if (!((slice1 && slice2) || (seqname1 && seqname2)))
305 {
306 ajDebug("ensIntronNewIni got Ensembl Exon objects on both, an "
307 "Ensembl Slice and sequence name.\n");
308
309 return NULL;
310 }
311
312 if (slice1 && slice2 && (!ensSliceMatch(slice1, slice2)))
313 {
314 ajDebug("ensIntronNewIni got Ensembl Exon objects on different "
315 "Ensembl Slice objects.\n");
316
317 return NULL;
318 }
319
320 if (seqname1 && seqname2 && (!ajStrMatchCaseS(seqname1, seqname2)))
321 {
322 ajDebug("ensIntronNewIni got Ensembl Exon objects on different "
323 "sequence names.\n");
324
325 return NULL;
326 }
327
328 if (ensFeatureGetStrand(feature1) != ensFeatureGetStrand(feature2))
329 {
330 ajDebug("ensIntronNewIni got Ensembl Exon objects on different "
331 "strands.\n");
332
333 return NULL;
334 }
335
336 if (ensFeatureGetStrand(feature1) >= 0)
337 {
338 start = ensFeatureGetEnd(feature1) + 1;
339 end = ensFeatureGetStart(feature2) - 1;
340 }
341 else
342 {
343 start = ensFeatureGetEnd(feature2) + 1;
344 end = ensFeatureGetStart(feature1) - 1;
345 }
346
347 if (start > (end + 1))
348 {
349 ajDebug("ensIntronNewIni requires that the start coordinate %u "
350 "is less than the end coordinate %u + 1 ", start, end);
351
352 return NULL;
353 }
354
355 strand = ensFeatureGetStrand(feature1);
356
357 if (slice1)
358 feature = ensFeatureNewIniS(analysis,
359 slice1,
360 start,
361 end,
362 strand);
363
364 if (seqname1)
365 feature = ensFeatureNewIniN(analysis,
366 seqname1,
367 start,
368 end,
369 strand);
370
371 if (feature)
372 {
373 AJNEW0(intron);
374
375 intron->Feature = feature;
376 intron->PreviousExon = ensExonNewRef(exon1);
377 intron->NextExon = ensExonNewRef(exon2);
378 intron->Use = 1U;
379 }
380 else
381 ajDebug("ensIntronNewIni could not create an Ensembl Feature.\n");
382
383 return intron;
384 }
385
386
387
388
389 /* @func ensIntronNewRef ******************************************************
390 **
391 ** Ensembl Object referencing function, which returns a pointer to the
392 ** Ensembl Object passed in and increases its reference count.
393 **
394 ** @param [u] intron [EnsPIntron] Ensembl Intron
395 **
396 ** @return [EnsPIntron] Ensembl Intron or NULL
397 **
398 ** @release 6.2.0
399 ** @@
400 ******************************************************************************/
401
ensIntronNewRef(EnsPIntron intron)402 EnsPIntron ensIntronNewRef(EnsPIntron intron)
403 {
404 if (!intron)
405 return NULL;
406
407 intron->Use++;
408
409 return intron;
410 }
411
412
413
414
415 /* @funcstatic intronNewCpyFeatures *******************************************
416 **
417 ** Returns a new copy of an Ensembl Intron, but in addition to the shallow
418 ** copy provided by ensIntronNewCpy, also copies all Ensembl Intron-
419 ** internal Ensembl Objects based on the Ensembl Feature class. This is useful
420 ** in preparation of ensIntronTransform and ensIntronTransfer, which
421 ** return an independent Ensembl Intron object and therefore, require
422 ** independent mapping of all internal Feature objects to the new
423 ** Ensembl Coordinate System or Ensembl Slice.
424 **
425 ** @param [u] intron [EnsPIntron] Ensembl Intron
426 **
427 ** @return [EnsPIntron] Ensembl Intron or NULL
428 **
429 ** @release 6.5.0
430 ** @@
431 ******************************************************************************/
432
intronNewCpyFeatures(EnsPIntron intron)433 static EnsPIntron intronNewCpyFeatures(EnsPIntron intron)
434 {
435 EnsPExon newexon = NULL;
436
437 EnsPIntron newintron = NULL;
438
439 if (!intron)
440 return NULL;
441
442 newintron = ensIntronNewCpy(intron);
443
444 if (!newintron)
445 return NULL;
446
447 newexon = ensExonNewCpy(intron->PreviousExon);
448 ensExonDel(&intron->PreviousExon);
449 intron->PreviousExon = newexon;
450
451 newexon = ensExonNewCpy(intron->NextExon);
452 ensExonDel(&intron->NextExon);
453 intron->NextExon = newexon;
454
455 return newintron;
456 }
457
458
459
460
461 /* @section destructors *******************************************************
462 **
463 ** Destruction destroys all internal data structures and frees the memory
464 ** allocated for an Ensembl Intron object.
465 **
466 ** @fdata [EnsPIntron]
467 **
468 ** @nam3rule Del Destroy (free) an Ensembl Intron
469 **
470 ** @argrule * Pintron [EnsPIntron*] Ensembl Intron address
471 **
472 ** @valrule * [void]
473 **
474 ** @fcategory delete
475 ******************************************************************************/
476
477
478
479
480 /* @func ensIntronDel *********************************************************
481 **
482 ** Default destructor for an Ensembl Intron.
483 **
484 ** @param [d] Pintron [EnsPIntron*] Ensembl Intron address
485 **
486 ** @return [void]
487 **
488 ** @release 6.2.0
489 ** @@
490 ******************************************************************************/
491
ensIntronDel(EnsPIntron * Pintron)492 void ensIntronDel(EnsPIntron *Pintron)
493 {
494 EnsPIntron pthis = NULL;
495
496 if (!Pintron)
497 return;
498
499 #if defined(AJ_DEBUG) && AJ_DEBUG >= 1
500 if (ajDebugTest("ensIntronDel"))
501 {
502 ajDebug("ensIntronDel\n"
503 " *Pintron %p\n",
504 *Pintron);
505
506 ensIntronTrace(*Pintron, 1);
507 }
508 #endif /* defined(AJ_DEBUG) && AJ_DEBUG >= 1 */
509
510 if (!(pthis = *Pintron) || --pthis->Use)
511 {
512 *Pintron = NULL;
513
514 return;
515 }
516
517 ensFeatureDel(&pthis->Feature);
518
519 ensExonDel(&pthis->PreviousExon);
520 ensExonDel(&pthis->NextExon);
521
522 ajMemFree((void **) Pintron);
523
524 return;
525 }
526
527
528
529
530 /* @section member retrieval **************************************************
531 **
532 ** Functions for returning members of an Ensembl Intron object.
533 **
534 ** @fdata [EnsPIntron]
535 **
536 ** @nam3rule Get Return Ensembl Intron attribute(s)
537 ** @nam4rule Feature Return the Ensembl Feature
538 ** @nam4rule Previousexon Return the previous Ensembl Exon
539 ** @nam4rule Nextexon Return the next Ensembl Exon
540 **
541 ** @argrule * intron [const EnsPIntron] Intron
542 **
543 ** @valrule Feature [EnsPFeature] Ensembl Feature or NULL
544 ** @valrule Nextexon [EnsPExon] Ensembl Exon or NULL
545 ** @valrule Previousexon [EnsPExon] Ensembl Exon or NULL
546 **
547 ** @fcategory use
548 ******************************************************************************/
549
550
551
552
553 /* @func ensIntronGetFeature **************************************************
554 **
555 ** Get the Ensembl Feature member of an Ensembl Intron.
556 **
557 ** @cc Bio::EnsEMBL::Feature
558 ** @param [r] intron [const EnsPIntron] Ensembl Intron
559 **
560 ** @return [EnsPFeature] Ensembl Feature or NULL
561 **
562 ** @release 6.2.0
563 ** @@
564 ******************************************************************************/
565
ensIntronGetFeature(const EnsPIntron intron)566 EnsPFeature ensIntronGetFeature(const EnsPIntron intron)
567 {
568 return (intron) ? intron->Feature : NULL;
569 }
570
571
572
573
574 /* @func ensIntronGetNextexon *************************************************
575 **
576 ** Get the next Ensembl Exon member of an Ensembl Intron.
577 **
578 ** @cc Bio::EnsEMBL::Intron::next_Exon
579 ** @param [r] intron [const EnsPIntron] Ensembl Intron
580 **
581 ** @return [EnsPExon] Ensembl Exon or NULL
582 **
583 ** @release 6.2.0
584 ** @@
585 ******************************************************************************/
586
ensIntronGetNextexon(const EnsPIntron intron)587 EnsPExon ensIntronGetNextexon(const EnsPIntron intron)
588 {
589 return (intron) ? intron->NextExon : NULL;
590 }
591
592
593
594
595 /* @func ensIntronGetPreviousexon *********************************************
596 **
597 ** Get the previous Ensembl Exon member of an Ensembl Intron.
598 **
599 ** @cc Bio::EnsEMBL::Intron::prev_Exon
600 ** @param [r] intron [const EnsPIntron] Ensembl Intron
601 **
602 ** @return [EnsPExon] Ensembl Exon or NULL
603 **
604 ** @release 6.2.0
605 ** @@
606 ******************************************************************************/
607
ensIntronGetPreviousexon(const EnsPIntron intron)608 EnsPExon ensIntronGetPreviousexon(const EnsPIntron intron)
609 {
610 return (intron) ? intron->PreviousExon : NULL;
611 }
612
613
614
615
616 /* @section member assignment *************************************************
617 **
618 ** Functions for assigning members of an Ensembl Intron object.
619 **
620 ** @fdata [EnsPIntron]
621 **
622 ** @nam3rule Set Set one member of an Ensembl Intron
623 ** @nam4rule Feature Set the Ensembl Feature
624 ** @nam4rule Nextexon Set the next Ensembl Exon
625 ** @nam4rule Previousexon Set the previous Ensembl Exon
626 **
627 ** @argrule * intron [EnsPIntron] Ensembl Intron
628 **
629 ** @valrule * [AjBool] ajTrue upon success, ajFalse otherwise
630 ** @argrule Feature feature [EnsPFeature] Ensembl Feature
631 ** @argrule Nextexon exon [EnsPExon] Next Ensembl Exon
632 ** @argrule Previousexon exon [EnsPExon] Previous Ensembl Exon
633 **
634 ** @fcategory modify
635 ******************************************************************************/
636
637
638
639
640
641 /* @func ensIntronSetFeature **************************************************
642 **
643 ** Set the Ensembl Feature member of an Ensembl Intron.
644 **
645 ** @cc Bio::EnsEMBL::Feature
646 ** @param [u] intron [EnsPIntron] Ensembl Intron
647 ** @param [u] feature [EnsPFeature] Ensembl Feature
648 **
649 ** @return [AjBool] ajTrue upon success, ajFalse otherwise
650 **
651 ** @release 6.5.0
652 ** @@
653 ******************************************************************************/
654
ensIntronSetFeature(EnsPIntron intron,EnsPFeature feature)655 AjBool ensIntronSetFeature(EnsPIntron intron,
656 EnsPFeature feature)
657 {
658 EnsPExon newexon = NULL;
659
660 EnsPSlice slice = NULL;
661
662 if (!intron)
663 return ajFalse;
664
665 /* Replace the current Feature. */
666
667 ensFeatureDel(&intron->Feature);
668
669 if (feature)
670 {
671 intron->Feature = ensFeatureNewRef(feature);
672
673 slice = ensFeatureGetSlice(intron->Feature);
674
675 /*
676 ** Transfer Ensembl Exon objects onto the new Ensembl Slice
677 ** linked to this Ensembl Feature.
678 */
679
680 newexon = ensExonTransfer(intron->PreviousExon, slice);
681 ensExonDel(&intron->PreviousExon);
682 intron->PreviousExon = newexon;
683
684 newexon = ensExonTransfer(intron->NextExon, slice);
685 ensExonDel(&intron->NextExon);
686 intron->NextExon = newexon;
687 }
688
689 return ajTrue;
690 }
691
692
693
694
695 /* @func ensIntronSetNextexon *************************************************
696 **
697 ** Set the next Ensembl Exon member of an Ensembl Intron.
698 **
699 ** @cc Bio::EnsEMBL::Intron::next_Exon
700 ** @param [u] intron [EnsPIntron] Ensembl Intron
701 ** @param [u] exon [EnsPExon] Ensembl Exon
702 **
703 ** @return [AjBool] ajTrue upon success, ajFalse otherwise
704 **
705 ** @release 6.5.0
706 ** @@
707 ** NOTE: The Perl API has no set method and does not transfer the Ensembl Exon
708 ** object onto the Ensembl Slice of the Ensembl Intron object.
709 ******************************************************************************/
710
ensIntronSetNextexon(EnsPIntron intron,EnsPExon exon)711 AjBool ensIntronSetNextexon(EnsPIntron intron,
712 EnsPExon exon)
713 {
714 if (!intron)
715 return ajFalse;
716
717 ensExonDel(&intron->NextExon);
718
719 intron->NextExon = ensExonTransfer(
720 exon,
721 ensFeatureGetSlice(intron->Feature));
722
723 if (!intron->NextExon)
724 ajWarn("ensIntronSetNextexon could not transfer "
725 "Ensembl Exon %u onto the "
726 "Ensembl Slice of this "
727 "Ensembl Intron.\n",
728 ensExonGetIdentifier(exon));
729
730 return ajTrue;
731 }
732
733
734
735
736 /* @func ensIntronSetPreviousexon *********************************************
737 **
738 ** Set the previous Ensembl Exon member of an Ensembl Intron.
739 **
740 ** @cc Bio::EnsEMBL::Intron::prev_Exon
741 ** @param [u] intron [EnsPIntron] Ensembl Intron
742 ** @param [u] exon [EnsPExon] Ensembl Exon
743 **
744 ** @return [AjBool] ajTrue upon success, ajFalse otherwise
745 **
746 ** @release 6.5.0
747 ** @@
748 ** NOTE: The Perl API has no set method and does not transfer the Ensembl Exon
749 ** object onto the Ensembl Slice of the Ensembl Intron object.
750 ******************************************************************************/
751
ensIntronSetPreviousexon(EnsPIntron intron,EnsPExon exon)752 AjBool ensIntronSetPreviousexon(EnsPIntron intron,
753 EnsPExon exon)
754 {
755 if (!intron)
756 return ajFalse;
757
758 ensExonDel(&intron->PreviousExon);
759
760 intron->PreviousExon = ensExonTransfer(
761 exon,
762 ensFeatureGetSlice(intron->Feature));
763
764 if (!intron->NextExon)
765 ajWarn("ensIntronSetPreviousexon could not transfer "
766 "Ensembl Exon '%u' onto the "
767 "Ensembl Slice of this "
768 "Ensembl Intron.\n",
769 ensExonGetIdentifier(exon));
770
771 return ajTrue;
772 }
773
774
775
776
777 /* @section debugging *********************************************************
778 **
779 ** Functions for reporting of an Ensembl Intron object.
780 **
781 ** @fdata [EnsPIntron]
782 **
783 ** @nam3rule Trace Report Intron members to debug file
784 **
785 ** @argrule Trace intron [const EnsPIntron] Ensembl Intron
786 ** @argrule Trace level [ajuint] Indentation level
787 **
788 ** @valrule * [AjBool] ajTrue upon success, ajFalse otherwise
789 **
790 ** @fcategory misc
791 ******************************************************************************/
792
793
794
795
796 /* @func ensIntronTrace *******************************************************
797 **
798 ** Trace an Ensembl Intron.
799 **
800 ** @param [r] intron [const EnsPIntron] Ensembl Intron
801 ** @param [r] level [ajuint] Indentation level
802 **
803 ** @return [AjBool] ajTrue upon success, ajFalse otherwise
804 **
805 ** @release 6.2.0
806 ** @@
807 ******************************************************************************/
808
ensIntronTrace(const EnsPIntron intron,ajuint level)809 AjBool ensIntronTrace(const EnsPIntron intron, ajuint level)
810 {
811 AjPStr indent = NULL;
812
813 if (!intron)
814 return ajFalse;
815
816 indent = ajStrNew();
817
818 ajStrAppendCountK(&indent, ' ', level * 2);
819
820 ajDebug("%SensIntronTrace %p\n"
821 "%S Feature %p\n"
822 "%S PreviousExon %p\n"
823 "%S NextExon %p\n"
824 "%S Use %u\n",
825 indent, intron,
826 indent, intron->Feature,
827 indent, intron->PreviousExon,
828 indent, intron->NextExon,
829 indent, intron->Use);
830
831 ensFeatureTrace(intron->Feature, level + 1);
832
833 ensExonTrace(intron->PreviousExon, level + 1);
834 ensExonTrace(intron->NextExon, level + 1);
835
836 ajStrDel(&indent);
837
838 return ajTrue;
839 }
840
841
842
843
844 /* @section calculate *********************************************************
845 **
846 ** Functions for calculating information from an Ensembl Intron object.
847 **
848 ** @fdata [EnsPIntron]
849 **
850 ** @nam3rule Calculate Calculate Ensembl Intron information
851 ** @nam4rule Length Calculate the length
852 ** @nam4rule Memsize Calculate the memory size in bytes
853 **
854 ** @argrule * intron [const EnsPIntron] Ensembl Intron
855 **
856 ** @valrule Length [ajuint] Length or 0U
857 ** @valrule Memsize [size_t] Memory size in bytes or 0
858 **
859 ** @fcategory misc
860 ******************************************************************************/
861
862
863
864
865 /* @func ensIntronCalculateLength *********************************************
866 **
867 ** Calculate the length of an Ensembl Intron.
868 **
869 ** @cc Bio::EnsEMBL::Intron::length
870 ** @param [r] intron [const EnsPIntron] Ensembl Intron
871 **
872 ** @return [ajuint] Length or 0U
873 **
874 ** @release 6.4.0
875 ** @@
876 ** NOTE: The Bio::EnsEMBL::Intron::length method seems to override
877 ** Bio::EnsEMBL::Feature::length to allow for zero-length introns.
878 ******************************************************************************/
879
ensIntronCalculateLength(const EnsPIntron intron)880 ajuint ensIntronCalculateLength(const EnsPIntron intron)
881 {
882 if (!intron)
883 return 0U;
884
885 return ensFeatureGetEnd(intron->Feature)
886 - ensFeatureGetStart(intron->Feature)
887 + 1U;
888 }
889
890
891
892
893 /* @func ensIntronCalculateMemsize ********************************************
894 **
895 ** Calculate the memory size in bytes of an Ensembl Intron.
896 **
897 ** @param [r] intron [const EnsPIntron] Ensembl Intron
898 **
899 ** @return [size_t] Memory size in bytes or 0
900 **
901 ** @release 6.4.0
902 ** @@
903 ******************************************************************************/
904
ensIntronCalculateMemsize(const EnsPIntron intron)905 size_t ensIntronCalculateMemsize(const EnsPIntron intron)
906 {
907 size_t size = 0;
908
909 if (!intron)
910 return 0;
911
912 size += sizeof (EnsOIntron);
913
914 size += ensFeatureCalculateMemsize(intron->Feature);
915
916 size += ensExonCalculateMemsize(intron->PreviousExon);
917 size += ensExonCalculateMemsize(intron->NextExon);
918
919 return size;
920 }
921
922
923
924
925 /* @section fetch *************************************************************
926 **
927 ** Functions for fetching information from an Ensembl Intron object.
928 **
929 ** @fdata [EnsPIntron]
930 **
931 ** @nam3rule Fetch Fetch Ensembl Intron information
932 ** @nam4rule All Fetch all Ensembl Intron information
933 ** @nam4rule Splicesequences
934 ** Fetch splice site sequences
935 **
936 ** @argrule * intron [const EnsPIntron] Ensembl Intron
937 ** @argrule Splicesequences Pdonor [AjPStr*]
938 ** AJAX String (splice donor sequence) address
939 ** @argrule Splicesequences Pacceptor [AjPStr*]
940 ** AJAX String (splice acceptor sequence) address
941 **
942 ** @valrule * [AjBool] ajTrue upon success, ajFalse otherwise
943 **
944 ** @fcategory misc
945 ******************************************************************************/
946
947
948
949
950 /* @func ensIntronFetchSplicesequences ****************************************
951 **
952 ** Fetch splice site sequences of an Ensembl Intron.
953 **
954 ** The caller is responsible for deleting the
955 ** AJAX String objects.
956 **
957 ** @cc Bio::EnsEMBL::Intron::splice_seq
958 ** @param [r] intron [const EnsPIntron] Ensembl Intron
959 ** @param [wP] Pdonor [AjPStr*]
960 ** AJAX String (splice donor sequence) address
961 ** @param [wP] Pacceptor [AjPStr*]
962 ** AJAX String (splice acceptor sequence) address
963 **
964 ** @return [AjBool] ajTrue upon success, ajFalse otherwise
965 **
966 ** @release 6.5.0
967 ** @@
968 ******************************************************************************/
969
ensIntronFetchSplicesequences(const EnsPIntron intron,AjPStr * Pdonor,AjPStr * Pacceptor)970 AjBool ensIntronFetchSplicesequences(const EnsPIntron intron,
971 AjPStr *Pdonor,
972 AjPStr *Pacceptor)
973 {
974 ajuint length = 0U;
975
976 AjBool result = AJFALSE;
977
978 EnsPSlice slice = NULL;
979 EnsPSliceadaptor sla = NULL;
980
981 if (!intron)
982 return ajFalse;
983
984 if (!*Pdonor)
985 return ajFalse;
986
987 if (!*Pacceptor)
988 return ajFalse;
989
990 if (*Pdonor)
991 ajStrAssignClear(Pdonor);
992
993 if (*Pacceptor)
994 ajStrAssignClear(Pacceptor);
995
996 sla = ensRegistryGetSliceadaptor(
997 ensExonadaptorGetDatabaseadaptor(
998 ensExonGetAdaptor(intron->PreviousExon)));
999
1000 result = ensSliceadaptorFetchByFeature(sla,
1001 intron->Feature,
1002 0,
1003 &slice);
1004
1005 if (!result)
1006 return result;
1007
1008 length = ensSliceCalculateLength(slice);
1009
1010 result = ensSliceFetchSequenceSubStr(slice, 1, 2, 1, Pdonor);
1011
1012 if (!result)
1013 return result;
1014
1015 result = ensSliceFetchSequenceSubStr(slice,
1016 length - 1,
1017 length,
1018 1,
1019 Pacceptor);
1020
1021 return result;
1022 }
1023
1024
1025
1026
1027 /* @section test **************************************************************
1028 **
1029 ** Functions for testing Ensembl Intron objects
1030 **
1031 ** @fdata [EnsPIntron]
1032 **
1033 ** @nam3rule Is Ensembl Intron has a property
1034 ** @nam4rule Canonical
1035 ** Test, whether an Ensembl Intron has canonical splice sites
1036 **
1037 ** @argrule * intron [const EnsPIntron] Ensembl Intron
1038 ** @argrule Canonical Presult [AjBool*] AJAX Boolean address
1039 **
1040 ** @valrule * [AjBool] ajTrue upon success, ajFalse otherwise
1041 **
1042 ** @fcategory use
1043 ******************************************************************************/
1044
1045
1046
1047
1048 /* @func ensIntronIsCanonical *************************************************
1049 **
1050 ** Test, whether an Ensembl Intron has canonical splice sites.
1051 **
1052 ** @cc Bio::EnsEMBL::Intron::is_splice_canonical
1053 ** @param [r] intron [const EnsPIntron] Ensembl Intron
1054 ** @param [w] Presult [AjBool*] AJAX Boolean address
1055 **
1056 ** @return [AjBool] ajTrue upon success, ajFalse otherwise
1057 **
1058 ** @release 6.5.0
1059 ** @@
1060 ******************************************************************************/
1061
ensIntronIsCanonical(const EnsPIntron intron,AjBool * Presult)1062 AjBool ensIntronIsCanonical(const EnsPIntron intron, AjBool *Presult)
1063 {
1064 AjPStr both = NULL;
1065 AjPStr donor = NULL;
1066 AjPStr acceptor = NULL;
1067
1068 if (!intron)
1069 return ajFalse;
1070
1071 if (!Presult)
1072 return ajFalse;
1073
1074 *Presult = AJFALSE;
1075
1076 ensIntronFetchSplicesequences(intron, &donor, &acceptor);
1077
1078 both = ajStrNew();
1079 ajStrAppendS(&both, donor);
1080 ajStrAppendS(&both, acceptor);
1081
1082 if (ajStrMatchCaseC(both, "GTAG"))
1083 *Presult = ajTrue;
1084
1085 if (ajStrMatchCaseC(both, "ATAC"))
1086 *Presult = ajTrue;
1087
1088 if (ajStrMatchCaseC(both, "GCAG"))
1089 *Presult = ajTrue;
1090
1091 ajStrDel(&both);
1092 ajStrDel(&donor);
1093 ajStrDel(&acceptor);
1094
1095 return ajTrue;
1096 }
1097
1098
1099
1100
1101 /* @section matching **********************************************************
1102 **
1103 ** Functions for matching Ensembl Intron objects
1104 **
1105 ** @fdata [EnsPIntron]
1106 **
1107 ** @nam3rule Match Test Ensembl Intron objects for identity
1108 ** @nam3rule Overlap Test Ensembl Intron objects for overlap
1109 ** @nam3rule Similarity Test Ensembl Intron objects for similarity
1110 **
1111 ** @argrule * intron1 [const EnsPIntron] Ensembl Intron
1112 ** @argrule * intron2 [const EnsPIntron] Ensembl Intron
1113 **
1114 ** @valrule * [AjBool] True on success
1115 **
1116 ** @fcategory use
1117 ******************************************************************************/
1118
1119
1120
1121
1122 /* @func ensIntronMatch *******************************************************
1123 **
1124 ** Test Ensembl Intron objects for identity.
1125 **
1126 ** @param [r] intron1 [const EnsPIntron] Ensembl Intron
1127 ** @param [r] intron2 [const EnsPIntron] Ensembl Intron
1128 **
1129 ** @return [AjBool] ajTrue if the Ensembl Intron objects are equal
1130 **
1131 ** @release 6.5.0
1132 ** @@
1133 ** The comparison is based on an initial pointer equality test and if that
1134 ** fails, individual members are compared.
1135 ******************************************************************************/
1136
ensIntronMatch(const EnsPIntron intron1,const EnsPIntron intron2)1137 AjBool ensIntronMatch(const EnsPIntron intron1,
1138 const EnsPIntron intron2)
1139 {
1140 if (!intron1)
1141 return ajFalse;
1142
1143 if (!intron2)
1144 return ajFalse;
1145
1146 if (!ensFeatureMatch(intron1->Feature, intron2->Feature))
1147 return ajFalse;
1148
1149 if (!ensExonMatch(intron1->PreviousExon, intron2->PreviousExon))
1150 return ajFalse;
1151
1152 if (!ensExonMatch(intron1->NextExon, intron2->NextExon))
1153 return ajFalse;
1154
1155 return ajTrue;
1156 }
1157
1158
1159
1160
1161 /* @section map ***************************************************************
1162 **
1163 ** Functions for mapping Ensembl Intron objects between
1164 ** Ensembl Coordinate System objects.
1165 **
1166 ** @fdata [EnsPIntron]
1167 **
1168 ** @nam3rule Transfer Transfer an Ensembl Intron
1169 ** @nam3rule Transform Transform an Ensembl Intron
1170 **
1171 ** @argrule * intron [EnsPIntron] Ensembl Intron
1172 ** @argrule Transfer slice [EnsPSlice] Ensembl Slice
1173 ** @argrule Transform csname [const AjPStr]
1174 ** Ensembl Coordinate System name
1175 ** @argrule Transform csversion [const AjPStr]
1176 ** Ensembl Coordinate System version
1177 **
1178 ** @valrule * [EnsPIntron] Ensembl Intron or NULL
1179 **
1180 ** @fcategory misc
1181 ******************************************************************************/
1182
1183
1184
1185
1186 /* @func ensIntronTransfer ****************************************************
1187 **
1188 ** Transfer an Ensembl Intron onto another Ensembl Slice.
1189 **
1190 ** @cc Bio::EnsEMBL::Intron::transfer
1191 ** @param [u] intron [EnsPIntron] Ensembl Intron
1192 ** @param [u] slice [EnsPSlice] Ensembl Slice
1193 ** @see ensFeatureTransfer
1194 **
1195 ** @return [EnsPIntron] Ensembl Intron or NULL
1196 **
1197 ** @release 6.5.0
1198 ** @@
1199 ******************************************************************************/
1200
ensIntronTransfer(EnsPIntron intron,EnsPSlice slice)1201 EnsPIntron ensIntronTransfer(EnsPIntron intron,
1202 EnsPSlice slice)
1203 {
1204 EnsPFeature newif = NULL;
1205
1206 EnsPIntron newintron = NULL;
1207
1208 if (ajDebugTest("ensIntronTransfer"))
1209 ajDebug("ensIntronTransfer\n"
1210 " intron %p\n"
1211 " slice %p\n",
1212 intron,
1213 slice);
1214
1215 if (!intron)
1216 return NULL;
1217
1218 if (!slice)
1219 return NULL;
1220
1221 if (!intron->Feature)
1222 ajFatal("ensIntronTransfer cannot transfer an Ensembl Intron "
1223 "without an Ensembl Feature.\n");
1224
1225 newif = ensFeatureTransfer(intron->Feature, slice);
1226
1227 if (!newif)
1228 return NULL;
1229
1230 newintron = intronNewCpyFeatures(intron);
1231
1232 ensIntronSetFeature(newintron, newif);
1233
1234 ensFeatureDel(&newif);
1235
1236 return newintron;
1237 }
1238
1239
1240
1241
1242 /* @func ensIntronTransform ***************************************************
1243 **
1244 ** Transform an Ensembl Intron into another Ensembl Coordinate System.
1245 **
1246 ** @cc Bio::EnsEMBL::Intron::transform
1247 ** @param [u] intron [EnsPIntron] Ensembl Intron
1248 ** @param [r] csname [const AjPStr] Ensembl Coordinate System name
1249 ** @param [r] csversion [const AjPStr] Ensembl Coordinate System version
1250 ** @see ensFeatureTransform
1251 **
1252 ** @return [EnsPIntron] Ensembl Intron or NULL
1253 **
1254 ** @release 6.5.0
1255 ** @@
1256 ******************************************************************************/
1257
ensIntronTransform(EnsPIntron intron,const AjPStr csname,const AjPStr csversion)1258 EnsPIntron ensIntronTransform(EnsPIntron intron,
1259 const AjPStr csname,
1260 const AjPStr csversion)
1261 {
1262 EnsPFeature newif = NULL;
1263
1264 EnsPIntron newintron = NULL;
1265
1266 if (!intron)
1267 return NULL;
1268
1269 if (!csname)
1270 return NULL;
1271
1272 newif = ensFeatureTransform(intron->Feature,
1273 csname,
1274 csversion,
1275 (EnsPSlice) NULL);
1276
1277 if (!newif)
1278 return NULL;
1279
1280 newintron = intronNewCpyFeatures(intron);
1281
1282 ensIntronSetFeature(newintron, newif);
1283
1284 ensFeatureDel(&newif);
1285
1286 return newintron;
1287 }
1288
1289
1290
1291
1292 /* @datasection [EnsPIntronsupportingevidence]
1293 ** Ensembl Intron Supporting Evidence
1294 **
1295 ** @nam2rule Intronsupportingevidence
1296 ** Functions for manipulating Ensembl Intron Supporting Evidence objects
1297 **
1298 ** @cc Bio::EnsEMBL::IntronSupportingEvidence
1299 ** @cc CVS Revision: 1.4
1300 ** @cc CVS Tag: branch-ensembl-68
1301 **
1302 ******************************************************************************/
1303
1304
1305
1306
1307 /* @section constructors ******************************************************
1308 **
1309 ** All constructors return a new Ensembl Intron Supporting Evidence by pointer.
1310 ** It is the responsibility of the user to first destroy any previous
1311 ** Intron Supporting Evidence. The target pointer does not need to be
1312 ** initialised to NULL, but it is good programming practice to do so anyway.
1313 **
1314 ** @fdata [EnsPIntronsupportingevidence]
1315 **
1316 ** @nam3rule New Constructor
1317 ** @nam4rule Cpy Constructor with existing object
1318 ** @nam4rule Ini Constructor with initial values
1319 ** @nam4rule Ref Constructor by incrementing the use counter
1320 **
1321 ** @argrule Cpy ise [const EnsPIntronsupportingevidence]
1322 ** Ensembl Intron Supporting Evidence
1323 ** @argrule Ini isea [EnsPIntronsupportingevidenceadaptor]
1324 ** Ensembl Intron Supporting Evidence Adaptor
1325 ** @argrule Ini identifier [ajuint] SQL database internal identifier
1326 ** @argrule Ini feature [EnsPFeature] Ensembl Feature
1327 ** @argrule Ini intron [EnsPIntron] Ensembl Intron
1328 ** @argrule Ini hitname [AjPStr] Hit name
1329 ** @argrule Ini canonical [AjBool] Canonical splice sites
1330 ** @argrule Ini score [double] Score
1331 ** @argrule Ini type [EnsEIntronsupportingevidenceType]
1332 ** Ensembl Intron Supporting Evidence Type enumeration
1333 ** @argrule Ref ise [EnsPIntronsupportingevidence]
1334 ** Ensembl Intron Supporting Evidence
1335 **
1336 ** @valrule * [EnsPIntronsupportingevidence]
1337 ** Ensembl Intron Supporting Evidence or NULL
1338 **
1339 ** @fcategory new
1340 ******************************************************************************/
1341
1342
1343
1344
1345 /* @func ensIntronsupportingevidenceNewCpy ************************************
1346 **
1347 ** Object-based constructor function, which returns an independent object.
1348 **
1349 ** @param [r] ise [const EnsPIntronsupportingevidence]
1350 ** Ensembl Intron Supporting Evidence
1351 **
1352 ** @return [EnsPIntronsupportingevidence]
1353 ** Ensembl Intron Supporting Evidence or NULL
1354 **
1355 ** @release 6.5.0
1356 ** @@
1357 ******************************************************************************/
1358
ensIntronsupportingevidenceNewCpy(const EnsPIntronsupportingevidence ise)1359 EnsPIntronsupportingevidence ensIntronsupportingevidenceNewCpy(
1360 const EnsPIntronsupportingevidence ise)
1361 {
1362 EnsPIntronsupportingevidence pthis = NULL;
1363
1364 if (!ise)
1365 return NULL;
1366
1367 AJNEW0(pthis);
1368
1369 pthis->Use = 1U;
1370 pthis->Identifier = ise->Identifier;
1371 pthis->Adaptor = ise->Adaptor;
1372 pthis->Feature = ensFeatureNewRef(ise->Feature);
1373 pthis->Intron = ensIntronNewRef(ise->Intron);
1374
1375 if (ise->Hitname)
1376 pthis->Hitname = ajStrNewRef(ise->Hitname);
1377
1378 pthis->Canonical = ise->Canonical;
1379 pthis->Score = ise->Score;
1380 pthis->Type = ise->Type;
1381
1382 return pthis;
1383 }
1384
1385
1386
1387
1388 /* @func ensIntronsupportingevidenceNewIni ************************************
1389 **
1390 ** Default constructor for an Ensembl Intron Supporting Evidence
1391 ** with initial values.
1392 **
1393 ** @cc Bio::EnsEMBL::IntronSupportingtEvidence::new
1394 ** @param [u] isea [EnsPIntronsupportingevidenceadaptor]
1395 ** Ensembl Intron Supporting Evidence Adaptor
1396 ** @param [r] identifier [ajuint] SQL database-internal identifier
1397 ** @param [u] feature [EnsPFeature] Ensembl Feature
1398 ** @param [u] intron [EnsPIntron] Ensembl Intron
1399 ** @param [u] hitname [AjPStr] Hit name
1400 ** @param [r] canonical [AjBool] Canonical splice sites
1401 ** @param [r] score [double] Score
1402 ** @param [u] type [EnsEIntronsupportingevidenceType]
1403 ** Ensembl Intron Supporting Evidence Type enumeration
1404 **
1405 ** @return [EnsPIntronsupportingevidence]
1406 ** Ensembl Intron Supporting Evidence or NULL
1407 **
1408 ** @release 6.5.0
1409 ** @@
1410 ******************************************************************************/
1411
ensIntronsupportingevidenceNewIni(EnsPIntronsupportingevidenceadaptor isea,ajuint identifier,EnsPFeature feature,EnsPIntron intron,AjPStr hitname,AjBool canonical,double score,EnsEIntronsupportingevidenceType type)1412 EnsPIntronsupportingevidence ensIntronsupportingevidenceNewIni(
1413 EnsPIntronsupportingevidenceadaptor isea,
1414 ajuint identifier,
1415 EnsPFeature feature,
1416 EnsPIntron intron,
1417 AjPStr hitname,
1418 AjBool canonical,
1419 double score,
1420 EnsEIntronsupportingevidenceType type)
1421 {
1422 EnsPIntronsupportingevidence ise = NULL;
1423
1424 if (!intron)
1425 return NULL;
1426
1427 AJNEW0(ise);
1428
1429 ise->Use = 1U;
1430 ise->Identifier = identifier;
1431 ise->Adaptor = isea;
1432
1433 if (intron)
1434 ise->Feature = ensFeatureNewCpy(ensIntronGetFeature(intron));
1435 else
1436 ise->Feature = ensFeatureNewRef(feature);
1437
1438 ise->Intron = ensIntronNewRef(intron);
1439
1440 if (hitname)
1441 ise->Hitname = ajStrNewRef(hitname);
1442
1443 if (intron)
1444 ensIntronIsCanonical(intron, &ise->Canonical);
1445 else
1446 ise->Canonical = canonical;
1447
1448 ise->Score = score;
1449 ise->Type = type;
1450
1451 return ise;
1452 }
1453
1454
1455
1456
1457 /* @func ensIntronsupportingevidenceNewRef ************************************
1458 **
1459 ** Ensembl Object referencing function, which returns a pointer to the
1460 ** Ensembl Object passed in and increases its reference count.
1461 **
1462 ** @param [u] ise [EnsPIntronsupportingevidence]
1463 ** Ensembl Intron Supporting Evidence
1464 **
1465 ** @return [EnsPIntronsupportingevidence]
1466 ** Ensembl Intron Supporting Evidence or NULL
1467 **
1468 ** @release 6.5.0
1469 ** @@
1470 ******************************************************************************/
1471
ensIntronsupportingevidenceNewRef(EnsPIntronsupportingevidence ise)1472 EnsPIntronsupportingevidence ensIntronsupportingevidenceNewRef(
1473 EnsPIntronsupportingevidence ise)
1474 {
1475 if (!ise)
1476 return NULL;
1477
1478 ise->Use++;
1479
1480 return ise;
1481 }
1482
1483
1484
1485
1486 /* @section destructors *******************************************************
1487 **
1488 ** Destruction destroys all internal data structures and frees the memory
1489 ** allocated for an Ensembl Intron Supporting Evidence object.
1490 **
1491 ** @fdata [EnsPIntronsupportingevidence]
1492 **
1493 ** @nam3rule Del Destroy (free) an Ensembl Intron Supporting Evidence
1494 **
1495 ** @argrule * Pise [EnsPIntronsupportingevidence*]
1496 ** Ensembl Intron Supporting Evidence address
1497 **
1498 ** @valrule * [void]
1499 **
1500 ** @fcategory delete
1501 ******************************************************************************/
1502
1503
1504
1505
1506 /* @func ensIntronsupportingevidenceDel ***************************************
1507 **
1508 ** Default destructor for an Ensembl Intron Supporting Evidence.
1509 **
1510 ** @param [d] Pise [EnsPIntronsupportingevidence*]
1511 ** Ensembl Intron Supporting Evidence address
1512 **
1513 ** @return [void]
1514 **
1515 ** @release 6.5.0
1516 ** @@
1517 ******************************************************************************/
1518
ensIntronsupportingevidenceDel(EnsPIntronsupportingevidence * Pise)1519 void ensIntronsupportingevidenceDel(EnsPIntronsupportingevidence *Pise)
1520 {
1521 EnsPIntronsupportingevidence pthis = NULL;
1522
1523 if (!Pise)
1524 return;
1525
1526 #if defined(AJ_DEBUG) && AJ_DEBUG >= 1
1527 if (ajDebugTest("ensIntronsupportingevidenceDel"))
1528 {
1529 ajDebug("ensIntronsupportingevidenceDel\n"
1530 " *Pise %p\n",
1531 *Pise);
1532
1533 ensIntronsupportingevidenceTrace(*Pise, 1);
1534 }
1535 #endif /* defined(AJ_DEBUG) && AJ_DEBUG >= 1 */
1536
1537 if (!(pthis = *Pise) || --pthis->Use)
1538 {
1539 *Pise = NULL;
1540
1541 return;
1542 }
1543
1544 ensFeatureDel(&pthis->Feature);
1545 ensIntronDel(&pthis->Intron);
1546
1547 ajStrDel(&pthis->Hitname);
1548
1549 ajMemFree((void **) Pise);
1550
1551 return;
1552 }
1553
1554
1555
1556
1557 /* @section member retrieval **************************************************
1558 **
1559 ** Functions for returning members of an
1560 ** Ensembl Intron Supporting Evidence object.
1561 **
1562 ** @fdata [EnsPIntronsupportingevidence]
1563 **
1564 ** @nam3rule Get Return Ensembl Intron Supporting Evidence attribute(s)
1565 ** @nam4rule Adaptor Return the Ensembl Intron Supporting Evidence Adaptor
1566 ** @nam4rule Canonical Return the canonical splice site member
1567 ** @nam4rule Feature Return the Ensembl Feature
1568 ** @nam4rule Hitname Return the hit name
1569 ** @nam4rule Identifier Return the SQL database-internal identifier
1570 ** @nam4rule Intron Return the Ensembl Intron
1571 ** @nam4rule Score Return the score
1572 ** @nam4rule Type Return the
1573 ** Ensembl Intron Supporting Evidence Type enumeration
1574 **
1575 ** @argrule * ise [const EnsPIntronsupportingevidence]
1576 ** Ensembl Intron Supporting Evidence
1577 **
1578 ** @valrule Adaptor [EnsPIntronsupportingevidenceadaptor]
1579 ** Ensembl Intron Supporting Evidence Adaptor or NULL
1580 ** @valrule Canonical [AjBool] Canonical splice sites or AJFALSE
1581 ** @valrule Feature [EnsPFeature] Ensembl Feature or NULL
1582 ** @valrule Hitname [AjPStr] Hit name
1583 ** @valrule Identifier [ajuint] SQL database-internal identifier or 0U
1584 ** @valrule Intron [EnsPIntron] Ensembl Intron or NULL
1585 ** @valrule Score [double] Score or 0.0
1586 ** @valrule Type [EnsEIntronsupportingevidenceType]
1587 ** Ensembl Intron Supporting Evidence Type enumeration or
1588 ** ensEIntronsupportingevidenceTypeNULL
1589 **
1590 ** @fcategory use
1591 ******************************************************************************/
1592
1593
1594
1595
1596 /* @func ensIntronsupportingevidenceGetAdaptor ********************************
1597 **
1598 ** Get the Ensembl Intron Supporting Evidence Adaptor member of an
1599 ** Ensembl Intron Supporting Evidence.
1600 **
1601 ** @cc Bio::EnsEMBL::Storable::adaptor
1602 ** @param [r] ise [const EnsPIntronsupportingevidence]
1603 ** Ensembl Intron Supporting Evidence
1604 **
1605 ** @return [EnsPIntronsupportingevidenceadaptor]
1606 ** Ensembl Intron Supporting Evidence Adaptor or NULL
1607 **
1608 ** @release 6.5.0
1609 ** @@
1610 ******************************************************************************/
1611
ensIntronsupportingevidenceGetAdaptor(const EnsPIntronsupportingevidence ise)1612 EnsPIntronsupportingevidenceadaptor ensIntronsupportingevidenceGetAdaptor(
1613 const EnsPIntronsupportingevidence ise)
1614 {
1615 return (ise) ? ise->Adaptor : NULL;
1616 }
1617
1618
1619
1620
1621 /* @func ensIntronsupportingevidenceGetCanonical ******************************
1622 **
1623 ** Get the canonical splice sites member of an
1624 ** Ensembl Intron Supporting Evidence.
1625 **
1626 ** @cc Bio::EnsEMBL::IntronSupportingEvidence::is_splice_canonical
1627 ** @param [r] ise [const EnsPIntronsupportingevidence]
1628 ** Ensembl Intron Supporting Evidence
1629 **
1630 ** @return [AjBool] Canonical splice sites or AJFALSE
1631 **
1632 ** @release 6.5.0
1633 ** @@
1634 ******************************************************************************/
1635
ensIntronsupportingevidenceGetCanonical(const EnsPIntronsupportingevidence ise)1636 AjBool ensIntronsupportingevidenceGetCanonical(
1637 const EnsPIntronsupportingevidence ise)
1638 {
1639 return (ise) ? ise->Canonical : AJFALSE;
1640 }
1641
1642
1643
1644
1645 /* @func ensIntronsupportingevidenceGetFeature ********************************
1646 **
1647 ** Get the Ensembl Feature member of an
1648 ** Ensembl Intron Supporting Evidence.
1649 **
1650 ** @cc Bio::EnsEMBL::Feature
1651 ** @param [r] ise [const EnsPIntronsupportingevidence]
1652 ** Ensembl Intron Supporting Evidence
1653 **
1654 ** @return [EnsPFeature] Ensembl Feature or NULL
1655 **
1656 ** @release 6.5.0
1657 ** @@
1658 ******************************************************************************/
1659
ensIntronsupportingevidenceGetFeature(const EnsPIntronsupportingevidence ise)1660 EnsPFeature ensIntronsupportingevidenceGetFeature(
1661 const EnsPIntronsupportingevidence ise)
1662 {
1663 return (ise) ? ise->Feature : NULL;
1664 }
1665
1666
1667
1668
1669 /* @func ensIntronsupportingevidenceGetHitname ********************************
1670 **
1671 ** Get the hit name member of an
1672 ** Ensembl Intron Supporting Evidence.
1673 **
1674 ** @cc Bio::EnsEMBL::IntronSupportingEvidence::hit_name
1675 ** @param [r] ise [const EnsPIntronsupportingevidence]
1676 ** Ensembl Intron Supporting Evidence
1677 **
1678 ** @return [AjPStr] Hit name or NULL
1679 **
1680 ** @release 6.5.0
1681 ** @@
1682 ******************************************************************************/
1683
ensIntronsupportingevidenceGetHitname(const EnsPIntronsupportingevidence ise)1684 AjPStr ensIntronsupportingevidenceGetHitname(
1685 const EnsPIntronsupportingevidence ise)
1686 {
1687 return (ise) ? ise->Hitname : NULL;
1688 }
1689
1690
1691
1692
1693 /* @func ensIntronsupportingevidenceGetIdentifier *****************************
1694 **
1695 ** Get the SQL database-internal identifier member of an
1696 ** Ensembl Intron Supporting Evidence.
1697 **
1698 ** @cc Bio::EnsEMBL::Storable::dbID
1699 ** @param [r] ise [const EnsPIntronsupportingevidence]
1700 ** Ensembl Intron Supporting Evidence
1701 **
1702 ** @return [ajuint] SQL database-internal identifier or 0U
1703 **
1704 ** @release 6.5.0
1705 ** @@
1706 ******************************************************************************/
1707
ensIntronsupportingevidenceGetIdentifier(const EnsPIntronsupportingevidence ise)1708 ajuint ensIntronsupportingevidenceGetIdentifier(
1709 const EnsPIntronsupportingevidence ise)
1710 {
1711 return (ise) ? ise->Identifier : 0U;
1712 }
1713
1714
1715
1716
1717 /* @func ensIntronsupportingevidenceGetIntron *********************************
1718 **
1719 ** Get the Ensembl Intron member of an
1720 ** Ensembl Intron Supporting Evidence.
1721 **
1722 ** @cc Bio::EnsEMBL::IntronSupportingEvidence::get_Intron
1723 ** @param [r] ise [const EnsPIntronsupportingevidence]
1724 ** Ensembl Intron Supporting Evidence
1725 **
1726 ** @return [EnsPIntron] Ensembl Intron or NULL
1727 **
1728 ** @release 6.5.0
1729 ** @@
1730 ******************************************************************************/
1731
ensIntronsupportingevidenceGetIntron(const EnsPIntronsupportingevidence ise)1732 EnsPIntron ensIntronsupportingevidenceGetIntron(
1733 const EnsPIntronsupportingevidence ise)
1734 {
1735 return (ise) ? ise->Intron : NULL;
1736 }
1737
1738
1739
1740
1741 /* @func ensIntronsupportingevidenceGetScore **********************************
1742 **
1743 ** Get the score member of an
1744 ** Ensembl Intron Supporting Evidence.
1745 **
1746 ** @cc Bio::EnsEMBL::IntronSupportingEvidence::score
1747 ** @param [r] ise [const EnsPIntronsupportingevidence]
1748 ** Ensembl Intron Supporting Evidence
1749 **
1750 ** @return [double] Score or 0.0
1751 **
1752 ** @release 6.5.0
1753 ** @@
1754 ******************************************************************************/
1755
ensIntronsupportingevidenceGetScore(const EnsPIntronsupportingevidence ise)1756 double ensIntronsupportingevidenceGetScore(
1757 const EnsPIntronsupportingevidence ise)
1758 {
1759 return (ise) ? ise->Score : 0.0;
1760 }
1761
1762
1763
1764
1765 /* @func ensIntronsupportingevidenceGetType ***********************************
1766 **
1767 ** Get the Ensembl Intron Supporting Evidence Type enumeration member of an
1768 ** Ensembl Intron Supporting Evidence.
1769 **
1770 ** @cc Bio::EnsEMBL::IntronSupportingEvidence::score_type
1771 ** @param [r] ise [const EnsPIntronsupportingevidence]
1772 ** Ensembl Intron Supporting Evidence
1773 **
1774 ** @return [EnsEIntronsupportingevidenceType]
1775 ** Ensembl Intron Supporting Evidence Type enumeration or
1776 ** ensEIntronsupportingevidenceTypeNULL
1777 **
1778 ** @release 6.5.0
1779 ** @@
1780 ******************************************************************************/
1781
ensIntronsupportingevidenceGetType(const EnsPIntronsupportingevidence ise)1782 EnsEIntronsupportingevidenceType ensIntronsupportingevidenceGetType(
1783 const EnsPIntronsupportingevidence ise)
1784 {
1785 return (ise) ? ise->Type : ensEIntronsupportingevidenceTypeNULL;
1786 }
1787
1788
1789
1790
1791 /* @section member assignment *************************************************
1792 **
1793 ** Functions for assigning members of an
1794 ** Ensembl Intron Supporting Evidence object.
1795 **
1796 ** @fdata [EnsPIntronsupportingevidence]
1797 **
1798 ** @nam3rule Set Set one member of an Ensembl Intron Supporting Evidence
1799 ** @nam4rule Feature Set the Ensembl Feature
1800 **
1801 ** @argrule * ise [EnsPIntronsupportingevidence]
1802 ** Ensembl Intron Supporting Evidence
1803 **
1804 ** @valrule * [AjBool] ajTrue upon success, ajFalse otherwise
1805 ** @argrule Feature feature [EnsPFeature] Ensembl Feature
1806 **
1807 ** @fcategory modify
1808 ******************************************************************************/
1809
1810
1811
1812
1813
1814 /* @func ensIntronsupportingevidenceSetFeature ********************************
1815 **
1816 ** Set the Ensembl Feature member of an Ensembl Intron Supporting Evidence.
1817 **
1818 ** @cc Bio::EnsEMBL::Feature
1819 ** @param [u] ise [EnsPIntronsupportingevidence]
1820 ** Ensembl Intron Supporting Evidence
1821 ** @param [u] feature [EnsPFeature] Ensembl Feature
1822 **
1823 ** @return [AjBool] ajTrue upon success, ajFalse otherwise
1824 **
1825 ** @release 6.5.0
1826 ** @@
1827 ******************************************************************************/
1828
ensIntronsupportingevidenceSetFeature(EnsPIntronsupportingevidence ise,EnsPFeature feature)1829 AjBool ensIntronsupportingevidenceSetFeature(
1830 EnsPIntronsupportingevidence ise,
1831 EnsPFeature feature)
1832 {
1833 if (!ise)
1834 return ajFalse;
1835
1836 ensFeatureDel(&ise->Feature);
1837
1838 ise->Feature = ensFeatureNewRef(feature);
1839
1840 return ajTrue;
1841 }
1842
1843
1844
1845
1846 /* @section debugging *********************************************************
1847 **
1848 ** Functions for reporting of an Ensembl Intron Supporting Evidence object.
1849 **
1850 ** @fdata [EnsPIntronsupportingevidence]
1851 **
1852 ** @nam3rule Trace Report Ensembl Intron Supporting Evidence members
1853 ** to debug file
1854 **
1855 ** @argrule Trace ise [const EnsPIntronsupportingevidence]
1856 ** Ensembl Intron Supporting Evidence
1857 ** @argrule Trace level [ajuint] Indentation level
1858 **
1859 ** @valrule * [AjBool] ajTrue upon success, ajFalse otherwise
1860 **
1861 ** @fcategory misc
1862 ******************************************************************************/
1863
1864
1865
1866
1867 /* @func ensIntronsupportingevidenceTrace *************************************
1868 **
1869 ** Trace an Ensembl Intron Supporting Evidence.
1870 **
1871 ** @param [r] ise [const EnsPIntronsupportingevidence]
1872 ** Ensembl Intron Supporting Evidence
1873 ** @param [r] level [ajuint] Indentation level
1874 **
1875 ** @return [AjBool] ajTrue upon success, ajFalse otherwise
1876 **
1877 ** @release 6.2.0
1878 ** @@
1879 ******************************************************************************/
1880
ensIntronsupportingevidenceTrace(const EnsPIntronsupportingevidence ise,ajuint level)1881 AjBool ensIntronsupportingevidenceTrace(
1882 const EnsPIntronsupportingevidence ise,
1883 ajuint level)
1884 {
1885 AjPStr indent = NULL;
1886
1887 if (!ise)
1888 return ajFalse;
1889
1890 indent = ajStrNew();
1891
1892 ajStrAppendCountK(&indent, ' ', level * 2);
1893
1894 ajDebug("%ensIntronsupportingevidenceTrace %p\n"
1895 "%S Use %u\n"
1896 "%S Identifier %u\n"
1897 "%S Adaptor %p\n"
1898 "%S Feature %p\n"
1899 "%S Intron %p\n"
1900 "%S Hitname '%S'\n"
1901 "%S Canonical '%B'\n"
1902 "%S Score %f.3\n"
1903 "%S Type '%s'\n",
1904 indent, ise,
1905 indent, ise->Use,
1906 indent, ise->Identifier,
1907 indent, ise->Adaptor,
1908 indent, ise->Feature,
1909 indent, ise->Intron,
1910 indent, ise->Hitname,
1911 indent, ise->Canonical,
1912 indent, ise->Score,
1913 indent, ensIntronsupportingevidenceTypeToChar(ise->Type));
1914
1915 ensFeatureTrace(ise->Feature, level + 1);
1916 ensIntronTrace(ise->Intron, level + 1);
1917
1918 ajStrDel(&indent);
1919
1920 return ajTrue;
1921 }
1922
1923
1924
1925
1926 /* @section calculate *********************************************************
1927 **
1928 ** Functions for calculating information from an
1929 ** Ensembl Intron Supporting Evidence object.
1930 **
1931 ** @fdata [EnsPIntronsupportingevidence]
1932 **
1933 ** @nam3rule Calculate Calculate Ensembl Intron Supporting Evidence information
1934 ** @nam4rule Memsize Calculate the memory size in bytes
1935 **
1936 ** @argrule * ise [const EnsPIntronsupportingevidence]
1937 ** Ensembl Intron Supporting Evidence
1938 **
1939 ** @valrule Memsize [size_t] Memory size in bytes or 0
1940 **
1941 ** @fcategory misc
1942 ******************************************************************************/
1943
1944
1945
1946
1947 /* @func ensIntronsupportingevidenceCalculateMemsize **************************
1948 **
1949 ** Calculate the memory size in bytes of an
1950 ** Ensembl Intron Supporting Evidence.
1951 **
1952 ** @param [r] ise [const EnsPIntronsupportingevidence]
1953 ** Ensembl Intron Supporting Evidence
1954 **
1955 ** @return [size_t] Memory size in bytes or 0
1956 **
1957 ** @release 6.5.0
1958 ** @@
1959 ******************************************************************************/
1960
ensIntronsupportingevidenceCalculateMemsize(const EnsPIntronsupportingevidence ise)1961 size_t ensIntronsupportingevidenceCalculateMemsize(
1962 const EnsPIntronsupportingevidence ise)
1963 {
1964 size_t size = 0;
1965
1966 if (!ise)
1967 return 0;
1968
1969 size += sizeof (EnsOIntronsupportingevidence);
1970
1971 size += ensFeatureCalculateMemsize(ise->Feature);
1972 size += ensIntronCalculateMemsize(ise->Intron);
1973
1974 if (ise->Hitname)
1975 {
1976 size += sizeof (AjOStr);
1977
1978 size += ajStrGetRes(ise->Hitname);
1979 }
1980
1981 return size;
1982 }
1983
1984
1985
1986
1987 /* @section fetch *************************************************************
1988 **
1989 ** Functions for fetching information from an
1990 ** Ensembl Intron Supporting Evidence object.
1991 **
1992 ** @fdata [EnsPIntronsupportingevidence]
1993 **
1994 ** @nam3rule Fetch Fetch Ensembl Intron Supporting Evidence information
1995 ** @nam4rule All Fetch all Ensembl Intron Supporting Evidence information
1996 ** @nam4rule Exons Fetch Ensembl Exon objects
1997 **
1998 ** @argrule * ise [const EnsPIntronsupportingevidence]
1999 ** Ensembl Intron Supporting Evidence
2000 ** @argrule Exons transcript [EnsPTranscript] Ensembl Transcript
2001 ** @argrule Exons Pprevious [EnsPExon*] Previous Ensembl Exon
2002 ** @argrule Exons Pnext [EnsPExon*] Next Ensembl Exon
2003 **
2004 ** @valrule * [AjBool] ajTrue upon success, ajFalse otherwise
2005 **
2006 ** @fcategory misc
2007 ******************************************************************************/
2008
2009
2010
2011
2012 /* @func ensIntronsupportingevidenceFetchExons ********************************
2013 **
2014 ** Fetch Ensembl Exon objects for an Ensembl Intron Supporting Evidence.
2015 **
2016 ** @cc Bio::EnsEMBL::Intron::find_previous_Exon
2017 ** @cc Bio::EnsEMBL::Intron::find_next_Exon
2018 ** @param [r] ise [const EnsPIntronsupportingevidence]
2019 ** Ensembl Intron Supporting Evidence
2020 ** @param [u] transcript [EnsPTranscript] Ensembl Transcript
2021 ** @param [wP] Pprevious [EnsPExon*] Previous Ensembl Exon address
2022 ** @param [wP] Pnext [EnsPExon*] Next Ensembl Exon address
2023 **
2024 ** @return [AjBool] ajTrue upon success, ajFalse otherwise
2025 **
2026 ** @release 6.5.0
2027 ** @@
2028 ******************************************************************************/
2029
ensIntronsupportingevidenceFetchExons(const EnsPIntronsupportingevidence ise,EnsPTranscript transcript,EnsPExon * Pprevious,EnsPExon * Pnext)2030 AjBool ensIntronsupportingevidenceFetchExons(
2031 const EnsPIntronsupportingevidence ise,
2032 EnsPTranscript transcript,
2033 EnsPExon *Pprevious,
2034 EnsPExon *Pnext)
2035 {
2036 ajuint previous = 0U;
2037 ajuint next = 0U;
2038
2039 const AjPList exons = NULL;
2040 AjIList iter = NULL;
2041
2042 EnsPExon exon = NULL;
2043
2044 EnsPFeature efeature = NULL;
2045 EnsPFeature ifeature = NULL;
2046
2047 if (!ise)
2048 return ajFalse;
2049
2050 if (!transcript)
2051 return ajFalse;
2052
2053 if (!Pprevious)
2054 return ajFalse;
2055
2056 if (!Pnext)
2057 return ajFalse;
2058
2059 *Pprevious = NULL;
2060 *Pnext = NULL;
2061
2062 ifeature = ensIntronsupportingevidenceGetFeature(ise);
2063
2064 if (ise->Adaptor)
2065 ensIntronsupportingevidenceadaptorRetrieveExonidentifiers(
2066 ise->Adaptor,
2067 ise,
2068 transcript,
2069 &previous,
2070 &next);
2071
2072 exons = ensTranscriptLoadExons(transcript);
2073
2074 iter = ajListIterNewread(exons);
2075
2076 while (!ajListIterDone(iter))
2077 {
2078 exon = (EnsPExon) ajListIterGet(iter);
2079
2080 if (previous && next)
2081 {
2082 /* For perstent objects stored in a database. */
2083
2084 if (ensExonGetIdentifier(exon) == previous)
2085 *Pprevious = ensExonNewRef(exon);
2086
2087 if (ensExonGetIdentifier(exon) == next)
2088 *Pnext = ensExonNewRef(exon);
2089 }
2090 else
2091 {
2092 efeature = ensExonGetFeature(exon);
2093
2094 if (ensFeatureGetStrand(ifeature) >= 0)
2095 {
2096 if (ensFeatureGetEnd(efeature) ==
2097 (ensFeatureGetStart(ifeature) - 1))
2098 *Pprevious = ensExonNewRef(exon);
2099
2100 if (ensFeatureGetStart(efeature) ==
2101 (ensFeatureGetEnd(ifeature) + 1))
2102 *Pnext = ensExonNewRef(exon);
2103 }
2104 else
2105 {
2106 if (ensFeatureGetStart(efeature) ==
2107 (ensFeatureGetEnd(ifeature) + 1))
2108 *Pprevious = ensExonNewRef(exon);
2109
2110 if (ensFeatureGetEnd(efeature) ==
2111 (ensFeatureGetStart(ifeature) - 1))
2112 *Pnext = ensExonNewRef(exon);
2113
2114 }
2115 }
2116 }
2117
2118 ajListIterDel(&iter);
2119
2120 return ajTrue;
2121 }
2122
2123
2124
2125
2126 /* @section matching **********************************************************
2127 **
2128 ** Functions for matching Ensembl Intron Supporting Evidence objects
2129 **
2130 ** @fdata [EnsPIntronsupportingevidence]
2131 **
2132 ** @nam3rule Match Test for identity
2133 ** @nam3rule Overlap Test for overlap
2134 ** @nam3rule Similarity Test for similarity
2135 **
2136 ** @argrule * ise1 [const EnsPIntronsupportingevidence]
2137 ** Ensembl Intron Supporting Evidence
2138 ** @argrule * ise2 [const EnsPIntronsupportingevidence]
2139 ** Ensembl Intron Supporting Evidence
2140 **
2141 ** @valrule * [AjBool] True on success
2142 **
2143 ** @fcategory use
2144 ******************************************************************************/
2145
2146
2147
2148
2149 /* @func ensIntronsupportingevidenceMatch *************************************
2150 **
2151 ** Test Ensembl Intron Supporting Evidence objects for identity.
2152 **
2153 ** @cc Bio::EnsEMBL::IntronSupportingEvidence::equals
2154 ** @param [r] ise1 [const EnsPIntronsupportingevidence]
2155 ** Ensembl Intron Supporting Evidence
2156 ** @param [r] ise2 [const EnsPIntronsupportingevidence]
2157 ** Ensembl Intron Supporting Evidence
2158 **
2159 ** @return [AjBool] ajTrue if the Ensembl Intron Supporting Evidence objects
2160 ** are equal
2161 **
2162 ** @release 6.5.0
2163 ** @@
2164 ** The comparison is based on an initial pointer equality test and if that
2165 ** fails, individual members are compared.
2166 ******************************************************************************/
2167
ensIntronsupportingevidenceMatch(const EnsPIntronsupportingevidence ise1,const EnsPIntronsupportingevidence ise2)2168 AjBool ensIntronsupportingevidenceMatch(
2169 const EnsPIntronsupportingevidence ise1,
2170 const EnsPIntronsupportingevidence ise2)
2171 {
2172 if (!ise1)
2173 return ajFalse;
2174
2175 if (!ise2)
2176 return ajFalse;
2177
2178 if (ise1 == ise2)
2179 return ajTrue;
2180
2181 if (ise1->Identifier != ise2->Identifier)
2182 return ajFalse;
2183
2184 if ((ise1->Adaptor && ise2->Adaptor) && (ise1->Adaptor != ise2->Adaptor))
2185 return ajFalse;
2186
2187 if (!ensFeatureMatch(ise1->Feature, ise2->Feature))
2188 return ajFalse;
2189
2190 if ((ise1->Intron && ise2->Intron) &&
2191 !ensIntronMatch(ise1->Intron, ise2->Intron))
2192 return ajFalse;
2193
2194 if (!ajStrMatchCaseS(ise1->Hitname, ise2->Hitname))
2195 return ajFalse;
2196
2197 if (ise1->Canonical != ise2->Canonical)
2198 return ajFalse;
2199
2200 if (ise1->Score != ise2->Score)
2201 return ajFalse;
2202
2203 return ajTrue;
2204 }
2205
2206
2207
2208
2209 /* @section map ***************************************************************
2210 **
2211 ** Functions for mapping Ensembl Intron Supporting Evidence objects between
2212 ** Ensembl Coordinate System objects.
2213 **
2214 ** @fdata [EnsPIntronsupportingevidence]
2215 **
2216 ** @nam3rule Transfer Transfer an Ensembl Intron Supporting Evidence
2217 ** @nam3rule Transform Transform an Ensembl Intron Supporting Evidence
2218 **
2219 ** @argrule * ise [EnsPIntronsupportingevidence]
2220 ** Ensembl Intron Supporting Evidence
2221 ** @argrule Transfer slice [EnsPSlice] Ensembl Slice
2222 ** @argrule Transform csname [const AjPStr]
2223 ** Ensembl Coordinate System name
2224 ** @argrule Transform csversion [const AjPStr]
2225 ** Ensembl Coordinate System version
2226 **
2227 ** @valrule * [EnsPIntronsupportingevidence]
2228 ** Ensembl Intron Supporting Evidence or NULL
2229 **
2230 ** @fcategory misc
2231 ******************************************************************************/
2232
2233
2234
2235
2236 /* @func ensIntronsupportingevidenceTransfer **********************************
2237 **
2238 ** Transfer an Ensembl Intron Supporting Evidence onto another Ensembl Slice.
2239 **
2240 ** @cc Bio::EnsEMBL::IntronSupportingEvidence::transfer
2241 ** @param [u] ise [EnsPIntronsupportingevidence]
2242 ** Ensembl Intron Supporting Evidence
2243 ** @param [u] slice [EnsPSlice] Ensembl Slice
2244 ** @see ensFeatureTransfer
2245 **
2246 ** @return [EnsPIntronsupportingevidence]
2247 ** Ensembl Intron Supporting Evidence or NULL
2248 **
2249 ** @release 6.5.0
2250 ** @@
2251 ******************************************************************************/
2252
ensIntronsupportingevidenceTransfer(EnsPIntronsupportingevidence ise,EnsPSlice slice)2253 EnsPIntronsupportingevidence ensIntronsupportingevidenceTransfer(
2254 EnsPIntronsupportingevidence ise,
2255 EnsPSlice slice)
2256 {
2257 EnsPFeature newfeature = NULL;
2258
2259 EnsPIntronsupportingevidence newise = NULL;
2260
2261 if (!ise)
2262 return NULL;
2263
2264 if (!slice)
2265 return NULL;
2266
2267 newfeature = ensFeatureTransfer(ise->Feature, slice);
2268
2269 if (!newfeature)
2270 return NULL;
2271
2272 newise = ensIntronsupportingevidenceNewCpy(ise);
2273
2274 ensIntronsupportingevidenceSetFeature(newise, newfeature);
2275
2276 return newise;
2277 }
2278
2279
2280
2281
2282 /* @func ensIntronsupportingevidenceTransform *********************************
2283 **
2284 ** Transform an Ensembl Intron Supporting Feature into another
2285 ** Ensembl Coordinate System.
2286 **
2287 ** @cc Bio::EnsEMBL::IntronSupportingFeature::transform
2288 ** @param [u] ise [EnsPIntronsupportingevidence]
2289 ** Ensembl Intron Supporting Evidence
2290 ** @param [r] csname [const AjPStr] Ensembl Coordinate System name
2291 ** @param [r] csversion [const AjPStr] Ensembl Coordinate System version
2292 ** @see ensFeatureTransform
2293 **
2294 ** @return [EnsPIntronsupportingevidence]
2295 ** Ensembl Intron Supporting Evidence or NULL
2296 **
2297 ** @release 6.5.0
2298 ** @@
2299 ******************************************************************************/
2300
ensIntronsupportingevidenceTransform(EnsPIntronsupportingevidence ise,const AjPStr csname,const AjPStr csversion)2301 EnsPIntronsupportingevidence ensIntronsupportingevidenceTransform(
2302 EnsPIntronsupportingevidence ise,
2303 const AjPStr csname,
2304 const AjPStr csversion)
2305 {
2306 EnsPFeature newfeature = NULL;
2307
2308 EnsPIntronsupportingevidence newise = NULL;
2309
2310 if (!ise)
2311 return NULL;
2312
2313 if (!csname)
2314 return NULL;
2315
2316 newfeature = ensFeatureTransform(ise->Feature,
2317 csname,
2318 csversion,
2319 (EnsPSlice) NULL);
2320
2321 if (!newfeature)
2322 return NULL;
2323
2324 newise = ensIntronsupportingevidenceNewCpy(ise);
2325
2326 ensIntronsupportingevidenceSetFeature(newise, newfeature);
2327
2328 return newise;
2329 }
2330
2331
2332
2333
2334 /* @section test **************************************************************
2335 **
2336 ** Functions for testing Ensembl Intron Supporting Evidence objects
2337 **
2338 ** @fdata [EnsPIntronsupportingevidence]
2339 **
2340 ** @nam3rule Has Ensembl Intron Supporting Evidence has a property
2341 ** @nam4rule Transcripts
2342 ** Test, whether an Ensembl Intron Supporting Evidnce has
2343 ** Ensembl Transcript objects linked
2344 **
2345 ** @argrule * ise [const EnsPIntronsupportingevidence]
2346 ** Ensembl Intron Supporting Evidence
2347 ** @argrule Transcripts Presult [AjBool*] AJAX Boolean address
2348 **
2349 ** @valrule * [AjBool] ajTrue upon success, ajFalse otherwise
2350 **
2351 ** @fcategory use
2352 ******************************************************************************/
2353
2354
2355
2356
2357 /* @func ensIntronsupportingevidenceHasTranscripts ****************************
2358 **
2359 ** Test, whether an Ensembl Intron has Ensembl Transcript objects linked.
2360 **
2361 ** @cc Bio::EnsEMBL::Intron::is_splice_canonical
2362 ** @param [r] ise [const EnsPIntronsupportingevidence]
2363 ** Ensembl Intron Supporting Evidence
2364 ** @param [w] Presult [AjBool*] AJAX Boolean address
2365 **
2366 ** @return [AjBool] ajTrue upon success, ajFalse otherwise
2367 **
2368 ** @release 6.5.0
2369 ** @@
2370 ******************************************************************************/
2371
ensIntronsupportingevidenceHasTranscripts(const EnsPIntronsupportingevidence ise,AjBool * Presult)2372 AjBool ensIntronsupportingevidenceHasTranscripts(
2373 const EnsPIntronsupportingevidence ise,
2374 AjBool *Presult)
2375 {
2376 AjBool result = AJFALSE;
2377
2378 AjPList identifiers = NULL;
2379
2380 if (!ise)
2381 return ajFalse;
2382
2383 if (!Presult)
2384 return ajFalse;
2385
2386 *Presult = ajFalse;
2387
2388 result = ensIntronsupportingevidenceadaptorRetrieveAllTranscriptidentifiers(
2389 ise->Adaptor,
2390 ise,
2391 identifiers);
2392
2393 if (ajListGetLength(identifiers))
2394 *Presult = ajTrue;
2395 else
2396 *Presult = ajFalse;
2397
2398 ajListFreeData(&identifiers);
2399
2400 return result;
2401 }
2402
2403
2404
2405
2406 /* @datasection [EnsEIntronsupportingevidenceType]
2407 ** Ensembl Intron Supporting Evidence Type
2408 **
2409 ** @nam2rule Intronsupportingevidence Functions for manipulating
2410 ** Ensembl Intron Supporting Evidence objects
2411 ** @nam3rule IntronsupportingevidenceType Functions for manipulating
2412 ** Ensembl Intron Supporting Evidence Type enumerations
2413 **
2414 ******************************************************************************/
2415
2416
2417
2418
2419 /* @section Misc **************************************************************
2420 **
2421 ** Functions for returning an
2422 ** Ensembl Intron Supporting Evidence Type enumeration.
2423 **
2424 ** @fdata [EnsEIntronsupportingevidenceType]
2425 **
2426 ** @nam4rule From Ensembl Intron Supporting Evidence Type query
2427 ** @nam5rule Str AJAX String object query
2428 **
2429 ** @argrule Str type [const AjPStr] Type string
2430 **
2431 ** @valrule * [EnsEIntronsupportingevidenceType]
2432 ** Ensembl Intron Supporting Evidence Type enumeration or
2433 ** ensEIntronsupportingevidenceTypeNULL
2434 **
2435 ** @fcategory misc
2436 ******************************************************************************/
2437
2438
2439
2440
2441 /* @func ensIntronsupportingevidenceTypeFromStr *******************************
2442 **
2443 ** Return an Ensembl Intron Supporting Evidence Type enumeration
2444 ** from an AJAX String.
2445 **
2446 ** @param [r] type [const AjPStr] Type string
2447 **
2448 ** @return [EnsEIntronsupportingevidenceType]
2449 ** Ensembl Intron Supporting Evidence Type enumeration or
2450 ** ensEIntronsupportingevidenceTypeNULL
2451 **
2452 ** @release 6.5.0
2453 ** @@
2454 ******************************************************************************/
2455
ensIntronsupportingevidenceTypeFromStr(const AjPStr type)2456 EnsEIntronsupportingevidenceType ensIntronsupportingevidenceTypeFromStr(
2457 const AjPStr type)
2458 {
2459 register EnsEIntronsupportingevidenceType i =
2460 ensEIntronsupportingevidenceTypeNULL;
2461
2462 EnsEIntronsupportingevidenceType iset =
2463 ensEIntronsupportingevidenceTypeNULL;
2464
2465 for (i = ensEIntronsupportingevidenceTypeNULL;
2466 intronsupportingevidenceKType[i];
2467 i++)
2468 if (ajStrMatchC(type, intronsupportingevidenceKType[i]))
2469 iset = i;
2470
2471 if (!iset)
2472 ajDebug("ensIntronsupportingevidenceTypeFromStr encountered "
2473 "unexpected string '%S'.\n", type);
2474
2475 return iset;
2476 }
2477
2478
2479
2480
2481 /* @section Cast **************************************************************
2482 **
2483 ** Functions for returning attributes of an
2484 ** Ensembl Intron Supporting Evidence Type enumeration.
2485 **
2486 ** @fdata [EnsEIntronsupportingevidenceType]
2487 **
2488 ** @nam4rule To Return Ensembl Intron Supporting Evidence Type enumeration
2489 ** @nam5rule Char Return C character string value
2490 **
2491 ** @argrule To iset [EnsEIntronsupportingevidenceType]
2492 ** Ensembl Intron Supporting Evidence Type enumeration
2493 **
2494 ** @valrule Char [const char*] Status
2495 **
2496 ** @fcategory cast
2497 ******************************************************************************/
2498
2499
2500
2501
2502 /* @func ensIntronsupportingevidenceTypeToChar ********************************
2503 **
2504 ** Cast an Ensembl Intron Supporting Evidence Type enumeration
2505 ** into a C-type (char *) string.
2506 **
2507 ** @param [u] iset [EnsEIntronsupportingevidenceType]
2508 ** Ensembl Intron Supporting Evidence Type enumeration
2509 **
2510 ** @return [const char*]
2511 ** Ensembl Intron Supporting Evidence Type C-type (char *) string
2512 **
2513 ** @release 6.5.0
2514 ** @@
2515 ******************************************************************************/
2516
ensIntronsupportingevidenceTypeToChar(EnsEIntronsupportingevidenceType iset)2517 const char* ensIntronsupportingevidenceTypeToChar(
2518 EnsEIntronsupportingevidenceType iset)
2519 {
2520 register EnsEIntronsupportingevidenceType i =
2521 ensEIntronsupportingevidenceTypeNULL;
2522
2523 for (i = ensEIntronsupportingevidenceTypeNULL;
2524 intronsupportingevidenceKType[i] && (i < iset);
2525 i++);
2526
2527 if (!intronsupportingevidenceKType[i])
2528 ajDebug("ensIntronsupportingevidenceTypeToChar "
2529 "encountered an out of boundary error on "
2530 "Ensembl Intron Supporting Evidence Type "
2531 "enumeration %d.\n",
2532 iset);
2533
2534 return intronsupportingevidenceKType[i];
2535 }
2536
2537
2538
2539
2540 /* @datasection [EnsPIntronsupportingevidenceadaptor]
2541 ** Ensembl Intron Supporting Evidence Adaptor
2542 **
2543 ** @nam2rule Intronsupportingevidenceadaptor Functions for manipulating
2544 ** Ensembl Intron Supporting Evidence Adaptor objects
2545 **
2546 ** @cc Bio::EnsEMBL::DBSQL::IntronSupportingEvidenceAdaptor
2547 ** @cc CVS Revision: 1.2
2548 ** @cc CVS Tag: branch-ensembl-68
2549 **
2550 ******************************************************************************/
2551
2552
2553
2554
2555 /* @funcstatic intronsupportingevidenceadaptorFetchAllbyStatement *************
2556 **
2557 ** Run a SQL statement against an Ensembl Database Adaptor and consolidate the
2558 ** results into an AJAX List of Ensembl Intron Supporting Evidence objects.
2559 **
2560 ** @cc Bio::EnsEMBL::DBSQL::IntronSupportingEvidenceAdaptor::_objs_from_sth
2561 ** @param [u] ba [EnsPBaseadaptor] Ensembl Base Adaptor
2562 ** @param [r] statement [const AjPStr] SQL statement
2563 ** @param [uN] am [EnsPAssemblymapper] Ensembl Assembly Mapper
2564 ** @param [uN] slice [EnsPSlice] Ensembl Slice
2565 ** @param [u] ises [AjPList] AJAX List of
2566 ** Ensembl Intron Supporting Evidence objects
2567 **
2568 ** @return [AjBool] ajTrue upon success, ajFalse otherwise
2569 **
2570 ** @release 6.4.0
2571 ** @@
2572 ******************************************************************************/
2573
intronsupportingevidenceadaptorFetchAllbyStatement(EnsPBaseadaptor ba,const AjPStr statement,EnsPAssemblymapper am,EnsPSlice slice,AjPList ises)2574 static AjBool intronsupportingevidenceadaptorFetchAllbyStatement(
2575 EnsPBaseadaptor ba,
2576 const AjPStr statement,
2577 EnsPAssemblymapper am,
2578 EnsPSlice slice,
2579 AjPList ises)
2580 {
2581 double score = 0.0;
2582
2583 ajuint identifier = 0U;
2584
2585 ajuint srid = 0U;
2586 ajuint srstart = 0U;
2587 ajuint srend = 0U;
2588 ajint srstrand = 0;
2589 ajuint analysisid = 0U;
2590
2591 AjBool canonical = AJFALSE;
2592
2593 AjPSqlstatement sqls = NULL;
2594 AjISqlrow sqli = NULL;
2595 AjPSqlrow sqlr = NULL;
2596
2597 AjPStr hitname = NULL;
2598 AjPStr type = NULL;
2599
2600 EnsPFeature feature = NULL;
2601
2602 EnsPIntron intron = NULL;
2603
2604 EnsPIntronsupportingevidence ise = NULL;
2605 EnsPIntronsupportingevidenceadaptor isea = NULL;
2606
2607 EnsEIntronsupportingevidenceType iset =
2608 ensEIntronsupportingevidenceTypeNULL;
2609
2610 EnsPDatabaseadaptor dba = NULL;
2611
2612 if (ajDebugTest("intronsupportingevidenceadaptorFetchAllbyStatement"))
2613 ajDebug("intronsupportingevidenceadaptorFetchAllbyStatement\n"
2614 " ba %p\n"
2615 " statement %p\n"
2616 " am %p\n"
2617 " slice %p\n"
2618 " ises %p\n",
2619 ba,
2620 statement,
2621 am,
2622 slice,
2623 ises);
2624
2625 if (!ba)
2626 return ajFalse;
2627
2628 if (!statement)
2629 return ajFalse;
2630
2631 if (!ises)
2632 return ajFalse;
2633
2634 dba = ensBaseadaptorGetDatabaseadaptor(ba);
2635
2636 isea = ensRegistryGetIntronsupportingevidenceadaptor(dba);
2637
2638 sqls = ensDatabaseadaptorSqlstatementNew(dba, statement);
2639
2640 sqli = ajSqlrowiterNew(sqls);
2641
2642 while (!ajSqlrowiterDone(sqli))
2643 {
2644 identifier = 0U;
2645 srid = 0U;
2646 srstart = 0U;
2647 srend = 0U;
2648 srstrand = 0;
2649 analysisid = 0U;
2650 hitname = ajStrNew();
2651 score = 0.0;
2652 type = ajStrNew();
2653 canonical = AJFALSE;
2654
2655 sqlr = ajSqlrowiterGet(sqli);
2656
2657 ajSqlcolumnToUint(sqlr, &identifier);
2658 ajSqlcolumnToUint(sqlr, &srid);
2659 ajSqlcolumnToUint(sqlr, &srstart);
2660 ajSqlcolumnToUint(sqlr, &srend);
2661 ajSqlcolumnToInt(sqlr, &srstrand);
2662 ajSqlcolumnToUint(sqlr, &analysisid);
2663 ajSqlcolumnToStr(sqlr, &hitname);
2664 ajSqlcolumnToDouble(sqlr, &score);
2665 ajSqlcolumnToStr(sqlr, &type);
2666 ajSqlcolumnToBool(sqlr, &canonical);
2667
2668 ensBaseadaptorRetrieveFeature(ba,
2669 analysisid,
2670 srid,
2671 srstart,
2672 srend,
2673 srstrand,
2674 am,
2675 slice,
2676 &feature);
2677
2678 if (!feature)
2679 {
2680 ajStrDel(&hitname);
2681 ajStrDel(&type);
2682
2683 continue;
2684 }
2685
2686 iset = ensIntronsupportingevidenceTypeFromStr(type);
2687
2688 if (!iset)
2689 ajDebug("intronsupportingevidenceadaptorFetchAllbyStatement "
2690 "encountered unexpected string '%S' in the "
2691 "'intron_supporting_evidence.score_type' field.\n",
2692 type);
2693
2694 ise = ensIntronsupportingevidenceNewIni(
2695 isea,
2696 identifier,
2697 feature,
2698 (EnsPIntron) NULL,
2699 hitname,
2700 canonical,
2701 score,
2702 iset);
2703
2704 ajListPushAppend(ises, (void *) ise);
2705
2706 ensFeatureDel(&feature);
2707 ensIntronDel(&intron);
2708
2709 ajStrDel(&hitname);
2710 ajStrDel(&type);
2711 }
2712
2713 ajSqlrowiterDel(&sqli);
2714
2715 ensDatabaseadaptorSqlstatementDel(dba, &sqls);
2716
2717 return ajTrue;
2718 }
2719
2720
2721
2722
2723 /* @section constructors ******************************************************
2724 **
2725 ** All constructors return a new Ensembl Intron Supporting Evidence Adaptor
2726 ** by pointer.
2727 ** It is the responsibility of the user to first destroy any previous
2728 ** Ensembl Intron Supporting Evidence Adaptor.
2729 ** The target pointer does not need to be initialised to NULL, but it is good
2730 ** programming practice to do so anyway.
2731 **
2732 ** @fdata [EnsPIntronsupportingevidenceadaptor]
2733 **
2734 ** @nam3rule New Constructor
2735 **
2736 ** @argrule New dba [EnsPDatabaseadaptor] Ensembl Database Adaptor
2737 **
2738 ** @valrule * [EnsPIntronsupportingevidenceadaptor]
2739 ** Ensembl Intron Supporting Evidence Adaptor or NULL
2740 **
2741 ** @fcategory new
2742 ******************************************************************************/
2743
2744
2745
2746
2747 /* @func ensIntronsupportingevidenceadaptorNew ********************************
2748 **
2749 ** Default constructor for an Ensembl Intron Supporting Evidence Adaptor.
2750 **
2751 ** Ensembl Object Adaptors are singleton objects in the sense that a single
2752 ** instance of an Ensembl Object Adaptor connected to a particular database is
2753 ** sufficient to instantiate any number of Ensembl Objects from the database.
2754 ** Each Ensembl Object will have a weak reference to the Object Adaptor that
2755 ** instantiated it. Therefore, Ensembl Object Adaptors should not be
2756 ** instantiated directly, but rather obtained from the Ensembl Registry,
2757 ** which will in turn call this function if neccessary.
2758 **
2759 ** @see ensRegistryGetDatabaseadaptor
2760 ** @see ensRegistryGetIntronsupportingevidenceadaptor
2761 **
2762 ** @cc Bio::EnsEMBL::DBSQL::IntronSupportingEvidenceAdaptor::new
2763 ** @param [u] dba [EnsPDatabaseadaptor] Ensembl Database Adaptor
2764 **
2765 ** @return [EnsPIntronsupportingevidenceadaptor]
2766 ** Ensembl Intron Supporting Evidence Adaptor or NULL
2767 **
2768 ** @release 6.5.0
2769 ** @@
2770 ******************************************************************************/
2771
ensIntronsupportingevidenceadaptorNew(EnsPDatabaseadaptor dba)2772 EnsPIntronsupportingevidenceadaptor ensIntronsupportingevidenceadaptorNew(
2773 EnsPDatabaseadaptor dba)
2774 {
2775 return ensFeatureadaptorNew(
2776 dba,
2777 intronsupportingevidenceadaptorKTablenames,
2778 intronsupportingevidenceadaptorKColumnnames,
2779 (const EnsPBaseadaptorLeftjoin) NULL,
2780 (const char *) NULL,
2781 (const char *) NULL,
2782 &intronsupportingevidenceadaptorFetchAllbyStatement,
2783 (void *(*)(const void *)) NULL,
2784 (void *(*)(void *)) &ensIntronsupportingevidenceNewRef,
2785 (AjBool (*)(const void *)) NULL,
2786 (void (*)(void **)) NULL,
2787 (size_t (*)(const void *)) &ensIntronsupportingevidenceCalculateMemsize,
2788 (EnsPFeature (*)(const void *)) &ensIntronsupportingevidenceGetFeature,
2789 "Intronsupportingevidence");
2790 }
2791
2792
2793
2794
2795 /* @section destructors *******************************************************
2796 **
2797 ** Destruction destroys all internal data structures and frees the memory
2798 ** allocated for an Ensembl Intron Supporting Evidence Adaptor object.
2799 **
2800 ** @fdata [EnsPIntronsupportingevidenceadaptor]
2801 **
2802 ** @nam3rule Del Destroy (free) an Ensembl Intron Supporting Evidence Adaptor
2803 **
2804 ** @argrule * Pisea [EnsPIntronsupportingevidenceadaptor*]
2805 ** Ensembl Intron Supporting Evidence Adaptor address
2806 **
2807 ** @valrule * [void]
2808 **
2809 ** @fcategory delete
2810 ******************************************************************************/
2811
2812
2813
2814
2815 /* @func ensIntronsupportingevidenceadaptorDel ********************************
2816 **
2817 ** Default destructor for an Ensembl Intron Supporting Evidence Adaptor.
2818 **
2819 ** This function also clears the internal caches.
2820 **
2821 ** Ensembl Object Adaptors are singleton objects that are registered in the
2822 ** Ensembl Registry and weakly referenced by Ensembl Objects that have been
2823 ** instantiated by it. Therefore, Ensembl Object Adaptors should never be
2824 ** destroyed directly. Upon exit, the Ensembl Registry will call this function
2825 ** if required.
2826 **
2827 ** @param [d] Pisea [EnsPIntronsupportingevidenceadaptor*]
2828 ** Ensembl Intron Supporting Evidence Adaptor address
2829 **
2830 ** @return [void]
2831 **
2832 ** @release 6.5.0
2833 ** @@
2834 ******************************************************************************/
2835
ensIntronsupportingevidenceadaptorDel(EnsPIntronsupportingevidenceadaptor * Pisea)2836 void ensIntronsupportingevidenceadaptorDel(
2837 EnsPIntronsupportingevidenceadaptor *Pisea)
2838 {
2839 ensFeatureadaptorDel(Pisea);
2840
2841 return;
2842 }
2843
2844
2845
2846
2847 /* @section member retrieval **************************************************
2848 **
2849 ** Functions for returning members of an
2850 ** Ensembl Intron Supporting Evidence Adaptor object.
2851 **
2852 ** @fdata [EnsPIntronsupportingevidenceadaptor]
2853 **
2854 ** @nam3rule Get Return Ensembl Intron Supporting Evidence Adaptor attribute(s)
2855 ** @nam4rule Baseadaptor Return the Ensembl Base Adaptor
2856 ** @nam4rule Databaseadaptor Return the Ensembl Database Adaptor
2857 ** @nam4rule Featureadaptor Return the Ensembl Feature Adaptor
2858 **
2859 ** @argrule * isea [EnsPIntronsupportingevidenceadaptor]
2860 ** Ensembl Intron Supporting Evidence Adaptor
2861 **
2862 ** @valrule Baseadaptor [EnsPBaseadaptor]
2863 ** Ensembl Base Adaptor or NULL
2864 ** @valrule Databaseadaptor [EnsPDatabaseadaptor]
2865 ** Ensembl Database Adaptor or NULL
2866 ** @valrule Featureadaptor [EnsPFeatureadaptor]
2867 ** Ensembl Feature Adaptor or NULL
2868 **
2869 ** @fcategory use
2870 ******************************************************************************/
2871
2872
2873
2874
2875 /* @func ensIntronsupportingevidenceadaptorGetBaseadaptor *********************
2876 **
2877 ** Get the Ensembl Base Adaptor member of an
2878 ** Ensembl Intron Supporting Evidence Adaptor.
2879 **
2880 ** @param [u] isea [EnsPIntronsupportingevidenceadaptor]
2881 ** Ensembl Intron Supporting Evidence Adaptor
2882 **
2883 ** @return [EnsPBaseadaptor] Ensembl Base Adaptor or NULL
2884 **
2885 ** @release 6.5.0
2886 ** @@
2887 ******************************************************************************/
2888
ensIntronsupportingevidenceadaptorGetBaseadaptor(EnsPIntronsupportingevidenceadaptor isea)2889 EnsPBaseadaptor ensIntronsupportingevidenceadaptorGetBaseadaptor(
2890 EnsPIntronsupportingevidenceadaptor isea)
2891 {
2892 return ensFeatureadaptorGetBaseadaptor(
2893 ensIntronsupportingevidenceadaptorGetFeatureadaptor(isea));
2894 }
2895
2896
2897
2898
2899 /* @func ensIntronsupportingevidenceadaptorGetDatabaseadaptor *****************
2900 **
2901 ** Get the Ensembl Database Adaptor member of an
2902 ** Ensembl Intron Supporting Evidence Adaptor.
2903 **
2904 ** @param [u] isea [EnsPIntronsupportingevidenceadaptor]
2905 ** Ensembl Intron Supporting Evidence Adaptor
2906 **
2907 ** @return [EnsPDatabaseadaptor] Ensembl Database Adaptor or NULL
2908 **
2909 ** @release 6.5.0
2910 ** @@
2911 ******************************************************************************/
2912
ensIntronsupportingevidenceadaptorGetDatabaseadaptor(EnsPIntronsupportingevidenceadaptor isea)2913 EnsPDatabaseadaptor ensIntronsupportingevidenceadaptorGetDatabaseadaptor(
2914 EnsPIntronsupportingevidenceadaptor isea)
2915 {
2916 return ensFeatureadaptorGetDatabaseadaptor(
2917 ensIntronsupportingevidenceadaptorGetFeatureadaptor(isea));
2918 }
2919
2920
2921
2922
2923 /* @func ensIntronsupportingevidenceadaptorGetFeatureadaptor ******************
2924 **
2925 ** Get the Ensembl Feature Adaptor member of an
2926 ** Ensembl Intron Supporting Evidence Adaptor.
2927 **
2928 ** @param [u] isea [EnsPIntronsupportingevidenceadaptor]
2929 ** Ensembl Intron Supporting Evidence Adaptor
2930 **
2931 ** @return [EnsPFeatureadaptor] Ensembl Feature Adaptor or NULL
2932 **
2933 ** @release 6.5.0
2934 ** @@
2935 ******************************************************************************/
2936
ensIntronsupportingevidenceadaptorGetFeatureadaptor(EnsPIntronsupportingevidenceadaptor isea)2937 EnsPFeatureadaptor ensIntronsupportingevidenceadaptorGetFeatureadaptor(
2938 EnsPIntronsupportingevidenceadaptor isea)
2939 {
2940 return isea;
2941 }
2942
2943
2944
2945
2946 /* @section canonical object retrieval ****************************************
2947 **
2948 ** Functions for fetching Ensembl Intron Supporting Evidence objects from an
2949 ** Ensembl SQL database.
2950 **
2951 ** @fdata [EnsPIntronsupportingevidenceadaptor]
2952 **
2953 ** @nam3rule Fetch Fetch Ensembl Intron Supporting Evidence object(s)
2954 ** @nam4rule All Fetch all Ensembl Intron Supporting Evidence objects
2955 ** @nam4rule Allby Fetch all Ensembl Intron Supporting Evidence objects
2956 ** matching a criterion
2957 ** @nam5rule Transcript Fetch all by an Ensembl Transcript
2958 ** @nam4rule By Fetch one Ensembl Intron Supporting Evidence object
2959 ** matching a criterion
2960 ** @nam5rule Identifier Fetch by an SQL database-internal identifier
2961 **
2962 ** @argrule * isea [EnsPIntronsupportingevidenceadaptor]
2963 ** Ensembl Intron Supporting Evidence Adaptor
2964 ** @argrule All ises [AjPList]
2965 ** AJAX List of Ensembl Intron Supporting Evidence objects
2966 ** @argrule AllbyTranscript transcript [const EnsPTranscript]
2967 ** Ensembl Transcript
2968 ** @argrule Allby ises [AjPList]
2969 ** AJAX List of Ensembl Intron Supporting Evidence objects
2970 ** @argrule ByIdentifier identifier [ajuint] SQL database-internal identifier
2971 ** @argrule By Pise [EnsPIntronsupportingevidence*]
2972 ** Ensembl Intron Supporting Evidence address
2973 **
2974 ** @valrule * [AjBool] ajTrue upon success, ajFalse otherwise
2975 **
2976 ** @fcategory use
2977 ******************************************************************************/
2978
2979
2980
2981
2982 /* @func ensIntronsupportingevidenceadaptorFetchAllbyTranscript ***************
2983 **
2984 ** Fetch all Ensembl Intron Supporting Evidence objects via an
2985 ** Ensembl Transcript object.
2986 **
2987 ** The caller is responsible for deleting the
2988 ** Ensembl Intron Supporting Evidence objects before deleting the AJAX List.
2989 **
2990 ** @cc Bio::EnsEMBL::Map::DBSQL::IntronSupportingEvidenceAdaptor::
2991 ** fetch_all_by_Transcript
2992 ** @param [u] isea [EnsPIntronsupportingevidenceadaptor]
2993 ** Ensembl Intron Supporting Evidence Adaptor
2994 ** @param [r] transcript [const EnsPTranscript] Ensembl Transcript
2995 ** @param [u] ises [AjPList]
2996 ** AJAX List of Ensembl Intron Supporting Evidence objects
2997 **
2998 ** @return [AjBool] ajTrue upon success, ajFalse otherwise
2999 **
3000 ** @release 6.2.0
3001 ** @@
3002 ******************************************************************************/
3003
ensIntronsupportingevidenceadaptorFetchAllbyTranscript(EnsPIntronsupportingevidenceadaptor isea,const EnsPTranscript transcript,AjPList ises)3004 AjBool ensIntronsupportingevidenceadaptorFetchAllbyTranscript(
3005 EnsPIntronsupportingevidenceadaptor isea,
3006 const EnsPTranscript transcript,
3007 AjPList ises)
3008 {
3009 void **valarray = NULL;
3010
3011 register ajuint i = 0U;
3012
3013 ajuint *Pidentifier = NULL;
3014
3015 AjPSqlstatement sqls = NULL;
3016 AjISqlrow sqli = NULL;
3017 AjPSqlrow sqlr = NULL;
3018
3019 AjPStr statement = NULL;
3020
3021 AjPTable table = NULL;
3022
3023 EnsPDatabaseadaptor dba = NULL;
3024
3025 if (!isea)
3026 return ajFalse;
3027
3028 if (!transcript)
3029 return ajFalse;
3030
3031 if (!ises)
3032 return ajFalse;
3033
3034 dba = ensIntronsupportingevidenceadaptorGetDatabaseadaptor(isea);
3035
3036 statement = ajFmtStr(
3037 "SELECT "
3038 "intron_supporting_evidence_id "
3039 "FROM "
3040 "transcript_intron_supporting_evidence "
3041 "WHERE "
3042 "intron_supporting_evidence_id.transcript_id = %u",
3043 ensTranscriptGetIdentifier(transcript));
3044
3045 sqls = ensDatabaseadaptorSqlstatementNew(dba, statement);
3046
3047 ajStrDel(&statement);
3048
3049 table = ajTableuintNew(ajSqlstatementGetSelectedrows(sqls));
3050
3051 ajTableSetDestroyvalue(
3052 table,
3053 (void (*)(void **)) &ensIntronsupportingevidenceDel);
3054
3055 sqli = ajSqlrowiterNew(sqls);
3056
3057 while (!ajSqlrowiterDone(sqli))
3058 {
3059 AJNEW0(Pidentifier);
3060
3061 sqlr = ajSqlrowiterGet(sqli);
3062
3063 ajSqlcolumnToUint(sqlr, Pidentifier);
3064
3065 ajTablePut(table, (void *) Pidentifier, NULL);
3066 }
3067
3068 ajSqlrowiterDel(&sqli);
3069
3070 ensDatabaseadaptorSqlstatementDel(dba, &sqls);
3071
3072 ensBaseadaptorFetchAllbyIdentifiers(
3073 ensIntronsupportingevidenceadaptorGetBaseadaptor(isea),
3074 (EnsPSlice) NULL,
3075 (ajuint (*)(const void *)) &ensIntronsupportingevidenceGetIdentifier,
3076 table);
3077
3078 ajTableToarrayValues(table, &valarray);
3079
3080 for (i = 0U; valarray[i]; i++)
3081 ajListPushAppend(ises,
3082 (void *) ensIntronsupportingevidenceNewRef(
3083 (EnsPIntronsupportingevidence) valarray[i]));
3084
3085 AJFREE(valarray);
3086
3087 ajTableDel(&table);
3088
3089 return ajTrue;
3090 }
3091
3092
3093
3094
3095 /* @func ensIntronsupportingevidenceadaptorFetchByIdentifier ******************
3096 **
3097 ** Fetch an Ensembl Intron Supporting Evidence via its
3098 ** SQL database-internal identifier.
3099 **
3100 ** The caller is responsible for deleting the
3101 ** Ensembl Intron Supporting Evidence.
3102 **
3103 ** @cc Bio::EnsEMBL::Map::DBSQL::IntronSupportingEvidenceAdaptor::fetch_by_dbID
3104 ** @param [u] isea [EnsPIntronsupportingevidenceadaptor]
3105 ** Ensembl Intron Supporting Evidence Adaptor
3106 ** @param [r] identifier [ajuint] SQL database-internal identifier
3107 ** @param [wP] Pise [EnsPIntronsupportingevidence*]
3108 ** Ensembl Intron Supporting Evidence address
3109 **
3110 ** @return [AjBool] ajTrue upon success, ajFalse otherwise
3111 **
3112 ** @release 6.2.0
3113 ** @@
3114 ******************************************************************************/
3115
ensIntronsupportingevidenceadaptorFetchByIdentifier(EnsPIntronsupportingevidenceadaptor isea,ajuint identifier,EnsPIntronsupportingevidence * Pise)3116 AjBool ensIntronsupportingevidenceadaptorFetchByIdentifier(
3117 EnsPIntronsupportingevidenceadaptor isea,
3118 ajuint identifier,
3119 EnsPIntronsupportingevidence *Pise)
3120 {
3121 return ensBaseadaptorFetchByIdentifier(
3122 ensIntronsupportingevidenceadaptorGetBaseadaptor(isea),
3123 identifier,
3124 (void **) Pise);
3125 }
3126
3127
3128
3129
3130 /* @section accessory object retrieval ****************************************
3131 **
3132 ** Functions for retrieving objects releated to
3133 ** Ensembl Intron Supporting Evidence objects
3134 ** from an Ensembl SQL database.
3135 **
3136 ** @fdata [EnsPIntronsupportingevidenceadaptor]
3137 **
3138 ** @nam3rule Retrieve
3139 ** Retrieve Ensembl Intron Supporting Evidence-releated object(s)
3140 ** @nam4rule All
3141 ** Retrieve all Ensembl Intron Supporting Evidence-releated objects
3142 ** @nam5rule Identifiers Retrieve all SQL database-internal identifier objects
3143 ** @nam5rule Transcriptidentifiers
3144 ** Retrieve all AJAX unsigned integer (Ensembl Transcript identifier) objects
3145 ** @nam4rule Exonidentifiers
3146 ** Retrive AJAX unsigned integer (Ensembl Exon identifier) objects
3147 **
3148 ** @argrule * isea [EnsPIntronsupportingevidenceadaptor]
3149 ** Ensembl Intron Supporting Evidence Adaptor
3150 ** @argrule AllIdentifiers identifiers [AjPList]
3151 ** AJAX List of AJAX unsigned integer
3152 ** (Ensembl Intron Supporting Evidence identifier) objects
3153 ** @argrule AllTranscriptidentifiers ise [const EnsPIntronsupportingevidence]
3154 ** Ensembl Intron Supporting Evidence
3155 ** @argrule AllTranscriptidentifiers transcriptids [AjPList]
3156 ** AJAX List of AJAX unsigned integer (Ensembl Transcript identifier) objects
3157 ** @argrule Exonidentifiers ise [const EnsPIntronsupportingevidence]
3158 ** Ensembl Intron Supporting Evidence
3159 ** @argrule Exonidentifiers transcript [const EnsPTranscript]
3160 ** Ensembl Transcript
3161 ** @argrule Exonidentifiers Previous [ajuint*]
3162 ** Previous Ensembl Exon identifier
3163 ** @argrule Exonidentifiers Pnext [ajuint*]
3164 ** Next Ensembl Exon identifier
3165 **
3166 ** @valrule * [AjBool] ajTrue upon success, ajFalse otherwise
3167 **
3168 ** @fcategory use
3169 ******************************************************************************/
3170
3171
3172
3173
3174 /* @func ensIntronsupportingevidenceadaptorRetrieveAllTranscriptidentifiers ***
3175 **
3176 ** Retrieve all Ensembl Transcript identifier objects of an
3177 ** Ensembl Intron Supporting Evidence.
3178 **
3179 ** @cc Bio::EnsEMBL::Map::DBSQL::IntronSupportingEvidenceAdaptor::
3180 ** list_linked_transcript_ids
3181 ** @param [u] isea [EnsPIntronsupportingevidenceadaptor]
3182 ** Ensembl Intron Supporting Evidence Adaptor
3183 ** @param [r] ise [const EnsPIntronsupportingevidence]
3184 ** Ensembl Intron Supporting Evidence
3185 ** @param [u] transcriptids [AjPList]
3186 ** AJAX List of AJAX unsigned integer (Ensembl Transcript identifier) objects
3187 **
3188 ** @return [AjBool] ajTrue upon success, ajFalse otherwise
3189 **
3190 ** @release 6.5.0
3191 ** @@
3192 ******************************************************************************/
3193
ensIntronsupportingevidenceadaptorRetrieveAllTranscriptidentifiers(EnsPIntronsupportingevidenceadaptor isea,const EnsPIntronsupportingevidence ise,AjPList transcriptids)3194 AjBool ensIntronsupportingevidenceadaptorRetrieveAllTranscriptidentifiers(
3195 EnsPIntronsupportingevidenceadaptor isea,
3196 const EnsPIntronsupportingevidence ise,
3197 AjPList transcriptids)
3198 {
3199 ajuint *Pidentifier = NULL;
3200
3201 AjPSqlstatement sqls = NULL;
3202 AjISqlrow sqli = NULL;
3203 AjPSqlrow sqlr = NULL;
3204
3205 AjPStr statement = NULL;
3206
3207 EnsPDatabaseadaptor dba = NULL;
3208
3209 if (!isea)
3210 return ajFalse;
3211
3212 if (!ise)
3213 return ajFalse;
3214
3215 if (!transcriptids)
3216 return ajFalse;
3217
3218 dba = ensIntronsupportingevidenceadaptorGetDatabaseadaptor(isea);
3219
3220 statement = ajFmtStr(
3221 "SELECT "
3222 "transcript_intron_supporting_evidence.transcript_id "
3223 "FROM "
3224 "transcript_intron_supporting_evidence "
3225 "WHERE "
3226 "transcript_intron_supporting_evidence."
3227 "intron_supporting_evidence_id = %u",
3228 ensIntronsupportingevidenceGetIdentifier(ise));
3229
3230 sqls = ensDatabaseadaptorSqlstatementNew(dba, statement);
3231
3232 sqli = ajSqlrowiterNew(sqls);
3233
3234 while (!ajSqlrowiterDone(sqli))
3235 {
3236 AJNEW0(Pidentifier);
3237
3238 sqlr = ajSqlrowiterGet(sqli);
3239
3240 ajSqlcolumnToUint(sqlr, Pidentifier);
3241
3242 ajListPushAppend(transcriptids, (void *) Pidentifier);
3243 }
3244
3245 ajSqlrowiterDel(&sqli);
3246
3247 ensDatabaseadaptorSqlstatementDel(dba, &sqls);
3248
3249 ajStrDel(&statement);
3250
3251 return ajTrue;
3252 }
3253
3254
3255
3256
3257 /* @func ensIntronsupportingevidenceadaptorRetrieveExonidentifiers ************
3258 **
3259 ** Retrieve Ensembl Exon identifiers of an
3260 ** Ensembl Intron Supporting Evidence.
3261 **
3262 ** @cc Bio::EnsEMBL::Map::DBSQL::IntronSupportingEvidenceAdaptor::
3263 ** fetch_flanking_exon_ids
3264 ** @param [u] isea [EnsPIntronsupportingevidenceadaptor]
3265 ** Ensembl Intron Supporting Evidence Adaptor
3266 ** @param [r] ise [const EnsPIntronsupportingevidence]
3267 ** Ensembl Intron Supporting Evidence
3268 ** @param [r] transcript [const EnsPTranscript] Ensembl Transcript
3269 ** @param [wP] Previous [ajuint*] Previous Ensembl Exon identifier
3270 ** @param [wP] Pnext [ajuint*] Next Ensembl Exon identifier
3271 **
3272 ** @return [AjBool] ajTrue upon success, ajFalse otherwise
3273 **
3274 ** @release 6.5.0
3275 ** @@
3276 ******************************************************************************/
3277
ensIntronsupportingevidenceadaptorRetrieveExonidentifiers(EnsPIntronsupportingevidenceadaptor isea,const EnsPIntronsupportingevidence ise,const EnsPTranscript transcript,ajuint * Previous,ajuint * Pnext)3278 AjBool ensIntronsupportingevidenceadaptorRetrieveExonidentifiers(
3279 EnsPIntronsupportingevidenceadaptor isea,
3280 const EnsPIntronsupportingevidence ise,
3281 const EnsPTranscript transcript,
3282 ajuint *Previous,
3283 ajuint *Pnext)
3284 {
3285 ajuint previousid = 0U;
3286 ajuint nextid = 0U;
3287
3288 AjPSqlstatement sqls = NULL;
3289 AjISqlrow sqli = NULL;
3290 AjPSqlrow sqlr = NULL;
3291
3292 AjPStr statement = NULL;
3293
3294 EnsPDatabaseadaptor dba = NULL;
3295
3296 if (!isea)
3297 return ajFalse;
3298
3299 if (!ise)
3300 return ajFalse;
3301
3302 if (!transcript)
3303 return ajFalse;
3304
3305 if (!Previous)
3306 return ajFalse;
3307
3308 if (!Pnext)
3309 return ajFalse;
3310
3311 *Previous = 0U;
3312 *Pnext = 0U;
3313
3314 dba = ensIntronsupportingevidenceadaptorGetDatabaseadaptor(isea);
3315
3316 statement = ajFmtStr(
3317 "SELECT "
3318 "transcript_intron_supporting_evidence.previous_exon_id, "
3319 "transcript_intron_supporting_evidence.next_exon_id "
3320 "FROM "
3321 "transcript_intron_supporting_evidence "
3322 "WHERE "
3323 "transcript_intron_supporting_evidence."
3324 "transcript_id = %u "
3325 "AND "
3326 "transcript_intron_supporting_evidence."
3327 "intron_supporting_evidence_id = %u",
3328 ensTranscriptGetIdentifier(transcript),
3329 ensIntronsupportingevidenceGetIdentifier(ise));
3330
3331 sqls = ensDatabaseadaptorSqlstatementNew(dba, statement);
3332
3333 sqli = ajSqlrowiterNew(sqls);
3334
3335 while (!ajSqlrowiterDone(sqli))
3336 {
3337 previousid = 0U;
3338 nextid = 0U;
3339
3340 sqlr = ajSqlrowiterGet(sqli);
3341
3342 ajSqlcolumnToUint(sqlr, &previousid);
3343 ajSqlcolumnToUint(sqlr, &nextid);
3344
3345 if (!*Previous)
3346 {
3347 *Previous = previousid;
3348 *Pnext = nextid;
3349 }
3350 }
3351
3352 ajSqlrowiterDel(&sqli);
3353
3354 ensDatabaseadaptorSqlstatementDel(dba, &sqls);
3355
3356 ajStrDel(&statement);
3357
3358 return ajTrue;
3359 }
3360