You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Load your summary statistics from a file
t<-fread("C:/Users/pc/Downloads/Compressed/presso.csv")
t<-t[!duplicated(t$SNP),]
snp<-as.data.frame(t$SNP)
t<-t[,-7]
t<-as.data.frame(t(t))
colnames(t)<-snp$`t$SNP`
t<-as.data.frame(t(t))
# Replace 'your_file_path.txt' with the actual path to your file
SummaryStats <- t
# Set the number of cores you want to use
num_cores <- 20
# Create a cluster with the specified number of cores
cl <- makeCluster(num_cores)
# Export necessary objects and libraries to the cluster
clusterExport(cl, c("SummaryStats", "mr_presso"))
clusterEvalQ(cl, library(MRPRESSO))
# Define a function to run mr_presso
run_mr_presso <- function(i) {
mr_presso(BetaOutcome = "Y_effect",
BetaExposure = "E1_effect",
SdOutcome = "Y_se",
SdExposure = "E1_se",
OUTLIERtest = TRUE,
DISTORTIONtest = TRUE,
data = SummaryStats,
NbDistribution = 6000,
SignifThreshold = 0.05)
}
# Run the function in parallel
results_list <- parLapply(cl, 1:num_cores, run_mr_presso)
# Stop the cluster
stopCluster(cl)
i hope this let you to increase speed of calculation
Dear professor
Is it possible to use multi-threaded work to increase the speed of calculations?
The text was updated successfully, but these errors were encountered: