Closed PierreLebrun closed 7 years ago
I can't reproduce it with my example. Here is what I tried:
add two separate 1d gates as you did (I am using tailgate
instead of mindensity
here to achieve the same effects, but I guess it doesn't matter regarding to the issue)
> add_pop(gs, alias = "38+", parent = "cd4-cd8+", dims = "CD38", gating_method = "tailgate")
> add_pop(gs, alias = "HLA+", parent = "cd4-cd8+", dims = "HLA", gating_method = "tailgate")
By the way, add_pop
is the API to interactively build the gating tree without the hassle of writing/reading the csv file, but it should behave the same as csv template.
Now I added 4 refGates
to construct the quadrants
> add_pop(gs, alias = "HLA-38+", pop = "HLA-38+",parent = "cd4-cd8+", dims = "HLA,38", gating_method = "refGate", gating_args = "38+:HLA+")
> add_pop(gs, alias = "HLA+38+", pop = "HLA+38+",parent = "cd4-cd8+", dims = "HLA,38", gating_method = "refGate", gating_args = "38+:HLA+")
> add_pop(gs, alias = "HLA-38-", pop = "HLA-38-",parent = "cd4-cd8+", dims = "HLA,38", gating_method = "refGate", gating_args = "38+:HLA+")
> add_pop(gs, alias = "HLA+38-", pop = "HLA+38-",parent = "cd4-cd8+", dims = "HLA,38", gating_method = "refGate", gating_args = "38+:HLA+")
note that you don't actually need 38-
and HLA-
1d gates, all you need is to refer to 38+
and HLA+
plotGate(gs[[1]], getChildren(gs[[1]], "cd4-cd8+"), digits = 4, gpar = list(nrow = 1))
So, yeah, please provide the reproducible example for the further troubleshooting.
Hello Mike,
Many thanks for your fast answer!
I tried to reproduce your code then, and on my computer, I have the same problem as with the gating template (by the way, csv template is not that much a hassle, and I do thing that some scientists are very happy to be able to use that instead of plain R. Anyway, that’s really great to have both options). As a side note, it is way slower using add_pop than using a gating template with the function gating(…)
So, I just reinstalled openCyto and flowWorkspace package and nothing change (I did some modification on the flowWorkspace, but only related to the .plotGate function, to add some flexibility (see an earlier post on github recently. Mainly, it crashes when trying to plot empty population in “data” mode. … so I created a range (xlim and ylim) for the non scatter channels after logicle transformation)…
So, here is the complete information of my machine:
Mac OS 10.12.6 running R 3.4.0 using Rstudio. I just reinstalled the last build of openCyto and flowWorkspace (release 3.5, version 1.14.0) using
source("https://bioconductor.org/biocLite.R") biocLite("openCyto") biocLite("flowWorkspace")
When I run your code, adapted to my populations:
add_pop(gs, alias = "BV+", parent = "CD3", dims = "BV421-A", gating_method = "tailgate") ... done add_pop(gs, alias = "PE+", parent = "CD3", dims = "PE-Cy7-A", gating_method = "tailgate") ... done add_pop(gs, alias = "A", pop = "BV+PE+",parent = "CD3", dims = "PE-Cy7-A,BV421-A", gating_method = "refGate", gating_args = "BV+:PE+") ... done Warning message: In if (quadInd == 1) { : the condition has length > 1 and only the first element will be used add_pop(gs, alias = "B", pop = "BV-PE+",parent = "CD3", dims = "PE-Cy7-A,BV421-A", gating_method = "refGate", gating_args = "BV+:PE+") ... done add_pop(gs, alias = "C", pop = "BV-PE-",parent = "CD3", dims = "PE-Cy7-A,BV421-A", gating_method = "refGate", gating_args = "BV+:PE+") ... done add_pop(gs, alias = "D", pop = "BV+PE-",parent = "CD3", dims = "PE-Cy7-A,BV421-A", gating_method = "refGate", gating_args = "BV+:PE+") ... done
I wonder of this is related to my channels names in ‘dims’ (but I can’t change them), due to the dashes ? But normally the gating strategy should be made based on ‘pop’, not on ‘dims’, right ?… I would like to print “quadInd” in .gating_reGate(…), in the gating-methods.R file of openCyto, to see for sure what happens…
Thanks for your valuable help !
Kind regards,
Pierre
Hello dear openCyto team,
The idea of the channels name was correct. I changed my import function to
fcs <- read.ncdfFlowSet(fcsFiles,alter.names = T)
and replaced all ‘-‘ by ‘.’ in my csv template file. Works like a charm ! So glad I have my 4 refGate quadrants back to Normal :-D :-D
So I guess indeed that in the .gating_reGate(…), it is using the names of the channels to match the + and – populations. I still think it is weird and it should be based on ‘pop’ attributes, and not ‘dims’, but at least I have a solid workaround.
Looking into the code, the match is made using these regular expressions:
quadPatterns <- c(".+-.+\+$", ".+\+.+\+$", ".+\+.+-$", ".+-.+-$")
This is giving the trouble when dims contains ‘+’ (not likely) and ‘–‘ (likely, as per my example above: dims = "PE-Cy7-A,BV421-A"). Again, based on ‘pop’, it would not occur. If based on ‘dims’, this could still be parsed to remove or correct the channel names before making the match to identity the quadrant.
Again, thanks for your help, the example you provided me was able to pinpoint my problem! Tell if you’re willing to do something about it and/or if I can help/support you in any way.
Kind regards,
Pierre
See red-highlighted notes in https://bioconductor.org/packages/release/bioc/vignettes/openCyto/inst/doc/HowToWriteCSVTemplate.html
regarding to the usage of pop
attribute. The actual content of X/Y
is always substituted by dims
column. Thus it doesn't matter what you put there in pop
for X/Y
(as long as they don't contain +-
).
So the solution is that you want to avoid +-
in your dims
column, in you example , simply
add_pop(gs, alias = "A", pop = "++",parent = "CD3", dims = "PE,BV421", gating_method = "refGate", gating_args = "BV+:PE+")
will do. There is no need for alter.name
.
Many thanks for the addition in the documentation !
My problem is that the FCS files I get comes with ‘+’ and ‘-‘ in the dims names, which might not be a good idea in the first place ☺… So I guess the alter.name is still the good option. The better workaround will be to tell the scientists to avoid that.
Thanks again,
Pierre
From: Mike Jiang notifications@github.com Reply-To: RGLab/openCyto reply@reply.github.com Date: Tuesday, 26 September 2017 at 19:56 To: RGLab/openCyto openCyto@noreply.github.com Cc: Pierre Lebrun Pierre.Lebrun@arlenda.com, Author author@noreply.github.com Subject: Re: [RGLab/openCyto] refGate with two rangeGate fails (without crash) (#155)
See red-highlighted notes in https://bioconductor.org/packages/release/bioc/vignettes/openCyto/inst/doc/HowToWriteCSVTemplate.html regarding to the usage of pop attribute. The actual content of X/Y is always substituted by dims column. Thus it doesn't matter what you put there in pop for X/Y (as long as they don't contain +-).
So the solution is that you want to avoid +- in your dims column, in you example , simply
add_pop(gs, alias = "A", pop = "++",parent = "CD3", dims = "PE,BV421", gating_method = "refGate", gating_args = "BV+:PE+")
will do. There is no need for alter.name.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/RGLab/openCyto/issues/155#issuecomment-332282002, or mute the threadhttps://github.com/notifications/unsubscribe-auth/Aekw6MjfY9nYbY25kYeZRv4ND-jvx4HBks5smTq8gaJpZM4PijG5.
Dear openCyto developper,
As usual, thanks for the awesome work!
I have been through a bug when two 1D rangeGate or mindensity are combined with a refGate as described here
One difference is that I do not use the 2D capabilities (as for instance, same page, line 5 of the gating template), but I use separately two rangeGate or mindensity because of the need to adjust 2 different SD values. so instead of 5: * cd4-/+cd8+/- cd3 cd4,cd8 mindensity
I would do: 5: cd4-/+ cd3 cd4 mindensity 6: cd8+/- cd3 cd8 mindensity or even (to rename population more flexibly): 5: cd4+ cd4+ cd3 cd4 mindensity 6: cd4- cd4- cd3 cd4 refGate cd4+ 6: cd8+ cd8+ cd3 cd8 mindensity 6: cd8- cd8- cd3 cd8 refGate cd8+
If you look on the associated image on that same page, you see that, for instance, CD4 and CD8 are separated in 4 quadrants, with proportion on each.
But when I launch the exact same code using opencyto 1.14.0 (release 3.5), I get the same graphs, but I only have proportion on 3 quadrants. The proportion written in quadrant 1 (-+) seems actually to be the sum of quadrant 1 and 2 (-+ and ++). Subpopulation are present in the output file (getPopStats() ) but they have also the same count there (which is not possible given the ++ quadrant is almost emply). Subpopulations from the two quadrants (see graphs) also appears to be the same... (and look how there is no proportion written in CD8+ population, quadrant ++)
I also got the following warning messages after gatings, which I think is related to the .gating_refGate(...) function. 15: In if (quadInd == 1) { ... : the condition has length > 1 and only the first element will be used 16: In if (quadInd == 1) { ... : the condition has length > 1 and only the first element will be used 17: In if (quadInd == 2) { ... : the condition has length > 1 and only the first element will be used 18: In if (quadInd == 3) { ... : the condition has length > 1 and only the first element will be used 19: In if (quadInd == 1) { ... : the condition has length > 1 and only the first element will be used 20: In if (quadInd == 1) { ... : the condition has length > 1 and only the first element will be used 21: In if (quadInd == 2) { ... : the condition has length > 1 and only the first element will be used 22: In if (quadInd == 3) { ... : the condition has length > 1 and only the first element will be used
You can see that there is never an error for quadInt==4... not sure of what we get from there... (Actually, I am even not sure of the order of the quadrant :-) )
I tried to circumvent the problem using a boolGate for the ++ population. This works for the outputs tables, but graphs does not follow elegantly (I like everything driven by the csv gating template).
Tell me if this is something you can reproduce easily with your own examples. Otherwise I will make an example with a dataset I can find publicly available.
Many thanks in advance for investigating.
Pierre