This is a test version of Biostars. For the public version, visit https://www.biostars.org.
[PLINK] Error: Duplicate ID when running an --update-ids

I am running the following script to update IDs in my PLINK project:

plink \
   --bfile Project1 \
   --update-ids UpdateIDs\
   --make-bed --out /Renamed/Project1

But when I try to run it, I get the following error:

Error: Duplicate ID '009-009 009-009-01'.

Sample file structure for UpdateIDs:

1   GSA_009-009_009-009-01_A01B01   009-009 009-009-01

Which is a tab-separated file containing following columns: old_fid, old_iid, new_fid, new_iid. I've checked the fam file and there are no actual ID duplicates, which is why I'm currently confused...

software-error gwas snp plink

Hard to guess without seeing your Project1.fam file and UpdateIDs file.

2 answers

Your issue lies in your UpdateIDs file. Particularly, you have multiple values for a singular key (assuming a map-like replacement). You can take one of two paths: either prune the excess lines yourself using a Python script (you will have to decide which value you will want to prioritize for each key) or you can use another tool (something like awk) to prune these lines.

Hello, you should remove the space from "009-009 009-009-01". You can use a function like gsub in R to remove it

Log in to answer this question.