This is a test version of Biostars. For the public version, visit https://www.biostars.org.
[solved]bcftools breaks in for loop

I want to filter my bcf files for various criteria. If I use it on one single file, it works, but as soon as I for-loop it, it breaks with unknown command.

for n in /Volumes/Temp/PBI_CNV/results/*.bcf; do
        bcftools filter -i 'MAPQ>40' $n > ${n%*.bcf}_mapq.vcf
done

for m in /Volumes/Temp/PBI_CNV/results/*_mapq.vcf; do
        grep -vwE '(LowQual|##contig)' $m > ${m%*.vcf}_qual.vcf
done

Results me in:

[main] Unrecognized command.
[main] Unrecognized command.
[main] Unrecognized command.
[main] Unrecognized command.
[main] Unrecognized command.
[main] Unrecognized command.
[main] Unrecognized command.
[main] Unrecognized command.
[main] Unrecognized command.
[main] Unrecognized command.
[main] Unrecognized command.
[main] Unrecognized command.
[main] Unrecognized command.
[main] Unrecognized command.
[main] Unrecognized command.

As well as empty _mapq.vcf and _qual.vcf files. No additional error, so the loop seems to be working. Is this a bug?

bash bcftools bcf vcf for-loop

1 answer

Might be a version issue try putting just bcftools inside the loop and see if it's the desired version

Log in to answer this question.