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

computNPA fails when the input data.frames don't have the same number of rows #3

Open
MahShaaban opened this issue Jan 22, 2021 · 2 comments

Comments

@MahShaaban
Copy link

computNPA fails with an uninformative error when the number of rows in the data.frames of the input list dL is not the same.

# Load packages
library(NPA)
#> Loading required package: R6
library(NPAModels)

# Load COPD data
data(COPD1)

# Load apoptosis model
net.apopto <- load_model('Mm', 'CFA', 'Apoptosis')

# Score the apoptosis model
npa <- compute_npa(COPD1, net.apopto, verbose = TRUE)
#> Preparing data...
#> Computing differential backbone values...
#> Computing amplitudes of perturbation...
#> Computing variance...
#> Computing downstream reshuffling...
#> Computing backbone reshuffling...
#> Done.

# COPD contain missing values
COPD2 <- COPD1
COPD2$`CS (5m)` <- COPD2$`CS (5m)`[-1,]

compute_npa(COPD2, net.apopto, verbose = TRUE)
#> Preparing data...
#> Error in sapply(dL, function(G) {: non-numeric argument to binary operator

Created on 2021-01-22 by the reprex package (v0.3.0)

The function checks the order of nodeLabel, but doesn't fail, here. Rather it fails when computing s, here

@sgubianpm
Copy link
Member

@MahShaaban, this is correct. I will add some check of the rows of the different slots. Actually, they have to be the same across the slots, so if different, the intersection has to be used.

@MahShaaban
Copy link
Author

Thanks @sgubianpm
Yes. To get the function to work, I used the intersection of the slots as you point out.
It would be great if the function can do that automatically, possibly with a warning. Or, the function could fail with an informative error message.

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