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

input file can't be file.vcf.gz? #26

Closed yanzhongsino closed 4 years ago

yanzhongsino commented 4 years ago

helllo, thanks for your software. I met an error while I used the command "vcf2phylip.py -f -o O.chinensis_01,O.octandra_01,O.scaberrima_01,O.scaberrima_02 -i melastoma.filter.vcf.gz" Then I got the message. Traceback (most recent call last): File "/DATA4/Liang/yanzhong/software/vcf2phylip-master/vcf2phylip.py", line 430, in main() File "/DATA4/Liang/yanzhong/software/vcf2phylip-master/vcf2phylip.py", line 124, in main if line.startswith("#CHROM"): TypeError: startswith first arg must be bytes or a tuple of bytes, not str

any reply will be welcomed.

edgardomortiz commented 4 years ago

The input can be compressed, no problem. The error I can see right now is the otugroup definition, just a single sample is allowed to be defined as outgroup. Changing that solves the problem?

If not, perhaps something with your python's version (I wrote it for > 3.7)? Also, do you have the latest commit? if you are not sure simply erase your copy of vcf2phylip and re-clone with:

git clone https://github.com/edgardomortiz/vcf2phylip/

Edgardo

edgardomortiz commented 4 years ago

I will close the issue now, please feel free to re-open it

danrlu commented 4 years ago

For anyone else searching for this error: Python 3.7.3 with vcf2phylip 2.0 gave this error. Python 2.7.13 with vcf2phylip 2.0 works. Python 3.7.3 with vcf2phylip 2.3 works.

Thank you for such a useful tool!