char *RawContig_getSubSeq(RawContig *contig, int start, int end, int strand) { SequenceAdaptor *sa; if (end < start) { fprintf(stderr, "Error: End coord is less then start coord to call on RawContig subseq."); exit(1); } if (strand != -1 && strand != 1) { strand = 1; } // if the sequence of this contig has been manually set retrieve its substring if (contig->seq) { char *str = StrUtil_substr(contig->seq, start-1, end - start + 1); if (strand == -1) { SeqUtil_reverseComplement(str,strlen(str)); } return str; } if (!RawContig_getAdaptor(contig)) { fprintf(stderr, "Error: RawContig subseq no sequence set and no db available\n"); return emptyString; } sa = DBAdaptor_getSequenceAdaptor(RawContig_getAdaptor(contig)->dba->dnadb); //return SequenceAdaptor_fetchByRawContigStartEndStrand(sa, RawContig_getDbID(contig), start, end, strand); return NULL; }
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 compareComplements(Slice *slice, SequenceAdaptor *seqA) { char *seq = SequenceAdaptor_fetchBySliceStartEndStrand(seqA, slice,1,POS_UNDEF,1); fprintf(stderr,"FORWARD STRAND SLICE SEQ for %s\n", Slice_getName(slice)); //fprintf(stderr,"%s\n", seq); char *invertedSeq = SequenceAdaptor_fetchBySliceStartEndStrand(seqA, slice,1,POS_UNDEF,-1); fprintf(stderr,"REVERSE STRAND SLICE SEQ for %s\n", Slice_getName(slice)); //fprintf(stderr,"%s\n", invertedSeq); ok(nTest++, strlen(seq) == Slice_getLength(slice)); //sequence is correct length SeqUtil_reverseComplement(seq, Slice_getLength(slice)); //reverse complement seq //fprintf(stderr,"%s\n", seq); ok(nTest++, !strcmp(seq, invertedSeq)); //revcom same as seq on inverted slice }