How to determine mutation type/subtype via pysam/samtools
I'm using pysam (a wrapper around samtools) to pull information from VCF records.
Is there a way to pull out the type/subtype information regarding a single mutation (line of data) contained in a VCF file? I.e. Whether the mutation is a SNP/SUB, INS, DEL, Etc.?
The following snippet pulls out the POSITION and the CHROMOSOME (respectively.)
bcf_in = VariantFile("test.bcf")
for rec in bcf_in.fetch():
print (rec.pos)
print (rec.chrom)
Is there a similar way to pull out the type info, or do I have to calculate it from the REF/ALT?
• 1,296 views
•
link
1 answer
bcftools query --format '%CHROM %POS %TYPE\n' input.vcf
• 0 views
•
link
Log in to answer this question.