decimal numbers in ggcyto geom_stats
1
0
Entering edit mode
@anderstondell-9441
Last seen 3 months ago
Norway

Hi,

I am using ggcyto to make graphical display of flow cytometry data, from a gating hierarchy generated in OpenCyto.

My problem is that I can't seem to find a way to control the number of decimals in gate labels. Default seem to be 3 numbers from the first non-zero number. Thus, in a gate the geom_stats label may for example be 0.00357% if the events in that gate is close to zero.

I would rather have only one decimal space, by some rounding function. Is there any quick fix, such as the "digits"-argument in xyplot?

Here is a reproducibel example:

data(GvHD)
fs <- GvHD[1]
gs <- GatingSet(fs)

    qg <- quadGate("FL1-H"=7.5e3, "FL2-H"=1e3)
    nodeIDs<-add(gs,qg,parent="root")
recompute(gs)

p <- ggcyto(gs, aes(x = `FL1-H`, y =  `FL2-H`), subset="root")
p + geom_hex(bins = 128)+geom_gate()+geom_stats()

Best regards,

Anders

 

ggcyto • 1.9k views
ADD COMMENT
0
Entering edit mode
Jiang, Mike ★ 1.3k
@jiang-mike-4886
Last seen 3.2 years ago
(Private Address)

I've added support for `digits` in `geom_stats`, pull the latest development version `ggcyto 1.3.2`

ADD COMMENT
0
Entering edit mode

Hi,

I still have some trouble with digits in geom_stats in ggcyto (partly because I am not able to upgrade R/Bioconductor at my university).

Is there an easy way to apply values to the geom_stats layer from gates extracted for example by getGate() and applied to the gatingset, and then for example by the function 'round(digits=1)' or similar to values (frequencies) from the filterResultlist?

You have given an example on the use of 'lapply' previously, but it is not very functional, as it only returns the value '10%' (https://www.bioconductor.org/packages/release/bioc/vignettes/ggcyto/inst/doc/ggcyto.flowSet.html):

p + geom_gate(den.gates.y) + geom_stats(value = lapply(rect.gates, function(g)0.1))

I can't seem to get the syntax right to control the values from the filterResultlist: 

'geom_stats(value = lapply(qg, function(g) ????))'

Is there any solution to this?

 

With regards,

 

 

 

ADD REPLY
0
Entering edit mode

You can install it directly from github

devtools::install_github("RGLab/ggcyto", ref = "trunk")

If you really want to manually supply the value for geom_stats layer, you can extract the stats directly from GatingSet

pop1 <- "CD15 FITC-CD45 PE+"
stat.val1 <- lapply(gs, function(gh)getProp(gh, pop1)
p + geom_hex(bins = 128)+geom_gate() + geom_stats( value = stat.val, gate = pop1)

But you will have to add geom_stats layers for each population since you have four quadrants to plot

Again, these should all be taken care of by one-liner call if you update ggcyto to the latest

p + geom_hex(bins = 128) + geom_gate() + geom_stats(digits = 1)

 

ADD REPLY
0
Entering edit mode

Thanks, this works very well.

ADD REPLY

Login before adding your answer.

Traffic: 785 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6