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

Improvements on plotGate (xyplot and hexbin) #30

Open
PierreLebrun opened this issue Sep 18, 2017 · 1 comment
Open

Improvements on plotGate (xyplot and hexbin) #30

PierreLebrun opened this issue Sep 18, 2017 · 1 comment

Comments

@PierreLebrun
Copy link

PierreLebrun commented Sep 18, 2017

Hello,

Many thanks for the development of Opencyto. Incredible work ! I am here listing some comments for possible improvements in flowWorkspace package, mainly in the plotGate function. My main idea is to be able to drive graphs and output table only by playing with a csv gating template (and not create adhoc plots for each case.

  1. When I plot my gates using the plotGate function, I get an error message on the graph, generated by xyplot from flowViz (which use hexbin package, which I think is giving the error). The error only occur when there is a single point to be plotted (resulting of the gating). When there is more than 1 unique point or when there is no point at all (empty gate with 0% of the data), all is fine. The error you can find on the graph is either:

image1

(This occurs with default binning (xbins =32), which value is not documented but can be found as "xbin=32") in plotGate signature. hexbin is the culprit in this, but I think this can be worked out from plotGate or xyplot from flowViz).

Or I get the following error when xbins=0

image2

These error does not stop the process, and except the writing on the figure, everything looks great. But the fact that it is written "Error" in big is not something scientits would like to see in production. An empty graph would be better. (I did not find any solution by only modifying the flowWorkspace package, so we should go deeper)

  1. There are two possibilities for ranges (xlim and ylim) of the graphs : "Instrument" or "Data". However, a better representation for the non scatter channels would be in the logicle space, which is by default about in the range of [-1 ; -4] (or a little bit larger, like [-1.2 ; -4.2] for the non scatter channels). I modified the plotGate function by doing something like:

#try to customize the x, y limits if requested if(!is.numeric(xlim)) { xlim <- match.arg(xlim, c("instrument", "data","autologicle")) if(xlim == "data") { xlim <- .getRange(parentData, xParam) } if(xlim == "autologicle") { cols = parentData@origColnames if(xParam %in% cols[grepl("FSC|SSC|Time",cols)]) { xlim <- .getRange(parentData, xParam) } else { xlim=c(-1.2,4.2) } }

  1. to help plotting without binning (which can take a large time on some machine, especially within Rstudio), there is the 'sample.ratio' parameter. However, an improvement would be to make this sample ratio only if the number of event is bigger then a threshold (say, 10000). I added the following parameters 'sample.minsize' in plotGate function

if(!is.null(sample.minsize)) { if( sample.minsize>nrow(parentFrame)) { sample.ratio=1 } }

This is all for now. Small improvements, but I think they can help the process of making the implementation of openCyto in a production environment.

Many thanks again.

@gfinak
Copy link
Member

gfinak commented Sep 18, 2017

Thanks, these are good suggestions. We haven't been supporting flowViz much lately since we have moved visualization over to the ggcyto package, but we will work on getting these improvements in.

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

2 participants