| Trees | Indices | Help |
|---|
|
|
Client-side interface to the EUtils services
See the module docstring for much more complete information.
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
opener = None, tool = TOOL, email = EMAIL, baseurl = ".../eutils/"
'opener' -- an object which implements the 'open' method like a
urllib2.OpenDirector. Defaults to urllib2.build_opener()
'tool' -- the term to use for the 'tool' field, used by NCBI to
track which programs use their services. If you write your
own tool based on this package, use your own tool name.
'email' -- a way for NCBI to contact you (the developer, not
the user!) if there are problems and to tell you about
updates or changes to their system.
'baseurl' -- location of NCBI's EUtils directory. Shouldn't need
to change this at all.
|
Enforce the NCBI requirement of one request every three seconds. Ideally the calling code would have respected the 3 second rule, but as this often hasn't happenend we check this here. wait - number of seconds between queries. |
term, db="pubmed", field=None, daterange=None, retstart=0, retmax=20, usehistory=0, webenv=none
Search the given database for records matching the query given
in the 'term'. See the module docstring for examples.
'term' -- the query string in the Entrez query language; see
http://www.ncbi.nlm.nih.gov/entrez/query/static/help/pmhelp.html
'db' -- the database to search
'field' -- the field to use for unqualified words
Eg, "dalke[au] AND gene" with field==None becomes
dalke[au] AND (genes[MeSH Terms] OR gene[Text Word]
and "dalke[au] AND gene" with field=="au" becomes
dalke[au] AND genes[Author]
(Yes, I think the first "au" should be "Author" too)
'daterange' -- a date restriction; either WithinNDays or DateRange
'retstart' -- include identifiers in the output, starting with
position 'retstart' (normally starts with 0)
'retmax' -- return at most 'retmax' identifiers in the output
(if not specified, NCBI returns 20 identifiers)
'usehistory' -- flag to enable history tracking
'webenv' -- if this string is given, add the search results
to an existing history. (WARNING: the history disappers
after about an hour of non-use.)
You will need to parse the output XML to get the new QueryKey
and WebEnv fields.
Returns an input stream from an HTTP request. The stream
contents are in XML.
|
dbids, webenv = None
Create a new collection in the history containing the given
list of identifiers for a database.
'dbids' -- a DBIds, which contains the database name and
a list of identifiers in that database
'webenv' -- if this string is given, add the collection
to an existing history. (WARNING: the history disappers
after about an hour of non-use.)
You will need to parse the output XML to get the new QueryKey
and WebEnv fields. NOTE: The order of the IDs on the server
is NOT NECESSARILY the same as the upload order.
Returns an input stream from an HTTP request. The stream
contents are in XML.
|
db, webenv, query_key, retstart = 0, retmax = 20, retmode = "xml" Get the summary for a collection of records in the history 'db' -- the database containing the history/collection 'webenv' -- the WebEnv cookie for the history 'query_key' -- the collection in the history 'retstart' -- get the summaries starting with this position 'retmax' -- get at most this many summaries 'retmode' -- can only be 'xml'. (Are there others?) Returns an input stream from an HTTP request. The stream contents are in 'retmode' format. |
dbids, retmode = "xml"
Get the summary for records specified by identifier
'dbids' -- a DBIds containing the database name and list
of record identifiers
'retmode' -- can only be 'xml'
Returns an input stream from an HTTP request. The stream
contents are in 'retmode' format.
|
db, webenv, query_key, retstart=0, retmax=20, retmode=None, rettype=None, seq_start=None, seq_stop=None, strand=None, complexity=None
Fetch information for a collection of records in the history,
in a variety of formats.
'db' -- the database containing the history/collection
'webenv' -- the WebEnv cookie for the history
'query_key' -- the collection in the history
'retstart' -- get the formatted data starting with this position
'retmax' -- get data for at most this many records
These options work for sequence databases
'seq_start' -- return the sequence starting at this position.
The first position is numbered 1
'seq_stop' -- return the sequence ending at this position
Includes the stop position, so seq_start = 1 and
seq_stop = 5 returns the first 5 bases/residues.
'strand' -- strand. Use EUtils.PLUS_STRAND (== 1) for plus
strand and EUtils.MINUS_STRAND (== 2) for negative
'complexity' -- regulates the level of display. Options are
0 - get the whole blob
1 - get the bioseq for gi of interest (default in Entrez)
2 - get the minimal bioseq-set containing the gi of interest
3 - get the minimal nuc-prot containing the gi of interest
4 - get the minimal pub-set containing the gi of interest
http://www.ncbi.nlm.nih.gov/entrez/query/static/efetchseq_help.html
The valid retmode and rettype values are
For publication databases (omim, pubmed, journals) the
retmodes are 'xml', 'asn.1', 'text', and 'html'.
If retmode == xml ---> XML (default)
if retmode == asn.1 ---> ASN.1
The following rettype values work for retmode == 'text'.
docsum ----> author / title / cite / PMID
brief ----> a one-liner up to about 66 chars
abstract ----> cite / title / author / dept /
full abstract / PMID
citation ----> cite / title / author / dept /
full abstract / MeSH terms /
substances / PMID
medline ----> full record in medline format
asn.1 ----> full record in one ASN.1 format
mlasn1 ----> full record in another ASN.1 format
uilist ----> list of uids, one per line
sgml ----> same as retmode="xml"
Sequence databases (genome, protein, nucleotide, popset)
also have retmode values of 'xml', 'asn.1', 'text', and
'html'.
If retmode == 'xml' ---> XML (default; only supports
rettype == 'native')
If retmode == 'asn.1' ---> ASN.1 text (only works for rettype
of 'native' and 'sequin')
The following work with a retmode of 'text' or 'html'
native ----> Default format for viewing sequences
fasta ----> FASTA view of a sequence
gb ----> GenBank view for sequences, constructed sequences
will be shown as contigs (by pointing to its parts).
Valid for nucleotides.
gbwithparts --> GenBank view for sequences, the sequence will
always be shown. Valid for nucleotides.
est ----> EST Report. Valid for sequences from
dbEST database.
gss ----> GSS Report. Valid for sequences from dbGSS
database.
gp ----> GenPept view. Valid for proteins.
seqid ----> To convert list of gis into list of seqids
acc ----> To convert list of gis into list of accessions
# XXX TRY THESE
fasta_xml
gb_xml
gi (same as uilist?)
A retmode of 'file' is the same as 'text' except the data is
sent with a Content-Type of application/octet-stream, which tells
the browser to save the data to a file.
A retmode of 'html' is the same as 'text' except a HTML header
and footer are added and special character are properly escaped.
Returns an input stream from an HTTP request. The stream
contents are in the requested format.
|
dbids, retmode = None, rettype = None, seq_start = None, seq_stop = None, strand = None, complexity = None
Fetch information for records specified by identifier
'dbids' -- a DBIds containing the database name and list
of record identifiers
'retmode' -- See the docstring for 'efetch_using_history'
'rettype' -- See the docstring for 'efetch_using_history'
These options work for sequence databases
'seq_start' -- return the sequence starting at this position.
The first position is numbered 1
'seq_stop' -- return the sequence ending at this position
Includes the stop position, so seq_start = 1 and
seq_stop = 5 returns the first 5 bases/residues.
'strand' -- strand. Use EUtils.PLUS_STRAND (== 1) for plus
strand and EUtils.MINUS_STRAND (== 2) for negative
'complexity' -- regulates the level of display. Options are
0 - get the whole blob
1 - get the bioseq for gi of interest (default in Entrez)
2 - get the minimal bioseq-set containing the gi of interest
3 - get the minimal nuc-prot containing the gi of interest
4 - get the minimal pub-set containing the gi of interest
Returns an input stream from an HTTP request. The stream
contents are in the requested format.
|
dbfrom, webenv, query_key, db="pubmed", retstart=0, retmax=20, cmd="neighbor", retmode=None, term=None, field=None, daterange=None,
Find records related (in various ways) to a collection of
records in the history.
'dbfrom' -- this is the name of the database containing the
collection of record. NOTE! For the other methods
this is named 'db'. But I'm keeping NCBI's notation.
This is where the records come FROM.
'webenv' -- the WebEnv cookie for the history
'query_key' -- the collection in the history
'db' -- Where the records link TO. This is where you want to
find the new records. For example, if you want to
find PubMed records related to a protein then 'dbfrom'
is 'protein' and 'db' is 'pubmed'
'cmd'-- one of the following (unless specified, retmode is the
default value, which returns data in XML)
neighbor: Display neighbors and their scores by database and ID.
(This is the default 'cmd'.)
prlinks: List the hyperlink to the primary LinkOut provider
for multiple IDs and database.
When retmode == 'ref' this URL redirects the browser
to the primary LinkOut provider for a single ID
and database.
llinks: List LinkOut URLs and Attributes for multiple IDs
and database.
lcheck: Check for the existence (Y or N) of an external
link in for multiple IDs and database.
ncheck: Check for the existence of a neighbor link for
each ID, e.g., Related Articles in PubMed.
'retstart' -- get the formatted data starting with this position
'retmax' -- get data for at most this many records
'retmode' -- only used with 'prlinks'
'term' -- restrict results to records which also match this
Entrez search
'field' -- the field to use for unqualified words
'daterange' -- restrict results to records which also match this
date criteria; either WithinNDays or DateRange
NOTE: DateRange must have both mindate and maxdate
Some examples:
In PubMed, to get a list of "Related Articles"
dbfrom = pubmed
cmd = neighbor
To get MEDLINE index only related article
dbfrom = pubmed
db = pubmed
term = medline[sb]
cmd = neighbor
Given a PubMed record, find the related nucleotide records
dbfrom = pubmed
db = nucleotide (or "protein" for related protein records)
cmd = neighbor
To get "LinkOuts" (external links) for a PubMed record set
dbfrom = pubmed
cmd = llinks
Get the primary link information for a PubMed document; includes
various hyperlinks, image URL for the provider, etc.
dbfrom = pubmed
cmd = prlinks
(optional) retmode = "ref" (causes a redirect to the privder)
Returns an input stream from an HTTP request. The stream
contents are in XML unless 'retmode' is 'ref'.
|
dbids, db="pubmed", cmd="neighbor", retmode=None, term=None, daterange=None
Find records related (in various ways) to a set of records
specified by identifier.
'dbids' -- a DBIds containing the database name and list
of record identifiers
'db' -- Where the records link TO. This is where you want to
find the new records. For example, if you want to
find PubMed records related to a protein then 'db'
is 'pubmed'. (The database they are from is part
of the DBIds object.)
'cmd' -- see the docstring for 'elink_using_history'
'retmode' -- see 'elink_using_history'
'term' -- see 'elink_using_history'
'daterange' -- see 'elink_using_history'
Returns an input stream from an HTTP request. The stream
contents are in XML unless 'retmode' is 'ref'.
|
| Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0.1 on Sun May 3 17:14:18 2009 | http://epydoc.sourceforge.net |