def __get__(self, obj, objtype): '''Concatenate exon sequences of a transcript to obtain its sequence.''' exon_count = obj.exonCount exon_starts = obj.exonStarts.split(',')[:exon_count] exon_ends = obj.exonEnds.split(',')[:exon_count] trans_seq = '' for i in range(0, exon_count): trans_seq += str( sequence.absoluteSlice(obj._anno_seq, int(exon_starts[i]), int(exon_ends[i]))) seq = sequence.Sequence(trans_seq, obj.name) setattr(obj, self.attr, seq) # cache on object return seq
def __get__(self, obj, objtype): '''Concatenate exon sequences of a transcript to obtain its sequence.''' exon_count = obj.exonCount exon_starts = obj.exonStarts.split(',')[:exon_count] exon_ends = obj.exonEnds.split(',')[:exon_count] trans_seq = '' for i in range(0, exon_count): trans_seq += str(sequence.absoluteSlice(obj._anno_seq, int(exon_starts[i]), int(exon_ends[i]))) seq = sequence.Sequence(trans_seq, obj.name) setattr(obj, self.attr, seq) # cache on object return seq
def printSliceAlignment(myslice, ifile=None): """print alignment of a gene as text, with numbering, seq differences in bold. Suitable for viewing as .html file in a browser...""" from pygr import sequence if ifile is None: import sys ifile = sys.stdout d = Autodict(myslice.stop - myslice.start) namedict = ~(myslice.nlmsaSequence.nlmsaLetters.seqDict) writeSeqToArray(myslice.start, 0, sequence.absoluteSlice(myslice.seq, myslice.start, myslice.stop), d, namedict) numline = d["#"] i = (myslice.start + 19) - ((myslice.start + 19) % 20) while i < myslice.stop: writeNumToArray(i, myslice.start, numline) i += 20 for srcPath, destPath, t in myslice.edges(): writeSeqToArray(destPath.start, srcPath.start - myslice.start, destPath, d, namedict) printHTML(d, ifile, 100)