merge vcf.gz file
1
0
Entering edit mode
20 months ago
Mali • 0

I have vcf.gz file I am trying to merge with bcftools . when I am using the command line it works

bcftools index -f file 1 
bcftools index -f file 2 
bcftools merge file1  file2  > out.vcf

I get the following error when I call the commands from R or Python: the file is not BGZF compressed

The files are gzip-compressed variants. Why it's working only through the command line?

bcftools • 866 views
ADD COMMENT
0
Entering edit mode

"file 1 " , with a space, cannot be a real argument. show us the real filenames please, and the error messages.

ADD REPLY
0
Entering edit mode
file1 = '/sci/labs/orzuk/orzuk/projects/Skin/data/Ichilov/vcfFiles/vcfFiles/eb3_1001_748-gatk-haplotype.final.vcf.gz'
file2 = '/sci/labs/orzuk/orzuk/projects/Skin/data/Ichilov/vcfFiles/vcfFiles/g15_02001_785-gatk-haplotype.final.vcf.gz'
merged_vcf =  '/sci/home/mali.tsadok/merged.vcf'
bcftools_cmd = ["bcftools" , "index" ,"-f" ,file1 ]
proc = subprocess.run(bcftools_cmd)
bcftools_cmd = ["bcftools" , "index" ,"-f" ,file2 ]
proc = subprocess.run(bcftools_cmd)
bcftools_cmd = ["bcftools", "merge" ,file1,file2 ,  "-o", merged_vcf]
proc = subprocess.run(bcftools_cmd)


Failed to open /sci/labs/orzuk/orzuk/projects/Skin/data/Ichilov/vcfFiles/vcfFiles/eb3_1001_748-gatk-haplotype.final.vcf.gz: not compressed with bgzip
ADD REPLY
2
Entering edit mode
20 months ago
ATpoint 85k

You must compress with bgzip.

gzip -d your.vcf.gz
bgzip your.vcf
ADD COMMENT

Login before adding your answer.

Traffic: 3002 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6