[Biopython-dev] DeprecationWorning SProt.py
Andrea
andrea at biodec.com
Mon Feb 23 07:22:51 EST 2009
Goodmorning,
my name is Andrea Zauli.
using the last version of biopyhthon (1.49) i received this
DeprecationWarning:
/usr/lib/python2.5/site-packages/biopython-1.49-py2.5-linux-x86_64.egg/Bio/SwissProt/SProt.py:147:
DeprecationWarning:
Bio.SwissProt.SProt.Iterator is deprecated.
Please use the function Bio.SwissProt.parse instead if you want to get
a SwissProt.SProt.Record,
or Bio.SeqIO.parse if you want to get a SeqRecord. If these solutions
do not work for you,
please get in contact with the Biopython developers
(biopython-dev at biopython.org).
DeprecationWarning)
But i still need to use it.
I'm going to explain my problem.
I noticed that the seq record parser SProt.SequenceParser (or the newest
Bio.SeqIO.parse)
aren't able to parse uniprot Feature (and generate SeqFeature Objects).
I noticed also
that SProt.RecordParser is able to parse uniprot Feature (and it
generates a list
of tuple for the parsed features). So to generate a "featured SeqRecord"
i need to parse
each uniprot "record" with both (SProt.SequenceParser,
SProt.RecordParser) and than transform
easily each Feature tuple into a SeqFeature instance .
To manage this problem actually i'm using SProt.Iterator that is able to
work with a file handle, and return like a generator, each unparsed uniprot
record. After, i can easily pass each unparsed uniprot record either to
SProt.SequenceParser and to SProt.RecordParser for parsing. In that way
i'm ALSO SURE that the record i'm parsing is the SAME.
If this method is deprecated, i'd be forced to use Bio.SeqIO.parse and
Bio.SwissProt.parse, but each have to act on their own handle (so i've to
open 2 file handles)..... and i'm not sure (ok i would be reasonably sure)
that i'm working exactly on the same "record" every each "".next()"" .
I could work in a different way if the Feature Parser (that in some
way parses the Feature in the SProt.RecordParser) could be transferred
to the SProt.SequenceParser (or Bio.SeqIO.parse).
So actually i need to work with:
- SProt.SequenceParser, SProt.RecordParser because of they have the
method "parse_str".
- SProt.Iterator because it is able to produce the "string" object that
represent
an uniprot record to parse (and that i can easily pass to the
".parse_str" method
for parsing).
I could stop to work with Prot.SequenceParser, SProt.RecordParser if
Bio.SeqIO and Bio.SwissProt
will have the methof ".parse_str".
I could stop to work with SProt.Iterator, if in some way there is an
alterntive.
I could work in a different way if the Feature Parser (that in some
way parses the Feature in the SProt.RecordParser) could be transferred
to the SProt.SequenceParser (or Bio.SeqIO.parse).
Thank in advance
Any help is appreciated
Best Reards
Dr. Andrea Zauli
More information about the Biopython-dev
mailing list