We've moved!
This site is now read-only. You can find our new documentation site and support forum for posting questions here.
Be sure to read our welcome blog!

how to split multiple samples in a single VCF file?

rcholicrcholic DenverMember

I finally got the filtered VCF file from PWA + PiCard + GATK pipeline, and have 11 exome-seq data files which were processed as a list of input to GATK. In the process of getting VCF, I did not see an option of separating the 11 samples. Now, I've got two VCF files (one for SNPs and the other for indels) that each has 11 samples. My question is how to proceed from here?

Should I separate the 11 files before annotation? or annotation first then split them 11 samples to individual files? Big question here is how to split the samples from vcf files? thanks


Best Answer


  • rcholicrcholic DenverMember

    Thanks Generaldine for the answer. A new question though: Since I have 11 samples in the VCF, if I do not split them, how do I filter the VCF file for individual samples same time? For example, my criteria is: at least 20 depth of coverage and 10 variant allele counts. Can I still use SelectVariants with parameter "-select "DP > 20.0" " ? how do I differentiate the total DP from at least 10 variant allels?

  • Geraldine_VdAuweraGeraldine_VdAuwera Cambridge, MAMember, Administrator, Broadie admin

    Have a look at the doc on VariantFiltration of genotype-level fields here: http://www.broadinstitute.org/gatk/guide/article?id=51

    Let me know if you still have questions, and if possible please use an example so I can be sure I understand what you're trying to do.

  • Geraldine_VdAuweraGeraldine_VdAuwera Cambridge, MAMember, Administrator, Broadie admin

    Actually I see you have a new question open; let's continue the discussion in that thread then.

  • BlueBlue Member

    To rcholic or anyone else who stumbles in here,

    To split a vcf file by sample:

    Use vcf-subset, with the -c option:

    -c, --columns File or comma-separated list of columns to keep in the vcf file. If file, one column per row
    So if your sample is named S1 and you want a VCF file for only that sample named S1.vcf:

    vcf-subset -c S1 bigfile.vcf > S1.vcf
    There are examples on the VCFtools documentation page, labelled "Stripping columns".

    Select two samples out of a VCF with many samples:
    java -Xmx2g -jar GenomeAnalysisTK.jar \
    -R ref.fasta \
    -T SelectVariants \
    --variant input.vcf \
    -o output.vcf \
    -sn SAMPLE_A_PARC \

Sign In or Register to comment.