Open JTumulty opened 2 hours ago
In addition this issue should be fixed in the other plotting functions: plotModel()
and plotFiltering()
where similar ggplot2 code is used. A proposed simple solution is to automatically change the column names provided by the user to "detected" and "subset_mito_percent" before plotting or providing to the flexmix function.
Documentation indicates that
plotMetrics()
andmixtureModel()
functions have the option for the user to specify columns in the object that contain the number of unique genes and the percentage of mitochondrial reads through the keywordsdetected=
andsubsets_mito_percent=
. Neither function acts as expected when other column names are provided. TheplotMetrics()
function will only display data from columns with those exact names "detected" and "subset_mito_percent" as long as they are present. If these columns are not present in the object, the plot will display a single point. ThemixtureModel()
function will similarly only return a model if these columns are present, and the model will only use the data from the columns with the exact names "detected" and "subsets_mito_percent". If these columns are not present in the object, it returns an error.Both issues appear to be due to the fact that
detected
andsubsets_mito_percent
are treated as variables in the plotMetrics and mixtureModel function, but when they are provided to ggplot function and flexmix function respectively, they are treated as exact names of columns. This is because ggplot accepts aesthetics without quotations around the column names as does the functional notation in the flexmix function.Reproducible example using dataset in vignette