This chapter contains several examples for the most important use cases of VCFPy.
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
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
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