Skip to main content

Minimaistic VCf parser in python

Project description


Python parser for parsing the genomics and transcriptomics VCF data.

Installation and setup

  1. Clone this repo
git clone
cd vcfparser


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:")

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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

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