Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variable expansion issue with +setGT? [$VARIABLE-] isn't working... #2276

Open
goeckeritz opened this issue Sep 9, 2024 · 1 comment
Open

Comments

@goeckeritz
Copy link

goeckeritz commented Sep 9, 2024

Hi Petr,

I've seen some other issues that are similar to this one, but I've not had issues with variable expansion for the filtering expressions until I started using it with +setGT.

I have a variable, $MOM_SAMP, that is the sample number for a mother sample. When I use the variable for pointing to this sample for a certain filter, for example FORMAT/DP[$MOM_SAMP]<15, I get the expected outcome.

However, when I do FORMAT/DP[$MOM_SAMP-]<30, it behaves as if [$MOM_SAMP-] isn't even there, and applies the filter to all samples in the multi-sample vcf. I've also tried [${MOM_SAMP}-], [$(MOM_SAMP)-], [($MOM_SAMP)-], and [$($MOM_SAMP)-], but it still applies the filter to every single sample (for [${MOM_SAMP}-]), I get the error that a command MOM_SAMP isn't found [for $(MOM_SAMP)-], I get a parsing error (for [($MOM_SAMP)-]), or it gives the sample number as it should but without the '-', so it again reports the command is not found (for [$($MOM_SAMP)-]). It honestly looks like the '-' is ignored no matter what.

For context, my command looks like this:

bcftools +fill-tags ${COMBINED_FILE} -Oz --threads 24 -- -t FORMAT/VAF | bcftools view --with-header --threads 24 -Oz -M2 -v snps | bcftools +setGT -Oz -- -t 'q' -n "./." -i "FORMAT/DP<10 | FORMAT/DP[$MOM_SAMP]<15 | FORMAT/DP[$MOM_SAMP]>250 | FORMAT/DP[$MOM_SAMP-]>31" > ${MOM}_test.vcf.gz

I.e., I am trying to apply a different depth filter to the other samples since they have different levels of coverage. Am I by chance just coding this incorrectly? I am using bcftools 1.18. Any insight you can give me is extremely appreciated!

Kindly,
Charity

@pd3
Copy link
Member

pd3 commented Sep 26, 2024

Can you create a small test case? As the problem is stated, it does not give enough information. I just need to see a minimal VCF and the exact commands to reproduce the problem, including how the environment variable is set. In my own tests it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants