Oh, Thank you for answer. Would you explain the solution for this problem? Could I just solved with editing "##fileformat=VCFv4.2 \n ##FILTER=<ID=PASS,Description="All filters passed">\n" in the first and second line?
It's so confused for data editing with vcftools - bcftools fusion preprocessing.
I want to view all results in bcftools, vcftool and zcat when I typing command, but it doesn't work.
for example, i want to see same results with
- bcftools view input.file | less
[environment]$ bcftools view input.vcf.gz | le Failed to read from input.vcf.gz: unknown file type
- vcftools --gzvcf input.file --recode --recode-INFO-all --stdout | less
fileDate=19/07/2023 - 16:10:54
2 ##source=SHAPEIT5 phase_common 1.1
3 ##contig=<ID=1,IDX=0>
4 ##INFO=<ID=AC,Number=A,Type=Integer,Description="ALT allele count">
5 ##INFO=<ID=AN,Number=1,Type=Integer,Description="Number of alleles">
6 ##FORMAT=<ID=GT,Number=1,Type=String,Description="Phased genotypes">
7 #CHROM POS ID REF ALT QUAL FILTER INFO FORMAT Sam1 Sam2 Sam3 ...
8 1 102988 rsID C A nan . AC=13;AN=198 GT 0|0 0|0 0|0 0|0 0|0
- zcat input.file | less
fileDate=19/07/2023 - 16:10:54
2 ##source=SHAPEIT5 phase_common 1.1
3 ##contig=<ID=1,IDX=0>
4 ##INFO=<ID=AC,Number=A,Type=Integer,Description="ALT allele count">
5 ##INFO=<ID=AN,Number=1,Type=Integer,Description="Number of alleles">
6 ##FORMAT=<ID=GT,Number=1,Type=String,Description="Phased genotypes">
7 #CHROM POS ID REF ALT QUAL FILTER INFO FORMAT Sam1 Sam 2 Sam3...
8 1 102988 rsID C A nan . AC=13;AN=198 GT 0|0 0|0 0|0 0|0 0|0
vcftools --gzvcf and zcat command works well (provide same results) but bcftools just omit the error : unknown file type
How do I solve this problem? In other input file, command sets works well and bcftools doesn't failed for read.
Thank you for attention.
1 answer
Your vcf file doesnt contain the fileformat header, which is necessary.
You can try that, but where did you get these VCFs from?
Well, I just filtering bcf and coverted it to vcf.gz for extracting MAF 0.01, and these files popped up... bcf was from after impute process, and vcftools omitted error as index : "inputfile" is in a format that cannot be usefully indexed. Here is the command
(After impute process) bcftools view input.bcf -Oz -o input.refine.vcf.gz
vcftools --gzvcf input.refine.vcf.gz --maf 0.01 --recode --recode-INFO-all --stdout | bgzip -c > output.vcf.gz && tabix -p vcf output.vcf.gz
Oh, I found the answer. Maybe direct filtering with bcf to vcf.gz output take the error easily! (Just my opinion, error message doesn't answer anything..)
Before I do bcf -> vcf.gz -> vcf.gz (maf filtering), but I do bcf -> vcf.gz (maf filtering) in this time.
Log in to answer this question.