Created
October 13, 2018 20:47
-
-
Save mdshw5/979636122347fe3f90434346c70e883e to your computer and use it in GitHub Desktop.
gencove to DNA.land
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import vcf | |
file = '' | |
with open('outfile.txt', 'w') as out: | |
for variant in vcf.Reader(open(file)): | |
if len(variant.FILTER) == 0: | |
if variant.is_snp: | |
for sample in variant.samples: | |
ref, alt = sample.gt_bases.replace('|', '/').split('/') | |
print(variant.CHROM, str(variant.POS), ref, alt, sep='\t', file=out) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment