This is a test version of Biostars. For the public version, visit https://www.biostars.org.
remove listed singletons from vcftools output

Hello all,

I would like to remove any singletons/doubletons from my vcf file.

I can find all the singletons/doubletons using: vcftools --vcf file.vcf --singletons --out file

This output file.singletons which has this information: CHROM POS SINGLETON/DOUBLETON ALLELE INDV

I thought I could extract the POS column from the file.singletons, remove the header and use as follow:

vcftools --vcf file.vcf --exclude file.singletons --recode --recode-INFO-all --out final_vcf

However this does not seem to remove any SNPs from the .vcf file. Is there anyway I can remove the SNPs listed in the .singletons file?

Thank you all for your help in advance

vcftools sequencing genome next-gen

1 answer

If anyone is having a similar problem - I found the solution! Instead of using --exclude flag use the --exclude-positions flag for vcftools. Make sure you take the 1st and second column of the --singletons output.

Just wanted to say thank you for following up like this! It helped me just now :)

Log in to answer this question.