Python API client for VariantGrid Open source Variant database and analysis platform
See changelog
python3 -m pip install variantgrid_api
from variantgrid_api.api_client import VariantGridAPI
from variantgrid_api.data_models import EnrichmentKit
api = VariantGridAPI(server="https://variantgrid.com", api_token="YOUR_API_TOKEN")
enrichment_kit = EnrichmentKit(name="idt_haem", version=1)
result = api.create_enrichment_kit(enrichment_kit)
Upload a VCF, have VariantGrid import + annotate any novel variants, then download the cohort-level annotated
export (all samples, single-sample VCFs included). Annotation can take a while, so the quickest way in is the
vg_api command line tool: the first call uploads, and running the same command again downloads the result
once it's ready.
$ export VARIANTGRID_API_TOKEN=YOUR_API_TOKEN
$ vg_api annotate_vcf input.vcf.gz -o results/
Uploaded input.vcf.gz (id=13256).
Annotating input.vcf.gz - run the same command again later to download.
$ vg_api annotate_vcf input.vcf.gz -o results/ # once it's done
Annotated vcf written to results/input.vcf_annotated_v254_GRCh38.vcf.gzFrom Python it's upload_file() / poll_upload_status() / download_annotated(), or the blocking
annotate_vcf() one-liner. See
Annotate a VCF on the wiki for batches, the
submit-now/download-later pattern, and all the options.
# Install required testing packages
python3 -m pip install -e ".[test]"
python3 -m pytest --cov=variantgrid_api