PyVCF icon indicating copy to clipboard operation
PyVCF copied to clipboard

How to obtain the Allelic depths field using pyvcf reader?

Open ipstone opened this issue 6 years ago • 2 comments

Hello, I need to extract the 'AD' field from VCF file, but I couldn't locate the object for the AD field: "Allelic depths for the ref and alt alleles in the order listed".

Many of my intersted fields can be found in the record.INFO, but not this AD field. Thanks

ipstone avatar Mar 20 '18 14:03 ipstone

Related, I am wondering if there is a method to return the raw text from each row (record), so that some fields could be manually extracted with the raw text. thanks

ipstone avatar Mar 20 '18 15:03 ipstone

vcfreader = vcf.Reader(open(vcffile, 'r'))
for record in vcfreader:
    for call in record:
        print(call.data.AD)

martinhaagmans avatar Apr 03 '18 14:04 martinhaagmans