Documentation
¶
Overview ¶
Package myvariant is the library behind the myvariant command line: the HTTP client, request shaping, and the typed data models for MyVariant.info.
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 ¶
const DefaultUserAgent = "myvariant-cli/0.1.0 (+https://github.com/tamnd/myvariant-cli)"
DefaultUserAgent identifies the client to MyVariant.info.
const Host = "myvariant.info"
Host is the site this client talks to, and the host the URI driver in domain.go claims.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
HTTP *http.Client
UserAgent string
BaseURL string
// Rate is the minimum gap between requests. Zero means no pacing.
Rate time.Duration
Retries int
// contains filtered or unexported fields
}
Client talks to MyVariant.info over HTTP.
func NewClient ¶
func NewClient() *Client
NewClient returns a Client with sensible defaults: a 30s timeout, a 300ms minimum gap between requests, and 3 retries on transient errors.
func (*Client) Get ¶
Get fetches url and returns the response body. It paces and retries according to the client's settings.
type Domain ¶
type Domain struct{}
Domain is the myvariant driver. It carries no state; the per-run client is built by the factory Register hands kit.
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 Variant ¶
type Variant struct {
ID string `json:"id" kit:"id"`
RsID string `json:"rsid,omitempty"`
ClinSig string `json:"clinical_significance,omitempty"`
CADD float64 `json:"cadd_phred,omitempty"`
GnomadAF float64 `json:"gnomad_af,omitempty"`
Gene string `json:"gene,omitempty"`
ClinVarID int `json:"clinvar_id,omitempty"`
}
Variant is a single annotated genetic variant from MyVariant.info.