Documentation
¶
Overview ¶
Package gwas is the library behind the gwas command line: the HTTP client, request shaping, and the typed data models for the NHGRI-EBI GWAS Catalog.
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) (int, error)
- func (c *Client) GetStudy(ctx context.Context, accessionID string) (*Study, error)
- func (c *Client) SearchStudies(ctx context.Context, limit, offset int) ([]*Study, int, error)
- type Config
- type Count
- type Domain
- type Study
Constants ¶
const Host = "www.ebi.ac.uk"
Host is the GWAS Catalog 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 GWAS Catalog REST API over HTTP.
func NewClientWithConfig ¶
NewClientWithConfig returns a Client using the given config.
type Config ¶
type Config struct {
BaseURL string
Rate time.Duration
Retries int
Timeout time.Duration
UserAgent string
}
Config carries the tunable parameters for the GWAS Catalog client.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns a Config with sensible defaults for the GWAS Catalog REST API.
type Domain ¶
type Domain struct{}
Domain is the GWAS Catalog 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). Any non-empty string is treated as a GWAS study accession (e.g. GCST000854).
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 Study ¶
type Study struct {
ID string `json:"id" kit:"id"` // accessionId like GCST000854
Trait string `json:"trait,omitempty"`
PubMedID string `json:"pubmed_id,omitempty"`
Title string `json:"title,omitempty"`
Journal string `json:"journal,omitempty"`
Author string `json:"author,omitempty"`
Date string `json:"date,omitempty"`
InitialSample string `json:"initial_sample,omitempty"`
SnpCount int `json:"snp_count,omitempty"`
}
Study is a single GWAS Catalog study record.