char *PredictionExon_getSeqString(PredictionExon *exon) { char *seq; if (PredictionExon_getSeqCacheString(exon)) { return PredictionExon_getSeqCacheString(exon); } if (!PredictionExon_getSlice(exon)) { fprintf(stderr, "Warning: this exon %s doesn't have a contig you won't get a seq\n", PredictionExon_getDisplayLabel(exon)); return NULL; } else { seq = BaseContig_getSubSeq(PredictionExon_getSlice(exon), PredictionExon_getStart(exon), PredictionExon_getEnd(exon), 1); if (PredictionExon_getStrand(exon) == -1){ SeqUtil_reverseComplement(seq,strlen(seq)); } } PredictionExon_setSeqCacheString(exon, seq); return PredictionExon_getSeqCacheString(exon); }
void PredictionTranscript_sort(PredictionTranscript *trans) { PredictionExon *firstExon = PredictionTranscript_getExonAt(trans,0); int strand; int i; for (i=0; i<PredictionTranscript_getExonCount(trans); i++) { if (!PredictionTranscript_getExonAt(trans,i)) { return; } } strand = PredictionExon_getStrand(firstExon); // Hack in using Exon function names if (strand == 1) { Vector_sort(PredictionTranscript_getExons(trans),Exon_forwardStrandCompFunc); } else if (strand == -1) { Vector_sort(PredictionTranscript_getExons(trans),Exon_reverseStrandCompFunc); } }