This is a test version of Biostars. For the public version, visit https://www.biostars.org.
update-chr issues with PLINK 1.9

Hello,

I am trying to update rsids then chromosome # in a PLINK file

.bim file starts out looking like this:

23  23:2700157:G:A  0   2700157 A   G
23  23:2700163:G:A  0   2700163 A   G
23  23:2703633:A:G  0   2703633 G   A

I make a update_rsid.txt file:

23:2700157:G:A X:2700157:G:A
23:2700163:G:A X:2700163:G:A
23:2703633:A:G X:2703633:A:G

run:

plink \
--bfile my_file \
--keep-allele-order \
--update-name update_rsid.txt \
--make-bed \
--out my_file_rsid_updated

updated bim file looks good now:

23  X:2700157:G:A   0   2700157 A   G
23  X:2700163:G:A   0   2700163 A   G
23  X:2703633:A:G   0   2703633 G   A

I make update_chr.txt:

X:2700157:G:A X
X:2700163:G:A X
X:2703633:A:G X

then try to update chrs:

plink \
--bfile my_file_rsid_updated \
--keep-allele-order \
--update-chr update_chr.txt \
--make-bed \
--out my_file_chr_updated

plink spits out this:

--update-chr: 10728 values updated.

but if I open the bim file it looks like nothing happened:

23  X:2700157:G:A   0   2700157 A   G
23  X:2700163:G:A   0   2700163 A   G
23  X:2703633:A:G   0   2703633 G   A

Am I implementing something wrong?

plink

1 answer

plink 1.9 treats the chromosome codes “23” and “X” as interchangeable, but for backward compatibility it defaults to outputting the numeric form. Use —output-chr (https://www.cog-genomics.org/plink/1.9/data#irreg_output ) to change this for a specific run.

Note that plink 2.0 outputs X instead of 23 by default; if you don’t want to use —output-chr all the time, an alternative is to use 2.0 when possible.

when I use --output-chr X, I get error. When I use --output-chr M it seems to accurately recode my chr 23 variants as X

X   X:2700157:G:A   0   2700157 A   G
X   X:2700163:G:A   0   2700163 A   G
X   X:2703633:A:G   0   2703633 G   A

Does this seem right, but I am a little baffled by it so am afraid to trust without understanding. Thank you so much

As explained in the documentation, —output-chr’s argument is the mitochondrial code, since that changes the most between datasets.

Thank you again, I didn't quite get that part of the documentation but I do now with the clarification.

Log in to answer this question.