Skip to main content

Minimaistic VCf parser in python

Project description

vcfparser

Python parser for parsing the genomics and transcriptomics VCF data.

Installation and setup

  1. Clone this repo
git clone https://github.com/everestial/vcfparser
cd vcfparser

Usage

from vcf_parser import VcfParser
# instantiate a vcf object by passing file name
filepath = 'input_test.vcf'
vcf_object = VcfParser(filepath)

Get MetaInfo about the vcf file

metainfo = vcf_object.parse_metadata()
print(f'Fileformat for given vcf is : {metainfo.fileformat}')
print(f'Filters for given vcf are : {metainfo.filters_}')
print(f' Contig lines are : {metainfo.contig}')
print(f' Dictionary of infos is : {metainfo.infos_}')
print(f' Sample names are : {metainfo.sample_names}')
print("Raw lines are:")
print(metainfo.raw_meta_data)

Get Records from vcf file

records = vcf_object.parse_records() # this creates a generator object

for record in records:
    # you can access methods and attributes of record object as
    chrom = record.CHROM
    pos = record.POS
    id = record.ID
    ref = record.REF
    alt = record.ALT
    qual = record.QUAL
    filter = record.FILTER

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vcfparser-0.1.6.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

vcfparser-0.1.6-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file vcfparser-0.1.6.tar.gz.

File metadata

  • Download URL: vcfparser-0.1.6.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.1

File hashes

Hashes for vcfparser-0.1.6.tar.gz
Algorithm Hash digest
SHA256 cb92e4892e28eea9b52617f645d77d6b6ab9d85a498478929acf524b90ef8901
MD5 594f7dcb00007e55d3f738d5835d86a9
BLAKE2b-256 999c68fda5b0a6c657b2f0a3d9d47efdafc30b5d7a2c3cd9201b934c5f6550a3

See more details on using hashes here.

File details

Details for the file vcfparser-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: vcfparser-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.1

File hashes

Hashes for vcfparser-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 1b46a7d5e4acf3f4d7adf1a404b66ccaa750c76b236c0a28a68097f4b8a22690
MD5 67f6ff979c608d805d9000af3eaaf460
BLAKE2b-256 6644ad87cd08c2b286f141201dfe12c8f0177aa507bba8634a64ce79097b4f80

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page