This is a test version of Biostars. For the public version, visit https://www.biostars.org.
BCFTOOLS view -S not working

Hello, I'm trying to exclude some samples from my vcf. My command looks like this:

bcftools view -S file.txt vcf_file.vcf >new_vcf.vcf

file.txt looks like this (each sample in a new line): ^V01523 ^V02073 ^V02653 ^V02923 ^V06633 ^V06854 ^V08639 ^V09208

I'm getting this error:

Error: subset called for sample that does not exist in header: "^V01523". Use "--force-samples" to ignore this error.

I've "cleaned" file.txt with dos2unix so it does not contain hidden characters. If I'm removing V01523 from the list I get the same error for the next sample.

Any advice? Thanks Hila

bcftools samples

1 answer

don't put all those '^' in the file and just use:

bcftools view -S ^file.txt vcf_file.vcf >new_vcf.vcf

see the manual:

-S, --samples-file [^]<file>  file of samples to include (or exclude with "^" prefix)

Log in to answer this question.