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 PredictionExon_loadGenomicMapper(Exon *exon, Mapper *mapper, IDType id, int start) { // NIY Make the Exon_getContig consistent Mapper_addMapCoordinates( mapper, id, start, start+Exon_getLength(exon)-1, Exon_getStrand(exon), Slice_getSeqRegionId(PredictionExon_getSlice(exon)), Exon_getStart(exon), Exon_getEnd(exon) ); }
MapperRangeSet *PredictionTranscript_genomic2cDNA(PredictionTranscript *trans, int start, int end, int strand, BaseContig *contig) { Mapper *mapper; // "ids" in mapper are contigs of exons, so use the same contig that should // be attached to all of the exons... if (!contig) { Vector *translateable = PredictionTranscript_getAllTranslateableExons(trans); PredictionExon *firstExon; if (!Vector_getNumElement(translateable)) { return MapperRangeSet_new(); } firstExon = Vector_getElementAt(translateable, 0); contig = (BaseContig*)PredictionExon_getSlice(firstExon); Vector_free(translateable); } mapper = PredictionTranscript_getcDNACoordMapper(trans); return Mapper_mapCoordinates(mapper,(IDType)contig, start, end, strand, "genomic"); }