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

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 :slight_smile: 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?

Kim-Anh

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

hi @stepra,
Have you tried with a Y outcome on the 0 to 100 scale instead? The Y in using the MAE should not be a factor.

You can send me you RData if that does not work at kimanh.lecao[at]unimelb.edu.au with a fully reproducible code.

Kim-Anh

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.
β†’

1 Like

Thanks @fquerdasi,

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!

Kim-Anh