R loop using PLINK keeps stalling
0
0
Entering edit mode
4.1 years ago

Hi

I have a loop set up in R which calls in PLINK for part of the loop. It works completely fine on my work laptop (Window 10) but when I try it on my personal laptop ( also windows 10) and will the same versions of PLINK and R - the loop keeps stalling which the errer message saying "child process failing to respond".

Can anyone advise how I can rectify this please? Am I missing some drivers or are some there some limitation setting on my personal latop?

Many thanks Key

R PLINK Loop • 1.3k views
ADD COMMENT
1
Entering edit mode

There's not enough information to help you. My guess is that you're running out of memory.

ADD REPLY
0
Entering edit mode

Thanks for that - how would I know if I am running out of memory please? When PLINK runs it states how much RAM is detected (8084MB) and that half of it if left for main workspace. The files created in each loop are overwritten each time so there is no decrease in computer space capacity. I agree it is something to do with my laptop rather than the program - but I am not a computer person so don't know what to look for.... what type of information would you need to advise on this please?

ADD REPLY
0
Entering edit mode

Please provide your R code for forloop.

ADD REPLY
0
Entering edit mode

I am using the magic for loop but i don't think its the code as it is working for my work laptop fine - it just keeps stalling on my personal laptop. The loop is pretty long....

library(data.table)
library(magicfor)
library(pROC)
setwd("C:/Users/*******")
base<-fread("******", header=T, data.table=F)
target<-fread("*******", header=F, data.table=F)

base$Pvalue<-as.numeric(base$Pvalue) 
magic_for(print, silent=T)
for(i in seq(0.00000005, 0.5, 0.000005)){
Threshold<-i
print(Threshold)
snps<-base[base$Pvalue<=Threshold, ]
Total.SNPs<-nrow(snps)
print(Total.SNPs)
a<-which(snps$MarkerName %in% target$V2)
Common.SNPS<-length(a)
print(Common.SNPS)
training<-base[a, ]
test<-nrow(training)
print(test)
write.table(training[,c(3,4,6)], "training.score", col.names=F, row.names=F, quote=F, sep="\t")
command<-sprintf("/Users/*********/plink --bfile NeuroChipAPOE --score training.score --out prs")
system(command)
prs<-fread("prs.profile", header=T, data.table=F)
prs$SCORE<-as.numeric(prs$SCORE)
prs$PHENO<-as.numeric(prs$PHENO)
score<-prs$SCORE
case<-prs$PHENO-1
glm<-glm(case~score, family=binomial)
P.value<-coef(summary(glm))[2,4]
print(P.value)
}

summary<- magic_result_as_dataframe()
write.table(summary, "Summary.txt", col.names=T, row.names=F, quote=F, sep="\t")
ADD REPLY
0
Entering edit mode

Thanks for fixing the script zx8754 - did a copy and paste quickly between teaching sessions - came back to find it sorted

ADD REPLY

Login before adding your answer.

Traffic: 2096 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6