Skip to content
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

Unit test selectSpectraVariables fails if localData is present and requested #29

Closed
meowcat opened this issue Mar 31, 2021 · 3 comments
Closed

Comments

@meowcat
Copy link
Contributor

meowcat commented Mar 31, 2021

selectSpectraVariables right now seems to be incompatible with using localData:

library(MsBackendMassbank)
library(RSQLite)
dbc <- dbConnect(SQLite(), system.file("sql", "minimassbank.sqlite",
                                       package = "MsBackendMassbank"))

# Works with no problems
be <- backendInitialize(MsBackendMassbankSql(), dbc)
res <- selectSpectraVariables(be, spectraVariables = spectraVariables(be))

## When adding localData: error
be@localData <- DataFrame(a = seq_along(be))
res <- selectSpectraVariables(be, spectraVariables = spectraVariables(be))

# Error in (function (cl, name, valueClass)  : 
#             assignment of an object of class “integer” is not valid for @‘localData’ in an object of class “MsBackendMassbankSql”; is(value, "DataFrame") is not TRUE

## When not requesting anything from localData, it works fine
res <- selectSpectraVariables(be, spectraVariables = setdiff(spectraVariables(be), "a"))

This is on 237dc75. Consequently, this causes the unit test to fail when using precursorMz caching (meowcat@7273224).

test_that("selectSpectraVariables,MsBackendMassbankSql works", {

@meowcat meowcat changed the title Unit test selectSpectraVariables fails if localData is present Unit test selectSpectraVariables fails if localData is present and requested Mar 31, 2021
@jorainer
Copy link
Member

Good catch! I will fix that.

jorainer added a commit that referenced this issue Apr 14, 2021
- Fix `selectSpectraVariables,MsBackendMassbankSql` if `@localData` contains
  only a single column (issue #29).
@jorainer
Copy link
Member

@meowcat could you please cross-check if the fix works for you too and eventually close the issue if so?

@meowcat
Copy link
Contributor Author

meowcat commented Apr 14, 2021

Works. Thanks!

@meowcat meowcat closed this as completed Apr 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants