Usage with command-line

ENASearch can be used via command-line with:

$ enasearch --help
Usage: enasearch [OPTIONS] COMMAND [ARGS]...

Options:
  --version   Show the version and exit.
  -h, --help  Show this message and exit.

Commands:
  get_analysis_fields       Get the fields extractable for an analysis.
  get_display_options       Get the list of possible formats to display...
  get_download_options      Get the options for download of data from...
  get_filter_fields         Get the filter fields of a result to build a...
  get_filter_types          Return the filters usable for the different...
  get_results               Get the possible results (type of data).
  get_returnable_fields     Get the fields extractable for a result.
  get_run_fields            Get the fields extractable for a run.
  get_sortable_fields       Get the fields of a result that can sorted.
  get_taxonomy_results      Get list of taxonomy results.
  retrieve_analysis_report  Retrieve analysis report from ENA.
  retrieve_data             Retrieve ENA data (other than taxon).
  retrieve_run_report       Retrieve run report from ENA.
  retrieve_taxons           Retrieve data from the ENA Taxon Portal.
  search_data               Search data given a query.

Commands

enasearch

The Python library for interacting with ENA’s API

enasearch [OPTIONS] COMMAND [ARGS]...

Options

--version

Show the version and exit.

get_analysis_fields

Get the fields extractable for an analysis.

This function returns the fields as a list.

enasearch get_analysis_fields [OPTIONS]

get_display_options

Get the list of possible formats to display the result.

This function returns the possible formats to display the result of a query on ENA. Each format is described.

enasearch get_display_options [OPTIONS]

get_download_options

Get the options for download of data from ENA.

Each option is described.

enasearch get_download_options [OPTIONS]

get_filter_fields

Get the filter fields of a result to build a query.

This function returns the fields that can be used to build a query on a result on ENA. Each field is described on a line with field id, its description, its type and to which results it is related

enasearch get_filter_fields [OPTIONS]

Options

--result <result>

Id of a result (accessible with get_results) [required]

get_filter_types

Return the filters usable for the different type of data.

This function returns the filters that can be used for the different type of data (information available with the information on the filter fileds). Each filter is described with its name, the possible operators or paramters, a description of the expected values

enasearch get_filter_types [OPTIONS]

get_results

Get the possible results (type of data).

This function return the possible results (or type of data) accessible with ENA with their ids and a short description

enasearch get_results [OPTIONS]

get_returnable_fields

Get the fields extractable for a result.

This function returns the fields as a list.

enasearch get_returnable_fields [OPTIONS]

Options

--result <result>

Id of a result (accessible with get_results) [required]

get_run_fields

Get the fields extractable for a run.

This function returns the fields as a list.

enasearch get_run_fields [OPTIONS]

get_sortable_fields

Get the fields of a result that can sorted.

This function returns the fields that can be used to sort the output of a query for a result on ENA. Each field is described on a line with field id, its description, its type and to which results it is related

enasearch get_sortable_fields [OPTIONS]

Options

--result <result>

Id of a result (accessible with get_results) [required]

get_taxonomy_results

Get list of taxonomy results.

This function returns the description about the possible results accessible via the taxon portal. Each taxonomy result is described with a short description

enasearch get_taxonomy_results [OPTIONS]

retrieve_analysis_report

Retrieve analysis report from ENA.

The output can be redirected to a file and directly display to the standard output given the display chosen.

enasearch retrieve_analysis_report [OPTIONS]

Options

--accession <accession>

Accession id (study accessions (ERP, SRP, DRP, PRJ prefixes), experiment accessions (ERX, SRX, DRX prefixes), sample accessions (ERS, SRS, DRS, SAM prefixes) and run accessions)) [required]

--fields <fields>

Fields to return (accessible with get_analysis_fields) [multiple or comma-separated]

--file <file>

File to save the report

retrieve_data

Retrieve ENA data (other than taxon).

This function retrieves data (other than taxon) from ENA by:

  • Building the URL based on the ids to retrieve and some parameters to format the results
  • Requesting the URL to extract the data

The output can be redirected to a file and directly display to the standard output given the display chosen.

enasearch retrieve_data [OPTIONS]

Options

--ids <ids>

Ids for records to return (other than Taxon and Project) [multiple] [required]

--display <display>

Display option to specify the display format (accessible with get_display_options) [required]

--download <download>

Download option to specify that records are to be saved in a file (used with file option, list accessible with get_download_options)

--file <file>

File to save the content of the search (used with download option)

--offset <offset>

First record to get (used only for display different of fasta and fastq

--length <length>

Number of records to retrieve (used only for display different of fasta and fastq

--subseq_range <subseq_range>

Range for subsequences (integer start and stop separated by a -)

--expanded

Determine if a CON record is expanded

--header

To obtain only the header of a record

retrieve_run_report

Retrieve run report from ENA.

The output can be redirected to a file and directly display to the standard output given the display chosen.

enasearch retrieve_run_report [OPTIONS]

Options

--accession <accession>

Accession id (study accessions (ERP, SRP, DRP, PRJ prefixes), experiment accessions (ERX, SRX, DRX prefixes), sample accessions (ERS, SRS, DRS, SAM prefixes) and run accessions)) [required]

--fields <fields>

Fields to return (accessible with get_run_fields) [multiple or comma-separated]

--file <file>

File to save the report

retrieve_taxons

Retrieve data from the ENA Taxon Portal.

This function retrieves data (other than taxon) from ENA by:

  • Formatting the ids to query then on the Taxon Portal
  • Building the URL based on the ids to retrieve and some parameters to format the results
  • Requesting the URL to extract the data

The output can be redirected to a file and directly display to the standard output given the display chosen.

enasearch retrieve_taxons [OPTIONS]

Options

--ids <ids>

Ids for taxon to return [multiple] [required]

--display <display>

Display option to specify the display format (accessible with get_display_options) [required]

--result <result>

Id of a taxonomy result (accessible with get_taxonomy_results)

--download <download>

Download option to specify that records are to be saved in a file (used with file option, list accessible with get_download_options)

--file <file>

File to save the content of the search (used with download option)

--offset <offset>

First record to get (used only for display different of fasta and fastq

--length <length>

Number of records to retrieve (used only for display different of fasta and fastq

--subseq_range <subseq_range>

Range for subsequences (integer start and stop separated by a -)

--expanded

Determine if a CON record is expanded

--header

To obtain only the header of a record

search_data

Search data given a query.

This function

  • Extracts the number of possible results for the query
  • Extracts the all the results of the query (by potentially running several times the search function)

The output can be redirected to a file and directly display to the standard output given the display chosen.

enasearch search_data [OPTIONS]

Options

Use free text search, otherwise the data warehouse is used

--query <query>

Query string, made up of filtering conditions, joined by logical ANDs, ORs and NOTs and bound by double quotes; the filter fields for a query are accessible with get_filter_fields and the type of filters with get_filter_types [required]

--result <result>

Id of a result (accessible with get_results) [required]

--display <display>

Display option to specify the display format (accessible with get_display_options) [required]

--download <download>

Download option to specify that records are to be saved in a file (used with file option, list accessible with get_download_options)

--file <file>

File to save the content of the search (used with download option)

--fields <fields>

Fields to return (accessible with get_returnable_fields, used only for report as display value) [multiple or comma-separated]

--sortfields <sortfields>

Fields to sort the results (accessible with get_sortable_fields, used only for report as display value) [multiple or comma-separated]

--offset <offset>

First record to get (used only for display different of fasta and fastq

--length <length>

Number of records to retrieve (used only for display different of fasta and fastq