Answers.Body: <p>It sounds like you downloaded the dbSNP release for the GRCh38 or GRCh37 genome releases from the <a href="https://www.ncbi.nlm.nih.gov/grc" rel="nofollow noreferrer">Genome Reference Consortium</a> (GRC) which name the chromosomes without the <code>chr</code> prefix and you were previously using a file that had been built using either hg19 or hg38 which use the <code>chr</code>. </p>
  
  <p>As far as I know, dbSNP only offers vcf files built against the GRC genome builds, so you (or someone else) had probably already modified the old file you were using and changed the chromosome names.</p>
  
  <p>Also note that if you want the latest version, you should download <a href="ftp://ftp.ncbi.nih.gov/snp/organisms/human_9606/VCF/All_20180418.vcf.gz" rel="nofollow noreferrer">ftp://ftp.ncbi.nih.gov/snp/organisms/human_9606/VCF/All_20180418.vcf.gz</a>. </p>
  
  <p>Anyway, yes, you can simply change the VCF to use <code>chrN</code> instead of <code>N</code>. Note, however, that you will also need to change the name of the mitochondrial chromosome from <code>MT</code> to <code>chrM</code></p>
  
  <p>You can do all this very easily with <code>sed</code>:</p>
  
  <pre><code>zcat All_20170710.vcf.gz | 
      sed -E '/^[^#]/{s/^([^#]+)/chr\1/; s/^chrMT/chrM/}' &gt; All_20170710.fixed.vcf
  </code></pre>
  
  <p>The command above will work on most <code>sed</code> implementations, including Linux (GNU sed) and also macOS (BSD sed). </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-10T11:53:43.373Z
Answers.Text: @heathobrien, @terdon : A little clarification here. I have downloded dbsnp_138.hg19.vcf.gz which use `chr` prefix and in file All_20170710 from GRC contains number only.
Answers.UserDisplayName: Lot_to_learn
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-10T12:00:51.753Z
Answers.Text: @Lot_to_learn whoops, yes sorry. GRC uses numbers only, it's the hg19 and hg38 that use `chr`. Answer edited. Also, where are you downloading these files from?
Answers.UserDisplayName: terdon
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-10T12:06:06.310Z
Answers.Text: @Lot_to_learn please see the updated answer. The first version would not have corrected the names for `chrX` and `chrY`.
Answers.UserDisplayName: terdon
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-12T09:26:16.897Z
Answers.Text: I have found more rs IDs from new dbSNP as comparison to old one. For one patient I got 3200 approx new rs IDs. Although I was expecting more new rs IDs. Thanks. This is working well.
Answers.UserDisplayName: Lot_to_learn
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-12T12:29:06.083Z
Answers.Text: @Lot_to_learn did you use the very latest edited version of my answer? The first had a couple of problems. To check, make sure that you have `chrMT`, `chrY` and `chrX` in the file.
Answers.UserDisplayName: terdon
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-13T12:32:38.530Z
Answers.Text: A little correction in my previous comment. I don't know why, when I checked no. of rs ID's using grep, it shows big number but gatk tool shows very less known rs ID.So when I use latest version of dbSNP I found very less known and most of the mutations are novel according to gatk variantEval. When I checked, I found that its reference is GRC38. So I use 2017 version of dbSNP. Now I am getting lot more known variants in variantEval. Now I am OK with 2017th version of dbSNP. Thanks.
Answers.UserDisplayName: Lot_to_learn
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-23T18:50:33.640Z
Answers.Text: Keep in mind that the different names sometimes correspond to different genome builds, so you should make absolutely sure that you are using the right (compatible) reference genome build before doing this. Eg you can't use a dbsnp set from b37 with a callset made using hg38 and vice versa.
Answers.UserDisplayName: Geraldine_VdAuwera
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-10T11:24:18.290Z
Answers.LastActivityDate: 2018-05-10T13:21:56.890Z
Answers.LastEditDate: 2018-05-10T13:21:56.890Z
Answers.UserDisplayName: terdon
Body: <p>I have used dbSNP build 138 to tag 'rs' ID in my VCF file. But later I came to know that now dbSNP build 150 has been released. I want to update the rs IDs in my VCF file. </p>
  
  <p>I tried but I found a problem for which I need suggestion. With dbSNP build 138, I am getting 450076 total variants, 248236 as known variants and the rest as novel. But when I use the latest dbSNP file, <code>All_20170710.vcf.gz</code>, I am getting same total variants but 0 as known and all as novel which is definitely wrong. </p>
  
  <p>When I checked the reason for this, I found that in the <code>All_20170710.vcf.gz</code> VCF file, all chromosomes are written as numbers like <code>1</code>, <code>2</code>, instead of <code>chr1</code>, <code>chr2</code> while in my vcf file, all chromosomes are written as <code>chr1</code>, <code>chr2</code>. The dbSNP build 138 file also has the chromosome names with the <code>chr</code> prefix, and that's why 138th build was giving good results. </p>
  
  <p>One solution would be add the <code>chr</code> word before chromosome number. Is that an efficient way? How do I do that? If not, what is the correct way to use  the latest dbSNP <code>All_20170710.vcf.gz</code> to tag rs IDs in a vcf file which contains ~32 Billion SNPs instead of <code>dbsnp_138.vcf</code> which contains only ~6 Billion SNPs? Any suggestions??</p>
  
  <p>Thanks</p>
  
