<p>If what you want is to split the main VCF file into 1 file per sample, you could use bcftools <a href="http://www.htslib.org/doc/bcftools.html#query" rel="nofollow noreferrer">query</a> and <a href="http://www.htslib.org/doc/bcftools.html#view" rel="nofollow noreferrer">view</a> commands.</p>

<p>A similar question was asked on <a href="https://www.biostars.org/p/130456/" rel="nofollow noreferrer">biostars</a>, adapting Jorge Amigo's solution to your situation, you might use:</p>

<pre><code>for sample in $(bcftools query -l $combined_vcf)
do
    bcftools view -c1 -Ov -s $sample -o ${$sample.vcf} $file
done
</code></pre>

CC BY-SA 3.0
2018-04-16T05:14:38.013Z
Thanks for the nice solution. Is there any similar way to combine two vcf file for one subject (one vcf file is having SNP+Indel obtained from GATK HaplotypeCaller, GenotypeGVCF and another vcf file is having SVs from GenomeStrip). I'll definitely try this way as many researchers have suggested in Biostar also. Thanks.
Lot_to_learn
CC BY-SA 3.0
2018-04-11T09:17:01.823Z
2018-04-11T09:17:01.823Z
cmdoret
<p>I have exome data 32 patients. My aim is to identify unique somatic mutations in each patients. For this I have completed my pipeline for Whole Exome Data analysis using various tools like BWA mem, picard, gatk etc. Now I have VCF and gVCF file of each patient. </p>

<p>For Variant Quality Score recalibration (VQSR), as per the doccumentation, we should have at least 30 patient data for good recalibration. So in order to perform VQSR, I combined gVCF of all 32 patients using genotypeGVCFs tool of gatk and done with VQSR. But now I have cohort of all patient data (a large combined vcf file). </p>

<p>I don't know how variant sub-class tool or other extraction tool work to extract all of the unique and related features to each patient. I know how to get significant mutations using mutect but here it is combined file but I want to get it for each one individually.</p>

<p>How can I get a vcf file for each patient (without missing a single variant associated to that patient) ?</p>

<vcf><mutations><exome><variation><somatic>
How to get unique somatic mutations for each individual patients
# How to get unique somatic mutations for each individual patients

(Asked by: username_0 on 2018-04-06)

I have exome data 32 patients. My aim is to identify unique somatic mutations in each patients. For this I have completed my pipeline for Whole Exome Data analysis using various tools like BWA mem, picard, gatk etc. Now I have VCF and gVCF file of each patient.

For Variant Quality Score recalibration (VQSR), as per the doccumentation, we should have at least 30 patient data for good recalibration. So in order to perform VQSR, I combined gVCF of all 32 patients using genotypeGVCFs tool of gatk and done with VQSR. But now I have cohort of all patient data (a large combined vcf file).

I don't know how variant sub-class tool or other extraction tool work to extract all of the unique and related features to each patient. I know how to get significant mutations using mutect but here it is combined file but I want to get it for each one individually.

How can I get a vcf file for each patient (without missing a single variant associated to that patient) ?

**Tags:** vcf, mutations, exome, variation, somatic

---

## 1 answers

### Answer by username_1 on 2018-04-11. Score: 4 | Accepted answer

If what you want is to split the main VCF file into 1 file per sample, you could use bcftools query and view commands.
A similar question was asked on biostars, adapting Jorge Amigo's solution to your situation, you might use:
for sample in $(bcftools query -l $combined_vcf)
do
    bcftools view -c1 -Ov -s $sample -o ${$sample.vcf} $file
done

> **Comments:**
> **username_0**: Thanks for the nice solution. Is there any similar way to combine two vcf file for one subject (one vcf file is having SNP+Indel obtained from GATK HaplotypeCaller, GenotypeGVCF and another vcf file is having SVs from GenomeStrip). I'll definitely try this way as many researchers have suggested in Biostar also. Thanks.  

---

