cole-trapnell-lab / monocle3

Other
330 stars 100 forks source link

Fixed group_cells_by argument in plot_cells function, can PR #648

Closed mauritsunkel closed 1 year ago

mauritsunkel commented 1 year ago

Tried in versions: 1.0.0 and 1.3.1. Docs state that group_cells_by argument takes c("cluster", "partition") or "the name of a column of colData(cds)".

"The name of a column of colData(cds)" did not work for me so I made the following changes:

  1. group_cells_by = match.arg(group_cells_by)

    to

    assertthat::assert_that(group_cells_by %in% c("cluster", "partition") | group_cells_by %in%
                              names(SummarizedExperiment::colData(cds)), msg = paste("group_cells_by must be one of",
                                                               "'cluster', 'partition', or a column in the colData table."))}

    As inspired by the same functionality in the code for the color_cells_by argument.

  2. stop("Error: unrecognized way of grouping cells.")

    to

    data_df$cell_group <- SummarizedExperiment::colData(cds)[data_df$input_name, group_cells_by]

This allows me to group and color by my custom features. Shall I make a pull request?

brgew commented 1 year ago

Hi,

I appreciate your feedback. I added your suggested changes to the Monocle3 master branch.

Thank you, Brent