Skip to content

SACGF/variantgrid_api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

variantgrid_api

PyPi version Python versions

Python API client for VariantGrid Open source Variant database and analysis platform

See changelog

Install

python3 -m pip install variantgrid_api

Example

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)

Annotate a VCF and download it back

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.gz

From 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.

Testing

# Install required testing packages
python3 -m pip install -e ".[test]"
python3 -m pytest --cov=variantgrid_api

About

No description, website, or topics provided.

Resources

License

Stars

0 stars

Watchers

4 watching

Forks

Packages

 
 
 

Contributors

Languages