API Documentation¶
-
htsget.
get
(url, output, reference_name=None, reference_md5=None, start=None, end=None, fields=None, tags=None, notags=None, data_format=None, max_retries=5, retry_wait=5, timeout=120, bearer_token=None, headers=None)[source]¶ Runs a request to the specified URL and write the resulting data to the specified file-like object.
Parameters: - url (str) – The URL of the data to retrieve. This may be composed of a prefix
such as
http://example.com/reads/
and an ID suffix such asNA12878
. The full URL must be supplied here, i.e., in this examplehttp://example.com/reads/NA12878
. - output (file) – A file-like object to write the downloaded data to. To support
retrying of failed transfers, this file must be seekable. For this reason,
retry will fail if
stdout
is provided. - reference_name (str) – The reference sequence name, for example “chr1”, “1”, or “chrX”. If unspecified, all data is returned.
- reference_md5 (str) – The MD5 checksum uniquely representing the reference sequence as a lower-case hexadecimal string, calculated as the MD5 of the upper-case sequence excluding all whitespace characters (this is equivalent to SQ:M5 in SAM).
- start (int) – The start position of the range on the reference, 0-based,
inclusive. If specified,
reference_name
orreference_md5
must also be specified. - end (int) – The end position of the range on the reference, 0-based exclusive.
If specified,
reference_name
orreference_md5
must also be specified. - data_format (str) – The requested format of the returned data.
- max_retries (int) – The maximum number of times that an individual transfer will be retried.
- retry_wait (float) – The amount of time in seconds to wait before retrying a failed transfer.
- timeout (float) – The socket timeout for I/O operations.
- bearer_token – The OAuth2 Bearer token to present to the htsget ticket server.
If this value is specified, the token is provided to the ticket server using
the
Authorization: Bearer [token]
header. Ifbearer_token
is None or not specified, no Authorization header is sent to the server. Obtaining the bearer token is beyond the scope of htsget; consult the documentation for your server for information on authentication and how to obtain a valid token. - headers – Additional headers needed for the requests to the htsget service.
- url (str) – The URL of the data to retrieve. This may be composed of a prefix
such as