trouble showing a polygon gate using geom_gate
3
0
Entering edit mode
Andrew Box ▴ 10
@andrew-box-13730
Last seen 5.7 years ago
Kansas City, MO - Stowers Institute for…

I'm having success using ggcyto and the geom_gate function to show rectangle gates.  However, when I follow the same approach to show a polygon gate, I get a warning message that I don't understand.  The hex plot is made, but no gate lines are plotted.  Are more arguments to geom_gate required when the gate is a polygon gate?

Here is the relevant section of my code:

sqrcut <- matrix(c(1.1,1.2,5,5,
                   0,1.7,2,0),ncol=2,nrow=4) 

colnames(sqrcut) <- c("FL03.A","FL17.A")

polyGate <- polygonGate(filterId = "Expressing-Live-Gate", .gate = sqrcut)

ggcyto(myFlowFrame, aes(x = "FL03.A", y = "FL17.A")) + geom_hex(bins = 96) +
  geom_gate(polyGate)

The error that's returned when I run it is this, I don't understand the reference to a group in this context.  The hex plot is made, however.

geom_path: Each group consists of only one observation. Do you need to adjust the group aesthetic?
Warning messages:
1: Removed 1 rows containing missing values (geom_hex). 
2: Removed 4 rows containing missing values (geom_path).
flowcore ggcyto • 1.7k views
ADD COMMENT
2
Entering edit mode
Jiang, Mike ★ 1.3k
@jiang-mike-4886
Last seen 3.1 years ago
(Private Address)

Looks like the gate is truncated by the actual data range. what is the output of range(myFlowFrame, "data")?

ADD COMMENT
0
Entering edit mode

Oh my, yes that's all it is.  I was thinking even if an edge was off scale the left-hand vertical line of the polygon would still be drawn and visible, but apparently that's not the case.  The range of the data is slightly less that the ranges of some of the polygon vertices.  Forcing xlim and ylim wider shows that the ploygon gate is drawn, and ensuring the gate vertices are within the data range behaves similarly.

 

​> range(framePwGated, "data")
      FS00.H   FS00.A   FS00.W   SS02.A   FL03.A    FL04.A    FL10.A     FL17.A    EstCont RatioFret
min 2.051245 2.108683 3.950034 2.289661 0.132408 -2.546863 0.1177577 0.03271251 0.03090378 -14.09843
max 3.798139 4.142489 4.099994 4.149062 4.499188  3.229013 3.7291782 1.76660090 1.08948358  18.30528

 

Resulting image

ADD REPLY
0
Entering edit mode
Andrew Box ▴ 10
@andrew-box-13730
Last seen 5.7 years ago
Kansas City, MO - Stowers Institute for…

deleted - 20 characters

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

With this fix https://github.com/RGLab/ggcyto/issues/5#issuecomment-378765096, the gate should display without your manually tweaking the limits.

ADD COMMENT

Login before adding your answer.

Traffic: 699 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