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

addPlottingFactor with NanoStringGeoMxSet version #48

Closed mgrout81 closed 11 months ago

mgrout81 commented 1 year ago

This issue occurs when any samples in the overlay are not in the geomx set object, within the addPlottingFactor w/ NanoStringGeoMxSet type input. I don't know whether it occurs in other circumstances.

Start of this "if" block: https://github.com/Nanostring-Biostats/SpatialOmicsOverlay/blob/a78d1bb386ff16daa3f83de907e6e7868c4bb9f0/R/addPlottingFactor.R#L89

Expected behavior: the code subsets the gxtSamples object to only include those present in the samples object. Observed behavior: Not sure exactly what is happening, but we're subsetting gxtSamples to just one sample, and not one that's relevant for the slide at hand. The addPlottingFactor function overall fails to add a plotting factor, and sampNames(overlay) becomes character(0).

Maddy did some investigating and determined this is due to how the code is handling the presence of two columns in the sData(annots) object that have Sample IDs in them. We suspect this may be due to changes in R syntax. This behavior was observed using Rv4.3.0 x86_64-pc-linux-gnu.

mgrout81 commented 1 year ago

I'm seeing a similar phenotype with data.frame as the input annots object.

maddygriz commented 11 months ago

@mgrout81 I have fixed this in both data.frames and geomxset objects. Just to be safe, I took the column with the highest match rate between the annotations and the overlay object. This change went into the v1.1 branch.