Answers.Body: <p>The standard and most common way to name SNPs is by using <a href="https://www.ncbi.nlm.nih.gov/snp/docs/RefSNP_about/" rel="nofollow noreferrer">rsIDs</a>.</p>
  <p>The reason your output from PLINK does not include SNP names is because these are not included in the original VCF you are working with. There are at least two possible options in order to fix this.</p>
  <ol>
  <li>Annotate first the source VCF with rsIDs from dbSNP. You can do this using bcftools and a recent (or latest) human rsID compilation in VCF format. E.g.</li>
  </ol>
  <blockquote>
  <p>Downloading rsIDs</p>
  </blockquote>
  <pre><code>wget ftp://ftp.ncbi.nih.gov/snp/organisms/human_9606_b151_GRCh37p13/VCF/All_20180423.vcf.gz
  wget ftp://ftp.ncbi.nih.gov/snp/organisms/human_9606_b151_GRCh37p13/VCF/All_20180423.vcf.gz.tbi
  </code></pre>
  <blockquote>
  <p>Subsetting chr22 from annotations</p>
  </blockquote>
  <p>This makes the annotation of the chr22 VCF faster</p>
  <pre><code>bcftools view --threads 10 --regions 22 All_20180423.vcf.gz -Oz -o 22_20180423.vcf.gz
  bcftools index 22_20180423.vcf.gz
  </code></pre>
  <blockquote>
  <p>VCF Annotation</p>
  </blockquote>
  <pre><code>bcftools annotate --threads 10 -a 22_20180423.vcf.gz -c ID -o ALL.chr22.phase3_shapeit2_mvncall_integrated_v5b.20130502.genotypes_annotated.vcf.gz
  </code></pre>
  <blockquote>
  <p>PLINK frequency estimations</p>
  </blockquote>
  <p>Now you can proceed as you had done already</p>
  <pre><code>plink --vcf ALL.chr22.phase3_shapeit2_mvncall_integrated_v5b.20130502.genotypes_annotated.vcf.gz --make-bed --out chr22data
  plink --bfile chr22data --freq --out chr22freqs
  </code></pre>
  <ol start="2">
  <li>An alternative option is to build your own 'SNP names' based on chromosome and cordinate (e.g. 22_16255382) using plink commands.</li>
  </ol>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-23T12:39:46.547Z
Answers.LastActivityDate: 2022-12-23T12:39:46.547Z
Answers.UserDisplayName: JRodrigoF
Body: <p>I downloaded the following vcf file from <a href="https://www.internationalgenome.org/" rel="nofollow noreferrer">https://www.internationalgenome.org/</a>.</p>
  <p><a href="http://ftp.1000genomes.ebi.ac.uk/vol1/ftp/release/20130502/ALL.chr22.phase3_shapeit2_mvncall_integrated_v5b.20130502.genotypes.vcf.gz" rel="nofollow noreferrer">http://ftp.1000genomes.ebi.ac.uk/vol1/ftp/release/20130502/ALL.chr22.phase3_shapeit2_mvncall_integrated_v5b.20130502.genotypes.vcf.gz</a></p>
  <p>I wanted to first try and calculate allele frequencies, and then from there calculate allele frequencies based on populations and so on. However, I ran into an issue where while I was using plink, I would utilize the --vcf command to try and calculate frequencies. The frequencies were calculated, but the SNP names were missing. I used the following command in Git Bash on Windows:</p>
  <pre><code>    plink --vcf ALL.chr22.phase3_shapeit2_mvncall_integrated_v5b.20130502.genotypes.vcf.gz --freq --out chr22datanew
  </code></pre>
  <p>I then tried to convert the file to plink binary (bed, bim, fam) to try and use that for the basis of the allele frequencies. I used the following commands:</p>
  <pre><code>plink --vcf ALL.chr22.phase3_shapeit2_mvncall_integrated_v5b.20130502.genotypes.vcf.vcf --make-bed --out chr22data
  
  plink --bfile chr22data --freq --out chr22freqs
  </code></pre>
  <p>Once again, the frequencies were calculated with no issue, but the SNP names were missing. I checked the .fam file that was created, and the SNPs were there, but not in the .bim file. This may be a simple, elementary level question, but does anyone know how to fix this? I am using plink 1.9 instead of vcftools because I'm using a computer that runs on Windows OS.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-12-23T09:58:40.413Z
Comments.Text: Can you please show the result of ``head chr22data.bim``
Comments.UserDisplayName: user438383
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-12-30T18:27:03.240Z
Comments.Text: Result:                                                                        
  22      .       0       16050075        G       A
  22      .       0       16050115        A       G
  22      .       0       16050213        T       C
  22      .       0       16050319        T       C
  22      .       0       16050527        A       C
  22      .       0       16050568        A       C
  22      .       0       16050607        A       G
  22      .       0       16050627        T       G
  22      .       0       16050646        T       G
  22      .       0       16050654        <CN3>   A
