Moanin object on 12 samples containing the following information:
Group variable given by 'Group' with the following levels:
A AB
6 6
Time variable given by 'Timepoint'
Basis matrix with 6 basis_matrix functions
Basis matrix was constructed with the following spline_formula
~Group + Group:splines::ns(Timepoint, df = 2) + 0
Information about the data (a SummarizedExperiment object):
class: SummarizedExperiment
dim: 10 12
metadata(0):
assays(1): ''
rownames(10): a b ... i j
rowData names(0):
colnames: NULL
colData names(4): Replicate Group Timepoint WeeklyGroup
I ran into the following error message:
Error in expand_contrast(object, contrast): There are not equal numbers of variables (basis functions) per level of grouping factor
Traceback:
1. DE_timecourse(moanin_model, "AB-A", use_voom_weights = FALSE)
2. DE_timecourse(moanin_model, "AB-A", use_voom_weights = FALSE)
3. .local(object, ...)
4. expand_contrast(object, contrast)
5. stop("There are not equal numbers of variables (basis functions) per level of grouping factor")
which is quite unexpected.
I tracked the issue back to where the function expand_contrast makes the check:
https://github.com/NelleV/moanin/blob/38158450e1c6b73ef473dce671b9318a1c136159/R/DE_timecourse.R#L42
Where glevs are the Group levels ('A','AB' in my case). Indeed for how the check is performed (with grep), all the columns from the second level ('AB') will be matched also by the first ('A'), hence the inequal number of variables per level.
Simply renaming the levels to ['A', 'BA'] restored the expected behaviour, but since it took me some time to figure out the problem, I deemed useful to share this observation.
Here follows the code to fully reproduce the issue:
Hello, I encountered an issue while attempting to run DE_timecourse function on a valid moanin object. As I called:
on a [mock] moanin object that looks like this:
I ran into the following error message:
which is quite unexpected. I tracked the issue back to where the function
expand_contrast
makes the check: https://github.com/NelleV/moanin/blob/38158450e1c6b73ef473dce671b9318a1c136159/R/DE_timecourse.R#L42 Where glevs are the Group levels ('A','AB' in my case). Indeed for how the check is performed (with grep), all the columns from the second level ('AB') will be matched also by the first ('A'), hence the inequal number of variables per level.Simply renaming the levels to ['A', 'BA'] restored the expected behaviour, but since it took me some time to figure out the problem, I deemed useful to share this observation.
Here follows the code to fully reproduce the issue: