Skip to content

DADA2_SPLITREGIONS fails with only one sample #891

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
julianSchwab opened this issue May 26, 2025 · 1 comment
Open

DADA2_SPLITREGIONS fails with only one sample #891

julianSchwab opened this issue May 26, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@julianSchwab
Copy link

julianSchwab commented May 26, 2025

Description of the bug

I know this is an unusual case, but I was running the pipeline for a benchmark only using one sample. However, DADA2_SPLITREGIONS fails with the following error:
Error in rowSums(df[, 2:(ncol(df) - 1)] != 0) : 'x' must be an array of at least two dimensions

The reason is that for only one sample the command df <- df[as.logical(rowSums(df[,2:(ncol(df)-1)] != 0)), ] fails due to automatic matrix to vector conversion if only one column is selected. Thus, rowSums produces this error.

For the sake of robustness, I would suggest to escape this rare case by e.g. enforcing matrix-structure via df[as.logical(as.matrix(rowSums(df[,2:(ncol(df)-1)] != 0))), ]

Command used and terminal output

Relevant files

No response

System information

No response

@julianSchwab julianSchwab added the bug Something isn't working label May 26, 2025
@julianSchwab julianSchwab changed the title DADA2:SPLITREGIONS fails with only one sample DADA2_SPLITREGIONS fails with only one sample May 26, 2025
@d4straub
Copy link
Collaborator

One sample is indeed unusual but we should make it work regardless. Thanks for suggesting a fix! Could you open a PR with the suggested changes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants