You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am writing to say that iSEE is just great. I mean really, just great. Great work.
Now one question, is there an easy way to coord_flip my feature assay plot, ie have tissue on the y-axis and the gene expression on the x-axis ( = a horizontal instead of a vertical layout)?
I was already about to follow the vignette for customization of panels and/or writing an own panel class, but wanted to check in whether there is not something that I am missing.
My understanding is that FeatureAssayPlot makes use of .violin_plot internally - which has a horizontal argument:
But I am struggling to find the place in the code where FeatureAssayPlot actually calls .violin_plot - which would be my entry point to potential customization ...
On a related note:
I am also wondering whether there is an easy way to add alternate background shading by column data to my Feature Assay Plot as shown in this example:
And I guess the general theme arising from these questions is: what's a developer's approach to change certain appearance features / plot layout aspects of a certain panel type beyond the options provided in the UI. Will that always be writing a new Panel class or could a helper such as .refineParameters be used for this purpose?
Now one question, is there an easy way to coord_flip my feature assay plot, ie have tissue on the y-axis and the gene expression on the x-axis ( = a horizontal instead of a vertical layout)?
Not right now, but it's something that could be fairly easily added.
But I am struggling to find the place in the code where FeatureAssayPlot actually calls .violin_plot - which would be my entry point to potential customization ...
It's a long rabbit hole through S4. The plotting expression is inherited from DotPlot:
what's a developer's approach to change certain appearance features / plot layout aspects of a certain panel type beyond the options provided in the UI. Will that always be writing a new Panel class or could a helper such as .refineParameters be used for this purpose?
A new panel class is pretty much always the answer, as there's no way to affect the behavior of the iSEE() function at the level you desire without writing S4 methods. In this particular case, it is kind-of straightforward:
Create a class that inherits from FeatureAssayPlot.
Write a new method for .defineDataInterface that creates a UI element to choose the column variable to use for splitting. This should be as easy as doing callNextMethod() and then adding the desired selectInput() to the resulting list.
Write a new method for .generateDotPlotData that extracts the desired colData variable and appends it to the data.frame. Again, this should be as easy as doing callNextMethod() and just adding another appropriately named column.
Write a new method for .generateDotPlot that actually does the splitting. If you're able to get the desired result by applying more ggplot2 stuff on the object that's already produced by the FeatureAssayPlot, then again, this could be as simple as doing callNextMethod() and just modifying the output to add more ggplot2 layers.
If you can't do your customization by just adding more ggplot2 layers, then 4 is the most difficult step if you want to be a "good citizen", as your panel would be expected to respond to the 20 other parameters that the user might be fiddling with (e.g., faceting, color by, size by, shape by, blah blah blah). The current panels already respond to those settings, so if you can callNextMethod(), you get that for free, but if not then you'll have to do it yourself. You could of course just ignore parameters you don't care about but that would be pretty confusing to users who would expect the widgets to do something.
Activity
LTLA commentedon Mar 18, 2021
Not right now, but it's something that could be fairly easily added.
It's a long rabbit hole through S4. The plotting expression is inherited from
DotPlot:iSEE/R/family_DotPlot.R
Lines 1234 to 1239 in 79d232e
A new panel class is pretty much always the answer, as there's no way to affect the behavior of the
iSEE()function at the level you desire without writing S4 methods. In this particular case, it is kind-of straightforward:FeatureAssayPlot..defineDataInterfacethat creates a UI element to choose the column variable to use for splitting. This should be as easy as doingcallNextMethod()and then adding the desiredselectInput()to the resulting list..generateDotPlotDatathat extracts the desiredcolDatavariable and appends it to the data.frame. Again, this should be as easy as doingcallNextMethod()and just adding another appropriately named column..generateDotPlotthat actually does the splitting. If you're able to get the desired result by applying more ggplot2 stuff on the object that's already produced by theFeatureAssayPlot, then again, this could be as simple as doingcallNextMethod()and just modifying the output to add more ggplot2 layers.If you can't do your customization by just adding more ggplot2 layers, then 4 is the most difficult step if you want to be a "good citizen", as your panel would be expected to respond to the 20 other parameters that the user might be fiddling with (e.g., faceting, color by, size by, shape by, blah blah blah). The current panels already respond to those settings, so if you can
callNextMethod(), you get that for free, but if not then you'll have to do it yourself. You could of course just ignore parameters you don't care about but that would be pretty confusing to users who would expect the widgets to do something.lgeistlinger commentedon Mar 18, 2021
Thanks a lot for taking the time to walk me through that. I'll try that out.
kevinrue commentedon Sep 2, 2024
Still interested? If it's popular, we could spend the time to develop a "horizontal feature assay plot" panel for this.