enpi_api.examples.references
Browse available references
Browse available reference databases and their revisions, fetch them all or get only one. Knowledge of available references and their revisions may be required e.g. in order to correctly configure a Sequence Annotation run.
Get all available references
This example showcases how to fetch all available references - the ones created for your organization and the public ones, available to everyone.
from enpi_api.l2.client.enpi_api_client import EnpiApiClient
with EnpiApiClient() as enpi_client:
"""Fetch all the available reference databases. If no private reference databases are
configured for your organization, then the results will contain only public reference databases."""
reference_databases = enpi_client.reference_database_api.get_reference_databases()
print(reference_databases)
Get a single reference
This example showcases how to get a single reference database revision by it's name, species and (optionally) label.
from enpi_api.l2.client.enpi_api_client import EnpiApiClient
with EnpiApiClient() as enpi_client:
"""Fetch all the available reference databases. If no private references were set
for your organization yet, result set will contain only the public reference databases"""
reference_name = "Example reference name"
reference_species = "Homo sapiens"
reference_revision_label = "Version 1.0" # Exact version string format depends on a given reference
# A single reference can be fetched by its name, species and version
reference_database_revision = enpi_client.reference_database_api.get_revision_by_name(
name=reference_name,
species=reference_species,
label=reference_revision_label, # A label can be used to fetch a targeted version of a reference
)
"""A reference can be fetched without `label` provided as well - in such case it will get the
latest version of the matched reference available.
newest_revision = enpi_client.reference_database_api.get_revision_by_name(
name=reference_name,
species=reference_species,
)
"""
1''' 2# Browse available references 3 4Browse available reference databases and their revisions, fetch them all or get only one. 5Knowledge of available references and their revisions may be required e.g. in order to correctly configure a Sequence Annotation run. 6 7##Get all available references 8 9This example showcases how to fetch all available references - the ones created for your organization and the public ones, available to everyone. 10```python 11from enpi_api.l2.client.enpi_api_client import EnpiApiClient 12 13with EnpiApiClient() as enpi_client: 14 """Fetch all the available reference databases. If no private reference databases are 15 configured for your organization, then the results will contain only public reference databases.""" 16 17 reference_databases = enpi_client.reference_database_api.get_reference_databases() 18 print(reference_databases) 19 20``` 21##Get a single reference 22 23This example showcases how to get a single reference database revision by it's name, species and (optionally) label. 24```python 25from enpi_api.l2.client.enpi_api_client import EnpiApiClient 26 27with EnpiApiClient() as enpi_client: 28 """Fetch all the available reference databases. If no private references were set 29 for your organization yet, result set will contain only the public reference databases""" 30 31 reference_name = "Example reference name" 32 reference_species = "Homo sapiens" 33 reference_revision_label = "Version 1.0" # Exact version string format depends on a given reference 34 35 # A single reference can be fetched by its name, species and version 36 reference_database_revision = enpi_client.reference_database_api.get_revision_by_name( 37 name=reference_name, 38 species=reference_species, 39 label=reference_revision_label, # A label can be used to fetch a targeted version of a reference 40 ) 41 42 """A reference can be fetched without `label` provided as well - in such case it will get the 43 latest version of the matched reference available. 44 45 newest_revision = enpi_client.reference_database_api.get_revision_by_name( 46 name=reference_name, 47 species=reference_species, 48 ) 49 """ 50 51``` 52'''