Tags: <vcf><sequence-annotation><snp><ngs>
Title: update dbSNP ID
ThreadText: # update dbSNP ID
  
  (Asked by: username_0 on 2018-05-10)
  
  I have used dbSNP build 138 to tag 'rs' ID in my VCF file. But later I came to know that now dbSNP build 150 has been released. I want to update the rs IDs in my VCF file.
  
  I tried but I found a problem for which I need suggestion. With dbSNP build 138, I am getting 450076 total variants, 248236 as known variants and the rest as novel. But when I use the latest dbSNP file, `All_20170710.vcf.gz`, I am getting same total variants but 0 as known and all as novel which is definitely wrong.
  
  When I checked the reason for this, I found that in the `All_20170710.vcf.gz` VCF file, all chromosomes are written as numbers like `1`, `2`, instead of `chr1`, `chr2` while in my vcf file, all chromosomes are written as `chr1`, `chr2`. The dbSNP build 138 file also has the chromosome names with the `chr` prefix, and that's why 138th build was giving good results.
  
  One solution would be add the `chr` word before chromosome number. Is that an efficient way? How do I do that? If not, what is the correct way to use the latest dbSNP `All_20170710.vcf.gz` to tag rs IDs in a vcf file which contains ~32 Billion SNPs instead of `dbsnp_138.vcf` which contains only ~6 Billion SNPs? Any suggestions??
  
  Thanks
  
  **Tags:** vcf, sequence-annotation, snp, ngs
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-05-10. Score: 2 | Accepted answer
  
  It sounds like you downloaded the dbSNP release for the GRCh38 or GRCh37 genome releases from the [Genome Reference Consortium](https://www.ncbi.nlm.nih.gov/grc) (GRC) which name the chromosomes without the `chr` prefix and you were previously using a file that had been built using either hg19 or hg38 which use the `chr`.
  
  As far as I know, dbSNP only offers vcf files built against the GRC genome builds, so you (or someone else) had probably already modified the old file you were using and changed the chromosome names.
  
  Also note that if you want the latest version, you should download <ftp://ftp.ncbi.nih.gov/snp/organisms/human_9606/VCF/All_20180418.vcf.gz>.
  
  Anyway, yes, you can simply change the VCF to use `chrN` instead of `N`. Note, however, that you will also need to change the name of the mitochondrial chromosome from `MT` to `chrM`
  
  You can do all this very easily with `sed`:
  
  ```
  zcat All_20170710.vcf.gz | 
      sed -E '/^[^#]/{s/^([^#]+)/chr\1/; s/^chrMT/chrM/}' > All_20170710.fixed.vcf
  
  ```
  
  The command above will work on most `sed` implementations, including Linux (GNU sed) and also macOS (BSD sed).
  
  > **Comments:**
  > **username_0**: @heathobrien, @username_1 : A little clarification here. I have downloded dbsnp_138.hg19.vcf.gz which use `chr` prefix and in file All_20170710 from GRC contains number only.  
  > **username_1**: @username_0 whoops, yes sorry. GRC uses numbers only, it's the hg19 and hg38 that use `chr`. Answer edited. Also, where are you downloading these files from?  
  > **username_1**: @username_0 please see the updated answer. The first version would not have corrected the names for `chrX` and `chrY`.  
  > **username_0**: I have found more rs IDs from new dbSNP as comparison to old one. For one patient I got 3200 approx new rs IDs. Although I was expecting more new rs IDs. Thanks. This is working well.  
  > **username_1**: @username_0 did you use the very latest edited version of my answer? The first had a couple of problems. To check, make sure that you have `chrMT`, `chrY` and `chrX` in the file.  
  > **username_0**: A little correction in my previous comment. I don't know why, when I checked no. of rs ID's using grep, it shows big number but gatk tool shows very less known rs ID.So when I use latest version of dbSNP I found very less known and most of the mutations are novel according to gatk variantEval. When I checked, I found that its reference is GRC38. So I use 2017 version of dbSNP. Now I am getting lot more known variants in variantEval. Now I am OK with 2017th version of dbSNP. Thanks.  
  > **username_2**: Keep in mind that the different names sometimes correspond to different genome builds, so you should make absolutely sure that you are using the right (compatible) reference genome build before doing this. Eg you can't use a dbsnp set from b37 with a callset made using hg38 and vice versa.  
  
  ---
  
  