Skip to content

Latest commit

 

History

History
48 lines (31 loc) · 1.33 KB

examples.rst

File metadata and controls

48 lines (31 loc) · 1.33 KB

Examples

This chapter contains several examples for the most important use cases of VCFPy.

Reading VCF Files

The following is an example for reading VCF files and writing out a TSV file with the genotype calls of all SNVs. You can find the example Python and VCF file in the sources below the directory examples/vcf_to_tsv.

../examples/vcf_to_tsv/vcf_to_tsv.py

The program call looks as follows.

../examples/vcf_to_tsv/stdout.txt

Writing VCF Files

The following shows how to add values to the FILTER column to records of an existing VCF file. Adding to existing records is simpler than constructing them from scratch, of course.

../examples/add_filter/add_filter.py

The program call looks as follows.

../examples/add_filter/stdout.txt

Jumping in Tabix-indexed Files

The following shows a small program that extracts a genomic region from the input VCF file and writes it to stdout.

../examples/fetch_tabix/fetch_tabix.py

The program call looks as follows.

../examples/fetch_tabix/stdout.txt