Nanostring-Biostats / GeomxTools

Tools for NanoString GeoMx Digital Spatial Profiler data for reading DCC and PKC files to NanoStringGeomxSet class, Normalization and QC.
MIT License
35 stars 16 forks source link

mixedModelDE gives "object <groupVar> not found" error when replicating vignette. #187

Closed joshscurll closed 1 year ago

joshscurll commented 1 year ago

I am attempting to use the mixedModelDE function for differential expression analysis (post- vs pre-treatment tissue) as per Section 7.3 in the GeoMx Workflows vignette (https://bioconductor.org/packages/release/workflows/vignettes/GeoMxWorkflows/inst/doc/GeomxTools_RNA-NGS_Analysis.html#73_Between_Slide_Analysis:_Diabetic_Kidney_Disease_vs_Healthy). In my case, I am analysing pre- and post-treatment tissue from a single patient, so I have no need to include any variable in the model intercept, but otherwise my code is the same as the vignette. However, mixedModelDE returns "object 'testClass' not found" as an error. This error seems to have been encountered by someone else here: https://bytemeta.vip/repo/Nanostring-Biostats/GeomxTools/issues/174. I have added a "testClass" factor column to my pData and included it in the model formula as in the vignette, so I don't know how to resolve this error.

Here is my code that produces the error: ` pData(target_DSPdata)$testClass <- factor(pData(target_DSPdata)$sample_type)

DEA_results <- c() for(segmt in DSP_segs){ ind <- pData(target_DSPdata)$segment == segmt mixedOutmc <- mixedModelDE(target_DSPdata[, ind], elt = "log2_Q3_norm", modelFormula = ~ testClass + 1, groupVar = "testClass", nCores = 1, #parallel::detectCores(), multiCore = FALSE)

r_test <- do.call(rbind, mixedOutmc["lsmeans", ]) tests <- rownames(r_test) r_test <- as.data.frame(r_test) r_test$Contrast <- tests

r_test$Gene <- unlist(lapply(colnames(mixedOutmc), rep, nrow(mixedOutmc["lsmeans", ][[1]]))) r_test$Subset <- segmt r_test$FDR <- p.adjust(r_test$Pr(>|t|), method = "fdr") r_test <- r_test[, c("Gene", "Subset", "Contrast", "Estimate", "Pr(>|t|)", "FDR")] DEA_results <- rbind(DEA_results, r_test) } `

This returns the following error:

Error in eval(predvars, data, env) : object 'testClass' not found

maddygriz commented 1 year ago

Hi @joshscurll,

Thank you for reaching out. Our customer support team will be able to help you with this. Please email support@nanostring.com with your issue.

Thanks, Maddy