yafeng / DEqMS

DEqMS is a tool for quantitative proteomic analysis
22 stars 3 forks source link

Error in simpleLoess(y, x, w, span, degree = degree, parametric = parametric, : NA/NaN/Inf in foreign function call (arg 2) #4

Closed hzaurzli closed 3 years ago

hzaurzli commented 3 years ago

Dear Author: when i ues DEqMS to fit the model:fit3$count = psm.count.table[rownames(fit3$coefficients),"count"] fit4 = spectraCounteBayes(fit3). i have this problem :Error in simpleLoess(y, x, w, span, degree = degree, parametric = parametric, : NA/NaN/Inf in foreign function call (arg 2)

here is my codes:

cond = as.factor(c(rep("M",21),rep("F",22))) design = model.matrix(~0+cond) # 0 means no intercept for the linear model colnames(design) = gsub("cond","",colnames(design)) x <- c("F-M") contrast = makeContrasts(contrasts=x,levels=design) fit1 <- lmFit(pro_M_F, design) fit2 <- contrasts.fit(fit1,contrasts = contrast) fit3 <- eBayes(fit2) library(matrixStats) count_columns = seq(16,34,2) psm.count.table = data.frame(count = rowMins( as.matrix(df.prot[,count_columns])), row.names = df.prot$Protein.accession) fit3$count = psm.count.table[rownames(fit3$coefficients),"count"] fit4 = spectraCounteBayes(fit3)

when i use this command:fit3$count = psm.count.table[rownames(fit3$coefficients),"count"],it will be error:

fit3$count [1] NA 1 NA NA 4 5 0 11 61 NA 1 NA NA 6 28 6 NA [18] 11 20 NA NA NA NA NA NA NA NA NA NA NA NA 23 NA NA [35] 27 2 NA 3 NA NA 8 3 5 NA 146 NA 1 1 NA 8 NA [52] 1 1 11 747 3 52 5 NA NA 1 27 5 NA NA NA NA NA [69] 3 NA NA NA NA 144 NA 1 1025 6 NA NA NA NA 1 1 NA [86] 18 NA NA NA NA 7 11 NA NA NA NA 6 0 0 355 NA NA [103] NA 1 2 17 18 NA NA 3 NA 10 NA 1 NA NA

can you help me?? thanks

yafeng commented 3 years ago

Your code looks fine to me. I suspect the error is related to NA values to the input matrix.

Have you checked if each group has minimum two valid values ? Aslo Make sure No any zero or NA present in fit3$count. Otherwise a quick test is to use oa.omit to filter out all rows with NA.

If no error remains, you have to double check if you have met the requirements.

Let me know how it goes.

Yafeng

在 2021年7月20日,19:58,Small runze @.***> 写道:



Dear Author: when i ues DEqMS to fit the model:fit3$count = psm.count.table[rownames(fit3$coefficients),"count"] fit4 = spectraCounteBayes(fit3). i have this problem :Error in simpleLoess(y, x, w, span, degree = degree, parametric = parametric, : NA/NaN/Inf in foreign function call (arg 2)

here is my codes:cond = as.factor(c(rep("M",21),rep("F",22)))

design = model.matrix(~0+cond) # 0 means no intercept for the linear model colnames(design) = gsub("cond","",colnames(design))

x <- c("F-M") contrast = makeContrasts(contrasts=x,levels=design) fit1 <- lmFit(pro_M_F, design) fit2 <- contrasts.fit(fit1,contrasts = contrast) fit3 <- eBayes(fit2)

library(matrixStats) count_columns = seq(16,34,2) psm.count.table = data.frame(count = rowMins( as.matrix(df.prot[,count_columns])), row.names = df.prot$Protein.accession) fit3$count = psm.count.table[rownames(fit3$coefficients),"count"] fit4 = spectraCounteBayes(fit3)

can you help me?? thanks

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/yafeng/DEqMS/issues/4, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAXG6N3CCGZYBTQ3KFBJV4LTYVQH7ANCNFSM5AVUYJJA.