Nanostring-Biostats / SpatialOmicsOverlay

Tools for analyzing data on the image from NanoString GeoMx Digital Spatial Profiler (DSP).
MIT License
17 stars 4 forks source link

v1.1 bug fixes #50

Closed maddygriz closed 11 months ago

maddygriz commented 11 months ago
maddygriz commented 11 months ago

confirming tests work with devtools::test()

══ Results ════════ Duration: 136.9 s

[ FAIL 0 | WARN 0 | SKIP 0 | PASS 421 ]

mgrout81 commented 11 months ago

I took a look at all six items above and ran into problems with three of them.

Add plotting factor fix worked with GeoMxSet object as annot, but not witha df.

mouse <- "mu_dev_E11_005"
print(paste("Mouse is", mouse))

# Get lab worksheet to use with this mouse  
lw_fn <- all_lw %>% select(slide_name, lw_fn) %>% 
  unique() %>% filter(slide_name == mouse) %>% 
  select(lw_fn) %>% unlist()

tifFile <- dir("~/data/cwilliams/sfn2023_mouseembryo_geomx/image_files/", 
               pattern = paste0(mouse, ".ome.tiff"),
               full.names = TRUE, recursive = TRUE)

soo <- readSpatialOverlay(ometiff = tifFile, annots = lw_fn, 
                          slideName = mouse, image = TRUE, #TRUE  
                          saveFile = FALSE, outline = FALSE,
                          res = res)

unk <- annots %>% filter(claire_q == "?") %>% mutate(claire_q = roi)

addPlottingFactor(overlay = soo, annots = unk,
                     plottingFactor = "claire_q") %>% sampNames()
# incorrect output: character(0), and all ROIs not matched

xml Extraction:

tifFile <- "/home/rstudio/data/cwilliams/sfn2023_mouseembryo_geomx/image_files//mu_dev_E9_image_files/mu_dev_E9_001.ome.tiff"
d <- "~/data/mgrout/soo_v1.1_testing/ome-tiff-xml-output"
dir.create(d, showWarnings = FALSE)

xmlExtraction(tifFile, saveFile=TRUE, outdir = d)

list.files(d)
# incorrect output: [1] "mu_dev_E9_001.ome.tiff"

ROI character matching

list.files("~/data/mgrout/soo_v1.1_testing/paredes/")

lw_fn <- "~/data/mgrout/soo_v1.1_testing/paredes/GW23_1_Pilot_82522_Paredes_20220829T2254_LabWorksheet.txt"
ome_tiff_fn <- "~/data/mgrout/soo_v1.1_testing/paredes/GW23_1_Pilot_82522_Paredes.ome.tiff"

soo <- readSpatialOverlay(ometiff = ome_tiff_fn, annots = lw_fn, 
                          slideName = "GW23_1_Pilot_82522_Paredes", image = TRUE, #TRUE  
                          saveFile = FALSE, outline = FALSE,
                          res = res)

# Error, could not open:
# Extracting XML
# Parsing XML - scan metadata
# Parsing XML - overlay data
# Error in if (nrow(AOIattrs) < nrow(annots)) { : 
#     argument is of length zero
#   In addition: There were 48 warnings (use warnings() to see them)
mgrout81 commented 11 months ago

Update: I'm also seeing issues with cropping using mu_dev_E15_012.ome.tiff. See settings in screenshot.

Picture1

maddygriz commented 11 months ago

@mgrout81

Will look at the cropping issue next.

maddygriz commented 11 months ago

I also added the capability to have the scale bar in mm instead of just um.

mgrout81 commented 11 months ago

Scale bar issue: https://github.com/Nanostring-Biostats/SpatialOmicsOverlay/commit/6389565765bb600ec002de45730aa80013899d57#r129172009 Works and looks good with um and mm, but not nm.

Using my own script and v1.1.1 of the repo, I couldn't re-create the issue I saw here:https://github.com/Nanostring-Biostats/SpatialOmicsOverlay/pull/50#issuecomment-1734583862

The three issues I ran into in the above comment (https://github.com/Nanostring-Biostats/SpatialOmicsOverlay/pull/50#issuecomment-1734379257) are now working for me. The three items that were earlier working for me are still working.

maddygriz commented 11 months ago

longtests updated mostly updating slide name with new lab worksheet. Needed to update _snaps for vdiffr tests since annotations changed. image

Confirmed normal tests still work. image

maddygriz commented 11 months ago

── BiocCheck results ── 0 ERRORS | 2 WARNINGS | 8 NOTES warnings = package size and even number version

── longtests results── [ FAIL 0 | WARN 0 | SKIP 0 | PASS 725 ]

── devtools::check() results ──

── R CMD check results ────────────────────────────── SpatialOmicsOverlay 1.1.1 ────
Duration: 14m 38.9s

❯ checking for unstated dependencies in examples ... OK
   WARNING
  ‘qpdf’ is needed for checks on size reduction of PDFs

❯ checking DESCRIPTION meta-information ... NOTE
  License components which are templates and need '+ file LICENSE':
    MIT

❯ checking top-level files ... NOTE
  File
    LICENSE
  is not mentioned in the DESCRIPTION file.
  Non-standard files/directories found at top level:
    ‘longtests’ ‘reqs.md’ ‘specs.md’

❯ checking R code for possible problems ... [53s/33s] NOTE
  plotSpatialOverlay: no visible binding for global variable ‘xcoor’
  plotSpatialOverlay: no visible binding for global variable ‘ycoor’
  plotSpatialOverlay: no visible binding for global variable ‘sampleID’
  plotSpatialOverlay: no visible binding for global variable ‘Target’
  scaleBarPrinting: no visible binding for global variable ‘X’
  scaleBarPrinting: no visible binding for global variable ‘Y’
  Undefined global functions or variables:
    Target X Y sampleID xcoor ycoor

❯ checking for non-standard things in the check directory ... NOTE
  Found the following files/directories:
    ‘muBrainSubset_SpatialOverlay.RDS’ ‘muBrain_GxT.RDS’

0 errors ✔ | 1 warning ✖ | 4 notes ✖

── R CMD check results - expected error ──

Error in texi2dvi(file = file, pdf = TRUE, clean = clean, quiet = quiet,  : 
  pdflatex is not available
Error in running tools::texi2pdf()
You may want to clean up by 'rm -Rf /tmp/RtmpfanphI/Rd2pdf2b0b45340877'
* DONE

Status: 1 ERROR, 1 WARNING, 3 NOTEs