ld_clump error

726 views
Skip to first unread message

fcz

unread,
Oct 10, 2023, 11:53:36 AM10/10/23
to plink2-users

I am trying to perform clumping using the 1000 genomes as reference dataset.

Here is my code

clump_data(
summaryset_orru_format,
clump_kb = 10000,
clump_r2 = 0.001,
clump_p1 = 1,
clump_p2 = 1,
pop = "EUR"
)

Error in api_query("ld/clump", query = list(rsid = dat[["rsid"]], pval = dat[["pval"]], :
The query to MR-Base exceeded 300 seconds and timed out. Please simplify the query

I tried another approach. Running local LD operations.

To get a path to plink you can do the following:

devtools::install_github("explodecomputer/genetics.binaRies")
plink <- genetics.binaRies::get_plink_binary()

To get the same LD reference dataset that is used by the API, you can download it directly from here:http://fileserve.mrcieu.ac.uk/ld/1kg.v3.tgz

and tried this

orru_clump <- ld_clump(
dplyr::tibble(rsid = summaryset_orru$rsid, pval = summaryset_orru$p, id = summaryset_orru$id),
plink_bin = plink,
bfile = "1kg.v3" #this is in the same directory of my R project
)

The outcome is

Clumping ebi-a-GCST90001942, 15141982 variants, using EUR population reference
PLINK v1.90b7 64-bit (16 Jan 2023) www.cog-genomics.org/plink/1.9/
(C) 2005-2023 Shaun Purcell, Christopher Chang GNU General Public License v3
Logging to C:\Users\corsfmdg\AppData\Local\Temp\Rtmp63D8xl\file393034026c62.log.
Options in effect:
--bfile 1kg.v3
--clump C:\Users\corsfmdg\AppData\Local\Temp\Rtmp63D8xl\file393034026c62
--clump-kb 10000
--clump-p1 0.99
--clump-r2 0.001
--out C:\Users\corsfmdg\AppData\Local\Temp\Rtmp63D8xl\file393034026c62

65210 MB RAM detected; reserving 32605 MB for main workspace.
Error: Failed to open 1kg.v3.bed.
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
cannot open file 'C:\Users\corsfmdg\AppData\Local\Temp\Rtmp63D8xl\file393034026c62.clumped': No such file or directory

Christopher Chang

unread,
Oct 10, 2023, 12:00:43 PM10/10/23
to plink2-users
I don't have experience using that R package, but my first guess is that you need to explicitly specify the bfile directory, because it looks like the R command is running plink 1.9 in a temporary directory that's doesn't have your bfile.

fcz

unread,
Oct 11, 2023, 6:30:12 AM10/11/23
to plink2-users
Thank you. 

I have tried two different approaches

plink2 <- "C:/Users/corsfmdg/Desktop/R/R_ME" # This is the same directory as my R project

plink <- "C:/Program Files/R/R-4.2.2/library/genetics.binaRies/bin/plink.exe" # This is set my R when I use the code genetics.binaRies::get_plink_binary()

** Using Plink2 **

orru_clump <- ld_clump(
  dplyr::tibble(rsid=summaryset_orru$rsid, pval=summaryset_orru$p, id=summaryset_orru$id),
  plink_bin = "plink2",
  bfile = "1kg.v3"
)
 
Clumping ebi-a-GCST90001942, 15141982 variants, using EUR population reference Error in file(file, "rt") : cannot open the connection In addition: Warning message: In file(file, "rt") : cannot open file 'C:\Users\corsfmdg\AppData\Local\Temp\Rtmp63D8xl\file39303fa538bf.clumped': No such file or directory

** Using Plink1 **

orru_clump <- ld_clump(
  dplyr::tibble(rsid = summaryset_orru$rsid, pval = summaryset_orru$p, id = summaryset_orru$id),
  plink_bin = "plink",
  bfile = "1kg.v3"
)

Clumping ebi-a-GCST90001942, 15141982 variants, using EUR population reference PLINK v1.90b7 64-bit (16 Jan 2023) www.cog-genomics.org/plink/1.9/ (C) 2005-2023 Shaun Purcell, Christopher Chang GNU General Public License v3 Logging to C:\Users\corsfmdg\AppData\Local\Temp\Rtmp63D8xl\file3930d7a4440.log. Options in effect: --bfile 1kg.v3 --clump C:\Users\corsfmdg\AppData\Local\Temp\Rtmp63D8xl\file3930d7a4440 --clump-kb 10000 --clump-p1 0.99 --clump-r2 0.001 --out C:\Users\corsfmdg\AppData\Local\Temp\Rtmp63D8xl\file3930d7a4440 65210 MB RAM detected; reserving 32605 MB for main workspace. Error: Failed to open 1kg.v3.bed. Error in file(file, "rt") : cannot open the connection In addition: Warning message: In file(file, "rt") : cannot open file 'C:\Users\corsfmdg\AppData\Local\Temp\Rtmp63D8xl\file3930d7a4440.clumped': No such file or directory

It seems Plink1 has more on the outcome but I am still experiencing the error...

fcz

unread,
Oct 11, 2023, 6:31:15 AM10/11/23
to plink2-users
correction plink1 is just plink

Chris Chang

unread,
Oct 11, 2023, 6:58:51 AM10/11/23
to fcz, plink2-users
Please reread my response.

--
You received this message because you are subscribed to the Google Groups "plink2-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to plink2-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/plink2-users/b1baed7b-6c96-492d-b4bb-d53ea4e6c9e0n%40googlegroups.com.

Chris Chang

unread,
Oct 11, 2023, 7:10:26 AM10/11/23
to fcz, plink2-users
And more generally, the problem here isn’t with plink, it’s with an R package I didn’t write.  You should contact the R package devs/maintainers for support.

Yijun Chen

unread,
Aug 20, 2024, 5:58:40 AM8/20/24
to plink2-users
Hi there, did you manage to resolve this issue? I'm encountering the same problem while using PLINK2 for clumping. Below is the error message I'm receiving:
PLINK v2.00a6 M1 (18 Aug 2024)                 www.cog-genomics.org/plink/2.0/
(C) 2005-2024 Shaun Purcell, Christopher Chang   GNU General Public License v3
Logging to /var/folders/yx/srfyn_x12ds4m5slvhktqbbh0000gn/T//Rtmp5czTBK/file2c0760871e08.log.
Options in effect:
  --bfile /Users/chenyijun/R_workspace/R_basic/MR/DEG_MR/eqtl_clump_test/EU1000QC/EU1000QC
  --clump /var/folders/yx/srfyn_x12ds4m5slvhktqbbh0000gn/T//Rtmp5czTBK/file2c0760871e08
  --clump-kb 100
  --clump-p1 1
  --clump-r2 0.1
  --out /var/folders/yx/srfyn_x12ds4m5slvhktqbbh0000gn/T//Rtmp5czTBK/file2c0760871e08
  --threads 1

Start time: Tue Aug 20 11:06:35 2024
16384 MiB RAM detected; reserving 8192 MiB for main workspace.
Using 1 compute thread.
503 samples (0 females, 0 males, 503 ambiguous; 503 founders) loaded from
/Users/chenyijun/R_workspace/R_basic/MR/DEG_MR/eqtl_clump_test/EU1000QC/EU1000QC.fam.
8550156 variants loaded from
/Users/chenyijun/R_workspace/R_basic/MR/DEG_MR/eqtl_clump_test/EU1000QC/EU1000QC.bim.
Note: No phenotype data present.
Error:
/var/folders/yx/srfyn_x12ds4m5slvhktqbbh0000gn/T//Rtmp5czTBK/file2c0760871e08
is empty.

End time: Tue Aug 20 11:06:36 2024

Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
  cannot open file '/var/folders/yx/srfyn_x12ds4m5slvhktqbbh0000gn/T//Rtmp5czTBK/file2c0760871e08.clumped': No such file or directory
Called from: file(file, "rt")
Error during wrapup: unimplemented type (29) in 'eval'

Error: no more error handlers available (recursive errors?); invoking 'abort' restart
Error during wrapup: INTEGER() can only be applied to a 'integer', not a 'unknown type #29'
Error: no more error handlers available (recursive errors?); invoking 'abort' restart
************************************************************************************

The temporary R file generated an error, but I'm not sure how to fix it.
Reply all
Reply to author
Forward
0 new messages