Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improving autoplot behavior and error messages #58

Open
jacobpwagner opened this issue Feb 3, 2020 · 0 comments
Open

Improving autoplot behavior and error messages #58

jacobpwagner opened this issue Feb 3, 2020 · 0 comments

Comments

@jacobpwagner
Copy link
Member

autoplot.GatingSet has a few cases where failures result in very opaque errors. We should first assess whether these use cases should fail at all (or if we instead switch to reasonably expected behavior) and otherwise at least make the errors more helpful.

  • First example. When called on a GatingHierarchy or GatingSet with a specified subpopulation, the expected behavior is to plot the geometric representation of the gate overlaying the data of the parent (plotting the gate). But in the case of the root population, there is no parent and no gate determining it.
library(flowWorkspace)
library(ggcyto)
gs <- load_gs(system.file("extdata", "gs_bcell_auto", package="flowWorkspaceData"))
autoplot(gs[[1]], "root")

This results in an error:

 Error in .cpp_getGate(obj@pointer, sampleNames(obj), y) : 
  no gate associated with root node. 

which is reasonably descriptive, but could be improved for clarity and could maybe drop the call information. However, we should consider whether the default behavior should be to plot the ungated data at the root node. That is, within the call do something like this:

autoplot(gh_pop_get_data(gs[[1]], "root"))

plot_zoom_png
where the user could then specify channels for a particular 1-D or 2-D plot. This kind of changes the nature of what autoplot is expected to do for a GatingSet object, however. Currently, first getting the cytoframe or cytoset from the GatingSet in that mannerer is a required intermediate step, but we could also consider adding a flag for gate vs data to autoplot.GatingSet or even adding gateplot and dataplot methods.

  • Second example, a GatingSet without gates:
library(flowWorkspace)
library(ggcyto)
files <- system.file("extdata", c("CytoTrol_CytoTrol_1.fcs", "CytoTrol_CytoTrol_2.fcs"), package="flowWorkspaceData")
cs <- load_cytoset_from_fcs(files)
gs <- GatingSet(cs)
autoplot(gs[[1]])

This results in an error because of how the method attempts to access the subpopulations:

Error in which(boolInd) : argument to 'which' is not logical 

In this case we should at the very least give a better error message. But again we could think about whether we should default to the behavior of plotting the ungated data.

In each of these cases, even if we don't want to change default plotting behavior, we could just have a message prompting the user to first get the appropriate cytoframe or cytoset object first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant