Skip to main content

pydbsnp

Interface with dbSNP VCF data

Installation

Step 0 (optional): If you don't want to bother with environment variables and don't care about how pydbsnp works under the hood, skip this step.

If you wish, you can determine the location where pydbsnp looks for relevant data using four environment variables: PYDBSNP_VCF_GRCH37, PYDBSNP_RSID_GRCH37, PYDBSNP_VCF_GRCH38, PYDBSNP_RSID_GRCH38. The VCF variables determine the location of the VCF data, the RSID variables determine the location of the rsid indices. For example, you could add this to your .bash_profile:

export PYDBSNP_VCF_GRCH37=<path of your choice>
export PYDBSNP_RSID_GRCH37=<path of your choice>
export PYDBSNP_VCF_GRCH38=<path of your choice>
export PYDBSNP_RSID_GRCH38=<path of your choice>

If you set these variables before continuing to the next step, pydbsnp will use them to determine where it places downloaded VCF files and RSID indices.

Step 1: install the python package via pip3

pip install pydbsnp

or

pip install --user pydbsnp

Step 2: Once the python package is installed, download and index the dbSBP VCF data:

pydbsnp-download
pydbsnp-index

For hg19/GRCh37 coordinates:

pydbsnp-download --reference-build GRCh37
pydbsnp-index

Command line usage

pydbsnp-query -h
pydbsnp-query rs231361
pydbsnp-query chr8:118184783
pydbsnp-query --reference-build GRCh37 rs231361
pydbsnp-query rs231361 chr8:118184783 rs7903146

API

Two classes are provided: Variant and GeneralizedVariant.

An object of the Variant class has an attribute for each relevant field of the VCF.

from pydbsnp import Variant
v = Variant(id='rs8056814')
print(v.chrom, v.pos, v.id, v.ref, v.alt)
print(v.info)
w = Variant(id='rs8056814', reference_build='GRCh37')
print(w.chrom, w.pos)
x = Variant('chr16', 75218429)
print(x)
help(Variant)

An object of the GeneralizedVariant class is similar, but each attribute is a tuple which may have multiple items. For example, one RSID may map to two sets of coordinates.

gv = GeneralizedVariant(id='rs8056814')
print(gv.chrom, gv.pos, gv.id, gv.ref, gv.alt)

Metadata

Release files for pydbsnp 2.0.2

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

Source distribution (sdist)

Source distribution for pydbsnp 2.0.2
File Size Uploaded
pydbsnp-2.0.2.tar.gz 8.1 kB Details

Built distribution (wheel)

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

Total release size: 16.8 kB

Release files / pydbsnp-2.0.2.tar.gz

Download URL pydbsnp-2.0.2.tar.gz
Size 8.1 kB
Tags Source
SHA-256 checksum
How to use checksums
07259a3bd1412e72664c908f364dccb7f6a5ae28e44a012620fd8959a4aa296b
BLAKE2b-256 checksum
How to use checksums
4364ce2bc4b12d024b96f391b8eb677a733f8512ce68461afcfe31c66b010c60
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.10

Release files / pydbsnp-2.0.2-py3-none-any.whl

Download URL pydbsnp-2.0.2-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6d37025b61f87dd50abfd576879ea66b9a9b04a1a01ced243427f0e73d157abd
BLAKE2b-256 checksum
How to use checksums
8154ec1ca49c7e0ad91f1907801cc4dbda43c6c71c79da763e16c92993c77059
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.10

Release history Release notifications | RSS feed

This release

2.0.2 This release

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.0.0

2 release files

0.1.13

2 release files

0.1.12

2 release files

0.1.11

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.24

2 release files

0.0.23

2 release files

0.0.22

2 release files

0.0.21

2 release files

0.0.19

2 release files

0.0.18

2 release files

0.0.17

2 release files

0.0.16

2 release files

0.0.15

2 release files

0.0.14

2 release files

0.0.13

2 release files

0.0.12

2 release files

0.0.11

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.4

2 release files

0.0.3

2 release files

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