Giter Club home page Giter Club logo

vcf2tsv's Introduction

Genomic VCF to tab-separated values

Python script for conversion of VCF data to tab-separated values (TSV)

A small script that converts genomic variant data encoded in VCF format into a tab-separated values file. The script utilizes brentp/cyvcf2 to parse the VCF file. By default, the program prints the fixed VCF columns, all INFO tag values (as defined in the VCF header, INFO tags not present in a given record is appended with a '.'), and all genotype data (FORMAT columns) for heterozygotes and homozygotes. If genotype data is present, it prints one line per sample, and a column denoted VCF_SAMPLE_ID indicates data for a given sample. The script has optional arguments to

  • skip sample genotype data (i.e. FORMAT colums)
  • keep rejected genotypes (i.e. FILTER != 'PASS' / GT == './.')
  • skip INFO data.
  • compress output TSV
  • print data types of VCF columns as a header line

IMPORTANT: If you run vcf2tsv with a large multi-sample VCF file, the size of the output TSV will quickly grow large, since there is one line per sample genotype in the output by default. Turn on --skip_genotype_data if you are primarily interested in the variant INFO elements, filesize of output will also be considerably smaller.

Installation

Running vcf2tsv requires Python 3. It also requires that you have cyvcf2 and numpy installed. This can be achieved through the use of pip.

Usage:

usage: vcf2tsv.py [-h] [--skip_info_data] [--skip_genotype_data]
	   [--keep_rejected_calls] [--print_data_type_header]
	   [--compress]
	   query_vcf out_tsv

Convert a VCF file with genomic variants to a file with tab-separated values
(TSV). One entry (TSV line) per sample genotype

positional arguments:
query_vcf             Bgzipped input VCF file with query variants
		    (SNVs/InDels)
out_tsv               Output TSV file with one line pr non-rejected sample
		    genotype (Variant, genotype and annotation data as
		    tab-separated values)

optional arguments:
-h, --help            show this help message and exit
--skip_info_data      Skip printing of data in INFO column (default: False)
--skip_genotype_data  Skip printing of genotype_data (FORMAT columns)
		    (default: False)
--keep_rejected_calls
		    Print data for rejected calls (default: False)
--print_data_type_header
		    Print a header line with data types of VCF annotations
		    (default: False)
--compress            Compress TSV file with gzip (default: False)
--version             show program's version number and exit

vcf2tsv's People

Contributors

sigven avatar

Stargazers

YaoLei-Leo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.