DillonHammill / CytoExploreR

Interactive Cytometry Data Analysis
61 stars 13 forks source link

Faulty axis in gating plot when setting logarithmic xlim/ylim to > 10E6 #89

Closed GKok closed 3 years ago

GKok commented 4 years ago

When setting gates and setting biex-transformed ylim to c(0,10000000), the axis is faulty. Up to 10E6 it shows logarithmically, above that it doesn't.

The picture speaks for itself.

image
gs <- GatingSet(fcs)

# Fluorescent channels
chans <- cyto_fluor_channels(gs)

# Biex transformation
gs <- cyto_transform(gs, channels = chans, type="biex")

# Create empty gatingTemplate
cyto_gatingTemplate_create("gates.csv")

# Set gates 'cells' and 'alive', then 'GFP+' where the faulty behavior occurs

# GFP positive
cyto_gate_draw(gs,
               alias = "GFP+",
               parent = "Alive",
               channels = c("FSC-A", "FL1-A"),
               type = "rectangle",
               axes_limits = "auto",
               ylim = c(0,10000000),
               gatingTemplate = "gates.csv")
DillonHammill commented 4 years ago

@GKok, I don't think this is a bug. The definition of the biex transform is bounded by the maxValue argument which is set at 262144 by default. As a result the data above this limit remains on the linear scale. If you need to transform data above this limit, you could try increasing the maxValue argument.

I will leave this issue open, to remind me to put in some code to automatically compute this limit for you. This value makes sense for traditional flow cytometry but now there are instruments with a much larger dynamic range (e.g. spectral flow cytometers). Ideally the limits of the transformation should be computed based on the instrument limits and not hard coded.

DillonHammill commented 3 years ago

Just adding a comment here, as the coming version of CytoExploreR now performs a check on maxValue when performing biexponential transformation. This will ensure that all data is appropriately transformed within the range of the instrument.