[Biopython] SwissProt parser: get entire entry as string?

Peter Cock p.j.a.cock at googlemail.com
Fri Aug 19 20:21:00 UTC 2016


On Fri, Aug 19, 2016 at 4:56 PM, Chevreux, Bastien
<bastien.chevreux at dsm.com> wrote:
> Dear list,
>
> Is there a way to get the entire entry of a just parsed SwissProt entry as
> string?
>
> Motivation: I want to write a simple filter for UniProt/SwissProt .dat files
> like this ...

Is this an example where grep on the raw file would work? If so,
then the Bio.SeqIO.index_db functionality may be useful - specifically
the get_raw method returns the raw data from the file as a string.

However, I suspect you are interested in matching things like
annotation which in the raw file could be line wrapped? In this
case you can probably get close with something like this is
you know it will be in the annotations dictionary:

"my string" in repr(rec,annotations)

Or are you looking for something in the feature annotations?
(aka feature qualifiers using the GenBank/EMBL terminology
reflected in the SeqFeature attribute naming)

Peter


More information about the Biopython mailing list