I'm parsing my vcf files with PyVCF and I would like to update my genotype calls: for every position in which the DP field is smaller than 10, genotype should be
"./.". For the moment I've generated a list with the updated calls as I wish, like this:
vcf_reader = vcf.Reader(filename='myfile.vcf.gz') new_gt =  for record in vcf_reader: if record.samples.data > 10: new_gt.append(record.samples.data) elif record.samples.data < 10: new_gt.append('./.')
However, I've also tried to directly modifying the genotypes in the
vcf_reader object, but I get an error message saying
'CallData' object does not support item assignment. In this link they have a similar problem in the
I was wondering: has someone found a way to directly modify genotype calls in PyVCF or to insert a list with the desired output? Thanks a lot in advanced!