Skip to content

omnilab/gwas API reference

Floor
Provider · Omnilab
Version
1.x
Conformance suite
not wired
Verified for real
Its README does not say
Licence
MIT
composer require omnilab/gwas:1.x-dev

Read from the package's own PHP files at the commit b14711f7d20e: its namespaces, classes, interfaces and enums, their public constants, properties and methods with their PHPDoc, and the options its factories take. Nothing of it is run.

Omnilab\Gwas

  • Association class

    One association of the GWAS Catalog: a variant's risk allele tied to a trait by a study, with its p-value (as the catalogue writes it, its mantissa and exponent: a float underflows past 1e-308), its odds ratio or beta and its confidence interval, the risk allele's frequency, where it lies and the genes mapped to it.

    3 methods · 16 properties

  • GwasSource class

    The NHGRI-EBI GWAS Catalog through its REST API v2: a study by its accession ("GCST000854") - its reported trait, its traits in EFO, Mondo or HPO, its samples and ancestries, platforms, SNP count, publication, summary statistics -; a variant by its rs id ("rs334") - its functional class, alleles, location, mapped genes -; a trait by its EFO, Mondo or HPO id ("MONDO_0011382") - its name and its studies -; each with its strongest associations (the smallest p-values first) as properties and the studies, variants and traits they tie it to as related things; a search of traits by name; the associations themselves, paged (associations(), outside the contract).

    7 methods · 2 constants

  • GwasSourceFactory class

    The GWAS Catalog: studies, variants and traits with their strongest associations, a search of traits, the associations paged - no key needed.

    3 options

Omnilab\Gwas

Association class

final readonly class Association implements Stringable Association.php:15

One association of the GWAS Catalog: a variant's risk allele tied to a trait by a study, with its p-value (as the catalogue writes it, its mantissa and exponent: a float underflows past 1e-308), its odds ratio or beta and its confidence interval, the risk allele's frequency, where it lies and the genes mapped to it.

public string $id
public ?Identifier $study
public Identifiers $variants
public array $riskAlleles

"rs334-T"

public ?float $pValue
public ?string $pValueText
public Identifiers $traits
public array $reported

the traits as the study reported them

public ?float $oddsRatio
public ?string $beta
public ?string $range
public ?string $riskFrequency
public array $genes

the mapped genes' symbols

public array $locations

"11:5227002"

public ?string $pubmed
public ?string $firstAuthor

Association::__construct()

public function __construct(public string $id, public ?Identifier $study, public Identifiers $variants, public array $riskAlleles, public ?float $pValue, public ?string $pValueText, public Identifiers $traits, public array $reported = [], public ?float $oddsRatio = null, public ?string $beta = null, public ?string $range = null, public ?string $riskFrequency = null, public array $genes = [], public array $locations = [], public ?string $pubmed = null, public ?string $firstAuthor = null)
$riskAlleles

"rs334-T"

$genes

the mapped genes' symbols

$locations

"11:5227002"

$reported

the traits as the study reported them

Association::fromRow()

public static function fromRow(array $row): ?self
$row

an association of the v2 API

Association::__toString()

public function __toString(): string

"rs334-T (HBB): p = 1e-323, Hereditary hemolytic anemias (PheCode 282)"

GwasSource class

final class GwasSource extends HttpSource GwasSource.php:34

The NHGRI-EBI GWAS Catalog through its REST API v2: a study by its accession ("GCST000854") - its reported trait, its traits in EFO, Mondo or HPO, its samples and ancestries, platforms, SNP count, publication, summary statistics -; a variant by its rs id ("rs334") - its functional class, alleles, location, mapped genes -; a trait by its EFO, Mondo or HPO id ("MONDO_0011382") - its name and its studies -; each with its strongest associations (the smallest p-values first) as properties and the studies, variants and traits they tie it to as related things; a search of traits by name; the associations themselves, paged (associations(), outside the contract).

No key, no account, no published rate: no throttle by default. Two calls an entity (the thing, its associations or its studies), one a search page. The v1 API answers 410 since its retirement.

const BASE_URI = 'https://www.ebi.ac.uk/gwas/rest/api/v2/'
const MAX_LIMIT = 100

The most items a page holds (the API's own cap is higher).

GwasSource::__construct()

public function __construct(HttpClientInterface $http, readonly int $associations = 10, string $baseUri = self::BASE_URI, array $headers = [], float $throttle = 0.0)
$associations

how many associations (or a trait's studies) an entity holds, the strongest first (0: none, one call)

GwasSource::getName()

public function getName(): string

GwasSource::capabilities()

public function capabilities(): array

GwasSource::entity()

public function entity(Identifier|string $id): ?Entity

A study ("GCST000854", its page), a variant ("rs334", "dbsnp:rs334", its dbSNP page) or a trait ("EFO_0004321", "MONDO:0011382", "HP_0001878"); another base's identifier is refused before any call; null when the catalogue has no such thing.

public function search(Query $query): Page

The traits whose name holds the text (the catalogue's EFO, Mondo and HPO terms), in its order; a domain other than biology answers nothing.

An entity of a page holds the trait's name: entity() adds its studies.

GwasSource::associations()

public function associations(Identifier|string $id, int $limit = 25, ?string $cursor = null): Page

The associations of a study, a variant or a trait, the smallest p-value first, one page at a time (the cursor is the page's number).

Outside the contract: an association ties a variant, a trait and a study, with its statistics.

GwasSource::traitOf()

public static function traitOf(string $id): ?Identifier

A trait's id as the catalogue writes it (EFO_0004321, MONDO_0011382) in a scheme of the core; null for the others.

GwasSourceFactory class

final class GwasSourceFactory extends SourceFactory GwasSourceFactory.php:21

The GWAS Catalog: studies, variants and traits with their strongest associations, a search of traits, the associations paged - no key needed.

options: mailto: 'support@glitchr.io' # in the User-Agent associations: 10 # associations (or a trait's studies) an entity holds (0: none, one call) throttle: 0 # seconds between two calls: the catalogue publishes no rate base_uri: 'https://www.ebi.ac.uk/gwas/rest/api/v2/'

Options

OptionDefault
associations10
throttle0.0
base_uriGwasSource::BASE_URI