This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Subset a VCF based on a certain string within VEP/ClinVar annotation

Hi all,

I am trying to subset my extremely large vcf file of around 11,000 samples based on the string "pathogenic". I tried the following:

bcftools view -i 'CSQ="Pathogenic"' -o PathOnlyClinVar.vcf Merged.vcf.gz

which I believe should have worked, but it only returned the header without any other information. I mainly want to safely subset my vcf file with ClinVar information that contains the string "Pathogenic".

Thanks!

bcftools vcf

1 answer

https://samtools.github.io/bcftools/bcftools.html#expressions

regex operators "~" and its negation "!~". The expressions are case sensitive unless "/i" is added.

bcftools view -i 'CSQ ~ "Pathogenic"' -o PathOnlyClinVar.vcf Merged.vcf.gz

Thank you, that seemed to do the trick! I'll have to brush up on my regex :)

Log in to answer this question.