Modify ID column in VCF file
1
0
Entering edit mode
2.6 years ago
Figaro1993 • 0

Hello,

I have a vcf file that has the following first three columns:

CHROM POS ID

chr1 121 .
chr1 125 .
chr1 127 .
chr2 100 .

how can I change the Column "ID" so that it consists out of CHROM + ID like in the following example:

CHROM POS ID

chr1 121 chr1:121
chr1 125 chr1:125
chr1 127 chr1:127 chr2 100 chr2:100

Thank you all for your help! Max

SNP VCF • 1.4k views
ADD COMMENT
3
Entering edit mode
2.6 years ago

use bcftools annotate https://samtools.github.io/bcftools/bcftools.html#annotate

-I, --set-id [+]FORMAT

    assign ID on the fly. The format is the same as in the query command (see below). By default all existing IDs are replaced. If the format string is preceded by "+", only missing IDs will be set. For example, one can use
ADD COMMENT
0
Entering edit mode

I tried it and it works. Thank you for the fast reply!

ADD REPLY

Login before adding your answer.

Traffic: 1922 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