Skip to content

DAregion fails with confusing error message if no cells are DA #4

@HectorRDB

Description

@HectorRDB

Hi,
Thanks a lot for the tool! However, I found that the following fails

library(DAseq)
labels_res <- X.label.info[X.label.info$condition == "R", "label"][c(1, 3)]
labels_nonres <- X.label.info[X.label.info$condition == "NR", "label"][c(1, 3)]
id <- X.label.melanoma %in% c(labels_res, labels_nonres)
da_cells <- getDAcells(
  X = X.melanoma[id, ],
  cell.labels = X.label.melanoma[id],
  labels.1 = labels_res,
  labels.2 = labels_nonres,
  do.plot = F
)
da_cells$da.up <- da_cells$da.down <- integer()
da_regions <- getDAregion(
  X = X.melanoma[id, ],
  da.cells = da_cells,
  cell.labels = X.label.melanoma[id],
  labels.1 = labels_res,
  labels.2 = labels_nonres
)

with error message Error in [<-(tmp, ii, , value = getDAscore(cell.labels = cell.labels, : subscript out of bounds. It was quite hard to troubleshoot what is going on simulations.
Although I understand you would want users to check the output of getDAcells, it might be nice to just return a warning and an object with no da regions or something more informative.
Best

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions