[BioPython] in addition...

Andrew Dalke adalke at mindspring.com
Tue Feb 11 12:06:28 EST 2003


Sep Dadsetan:
> Is it possible to extract extra info, for example 1000bp
> upstream of a sequence, using EUtils or other available scripts?
> As far as I'm aware, using batch retrieval, you only can attain
> the gene from starting base to end, right?

It is possible with EUtils.


>>> import EUtils
>>> from EUtils import DBIdsClient
>>> record = DBIdsClient.from_dbids(EUtils.DBIds("protein", "4579714"))
>>> help(record.efetch)
Help on method efetch in module EUtils.DBIdsClient:

efetch(self, retmode='xml', rettype=None, seq_start=None, seq_stop=None,
strand=
None, complexity=None) method of EUtils.DBIdsClient.SequenceDBIdsRecordSet
instance

>>> print record.efetch(retmode="text", rettype="fasta").read()
>gi|4579714|dbj|BAA75200.1| Bacteriorhodopsin [Halobacterium sp.]
MCCAALAPPMAATVGPESIWLWIGTIGMTLGTLYFVGRGRGVRDRKMQEFYIITIFITTIAAAMYFAMAT
GFGVTEVMVGDEALTIYWARYADWLFTTPLLLLDLSLLAGANRNTIATLIGLDVFMIGTGAIAALSSTPG
TRIAWWAISTGALLALLYVLVGTLSENARNRAPEVASLFGRLRNLVIALWFLYPVVWILGTEGTFGILPL
YWETAAFMVLDLSAKVGFGVILLQSRSVLERVATPTAAPT


>>> print record.efetch(retmode="text", rettype="fasta", seq_start = 2,
seq_stop = 10).read()
>gi|4579714:2-10 Bacteriorhodopsin [Halobacterium sp.]
CCAALAPPM


>>>

BTW, there are occasional crashes in the server.  I just got

>>> print record.efetch(retmode="text", rettype="fasta").read()
Traceback (most recent call last):
    ...
  File "/usr/local/lib/python2.2/urllib2.py", line 400, in
http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 500: Internal Server Error

but when I tried it again, it worked.  I don't know if I should
have a "try a couple times until it works" code put into the
EUtils system or not.

					Andrew
					dalke at dalkescientific.com



More information about the BioPython mailing list