Documentation
¶
Overview ¶
Package gdc is the library behind the gdc command line: the HTTP client, request shaping, and the typed data models for the NCI Genomic Data Commons (GDC), which indexes cancer genomics data: 50k+ cases, 1.27M files, 3.3M mutations across 91 cancer projects.
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 Case
- type Client
- func (c *Client) GetCase(ctx context.Context, caseID string) (*Case, error)
- func (c *Client) ListFiles(ctx context.Context, caseID string, limit, from int) ([]File, int, error)
- func (c *Client) ListProjects(ctx context.Context, limit, from int) ([]Project, int, error)
- func (c *Client) SearchCases(ctx context.Context, keyword, site, project string, limit, from int) ([]Case, int, error)
- func (c *Client) SearchMutations(ctx context.Context, geneSymbol string, limit, from int) ([]Mutation, int, error)
- type Config
- type Domain
- type File
- type Mutation
- type Project
Constants ¶
const BaseURL = "https://api.gdc.cancer.gov"
BaseURL is the root every request is built from.
const Host = "api.gdc.cancer.gov"
Host is the GDC API hostname this client talks to.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Case ¶
type Case struct {
ID string `json:"id" kit:"id"`
SubmitterID string `json:"submitter_id"`
ProjectID string `json:"project_id"`
PrimarySite string `json:"primary_site"`
DiseaseType string `json:"disease_type"`
Age int `json:"age"`
Gender string `json:"gender"`
Race string `json:"race"`
}
Case is a single GDC cancer case record.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client talks to the GDC REST API.
func (*Client) ListFiles ¶
func (c *Client) ListFiles(ctx context.Context, caseID string, limit, from int) ([]File, int, error)
ListFiles lists files for a given case_id.
func (*Client) ListProjects ¶
ListProjects lists all GDC cancer projects.
type Config ¶
type Config struct {
BaseURL string
Rate time.Duration
Retries int
Timeout time.Duration
UserAgent string
}
Config holds the runtime settings for the GDC client.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns a Config with sensible defaults.
type Domain ¶
type Domain struct{}
Domain is the GDC 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). UUID-shaped inputs (contain "-" and len>30) are treated as case IDs; everything else is also classified as a case keyword search target.
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 File ¶
type File struct {
ID string `json:"id" kit:"id"`
Name string `json:"name"`
DataType string `json:"data_type"`
DataCategory string `json:"data_category"`
Format string `json:"format"`
SizeBytes int64 `json:"size_bytes"`
Access string `json:"access"`
CaseID string `json:"case_id"`
ProjectID string `json:"project_id"`
}
File is a single GDC file record.
type Mutation ¶
type Mutation struct {
ID string `json:"id" kit:"id"`
Chromosome string `json:"chromosome"`
StartPos int64 `json:"start_pos"`
EndPos int64 `json:"end_pos"`
RefAllele string `json:"ref_allele"`
TumorAllele string `json:"tumor_allele"`
MutationType string `json:"mutation_type"`
GeneID string `json:"gene_id"`
GeneSymbol string `json:"gene_symbol"`
}
Mutation is a single GDC somatic mutation (SSM) record.