[Biopython] access Uniprot record by different ids

Peter Cock p.j.a.cock at googlemail.com
Tue Jul 10 13:43:31 UTC 2012


On Tue, Jul 10, 2012 at 2:16 PM, Sheila the angel
<from.d.putto at gmail.com> wrote:
> I have a Uniprot AC list in which some AC are primary and some are
> secondary. The function
> my_dict = SeqIO.index("uniprot_sprot.dat", "swiss")
> makes dictionary of  uniprot data but I can access a record only by primary
> AC.
> my_dict['P04637']  # gives the record
> my_dict['Q15086'] # KeyError
> my_dict['P53_HUMAN'] # KeyError
>
> Is it possible to access same record by both primary and secondary ACs
> (and by uniprot ID) ?

Not directly with Bio.SeqIO.index() or Bio.SeqIO.index_db(), no.
You could perhaps use a second dictionary mapping aliases to
the primary ID?

Peter



More information about the Biopython mailing list