Comments.UserDisplayName: Shreyas Arashanapalli
Tags: <vcf><snp><plink><allele-frequency><rsid>
Title: Maintaining SNP names when calculating allele frequencies from a VCF file on plink 1.9
ThreadText: # Maintaining SNP names when calculating allele frequencies from a VCF file on plink 1.9
  
  (Asked by: username_0 on 2022-12-22)
  
  I downloaded the following vcf file from <https://www.internationalgenome.org/>.
  
  <http://ftp.1000genomes.ebi.ac.uk/vol1/ftp/release/20130502/ALL.chr22.phase3_shapeit2_mvncall_integrated_v5b.20130502.genotypes.vcf.gz>
  
  I wanted to first try and calculate allele frequencies, and then from there calculate allele frequencies based on populations and so on. However, I ran into an issue where while I was using plink, I would utilize the --vcf command to try and calculate frequencies. The frequencies were calculated, but the SNP names were missing. I used the following command in Git Bash on Windows:
  
  ```
      plink --vcf ALL.chr22.phase3_shapeit2_mvncall_integrated_v5b.20130502.genotypes.vcf.gz --freq --out chr22datanew
  
  ```
  
  I then tried to convert the file to plink binary (bed, bim, fam) to try and use that for the basis of the allele frequencies. I used the following commands:
  
  ```
  plink --vcf ALL.chr22.phase3_shapeit2_mvncall_integrated_v5b.20130502.genotypes.vcf.vcf --make-bed --out chr22data
  
  plink --bfile chr22data --freq --out chr22freqs
  
  ```
  
  Once again, the frequencies were calculated with no issue, but the SNP names were missing. I checked the .fam file that was created, and the SNPs were there, but not in the .bim file. This may be a simple, elementary level question, but does anyone know how to fix this? I am using plink 1.9 instead of vcftools because I'm using a computer that runs on Windows OS.
  
  **Tags:** vcf, snp, plink, allele-frequency, rsid
  
  > **Comments:**
  > **username_1**: Can you please show the result of ``head chr22data.bim``  
  > **username_0**: Result:                                                                         22      .       0       16050075        G       A 22      .       0       16050115        A       G 22      .       0       16050213        T       C 22      .       0       16050319        T       C 22      .       0       16050527        A       C 22      .       0       16050568        A       C 22      .       0       16050607        A       G 22      .       0       16050627        T       G 22      .       0       16050646        T       G 22      .       0       16050654        <CN3>   A  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2022-12-23. Score: 1
  
  The standard and most common way to name SNPs is by using [rsIDs](https://www.ncbi.nlm.nih.gov/snp/docs/RefSNP_about/).
  
  The reason your output from PLINK does not include SNP names is because these are not included in the original VCF you are working with. There are at least two possible options in order to fix this.
  
  1. Annotate first the source VCF with rsIDs from dbSNP. You can do this using bcftools and a recent (or latest) human rsID compilation in VCF format. E.g.
  
  > Downloading rsIDs
  
  ```
  wget ftp://ftp.ncbi.nih.gov/snp/organisms/human_9606_b151_GRCh37p13/VCF/All_20180423.vcf.gz
  wget ftp://ftp.ncbi.nih.gov/snp/organisms/human_9606_b151_GRCh37p13/VCF/All_20180423.vcf.gz.tbi
  
  ```
  
  > Subsetting chr22 from annotations
  
  This makes the annotation of the chr22 VCF faster
  
  ```
  bcftools view --threads 10 --regions 22 All_20180423.vcf.gz -Oz -o 22_20180423.vcf.gz
  bcftools index 22_20180423.vcf.gz
  
  ```
  
  > VCF Annotation
  
  ```
  bcftools annotate --threads 10 -a 22_20180423.vcf.gz -c ID -o ALL.chr22.phase3_shapeit2_mvncall_integrated_v5b.20130502.genotypes_annotated.vcf.gz
  
  ```
  
  > PLINK frequency estimations
  
  Now you can proceed as you had done already
  
  ```
  plink --vcf ALL.chr22.phase3_shapeit2_mvncall_integrated_v5b.20130502.genotypes_annotated.vcf.gz --make-bed --out chr22data
  plink --bfile chr22data --freq --out chr22freqs
  
  ```
  
  2. An alternative option is to build your own 'SNP names' based on chromosome and cordinate (e.g. 22\_16255382) using plink commands.
  
  
  ---
  
  