Issue for tutorial of nanostring analysis

Hi Guys,

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?

Thank you in advance.

Nazim

> demoData <-
+   readNanoStringGeoMxSet(dccFiles = DCCFiles,
+                          pkcFiles = PKCFiles,
+                          phenoDataFile = SampleAnnotationFile,
+                          phenoDataSheet = "Template",
+                          phenoDataDccColName = "Sample_ID",
+                          protocolDataColNames = c("aoi", "roi"),
+                          experimentDataColNames = c("panel"))
Error in readNanoStringGeoMxSet(dccFiles = DCCFiles, pkcFiles = PKCFiles,  : 
  lazy-load database '/home/one/R/x86_64-pc-linux-gnu-library/4.1/readxl/R/readxl.rdb' is corrupt
In addition: Warning messages:
1: In readNanoStringGeoMxSet(dccFiles = DCCFiles, pkcFiles = PKCFiles,  :
  restarting interrupted promise evaluation
2: In readNanoStringGeoMxSet(dccFiles = DCCFiles, pkcFiles = PKCFiles,  :
  internal error -3 in R_decompress1
> demoData <-readNanoStringGeoMxSet(dccFiles = DCCFiles,
+                          pkcFiles = PKCFiles,
+                          phenoDataFile = SampleAnnotationFile,
+                          phenoDataSheet = "Template",
+                          phenoDataDccColName = "Sample_ID",
+                          protocolDataColNames = c("aoi", "roi"),
+                          experimentDataColNames = c("panel"))
Error in readNanoStringGeoMxSet(dccFiles = DCCFiles, pkcFiles = PKCFiles,  : 
  lazy-load database '/home/one/R/x86_64-pc-linux-gnu-library/4.1/readxl/R/readxl.rdb' is corrupt
In addition: Warning messages:
1: In readNanoStringGeoMxSet(dccFiles = DCCFiles, pkcFiles = PKCFiles,  :
  restarting interrupted promise evaluation
2: In readNanoStringGeoMxSet(dccFiles = DCCFiles, pkcFiles = PKCFiles,  :
  internal error -3 in R_decompress1

Did you start of with this?

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")
library(NanoStringNCTools)
library(GeomxTools)
library(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 
}

Hi @technocrat,

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?

Thank you in advance.
Best
Nazim

@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

The first task is to bring R to version 4.2.2 if needed.

Then install or re-install Bioconductor, which is explained here


if (!require("BiocManager", quietly = TRUE))
    install.packages("BiocManager")
BiocManager::install(version = "3.16")

Next


if (!require("BiocManager", quietly = TRUE))
    install.packages("BiocManager")

BiocManager::install("GeomxTools")

Finally,

if (!require("BiocManager", quietly = TRUE))
    install.packages("BiocManager")

BiocManager::install("GeoMxWorkflows")

If I'm right that {GeoMxWorkflows} is what is meant by Workflow

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"))

Do you have please an idea of the issue?

Thank you for your help
Best
Nazim

Hi @technocrat ,

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?

Thank you in advance
Best
Nazim

Hard to help without a a reprex. See the FAQ.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.