Filtering specific columns (SAMPLE IDs) in a VCF file using BCFtools
1
1
Entering edit mode
4.3 years ago
gprashant17 ▴ 110

I would like to filter variants from a VCF file for only specific samples. I have a file (sample_file.txt) that contains a single column of the required Sample IDs.

I used this command:

 ./bcftools view --force-samples sample_file.txt  file.vcf > output.vcf

But I get this error:

Failed to read from sample_file.txt: unknown file type

Should the sample file also contain any header information?

Running the command to view the head of the sample file gives me this:

 head sample_file.txt

GTEX-111CU 
GTEX-111FC
GTEX-111VG
GTEX-111YS
GTEX-1122O
GTEX-1128S
GTEX-117YX
GTEX-11DXX
GTEX-11DZ1
GTEX-11EI6

Further, I would also like to generate a genotype matrix with GT attribute. Is there any command for this?

vcf bcf SNP rna-seq software error • 3.2k views
ADD COMMENT
1
Entering edit mode
4.3 years ago

you want:

 ./bcftools view --samples-file sample_file.txt  file.vcf > output.vcf
ADD COMMENT

Login before adding your answer.

Traffic: 2132 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6