Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

one error at step 3 #1

Open
kys21207 opened this issue Feb 2, 2023 · 2 comments
Open

one error at step 3 #1

kys21207 opened this issue Feb 2, 2023 · 2 comments

Comments

@kys21207
Copy link

kys21207 commented Feb 2, 2023

Hi CGWAS,

Please see the error below. I am not sure why I met the error.

"Error in summary.connection(connection) : invalid connection"

cgwas(gwasFilePath, snpFilePath, outputPath,
traitName = traitName, mrafFilePath = mrafFilePath, indSNPN = indSNPN)


/ / / /| | / // | / /
/ / ______ / / __ | | /| / // /| | _

/ /
/_____// /
/ / | |/ |/ // ___ | / /
_
/ _
/ |/|//
/ |
|/
___/ version 0.9.3

========== C-GWAS basic parameters ==========

GWAS result file path : /home/cdsw/test_cgwas
SNP information file path : ~/test_cgwas/SnpInfo
GWAS name : D1, D2, D3
Exclude NA : TRUE
MRAF path : ~/test_cgwas/mraf
Output path : /home/cdsw
Keep i-EbICoW output : FALSE
Parallel number : 20

========== C-GWAS advanced parameters ==========

User define 2/13 parameters

Independent SNP number : 1e+05
Min EbICoW power increase ratio : 1.1

Other 11/13 parameters are in default

========== C-GWAS step 1 : Data formating ==========

Read and format 3 GWASs ..

0 SNP with NA found
==================================================
--------------------------------------------------
==================================================

C-GWAS step 1 completed
Step 1 takes 104.9 Secs.

========== C-GWAS step 2 : GetI ==========

Estimating inflation for 3 GWASs ..
Adjusted GWASs test statistics written to Details/i-EbICoW/
Summary of GetI written to Details/SummaryGetI.txt

C-GWAS step 2 completed
Step 2 takes 20.3 Secs.

========== C-GWAS step 3 : GetPsi ==========

Estimating background correlation for 3 GWAS pairs ..
Error in summary.connection(connection) : invalid connection

@kys21207
Copy link
Author

kys21207 commented Feb 2, 2023

Code

outputPath <- getwd() # set the directory of the output files
ExDataDir <- "~/test_cgwas"
gwasFileName <- c("d1.assoc", "d2.assoc", "d3.assoc")
gwasFilePath <- file.path(ExDataDir, gwasFileName)
snpFilePath <- file.path(ExDataDir, 'SnpInfo')
traitName <- c("D1", "D2", "D3")

mrafFilePath <- file.path(ExDataDir, 'mraf')
indSNPN = 1e5

cgwas(gwasFilePath, snpFilePath, outputPath,
traitName = traitName, mrafFilePath = mrafFilePath, indSNPN = indSNPN)

@kys21207
Copy link
Author

kys21207 commented Feb 3, 2023

I found the cause in the code below. It looks like you forgot to add 'registerDoParallel(cl)' in step 3. See the updated code below. Now it works well..

GetPsi

step3 <- function(cgwasenv) {
logOutput("========== C-GWAS step 3 : GetPsi ==========\n\n", cgwasenv = cgwasenv)
logOutput("Estimating background correlation for ",
nrow(pairma <- t(combn(seq_len(cgwasenv$.TRAIT_NUM), 2))),
" GWAS pairs ..\n", cgwasenv = cgwasenv)

minsnpn = 1e5
maSpltRw = ceiling(cgwasenv$.SNP_N / minsnpn)
maSpltN = floor(cgwasenv$.SNP_N / maSpltRw) * maSpltRw
resinfm <- as.matrix(
read.table(file.path(cgwasenv$.CGWAS_DETAIL_PATH, "SummaryGetI.txt"),
header = T)[,-1])

threadNCur <- min(cgwasenv$.PARAL_NUM, nrow(pairma))
cl <- makeCluster(threadNCur)
registerDoParallel(cl)

globalVariables(c('i'))

i <- 1 # assign parallel control variants

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant