Tried to report this bug on github but none of my text can be seen either in the preview or after submission. So here it goes:
<!--
π Click the "Preview" tab above to see this text in HTML π
-->
Please follow **all the steps** described at https://mixomics-users.discourse.group/t/reproducible-example-to-clarify-issues/470 and next fill in the items below:
------------
π **Describe the bug:**
<!--
I went pack to a script after updating my mixomics package to 6.23.4. Suddenly, this code does not work anymore:
tune.spls1.MAE <- mixOmics::tune.spls(X, Y, ncomp= 1,
+ test.keepX = list.keepX,
+ validation = 'loo',
+ progressBar = FALSE,
+ measure = 'MAE')
Error in Check.entry.pls(X, Y, ncomp, keepX, keepY, mode = mode, scale = scale, :
Unmapped Y contains samples with no associated class. May be caused by NAs in input Y vector
I did check X and Y and they looks fine, all numeric, no NAs
-->
------------
π **reprex results from [reproducible example](https://mixomics-users.discourse.group/t/reproducible-example-to-clarify-issues/470) including sessioninfo():**
------------
π€ **Expected behavior:**
<!--
I expected the tuning to work as it has done previously. Using
data("breast.TCGA")
X <- breast.TCGA$data.train$mrna
Y <- breast.TCGA$data.train$subtype
Y=as.numeric
tune.spls1.MAE <- mixOmics::tune.spls(X, Y, ncomp= 1,
test.keepX = list.keepX,
validation = 'loo',
progressBar = FALSE,
measure = 'MAE')
Works! Just trying my first three columns of X againt Y throws the same error but the numbers look fine. The function can handle negative values, I suppose.
-->
------------
π‘ **Possible solution:**
<!--
No idea. I appreciate your help!
-->
hi @stepra,
I wonβt be able to help as I dont have access to the data you are trying to input. We would need the .RData with your code.
In the previous TCGA example the Y actually has a factor rather than a vector of continuous values. It still does not solve your original problem but I am saying it is used wrongly there. For MAE etc we would expect to have one single variable Y, is this what you have?
Dear Kim-Anh,
I very much appreciate your reply and understand, of course, that you cannot do anything without my data. Could I send it to you or one or your colleagues? I am really out of ideas and stuck. Iβd appreciate that a lot! For the example data I convert Y into numeric (it has values 1,2,3) before running the spls. Might not make sense biologically, but I just wanted to test the code. My Y (outcome) is %, i.e. ranges from 0 to 100.
Best wishes,
Stefanie
I believe there is a bug in the code for the tune.spls() function. Specifically, the below line from the check.entry.R script on the Mixomics github:
if (DA) {
if (length(which(rowSums(Y)==0)) != 0) {
stop(βUnmapped Y contains samples with no associated class. May be caused by NAs in input Y vectorβ)
}
}
Is being run in the tune.spls() function, even when the analysis is NOT DA.
Because I get the same error as @stepra, but when I remove the 0s from my input Y vector (e.g., by adding a constant), the error disappears. However, when I try to specify DA = FALSE for tune.spls() to get the chunk above to not apply, I get an error saying that there is no input argument for DA.
β
There must be an issue in how we declare which object is DA or not. Iβll put a note here but unfortunately at the moment we have no funding for a software developer for the remaining of this year.
Your trick seems to work well though, so that will be useful for those experiencing the same issue!