Closed AlexLlanesQuevedo closed 2 years ago
pysam (the library momi2 uses to read VCFs) requires that the variant file be indexed for reading. You need to compress and index your VCF file by running:
$ bcftools view -o run5_40indv.bcf run5_40indv.vcf $ bcftools index run5_40indv.bcf
Then use the resulting .bcf file with momi2.
On Mon, Dec 28, 2020 at 12:15 PM AlexLlanesQuevedo notifications@github.com wrote:
Hi all, I have my dataset in a single vcf (obtained with ipyrad and curated with vcftools) so I created the .bed file by using the vcf2bed script ( https://raw.githubusercontent.com/isaacovercast/lab-notebooks/master/vcf2bed/vcf2bed.py). I assigned the individuals to populations with the parameter ind2pop ; however when creating the snp allele counts array with momi.SnpAlleleCounts.read_vcf I get the error: ValueError: fetch requires an index. Could you help me to overcome this error? [image: imagen] https://user-images.githubusercontent.com/59844946/103231617-d1e05d80-48fd-11eb-85fb-934851bd1943.png
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/popgenmethods/momi2/issues/40, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAEOHGOMRPAVQXGVU7BBA3SXC4JTANCNFSM4VMIIHWA .
-- Jonathan terhorst@gmail.com
What @terhorst says is correct, but I'm leaving this issue open until we update the documentation of read_vcf()
to make clear that an indexed VCF file is required.
Hi all, I have my dataset in a single vcf (obtained with ipyrad and curated with vcftools) so I created the .bed file by using the vcf2bed script (https://raw.githubusercontent.com/isaacovercast/lab-notebooks/master/vcf2bed/vcf2bed.py). I assigned the individuals to populations with the parameter![imagen](https://user-images.githubusercontent.com/59844946/103231617-d1e05d80-48fd-11eb-85fb-934851bd1943.png)
ind2pop
; however when creating the snp allele counts array withmomi.SnpAlleleCounts.read_vcf
I get the error: ValueError: fetch requires an index. Could you help me to overcome this error?