I have noticed what I assume is a bug in line 301:
nbPASS=$(bcftools query -f "QUAL\n" "$inputfile" | grep -c "PASS" )
This bcftools query just produces a list of QUAL as output so that the count would be 0 for every sample - including the data you provide as an example. To extract the values of the QUAL column, you need to add "%" before it.
nbPASS=$(bcftools query -f "%QUAL\n" "$inputfile" | grep -c "PASS" )
However, the QUAL column contains quality scores, i.e. numbers. You are probably looking for the FILTER column, which contains the value PASS if the quality filter is passed:
nbPASS=$(bcftools query -f "%FILTER\n" "$inputfile" | grep -c "PASS" )
I have noticed what I assume is a bug in line 301:
nbPASS=$(bcftools query -f "QUAL\n" "$inputfile" | grep -c "PASS" )This bcftools query just produces a list of QUAL as output so that the count would be 0 for every sample - including the data you provide as an example. To extract the values of the QUAL column, you need to add "%" before it.
nbPASS=$(bcftools query -f "%QUAL\n" "$inputfile" | grep -c "PASS" )However, the QUAL column contains quality scores, i.e. numbers. You are probably looking for the FILTER column, which contains the value PASS if the quality filter is passed:
nbPASS=$(bcftools query -f "%FILTER\n" "$inputfile" | grep -c "PASS" )