mixOmicsTeam / mixOmics

Development repository for the Bioconductor package 'mixOmics '
http://mixomics.org/
162 stars 54 forks source link

Error in Check.entry.pls #291

Closed StefPN closed 1 month ago

StefPN commented 1 year ago

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:


πŸ” reprex results from reproducible example including sessioninfo():


πŸ€” Expected behavior:


πŸ’‘ Possible solution:

StefPN commented 1 year ago

For some reason, none of my text can be seen either in the preview or after submission. So I posted it here: https://mixomics-users.discourse.group/t/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/1202

evaham1 commented 1 month ago

Copying code here for reference:

<!--
πŸ‘† 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!
-->
evaham1 commented 1 month ago

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.

evaham1 commented 1 month ago

not enough information at this time, unable to reproduce this error and due to post being from summer 2023 closing for now