<p>Additional tidbit I learned in the last year that I wanted to share with anyone else that's working on this.</p>
<p>Plink creates an extremely generic <a href="https://www.cog-genomics.org/plink2/formats#fam" rel="nofollow noreferrer">fam</a> file for you, but if you are updating this fam file to reflect your population's family structure, sex, etc., note that when using plink binary files (bed/bim/fam) the order of the individuals in the fam file needs to match the order of the individuals in the other files (which is the order of the individuals in the generic fam file)</p>
<p>Do be careful if you care about which alleles are major/minor, as sometimes the order gets switched around in plink. For more info see &quot;Variant Call Format&quot; section on this <a href="https://www.cog-genomics.org/plink2/input" rel="nofollow noreferrer">page</a>.</p>

CC BY-SA 4.0
2019-02-28T06:48:50.053Z
2022-02-22T20:58:20.653Z
2022-02-22T20:58:20.653Z
Sarah
<p>Given that Plink reads in VCF files natively, and Plink is your desired output format, I expect that <code>plink --vcf &lt;file&gt;</code> would be the best option.</p>
<p>As mentioned by @sarah, Plink uses the sample IDs to create family/individual IDs, see  &quot;Variant Call Format&quot; section on this <a href="https://www.cog-genomics.org/plink2/input" rel="nofollow noreferrer">page</a>:</p>
<blockquote>
<p>VCF files just contain sample IDs, instead of the distinct family and
within-family IDs tracked by PLINK. We offer three ways to convert
these IDs:</p>
<pre><code>--double-id causes both family and within-family IDs to be set to the sample ID.
--const-fid converts sample IDs to within-family IDs while setting all family IDs to a single value (default '0').
--id-delim causes sample IDs to be parsed as &lt;FID&gt;&lt;delimiter&gt;&lt;IID&gt;; the default delimiter is '_'. If any sample ID
</code></pre>
<p>does not contain exactly one instance of the delimiter, an error is
normally reported; however, if you have simultaneously specified
--double-id or --const-fid, PLINK will fall back on that approach to handle zero-delimiter IDs.</p>
<p>If none of these three flags is present, the loader defaults to
--double-id + --id-delim.</p>
</blockquote>
<p>There are caveats associated with the types of variants that Plink will pull in from the VCF files, mostly related to limitations of Plink's own file formats. But if your end-goal is Plink, then that should be fine.</p>

CC BY-SA 4.0
2018-02-28T21:38:45.087Z
2022-02-22T20:59:17.407Z
2022-02-22T20:59:17.407Z
gringer
<p>I am trying to find the best way to convert VCF files to PLINK binary bed/bim/fam files, but it seems like there are many varied ways to do this. (For example, using <a href="https://www.cog-genomics.org/plink2/input" rel="noreferrer">Plink 1.9 --vcf tag</a>, <a href="http://apol1.blogspot.com/2014/11/best-practice-for-converting-vcf-files.html" rel="noreferrer">bcftools</a>, <a href="https://software.broadinstitute.org/gatk/documentation/tooldocs/3.8-0/org_broadinstitute_gatk_tools_walkers_variantutils_VariantsToBinaryPed.php" rel="noreferrer">GATK</a>, and <a href="https://vcftools.github.io/documentation.html#plink" rel="noreferrer">vcftools</a>). </p>

<p>Obviously they all probably have their uses and you could likely spend a while discussing this, but can anyone give a short, simple explanation as to whether the methods are generally the same, or whether one or another is generally best for certain situations? Thanks!</p>

<vcf><plink><gatk><vcftools>
Converting VCF file to PLINK bed/bim/fam files
# Converting VCF file to PLINK bed/bim/fam files

(Asked by: username_0 on 2018-02-28)

I am trying to find the best way to convert VCF files to PLINK binary bed/bim/fam files, but it seems like there are many varied ways to do this. (For example, using [Plink 1.9 --vcf tag](https://www.cog-genomics.org/plink2/input), [bcftools](http://apol1.blogspot.com/2014/11/best-practice-for-converting-vcf-files.html), [GATK](https://software.broadinstitute.org/gatk/documentation/tooldocs/3.8-0/org_broadinstitute_gatk_tools_walkers_variantutils_VariantsToBinaryPed.php), and [vcftools](https://vcftools.github.io/documentation.html#plink)).

Obviously they all probably have their uses and you could likely spend a while discussing this, but can anyone give a short, simple explanation as to whether the methods are generally the same, or whether one or another is generally best for certain situations? Thanks!

**Tags:** vcf, plink, gatk, vcftools

---

## 2 answers

### Answer by username_1 on 2018-02-28. Score: 8 | Accepted answer

Given that Plink reads in VCF files natively, and Plink is your desired output format, I expect that plink --vcf  would be the best option.
As mentioned by @sarah, Plink uses the sample IDs to create family/individual IDs, see  "Variant Call Format" section on this page:

VCF files just contain sample IDs, instead of the distinct family and
within-family IDs tracked by PLINK. We offer three ways to convert
these IDs:
--double-id causes both family and within-family IDs to be set to the sample ID.
--const-fid converts sample IDs to within-family IDs while setting all family IDs to a single value (default '0').
--id-delim causes sample IDs to be parsed as ; the default delimiter is '_'. If any sample ID

does not contain exactly one instance of the delimiter, an error is
normally reported; however, if you have simultaneously specified
--double-id or --const-fid, PLINK will fall back on that approach to handle zero-delimiter IDs.
If none of these three flags is present, the loader defaults to
--double-id + --id-delim.

There are caveats associated with the types of variants that Plink will pull in from the VCF files, mostly related to limitations of Plink's own file formats. But if your end-goal is Plink, then that should be fine.


---

### Answer by username_0 on 2019-02-28. Score: 3

Additional tidbit I learned in the last year that I wanted to share with anyone else that's working on this.

Plink creates an extremely generic [fam](https://www.cog-genomics.org/plink2/formats#fam) file for you, but if you are updating this fam file to reflect your population's family structure, sex, etc., note that when using plink binary files (bed/bim/fam) the order of the individuals in the fam file needs to match the order of the individuals in the other files (which is the order of the individuals in the generic fam file)

Do be careful if you care about which alleles are major/minor, as sometimes the order gets switched around in plink. For more info see "Variant Call Format" section on this [page](https://www.cog-genomics.org/plink2/input).


---

