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've run in to a case of "No elements in common between groups with name: var" that might not be appropriate.
Example case:
I'd like to compare gene expression of two sets of samples A and B; genes on Y and samples on X. To compare A and B I plot two main heatmaps next to each other. I'd also like for both groups to have some discrete column annotations. I'd like for these to have the same name, the same legend and the same colors.
If I now happen to add an annotation that have completely different levels for A and B -- no value of the annotation for group A exists in group B and vice versa, but the variable is the same -- I get an error from
stop(paste("No elements in common between groups with name:",
.
A second case is when the annotation added for B only contain NA values -- in this case, the code above will again find 0 shared variables and will stop().
Maybe there is an important reason to stop() in this case. Or maybe it is to protect from the possibility of the user adding two different annotations with the same name? If it's the latter, would you consider only to give a warning(), to allow from the example given above?
A workaround is to make each annotation column a factor with -all- the necessary levels -- either all allowed levels for the variable or, to keep the number of ticks minimal, the ones available in either A or B.
Thanks for the reproducible example. I think you're probably right that having an error rather than a warning (or even just message) is too much. I don't recall why it was implemented that way, my best guess is an attempt to provide safeguard for the logic of combining color bars -- that it might combine things that a user doesn't want combined. I'll test out what switching it to a warning or message would do.
I've run in to a case of "No elements in common between groups with name: var" that might not be appropriate.
Example case:
I'd like to compare gene expression of two sets of samples A and B; genes on Y and samples on X. To compare A and B I plot two main heatmaps next to each other. I'd also like for both groups to have some discrete column annotations. I'd like for these to have the same name, the same legend and the same colors.
If I now happen to add an annotation that have completely different levels for A and B -- no value of the annotation for group A exists in group B and vice versa, but the variable is the same -- I get an error from
iheatmapr/R/colorbars.R
Line 244 in a31ffc0
A second case is when the annotation added for B only contain NA values -- in this case, the code above will again find 0 shared variables and will stop().
Maybe there is an important reason to stop() in this case. Or maybe it is to protect from the possibility of the user adding two different annotations with the same name? If it's the latter, would you consider only to give a warning(), to allow from the example given above?
A workaround is to make each annotation column a factor with -all- the necessary levels -- either all allowed levels for the variable or, to keep the number of ticks minimal, the ones available in either A or B.
Reproducible example:
The text was updated successfully, but these errors were encountered: