I can call genotype bases for one sample at a time separately using pyVCF
module as:
for sample in record.samples:
call = record.genotype('MA611')
print(call.gt_bases)
Ouput:
A/A
A|G
G/G
C|T
But, how can I print the gt_bases
for all the samples in a vcf file
using for loop. I tried:
for sample in record.samples:
for x in record.genotype:
call = record.genotype(x)
print(call.gt_bases)
I am getting error:
for x in record.genotype:
TypeError: 'method' object is not iterable
Thanks !
Isn't this an odd loop? You loop over all samples, but never actually use that variable
sample
in your loop.