edgardomortiz / vcf2phylip

Convert SNPs in VCF format to PHYLIP, NEXUS, binary NEXUS, or FASTA alignments for phylogenetic analysis
GNU General Public License v3.0
294 stars 85 forks source link

Key Error '-' #11

Closed mwpil closed 5 years ago

mwpil commented 5 years ago

Hello,

I'm trying to convert my vcf file to phylip, but I can't work out the error I get.

$ python vcf2phylip.py -i cfaplusoutD.recode.vcf -o AN02:C6G73ANXX:7:250444719

Converting file cfaplusoutD.recode.vcf:

Number of samples in VCF: 47 Traceback (most recent call last): File "vcf2phylip.py", line 421, in main() File "vcf2phylip.py", line 241, in main site_tmp = ''.join([amb[''.join(sorted(set([nuc[broken[i][j]] for j in gt_idx])))] for i in range(9, index_last_sample)]) KeyError: '-'

I'm attaching the first 2000 variants of the file here, in case there is any way you can help. Thank you very much for your time, in advance.

edgardomortiz commented 5 years ago

Hi, The error was caused by the SNPs whose reference allele was a gap "-", please clone again and let me know if it works. Just out of curiosity, what pipeline produced this VCF?

Edgardo

mwpil commented 5 years ago

It worked. This is GBS data, ran through a TASSEL pipeline with a reference genome. Thank you very much for your help. Maria.

edgardomortiz commented 5 years ago

Excellent, glad to help