--cm-map error

371 views
Skip to first unread message

Antonio Nappi

unread,
Feb 13, 2023, 5:00:53 AM2/13/23
to plink2-users
I want to calculate LDSC for my genetic data and I need the centimorgan position, since it;s not present in my bim file I downloaded a genetic map for my version of the human genome. The genetic map has the following structure:
```
chr position COMBINED_rate(cM/Mb) Genetic_Map(cM)
3 19435 0.0 0.0
3 19817 1.4456717107 0.000552246593487
3 20548 1.2616791064 0.001474534020266
3 20631 1.1281096164 0.001568167118427
3 20936 0.8632509178 0.001831458648356
3 21068 0.6555777504 0.001917994911409
```
and I have one map for each chrom.
When I run the following command:
```
plink --bfile ~/ukb_imp_chr1_v3_filtered_hg38 --cm-map ~/genetic_map_hg38_chr1.txt 1 --make-bed --out ~/ukb_imp_chr1_v3_filtered_hg38_with_cm
```
I got the following error:
```
Error: Line 1 of --cm-map file has fewer tokens than expected.
```
but I don't know which tokens does plink expect. How could I solve it?

Christopher Chang

unread,
Feb 13, 2023, 11:40:25 AM2/13/23
to plink2-users
Thanks for reporting this, I will fix the behavior today.  The problem is actually that there is one more column than expected (an older version of this format did not have the 'chr' column), the error message is mistaken.

A temporary workaround is to use e.g. Unix "cut" to remove the chr column, before providing the file to plink 1.9.

Antonio Nappi

unread,
Feb 13, 2023, 12:54:39 PM2/13/23
to plink2-users
So basically if I run it without the chr col will it work?

Christopher Chang

unread,
Feb 13, 2023, 12:58:31 PM2/13/23
to plink2-users
That is what I'd expect.

Antonio Nappi

unread,
Feb 13, 2023, 1:03:29 PM2/13/23
to plink2-users
Hi Chris, it still doesn't work. The genetic map file is like this one now
position COMBINED_rate(cM/Mb) Genetic_Map(cM)
19435 0.0 0.0
19817 1.4456717107 0.000552246593487
20548 1.2616791064 0.001474534020266
20631 1.1281096164 0.001568167118427
20936 0.8632509178 0.001831458648356
21068 0.6555777504 0.001917994911409
21733 0.6454703468 0.002347232692031
22491 0.6353251051 0.002828809121726
22838 0.6330344657 0.003048472081324
the error is the same of the first message, what could I try to fix it?

Christopher Chang

unread,
Feb 13, 2023, 1:25:30 PM2/13/23
to plink2-users
I am unable to replicate what you describe.  Please post a full .log file, the (clipped) genetic map file that you're trying to use, and a plink fileset (could be a fake one with just one sample and one variant) that allows me to reproduce the error.

Antonio Nappi

unread,
Feb 13, 2023, 2:20:31 PM2/13/23
to plink2-users
Hi Chris,
here there .log file:
PLINK v1.90b6.24 64-bit (6 Jun 2021) www.cog-genomics.org/plink/1.9/ (C) 2005-2021 Shaun Purcell, Christopher Chang GNU General Public License v3 Logging to /lustre/groups/shared/ukbb-87065/dataset/genos/imputed/bfile-filtered-hg38-with-cm/ukb_imp_chr1_v3_filtered_hg38.log. Options in effect: --bfile /lustre/groups/shared/ukbb-87065/dataset/genos/imputed/bfile-filtered-hg38/ukb_imp_chr1_v3_filtered_hg38 --cm-map /lustre/groups/shared/ukbb-87065/users/antonio.nappi/genetic_map/plink.chr1.GRCh38.map 1 --make-bed --out /lustre/groups/shared/ukbb-87065/dataset/genos/imputed/bfile-filtered-hg38-with-cm/ukb_imp_chr1_v3_filtered_hg38 772500 MB RAM detected; reserving 386250 MB for main workspace. 843784 variants loaded from .bim file. 487409 people (222956 males, 264246 females, 207 ambiguous) loaded from .fam. Ambiguous sex IDs written to /lustre/groups/shared/ukbb-87065/dataset/genos/imputed/bfile-filtered-hg38-with-cm/ukb_imp_chr1_v3_filtered_hg38.nosex .
Error: Line 1 of --cm-map file has fewer tokens than expected.

here the genetic map:
position COMBINED_rate(cM/Mb) Genetic_Map(cM)
55550 0.0 0.0
632942 0.0 0.0
633147 0.0 0.0
785910 2.685807669 0.410292036939447
788439 2.8222713027 0.417429561063975
788511 2.9813105581 0.417644215424158
792862 2.9806151254 0.430612871834774
794568 3.0780969498 0.435864105231133
805477 3.075133293 0.46941073432447

here the bim file:

1 1:692794_CA_T  0.0  756324 T CA 0

the fam file:

480
480 0 0 1 -9 0

I won't allegate the bed file, but the script to generate it is quite simple:
import numpy as np
bed = np.random.randint(0,2,(1,192125))

Christopher Chang

unread,
Feb 13, 2023, 4:16:40 PM2/13/23
to plink2-users
Still doesn't replicate for me.  Are you sure you are pointing --cm-map to your new 3-column file, rather than the original 4-column one?

Christopher Chang

unread,
Feb 14, 2023, 12:03:23 AM2/14/23
to plink2-users
Meanwhile, I have posted a PLINK 1.9 development build which should support the 4-column map dialect; let me know if that works with your 4-column files.  (Note that you must not specify the chromosome code on the command line when providing a 4-column map file.)

Antonio Nappi

unread,
Feb 14, 2023, 3:08:11 AM2/14/23
to plink2-users
Hi Christopher, yes I overwrite the files so they are the 3-column files. I will try with the new version of plink, I will let you know.

Antonio Nappi

unread,
Feb 14, 2023, 3:16:36 AM2/14/23
to plink2-users
Hi Christopher, I have restored the 4-col file and now the error provived, with the new version of plink, it's the following one:
Error: Invalid bp coordinate on line 2 of --cm-map file.

Antonio Nappi

unread,
Feb 14, 2023, 4:01:44 AM2/14/23
to plink2-users
Hi Christopher, my bad. Now it works perfectly. Thanks you for your reply :)
Reply all
Reply to author
Forward
0 new messages