Entering edit mode
4.3 years ago
caro-ca
▴
20
Dear, I am trying to create a VennDiagram by using bcftools stats and consequently plot-vcfstats. For bcftools stats I followed:
bgzip -c file.vcf > file.vcf.gz
tabix -p vcf file.vcf.gz
But tabix raised this error:
[E::hts_idx_push] Unsorted positions on sequence #3: 84070 followed by 84069
Therefore, to sort I used this code:
(grep ^"#" file.vcf ; grep -v ^"#" file.vcf | sort -k1,1 -k2,2n) > file1_sorted.vcf
Compressing and indexing worked fine for my two VCF files. However, while running
bcftools stats file1_sorted.vcf.gz file2_sorted.vcf.gz
This is the stdout message:
Failed to open file2_sorted.vcf.gz: unknown file type
I hope you could help me out. Thank you in advance
Can you try using
bcftools sort
? It is best to stay with tools designed for specific file formats in some cases (VCF being one).Yeah, I tried and this is the error:
Can you give us the output of
grep "^##" samples_all_merged_STROPE.vcf
This file is really short compared to the non-sorted file, is there a way to upload files?
It tells me enough to diagnose what went wrong. There is no need to upload large files.
You should not have used the
grep
->sort
thing you used - that command sequence is flawed and it corrupted the file. Please usebcftools sort
on thefile.vcf
that you used grep/sort on.I used this code, but it did not work.
Am I using it correctly?
No,
-Ov
means you're expected uncompressed VCF as output, which you're saving in avcf.gz
file. Use either-Oz
or save it as a.vcf
file.Can you give us the output to:
This is the output of bcftools
and
bcftools view
does not retrieve anything.To sum up:
bcftools sort
, it did not work (stdout message above).bcftools view -h samples_all_merged_STROPE.vcf | grep -m50 "^##contig"
having no output nor error messages.Lastly, I used
bcftools view samples_all_merged_STROPE.vcf -Oz -o samples_all_merged_STROPE_sorted.vcf.gz
having an output, but while executingbcftools index samples_all_merged_STROPE_sorted.vcf.gz
this is the error message:Thank you in advance for your persistent help.
It looks like your contig lines are missing - which is a HUGE problem. The
grep
output from a comment above shows me your header is already messed up. The conclusion is - the filesamples_all_merged_STROPE.vcf
is not usable in its current form.How did you create the
samples_all_merged_STROPE.vcf
file? You're going to have to re-create it after fixing any problems in the process that created it.