This is a test version of Biostars. For the public version, visit https://www.biostars.org.
bcftools "The argument to -g not recognised"

Hi all,

Fairly new to the use of bcftools, I am trying to create a vcf file by typing the following:

bcftools view -v -c -g output.bcf > output.vcf

However, I receive the following error message: the argument to -g not recognised. Expected one of hom/het/miss/^hom/^het/^miss, got "output.bcf".

I confirm that I am in the right directory and even tried to give the full directory but without success. Unfortunately, I cannot find details online on how to solve this issue.

Any help would be much appreciated.

Antoine

bcftools

3 answers

I just had an issue with bcftools and found a solution. Hopefully your issue is similar.

The new bcftools (1.3) uses call function in place of view now. If you still need the view function, -g, --genotype requires combination of [^][hom|het|miss].

Man page.

Thanks. It is likely the source of the problem. I tried the following but without success:

bcftools view -v -c -g[hom|het|miss] output.bcf > output.vcf
bcftools call -v -c -g[hom|het|miss] output.bcf > output.vcf

Any thoughts?

Have you tried removing the brackets (e.g. bcftools view -vcg hom|het|miss)?

Yes I did. Still no luck. Btw, I am not sure that the latest version of bcftools actually uses call in place of view. The man page says that call is the former "view". So I guess view is the option I am actually aiming for.

Thanks for sharing your thoughts.

Try supplying just hom to the -g - if it works, there might be a problem with the syntax of the compound option.Also, try giving a white space between the -g and the hom|het - that might be a possible source of error as well.

And welcome to the trial and error world of tools :)

Thanks Ram. I tried that but it did not work. I am thinking it could be related to the version of bcftools where the syntax has to be applied differently than in previous versions.

-g is to filter genotypes and is not a toggle - it needs an value passed to the argument. Are you looking to drop genotype information? That's the -G option.

Thanks for your quick answer Ram. My understanding was that -g was a filtering options allowing to "include only sites with one or more homozygous (hom), heterozygous (het) or missing (miss) genotypes". At this point, I am not trying to drop genotype information but to do what the -g seems to offer. There might still be something I am missing here.

Log in to answer this question.