RGLab / openCyto

A package that provides data analysis pipeline for flow cytometry.
GNU Affero General Public License v3.0
77 stars 29 forks source link

mindensity issue #136

Closed kdh4win4 closed 7 years ago

kdh4win4 commented 7 years ago

Dear Mike and Greg,

gs1 <- GatingSet(fs[1])
gs1t <- transform(gs1, trans)
read.csv("gt_080_yohann_macpro_1.csv")
gt_yohann_1 <- gatingTemplate("gt_080_yohann_macpro_1.csv") # for single set, key causion, 
gating(gt_yohann_1,  gs1t) 
plotGate(gs1t[[1]]) # 

screen shot 2017-03-31 at 12 14 50 pm

grid.arrange(plotGate(gs1t, "G660_n"), plotGate(gs1t, "G660_p"), ncol=2)

screen shot 2017-03-31 at 12 15 03 pm

kdh4win4 commented 7 years ago

mindensity is not dividing clusters well. Here is a gating template. gt_080_y_m_1.xlsx

gfinak commented 7 years ago

Your populations are not well separated. Perhaps try lowering the amount of smoothing (the “adjust” parameter).

From: kdh4win4 notifications@github.com Reply-To: RGLab/openCyto reply@reply.github.com Date: Friday, March 31, 2017 at 9:18 AM To: RGLab/openCyto openCyto@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: Re: [RGLab/openCyto] mindensity issue (#136)

mindensity is not dividing clusters well. Here is a gating template. gt_080_y_m_1.xlsx

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

kdh4win4 commented 7 years ago

It does not work well. I tried to change 'adjust=' value from 2 to 1.5

mikejiang commented 7 years ago

I see you set gate_range=c(3e2,7e2) in template, which is at raw scale. You want to use the transformed scale here (or not specify it and let the algorithm determine t)

You can use ggcyto to display the 1d density at transformed coordinates and quickly see how different adjust values affects the two peaks .

 ggcyto(gs, aes(x =`G660`), subset = "nonNeutro") + geom_density(adjust = 0.5)
kdh4win4 commented 7 years ago

I appreciate it. Mike. I solve this issue with your help. I just removed gate_range() function and could made what I want.
If you don't mind, can I know how to see raw scale and transformed scale of fcs data ?

mikejiang commented 7 years ago

data is already stored at transformed scale once the transformation is done. plotGate simply inverse transform axis labels (NOT the data) so that it display the numbers at raw scale. To disable this behavior, you can set raw.scale = F when you plotGate

Again, it is more intuitive to use ggcyto, The one I showed you was transformed axis, to inverse transform to linear, simply add axis_x_inverse_trans() layer, e.g.

p + axis_x_inverse_trans()
kdh4win4 commented 7 years ago

Dear Mike, Can I know what I did wrong on plotGate() ?

> grid.arrange(plotGate(gst[[1]],"CD16CD56dim"), plotGate(gst[[2]], "CD16CD56dim"), 
+              plotGate(gst[[3]],"CD16CD56dim"), plotGate(gst[[4]], "CD16CD56dim"),
+              plotGate(gst[[5]],"CD16CD56dim"), plotGate(gst[[6]], "CD16CD56dim"),
+              plotGate(gst[[7]],"CD16CD56dim"), plotGate(gst[[8]], "CD16CD56dim"),
+              plotGate(gst[[9]],"CD16CD56dim"), ncol=3) # "alias name"
Error in gList(list(wrapvp = list(x = 0.5, y = 0.5, width = 1, height = 1,  : 
  only 'grobs' allowed in "gList"
kdh4win4 commented 7 years ago

It did not generate 3x3 matrix format plots.

kdh4win4 commented 7 years ago

I just solved this grid.arrange issue by changing "[[]]" to "[]". Thank you.

mikejiang commented 7 years ago

You should be able to do it with one-liner

plotGate(gst[1:9],"CD16CD56dim" , layout = c(3, 3))

see layout section of lattice documenation for ?xyplot

Again, it is more intuitive with ggcyto

autoplot(gst[1:9],"CD16CD56dim") + facet_wrap(~name, nrow = 3)
kdh4win4 commented 7 years ago

Thank you. Mike Can I ask one more question? The FSC and SSC channel are not naturally transformed by transform() function. Do you know how to transform those channels ?

gfinak commented 7 years ago

@kdh4win4 you should not be transforming FSC and SSC. Those channels do not measure fluorescence and the data are not log-normal.

kdh4win4 commented 7 years ago

Thank you. Dr. Greg Finak This is another small issue. The 'autoplot' function and 'plotGate' function have difference for displaying cell density population. Therefore, the two figures are different somewhat. Can I know how to adjust or change plotGate() functional options to let the plotgate figure has the same cell density population color code as the 'autoplot' does ?