Change chromosome notation in dbSNP VCF file
0
0
Entering edit mode
2.7 years ago

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 • 2.0k views
ADD COMMENT
1
Entering edit mode

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.

ADD REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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.

ADD REPLY

Login before adding your answer.

Traffic: 2263 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6