I am very new in r for analysis of nanostring. I followed a tutorial for analysing nanostrinf data. But, I did not understand why the script following doesn't work. What is your thought please?
if (!require("BiocManager", quietly = TRUE))
install.packages("BiocManager")
# The following initializes most up to date version of Bioc
BiocManager::install(version="3.15")
BiocManager::install("NanoStringNCTools")
BiocManager::install("GeomxTools")
BiocManager::install("GeoMxWorkflows")
if(packageVersion("GeomxTools") < "2.1" &
packageVersion("GeoMxWorkflows") >= "1.0.1"){
stop("GeomxTools and Workflow versions do not match. Please use the same version.
This workflow is meant to be used with most current version of packages.
If you are using an older version of Bioconductor please reinstall GeoMxWorkflows and use vignette(GeoMxWorkflows) instead")
}
if(packageVersion("GeomxTools") > "2.1" &
packageVersion("GeoMxWorkflows") <= "1.0.1"){
stop("GeomxTools and Workflow versions do not match.
Please use the same version, see install instructions above.")
# to remove current package version
# remove.packages("GeomxTools")
# remove.packages("GeoMxWorkflows")
# see install instructions above
}
I tried the script that you sent to me and you're right about it. The versions of GeomxTools and Workflow versions do not match because I read that:
"GeomxTools and Workflow versions do not match. Please use the same version.
This workflow is meant to be used with most current version of packages.
If you are using an older version of Bioconductor please reinstall GeoMxWorkflows and use vignette(GeoMxWorkflows) instead".
My question is about the update of these packages. Do you know please an site where I can update them at the same version?
@technocrat, sorry to bother you, but I tried to find a way to update the both packages, but I did understand the best way to do that. May be do you have any idea to overcome this issue?
Thank you in advance for your help.
Best
Nazim
Hi @technocrat ,
thank you a lot +++ It is working.
I can do a lot thing, but in this section, the script doesn't work because of 'factor' and its function levels which erased all my vector and because of that I can draw a figure:
# gather the data and plot in order: class, slide name, region, segment
test_gr <- gather_set_data(count_mat, 1:4)
test_gr$x <- factor(test_gr$x,
levels = c("class", "slide name", "region", "segment"))
sorry for borthering you but I tried also to do a Differential Expression in this example 'within slide analysis: glomerul vs tubules'. But I ran it, R studio doesn't work and stop to work.
dd2 <- pData(target_demoData)[, c("class", "segment", "region")]
dd2$region
####################################### Within Slide Analysis: Glomeruli vs Tubules
# convert test variables to factors
pData(target_demoData)$testRegion <-
factor(dd2$region, c("glomerulus", "tubule"))
pData(target_demoData)[["slide"]] <-
factor(pData(target_demoData)[["slide name"]])
assayDataElement(object = target_demoData, elt = "log_q") <-
assayDataApply(target_demoData, 2, FUN = log, base = 2, elt = "q_norm")
# run LMM:
# formula follows conventions defined by the lme4 package
results <- c()
for(status in c("DKD", "normal")) {
ind <- pData(target_demoData)$class == status
mixedOutmc <-
mixedModelDE(target_demoData[, ind],
elt = "log_q",
modelFormula = ~ testRegion + (1 + testRegion | slide),
groupVar = "testRegion",
nCores = parallel::detectCores(),
multiCore = FALSE)
# format results as data.frame
r_test <- do.call(rbind, mixedOutmc["lsmeans", ])
tests <- rownames(r_test)
r_test <- as.data.frame(r_test)
r_test$Contrast <- tests
# use lapply in case you have multiple levels of your test factor to
# correctly associate gene name with it's row in the results table
r_test$Gene <-
unlist(lapply(colnames(mixedOutmc),
rep, nrow(mixedOutmc["lsmeans", ][[1]])))
r_test$Subset <- status
r_test$FDR <- p.adjust(r_test$`Pr(>|t|)`, method = "fdr")
r_test <- r_test[, c("Gene", "Subset", "Contrast", "Estimate",
"Pr(>|t|)", "FDR")]
results <- rbind(results, r_test)
}
What do you think about this issue? Version of R studio or another stuff?