This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Change chromosome notation in dbSNP VCF file

Hiii, I have downloaded dbSNP VCf file from [https://ftp.ncbi.nih.gov/snp/organisms/human_9606/VCF/] The format is as follows:

#CHROM  POS     ID      REF     ALT     QUAL    FILTER  INFO
1       10019   rs775809821     TA      T       .       .       RS=775809821;RSPOS=10020;dbSNPBuildID=144;SSR=0;SAO=0;VP=0x050000020005000002000200;GENEINFO=DDX11L1:100287102;WGT=1;VC=DIV;R5;ASP
1       10039   rs978760828     A       C       .       .       RS=978760828;RSPOS=10039;dbSNPBuildID=150;SSR=0;SAO=0;VP=0x050000020005000002000100;GENEINFO=DDX11L1:100287102;WGT=1;VC=SNV;R5;ASP
1       10043   rs1008829651    T       A       .       .       RS=1008829651;RSPOS=10043;dbSNPBuildID=150;SSR=0;SAO=0;VP=0x050000020005000002000100;GENEINFO=DDX11L1:100287102;WGT=1;VC=SNV;R5;ASP
1       10051   rs1052373574    A       G       .       .       RS=1052373574;RSPOS=10051;dbSNPBuildID=150;SSR=0;SAO=0;VP=0x050000020005000002000100;GENEINFO=DDX11L1:100287102;WGT=1;VC=SNV;R5;ASP
1       10051   rs1326880612    A       AC      .       .       RS=1326880612;RSPOS=10051;dbSNPBuildID=151;SSR=0;SAO=0;VP=0x050000020005000002000200;GENEINFO=DDX11L1:100287102;WGT=1;VC=DIV;R5;ASP;TOPMED=0.99998407237512742,0.00001592762487257

I want to change the first column, i.e. #CHROM from 1 to chr1. I tried but it changed all 1 into chr1. I want it specifically for column1. Please suggest me how to do it. Thank you.

ngs

What code did you try?

I guess simple sed should do the job (in Linux of course), for example

sed -e 's/^/chr/' file > file.new

It will prefix chr at the beginning of every line.

but I want this in column1 only. how does your command work for column1?

^ (caret character) means starting of the line. So in sed command, I am substituting starting of the line by chr.

Wanting to change chromosome names usually has to do with applying data based on a particular reference on data based on a different one. Make sure you know what you're doing before you actually try to solve your issue.

0 answers

No answers yet.

Log in to answer this question.