text: user2141: 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
  
  user298: It sounds like you downloaded the dbSNP release for the GRCh38 or GRCh37 genome releases from the Genome Reference Consortium (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). 
  
original_text: 2141: <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>
   298: <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>
  