Documentation
¶
Overview ¶
Package ena is the library behind the ena command line: the HTTP client, request shaping, and the typed data models for the EMBL-EBI European Nucleotide Archive (ENA).
The Client here is the spine every command shares. It sets a real User-Agent, paces requests so a busy session stays polite, and retries the transient failures (429 and 5xx) that any public API throws under load.
Index ¶
- Constants
- type Client
- func (c *Client) Get(ctx context.Context, rawURL string) ([]byte, error)
- func (c *Client) GetCount(ctx context.Context, resultType string) (int, error)
- func (c *Client) GetStudy(ctx context.Context, accession string) (*Study, error)
- func (c *Client) SearchSequences(ctx context.Context, query string, limit, offset int) ([]*Sequence, error)
- func (c *Client) SearchStudies(ctx context.Context, query string, limit, offset int) ([]*Study, error)
- type Config
- type Domain
- type Sequence
- type Stat
- type Study
Constants ¶
const Host = "www.ebi.ac.uk"
Host is the ENA portal host, used for URI resolution and the domain Hosts list.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client talks to the ENA Portal API over HTTP.
func NewClientWithConfig ¶
NewClientWithConfig returns a Client using the given config.
func (*Client) GetCount ¶
GetCount returns the total record count for a result type (study, sequence, read_run, sample, …). The /count endpoint returns plain text: first line is "count", second line is the integer.
func (*Client) GetStudy ¶
GetStudy fetches a single study by accession (e.g. PRJNA449226, ERP000958).
type Config ¶
type Config struct {
BaseURL string
Rate time.Duration
Retries int
Timeout time.Duration
UserAgent string
}
Config carries the tunable parameters for the ENA client.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns a Config with sensible defaults for the ENA Portal API.
type Domain ¶
type Domain struct{}
Domain is the ENA driver. It carries no state; the per-run client is built by the factory Register hands kit.
func (Domain) Classify ¶
Classify turns any accepted input into the canonical (type, id). ENA study accessions start with PRJNA, ERP, SRP, DRP, or similar prefixes. Any non-empty string is treated as a study accession.
func (Domain) Info ¶
func (Domain) Info() kit.DomainInfo
Info describes the scheme, the hostnames a pasted link is matched against, and the identity reused for the binary's help and version.
type Sequence ¶
type Sequence struct {
ID string `json:"id" kit:"id"` // accession
Description string `json:"description,omitempty"`
MolType string `json:"mol_type,omitempty"`
Length string `json:"length,omitempty"`
Organism string `json:"organism,omitempty"`
TaxID string `json:"tax_id,omitempty"`
}
Sequence is a single ENA sequence record.
type Study ¶
type Study struct {
ID string `json:"id" kit:"id"` // study_accession
Title string `json:"title"`
Description string `json:"description,omitempty"`
StudyType string `json:"study_type,omitempty"`
TaxID string `json:"tax_id,omitempty"`
Organism string `json:"organism,omitempty"`
FirstPublic string `json:"first_public,omitempty"`
LastUpdated string `json:"last_updated,omitempty"`
SecondaryAccess string `json:"secondary_accession,omitempty"`
}
Study is a single ENA study record.