nateosher / DIMPLE

MIT License
2 stars 1 forks source link

Error Creating Multiplex Experiment Object #106

Closed gauripatel closed 6 months ago

gauripatel commented 7 months ago

Dear DIMPLE team,

I am trying to create a multiplex experiment object on a dataset containing 2401411 cells with 6 cells types. Any NAs in the data have been removed prior to using any DIMPLE functions. When I try to make the multiplex experiment object, I run into this issue and I am not sure how to make sense of it: Error in (function (.x, .f, ..., .progress = FALSE) : ℹ In index: 110. Caused by error in dens.split[[2]]: ! subscript out of bounds

I have attached the smallest subset of the original dataset for which I could recreate the same error and have attached it below. The debugger also showed this message when I tried to debug on this subset. debug: mltplx_objects <- furrr::future_map(dfs, function(df) {
xrange <- attr(df, "xrange") yrange <- attr(df, "yrange") slide_id <- attr(df, "slide_id") obj <- new_MltplxObject(df$x, df$y, df$marks, slide_id, xrange = xrange, yrange = yrange, ps = ps, bw = bw, dist_metric = dist_metric, .dist_metric_name = dist_metric_name) prog() return(obj) })

LungData_error_subset.csv

Lastly, here is the code that can be used to recreate the error: library(magrittr) library(dplyr) library(tidyverse) library(DIMPLE) library(knitr) library(data.table)

data_error = read.csv('LungData_error_subset.csv')

mltplx_data <- data_error %>% select(Cell.X.Position, Cell.Y.Position, type, Sample.Name)

mltplx_experiment = DIMPLE::new_MltplxExperiment(x=mltplx_data$Cell.X.Position, y=mltplx_data$Cell.Y.Position, marks=as.factor(mltplx_data$type), slide_id = mltplx_data$Sample.Name, ps=20, bw=30, dist_metric=cor)

Please let me know what could be the issue here and how to resolve it. Thank you!

nateosher commented 7 months ago

Hi Gauri,

I am able to reproduce this. I think the bug stems from the fact that the image in your set only has one type of point. I'll try to push a fix to this, but for now, if you limit your data set to slides with at least 2 cell types, that should work in the meantime. Let me know if the issue persists- will update once I've pushed a fix.

gauripatel commented 7 months ago

Thank you! Removing the images with only one type worked.

jeliason commented 6 months ago

closed by #107