[BioPython] Sequence numbering. Moving on...
Thomas.Sicheritz@molbio.uu.se
Thomas.Sicheritz@molbio.uu.se
Wed, 6 Oct 1999 11:43:52 +0100 (WET DST)
Andrew Dalke writes:
> Thomas.Sicheritz@molbio.uu.se said:
> >Again - for practical reasons, why not an additional
> >return_seqReverse method ?
> > MySlice(7,30).return_seqReverse().translate()
>
> Does this mean it returns a new (reversed) sequence, or that it
> does the reverse and returns itself?
more like the sequence object is keeping a reference to
self.reversed string representation (caching ?) ...
(next question: does seqReverse - reverse and complement = antiparallel ?
if not, the right call should have been
MySlice(7,30).return_seqReverse().return_seqComplement().translate()
or
MySlice(7,30).return_seqAntiparallel().translate()
even if raw reverse is a rare biological sequence operation we still need
seqReverse, seqComplement and seqAntiparallel
)
... but the better and in my opinion more 'right' solution to this
particular translation problem is that the translation method can handle
all 6 frames
like:
seq = seqobj("ATGACAAAGCTAATTATTCACTTGGTTTCAGACTCTTCTGTGCAAACTGCAAAACATGC")
for frame in [-3,-2,-1,1,2,3]:
print "Frame %d:%s" % (frame, seq.MySlice(7,30).translate(frame))
Frame -3: KPSE*LA
Frame -2: ETK*IIS
Frame -1: *NQVNN*
Frame 1: S*LFTWF
Frame 2: ANYSLGF
Frame 3: LIIHLVS
print seq.MySlice(7,30)
'AGCTAATTATTCACTTGGTTTCA'
print seq.MySlice(7,30).reverse()
"ACTTTGGTTCACTTATTAATCGA"
print seq.MySlice(7,30).complement()
'TCGATTAATAACTGAACCAAAGT'
print seq.MySlice(7,30).antiparallel()
'TGAAACCAAGTGAATAATTAGCT'
> Take a look at
> ftp://ftp.ks.uiuc.edu/pub/group/dalke/line_lexer.tar.gz
> The code isn't well documented, and I did it in one evening to
> see if the idea of building the parse tree off of Python's
> parser worked. It did. Then I tried to see if I could make
> it support a simple file format. It did. It does not work for
> more complicated formats, though swissprot shouldn't be a problem.
> That's where an NFA should be used instead.
>
> In other words, beware!
beware ... ? @shudder@ ... I finally found your file. It was on display in
the bottom of a locked filing cabinet stuck in a disused lavatory with a
sign on the door saying Beware of the Leopard." :-)
... sorry, couldn't resist ... 'beware' always triggers hitchhiker syndromes ...
Thx for the link - I'll play with it tonight.
-thomas
--
Sicheritz Ponten Thomas E. Linnaeus Centre for Bioinformatics
blippblopp@linux.nu BMC, Uppsala University
BMC: +46 18 4714214 BOX 590 S-751 24 UPPSALA Sweden
Fax +46 18 557723 http://evolution.bmc.uu.se/~thomas
Molecular Python: http://evolution.bmc.uu.se/~thomas/python
Molecular Linux: http://evolution.bmc.uu.se/~thomas/mol_linux
De Chelonian Mobile ... The Turtle Moves ...