Created
May 19, 2018 04:56
-
-
Save finswimmer/b62948f036b956cd1acbe1e882b95d81 to your computer and use it in GitHub Desktop.
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 sys | |
from pysam import VariantFile | |
vcf_in = VariantFile(sys.argv[1]) | |
print(str(vcf_in.header).strip()) | |
for rec in vcf_in: | |
for key, value in rec.info.items(): | |
if vcf_in.header.info[key].number not in ("A", "R", "G", ".", "0"): | |
if type(value) is tuple: | |
rec.info[key] = value[0:vcf_in.header.info[key].number] | |
print(str(rec).strip()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Answer on biostars question: https://www.biostars.org/p/315408