This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to delete sample using vcftools

If I had merged every vcf file of samples, but find one sample I don't want. How can I delete that sample using vcftools?? Thank you!!!

vcftools delete sample vcf

1 answer

As it says in the manual

--indv <string>
--remove-indv <string>

Specify an individual to be kept or removed from the analysis. This option can be used multiple times to specify multiple individuals. If both options are specified, then the "--indv" option is executed before the "--remove-indv option".

So for example (untested)

vcftools --remove-indv YOUR_INDIVIDUALS_NAME --vcf your_snps.vcf --out your_filtered_snps.vcf

It seems work But I can't find the output file?? There only a .log file.

Parameters as interpreted: --vcf /home/chung/vcftools_0.1.13/perl/QC/life_chr2.vcf --out /home/chung/vcftools_0.1.13/perl/QC/life_chr2_new.vcf --remove-indv NGS20140306D

Excluding individuals in 'exclude' list After filtering, kept 420 out of 421 Individuals After filtering, kept 2609042 out of a possible 2609042 Sites Run Time = 93.00 seconds

Hi! I was having the same trouble but if your just add --recode to your line, it will generate the file with the prefix you stated with --out. Like this:

vcftools --remove-indv YOUR_INDIVIDUALS_NAME --vcf your_snps.vcf --recode --out your_filtered_snps.vcf

According to the vcftools manual:

These options are used to generate a new file in either VCF or BCF from the input VCF or BCF file after applying the filtering options specified by the user.

Hope it helps!

Thank you for your post! I was having the same trouble and the --recode option worked!

Log in to answer this question.