[BioC] FlowViz graphics problems

Deepayan Sarkar deepayan.sarkar at gmail.com
Wed May 20 23:13:48 CEST 2009


On Wed, May 20, 2009 at 6:06 AM, Anja Schiel <a.e.schiel at medisin.uio.no> wrote:
> Hi,
>
> I am currently testing flowCore and flowViz and have encountered some
> problems.
>
> I am running :
> R version 2.9.0 (2009-04-17)
> i486-pc-linux-gnu
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods
> base
>
> other attached packages:
> [1] flowViz_1.8.0    lattice_0.17-25  flowCore_1.10.0  rrcov_0.5-01
> [5] pcaPP_1.6        mvtnorm_0.9-5    robustbase_0.4-5 Biobase_2.4.1
>
> loaded via a namespace (and not attached):
>  [1] feature_1.2.3      graph_1.22.2       grid_2.9.0
> KernSmooth_2.22-22
>  [5] ks_1.6.3           latticeExtra_0.5-4 MASS_7.2-47
> RColorBrewer_1.0-2
>  [9] stats4_2.9.0       tools_2.9.0
>
>
> I have noticed that when I use
> xyplot(`SSC-H` ~ `FSC-H`, data = fs.trans[[1]], filter = eGate)
> I get a plot with the Gate defined by eGate plotted, but when I try to
> do the same with
> flowPlot(fs.trans[[1]], filter = eGate)
> the gate is not drawn. Since the default settings seem to be filter =
> NULL (and I pass eGate to filter) and showFilter = TRUE I am wondering
> if this is a glinch in the system or if my command is wrong.

The 'flowPlot' function is not really maintained any more; the method
for "flowFrame" does have a 'filter' argument, but it is never used in
the actual function definition. xyplot() should be able to do
everything flowPlot does. If not, please let us know.

> Second I am somewhat confused about the plot function. When I transform
> my FL-H signals with
> fs.trans <- transform('FL1-H' = asinh, 'FL2-H' = asinh) %on% fs
> and then run
> plot (fs.trans[[7]], 'FL1-H', breaks=256)
> I get a histogram with all my data crammed into the left corner due to
> the y-axis scale that seems to be extremely large.

The following seems to work for me:

data(GvHD)
fs <- GvHD
fs.trans <- transform('FL1-H' = asinh, 'FL2-H' = asinh) %on% fs
plot(fs[[7]], "FL1-H") ## most of the data in left-most bin
plot(fs.trans[[7]], "FL1-H") ## much more spread out

So we need a reproducible example to figure out why you are seeing
different behavior.

> Also the axis changes
> between the files. I have tried to figure out how this function works
> (checked the normal and lattice information), but I am clearly not
> understanding what is the underlying set of data points that determines
> the y-axis scale. I would like to know how to reduce the y-axis scale
> and keep it constant between different files (at least if this is not
> something totally stupid to try).

I'm not sure what you mean. Different calls with different flow frames
will have different scales, based on the data for that frame. You
should be able to explicitly specify 'xlim' and 'ylim' to be the same
in all calls. This doesn't work now, and that's a bug.  We will fix it
soon.

You could always use densityplot() instead to compare multiple FCS files.

densityplot(~`FL1-H` | names, data = fs.trans[1:5])

> Third, I have created densityplots and noticed that the order of files
> is not like the order in the phenoData info. In phenoData the files are
> ordered according to their file-names (or more precise by the trailing
> numbers given by CellQuest), while they are plotted in some kind of
> alphabetical order in densityplot. Is it possible to pass an argument to
> densityplot that will plot the files in the file-names order?

Yes, that's the default for factor levels (see ?factor) when the file
names get converted to a factor. You can control the order by
specifying the levels explicitly. For example, compare:

densityplot(factor(name, levels = rev(unique(name))) ~`FL1-H`, data =
fs.trans[1:5])

and

densityplot(factor(name, levels = unique(name)) ~`FL1-H`, data = fs.trans[1:5])

> And is it also possible to have the plot in black and white and not in color?

Yes, e.g.

densityplot( ~`FL1-H`, data = fs.trans[1:5], par.settings =
standard.theme(color = FALSE))

See ?trellis.device and ?flowViz.par.get for more details.

> I have also tried different gates and managed to create ellipsoid,
> rectangular and n2Filter, but failed to produce a polygon gate. Could
> anyone provide me with an simple example how to do that?

See the example in ?polygonGate.

> And a last question, how could I produce a densityplot where I have an
> overaly instead of shingles for several files in one figure (such as is
> often used for publications, to show the shift from unstained, isotype
> control to specific staining).

Unfortunately that's not yet supported by  the "flowSet" densityplot
method. You could however use the underlying lattice functions
directly to get what you want:

tmpe <-
    fsApply(fs.trans[1:6],
            function(x) exprs(x)[, "FL1-H"],
            simplify = FALSE)

densityplot(~data, do.call(make.groups, tmpe), groups = which,
            plot.points = FALSE, auto.key = list(columns = 3))

-Deepayan



More information about the Bioconductor mailing list