This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Whole Genome .vcf file split by Chromosome with BCFTools without index file
for i in {1..22}; do bcftools view "$(input)" --regions chr$i --output "$(output)" --output-type z; done

Hello, this is my current code that I am using to try to split a whole genome vcf file into 22 vcf files by chromosome. Unfortunately, it keeps spitting out an error that says I need an index file. Is there any way I could alter my code such that I do not need an index file to do so. I would imagine just like vcftools that bcftools could split by chromosome without the need for an index.

Thank you!

vcf bcftools

1 answer

Use --targets instead of --regions

Thank you, this worked great!

Log in to answer this question.