LieberInstitute / spatialLIBD

Code for the spatialLIBD R/Bioconductor package and shiny app
http://LieberInstitute.github.io/spatialLIBD/
80 stars 16 forks source link

Implement a check_spe() function #6

Closed lcolladotor closed 3 years ago

lcolladotor commented 3 years ago

Hi Brenda,

We need to implement a new function check_spe() similar to check_sce(). I think that we can copy the code, then remove anything check_spe() doesn't need that the older function needed.

It'll be good to check what else might be missing that we have in the spe object at https://github.com/LieberInstitute/spatialDLPFC/blob/main/analysis/03_try_shiny.R that might be missing from say the example spe object (called ve_test below) that we can create with the data in the SpatialExperiment package.

## Use the appropriate one from below:
# library("spatialLIBD")
# devtools::load_all()

dir <- system.file(file.path("extdata", "10xVisium"), 
                    package = "SpatialExperiment")

sample_ids <- c("section1", "section2")
samples <- file.path(dir, sample_ids)
(ve_test <- read10xVisium(samples, sample_ids, type="sparse", data="raw", 
                    images = c("lowres"), load = TRUE))

## Beyond SpatialExperiment for spatialLIBD
ve_test$key <- paste0(ve_test$Barcode, '-', ve_test$sample_id)
rowData(ve_test)$gene_search <- paste0(rownames(ve_test), "; ", rowData(ve_test)$symbol)

Once we have this function, we can update run_app() to use it internally.

Something we need to decide is whether to expect any names in reducedDim(spe). I think that run_app() will not work without any reducedDim() info, so it might be good to add this requirement in check_spe() OR we might have to consider making run_app() and all the shiny code more flexible.

Let's keep talking about this! ^^

Best, Leo