Skip to main content

dbSNP to Parquet Converter

A python-package focused rewrite of Weinstock's dbSNP to parquet repository. This package allows convenient download, processing and access to data from dbSNP. A simple python interface can be used to work with the data once it is processed.

Installation

pyvariantdb is available on PyPI and can be installed from there with the package management tool of choice. For development we use pixi:

# install pixi
curl -fsSL https://pixi.sh/install.sh | sh
pixi update && pixi install

Usage

We recommend to prepare the data from the command line before using the package since download and processing takes quit some time. Per default the data is stored at ~/.cache/pyvariantdb. This can be changed through the usage of environment variables:

export PYVARIANTDB_HOME = "/raid/cache/pyvariantdb"

Execution of the pipeline can be done with:

# activate pixi
pixi shell -e default
# download dbsnp
pyvariantdb-download
# transform the database to parquets
pyvariantdb-make-dbsnp 

We aim to provide an easy interface to extract genomic coordinates from dbSNP. For this, the main functionality is extremely simple. Just provide the rs-identifier (with or without chromosome) and we fetch the respective coordindates. However, to achieve this we need to run the pipeline mentioned above.

Extracting coordinates is simple:

from pyvariantdb.lookup import SNPLookup

lookup = SNPLookup()
# P53 mutations, chromosome 17
rsids = ["rs1042522", "rs17878362", "rs1800372"]
df_chr = lookup.query_chromosome(rsids, "17")
df_genome = lookup.query_genome(rsids)
print(df_chr)
print(df_genome) 

Processing Pipeline

pyvariantdb offers some quality of life improvements for working with dbSNP and the original repository. The original pipeline remains the same:

  1. Downloads dbSNP data (GRCh38 build 156)
  2. Filters for SNVs only
  3. Converts chromosome contigs to standard naming
  4. Splits data by chromosome
  5. Creates Parquet lookup tables with RSID mappings

Output

The script entrypoint generates the following files on-disk to the defined cache dir.

  • dbSNP_156.bcf - Full filtered BCF file
  • dbSNP_156.chr*.bcf - Per-chromosome BCF files
  • dbSNP_156.chr*.lookup.parquet - Per-chromosome RSID lookup tables
  • dbSNP_156.lookup.parquet - Combined RSID lookup table

Metadata

Release files for pyvariantdb 1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyvariantdb 1.4
File Size Uploaded Provenance
pyvariantdb-1.4.tar.gz 19.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pyvariantdb 1.4
File Interpreter ABI Platform
pyvariantdb-1.4-py3-none-any.whl Python 3 none any Details

Total release size: 38.8 kB

Release files / pyvariantdb-1.4.tar.gz

Download URL pyvariantdb-1.4.tar.gz
Size 19.6 kB
Tags Source
SHA-256 checksum
How to use checksums
d49c36426b1d3a2d2a2e9e35be3b5e742e29068ca609dbe3872690003df2e444
BLAKE2b-256 checksum
How to use checksums
5ca3e1ef14aacc87f16b8f9be2162b059bd79ed0c5ed0135038207d932782685
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.9

Release files / pyvariantdb-1.4-py3-none-any.whl

Download URL pyvariantdb-1.4-py3-none-any.whl
Size 19.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cbcaadb8d336156ef87932337d7098edc80ce204c1638f6f2cd53f5d4c6e8470
BLAKE2b-256 checksum
How to use checksums
edf9234ac7d6953065ed5dc10ff81752850a158051cf163aac9474147ace16c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.9

Security for pyvariantdb 1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.4 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page