This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Changing Sample Names in Merged VCF file

Hi All,

I have merged about 36 .vcf tumor Files into one single merged .vcf file. Now the problem is the vendor has given the .vcf file name as the R1_XXX_T_1.vcf and sample Name in vcf as Tumor, Likewise, all sample Names in .vcf is given as Tumor. My question is, can I change the sample name in merged vcf? if yes how? Is it possible to retain file_name as sample names in the vcf?

Thanks for Help,

Dave

vcf sample

2 answers

Hello,

bcftools reaheder should help you here. To use it, you have to prepare a text file, where in each line you write the old and the new sample name. Or just the new sample name, but all names in the order they should appear in the vcf.

Then you can doing this

$ bcftools reheader -s names.txt in.vcf > out.vcf

fin swimmer

Follow the post Rename sample name

Log in to answer this question.