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

Problem when running Muscle_wrapper.R #1

Open
sdontsay opened this issue Oct 9, 2023 · 2 comments
Open

Problem when running Muscle_wrapper.R #1

sdontsay opened this issue Oct 9, 2023 · 2 comments

Comments

@sdontsay
Copy link

sdontsay commented Oct 9, 2023

Hi Kwangmoon,

Thanks for your tool and informative instructions on running it, but I still have some questions about running it.

  1. When running the script "Muscle_wrapper.R", at the last step, run "Muscle(datatensor,R=Rank,tol=tol,maxiter=maxiter,dir_out=dir_out,dir_functions = dir_functions,chr_num=chr_num,modality = modality,ssh)", I always got the error saying that "parallel not found", even if I have set GNU=FALSE and ssh=NULL. Later, I realized I can force they do not call parallel in the rankone_Muscle() function, but I am wondering is it some bugs of the codes or I missed something important?

  2. After skipping the "parallel not found" error, I keep receiving the error as follows,

Error in gzfile(file, "rb") : cannot open the connection
In addition: Warning messages:
1: In gzfile(file, "rb") :
cannot open compressed file '/mmfs1/scratch/……/Muscle/data/data1_modeA_res.rds', probable reason 'No such file or directory'
2: In gzfile(file, "rb") :
cannot open compressed file '/mmfs1/scratch/……/Muscle/data/data1_modeA_res.rds', probable reason 'No such file or directory'

It seems like I need to run the initializer.R in the rankone_Muscle() function in Muscle_functions.R to create those files first, then run the remaining codes. The thing is, I see that if I set GNU=TRUE, the codes in Muscle_functions.R can create those files indeed, but if I set it to FALSE, there are no codes to create the files when the condition is met. Here below is the code snippet creating the files,

if(GNU==TRUE){
if(!is.null(ssh))system(paste0('cd ',dir_functions,'; parallel -S ',ssh,' --jobs 4 --workdir . Rscript ::: Initializer.R ::: ', which.tensors, ' ::: ',dir_out))
if(is.null(ssh))system(paste0('cd ',dir_functions,'; parallel --jobs 4 --workdir . Rscript ::: Initializer.R ::: ', which.tensors, ' ::: ',dir_out))
}

and after this, you created a loop to read the _modeA_res.rds and _modeB_res.rds files, but we don't have those files on disk if GNU=FALSE.

Thus, I tried to write a GNP!=FALSE code to do that work, as follows,

if(GNU!=TRUE){
for(chr in 1:chr_num){
system(paste0('cd ',dir_functions,"; Rscript --vanilla Initializer.R ",chr,' ',' ',dir_out))
}
}

The thing is, I am not quite familiar with your code, I believe I got something wrong with modification, and it did not work out. So, could you review your code, check out if there are any bugs, and help me work this out?

BTW, I am using the Liu et al. 2021 data set you provided to do this.

Thanks a lot

@kmp0223
Copy link
Contributor

kmp0223 commented Oct 13, 2023

Hi sdontsay,

Thanks for bringing up this issue! To comment about your issues one by one,

  1. The Muscle relies on the "parallel" for estimating the modality and chromosome specific parameters $A_{chr,r}$, $B_{chr,r}$, $v_{CG,r}$, and $v_{CH,r}$. I highly recommend installing "parallel" based on this link : (https://medium.com/analytics-vidhya/simple-tutorial-to-install-use-gnu-parallel-79251120d618) for faster computation.

  2. As for the GNU!=FALSE case, the code " btd_res[[chr]]$A=tryCatch(readRDS(paste0(outname,chr,'_modeA_res.rds')),error=function(e){system(paste0('cd ',dir_functions,"; Rscript --vanilla Initializer.R ",
    chr,' ', dir_out));return(readRDS(paste0(outname,chr,'_modeA_res.rds')))})" in the rankone_Muscle() function

first checks if the loci loading matrix $A_{chr,r}$ is in the directory and otherwise runs the Initializer with vanilla R, so I would say there is a code that conducts the estimation for the modality and chromosome specific parameters.

I entirely changed the codes for the ones who does not have "parallel" installed. So can you maybe follow the steps in the Wiki page and let me know if there still is any issue?

Thank you very much!

Best,
Kwangmoon

@sdontsay
Copy link
Author

Hi Kwangmoon,

Thanks for your reply! These days I am quite busy, and I will try your new code when I've got free time soon. I will let you know if I have any further questions.

Hope they work on my end, and have a nice weekend!

Regards,

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

2 participants