Bases: builtins.object
Constructs a Request. Sends HTTP request.
Returns: | class:Response <Response> object. |
---|---|
Return type: | A |
Bases: builtins.object
Accepts and parses results from a call to the BOLD API.
Parses the data and returns a Response object.
list or str
Metadata from BOLD after parsing.
str
Alias of the method used to interact with BOLD.
Parses XML response from BOLD.
Parameters: |
|
---|---|
Returns: | List of all items as dictionaries. |
Parses string response from BOLD containing FASTA sequences.
Parameters: | result_string – FASTA sequences as string returned from BOLD. |
---|---|
Returns: | List of all items as Biopython SeqRecord objects. |
Call the Full Data Retrieval API (combined).
Parameters: |
|
---|---|
Returns: | The data is returned as a string in TSV format or list of dicts parsed from a XML file. |
Raises: | ValueError – If format is not None or ‘tsv’. |
Examples
>>> import bold
>>> res = bold.call_full_data(taxon='Hermeuptychia', geo='Peru')
>>> item = res.items[0]
>>> [item['sequences_sequence_genbank_accession'] for item in res.items]
['KF466142', 'KF466143', 'KF466144']
Call the ID Engine API http://www.boldsystems.org/index.php/resources/api?type=idengine
Parameters: |
|
---|---|
Returns: | List of dictionaries containing metadata. One dictionary per BOLD record. |
Examples
>>> import bold
>>> seq = 'TTTTTGGTATTTGAGCAGGAATAGTAGGAACTTCTCTCAGTTTAATTATTCGAATAGAATTAGGTAATCCAGGTTTCTTAATTGGAGATGATCAAATTTATAATACTATTGTAACAGCCCATGCTTTTATTATAATTTTTTTTATAGTTATACCTATTGTAATTGGAGGATTTGGAAATTGACTAGTTCCCCTAATATTAGGTGCACCTGATATAGCTTTCCCTCGTATAAATAATATAAGATATTGACTACTTCCACCATCTTTAATATTATTAATTTCAAGTAGTATTGTAGAAAATGGAGCTGGAACAGGTTGAACAGTTTACCCCCCTCTTTCCTCTAATATTGCTCATAGAGGAACCTCAGTAGACTTAGCAATTTTTTCTCTTCATTTAGCTGGTATTTCTTCTATTTTAGGAGCTATTAATTTTATTACTACAATTATTAATATACGAGTTAATGGAATATCCTATGATCAAATACCTTTATTTGTTTGAGCTGTTGGAATTACAGCTCTTCTTTTACTTCTTTCTTTACCTGTTTTAGCAGGAGCTATCACAATACTTCTTACAGATCGAAATTTAAATACATCATTTTTTGATCCTGCAGGAGGAGGTGATCCAATTTTATACCAACATTTATTTTGATTTTTTGGTCACCC'
>>> res = bold.call_id(seq, db='COX1')
>>> item = res.items[1]
>>> item['bold_id'] # this is the ID assigned by BOLD
'GBLN3590-14'
Call the Specimen Data Retrieval API.
Parameters: |
|
---|---|
Returns: | DNA sequences of matching records in FASTA format. |
Examples
>>> import bold
>>> res = bold.call_sequence_data(taxon='Hermeuptychia', geo='Peru')
>>> items = res.items
>>> [item.id for item in items]
['GBLN4477-14|Hermeuptychia', 'GBLN4478-14|Hermeuptychia', 'GBLN4479-14|Hermeuptychia']
Call the Specimen Data Retrieval API.
Parameters: |
|
---|---|
Raises: | ValueError – If format is not None and not ‘tsv’. |
Returns: | Matching specimen data records as string in TSV format or as list of dictionaries. |
Examples
>>> import bold
>>> bin = 'BOLD:AAE2777'
>>> res = bold.call_specimen_data(bin=bin)
>>> class_taxon_names = [item['taxonomy_class_taxon_name'] for item in res.items]
>>> class_taxon_names[0]
'Insecta'
Call the TaxonData API. It has several methods to get additional metadata.
Parameters: |
|
---|---|
Returns: | List of dictionaries containing metadata for a given taxon. |
Raises: | ValueError – If include_tree is not True or False. |
Examples
>>> import bold
>>> tax_id = 88899
>>> res = bold.call_taxon_data(tax_id, data_type='basic,images')
>>> item = res.items[0]
>>> item['taxon']
'Momotus'
>>> [(i['image'], i['photographer']) for i in item['images']]
[('BSPBB/MJM_7364_IMG_2240_d+1345758620.JPG', 'Oscar Lopez')]
Call the TaxonSearch API http://www.boldsystems.org/index.php/resources/api?type=taxonomy#Ideasforwebservices-SequenceParameters
Parameters: |
|
---|---|
Returns: | List of dictionaries containing metadata. One dictionary per BOLD record. |
Raises: | ValueError – If fuzzy is not True or False. |
Examples
>>> import bold
>>> taxonomic_identification = 'Euptychia ordinata'
>>> res = bold.call_taxon_search(taxonomic_identification, fuzzy=False)
>>> item = res.items[0] # there can be more than one result
>>> item['tax_id']
302603
Trace files can be retrieved from BOLD by querying with several parameters.
Parameters: |
|
---|---|
Returns: | A TAR file consisting of compressed Trace Files (traces in either .ab1 or .scf format) along with a file listing the Process ID, taxon and marker for each Trace File included. |
Examples
>>> import bold
>>> res = bold.call_trace_files(taxon='Euptychia mollis',
... institutions='York University')
>>> with open("trace_files.tar", "wb") as handle:
... handle.write(res.file_contents)
4106240
Builds our request based on given arguments. Used internally.
Parameters: |
|
---|---|
Returns: | Request object with service alias, correct URL and user arguments. |