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

computeModelFits error : invalid argument to unary operator #14

Open
gomeznick86 opened this issue Feb 19, 2020 · 4 comments
Open

computeModelFits error : invalid argument to unary operator #14

gomeznick86 opened this issue Feb 19, 2020 · 4 comments

Comments

@gomeznick86
Copy link

gomeznick86 commented Feb 19, 2020

I tried running the computeModelFits function using my own data and it errors out with the message:

"Error in -vecImpulseParam[1] : invalid argument to unary operator".

I looked through the traceback but aren't familiar with where its calling the function.

Below is the traceback.

9.FUN(X[[i]], ...)
8.lapply(X = X, FUN = FUN, ...)
7.sapply(vecTimepoints, function(t) { (1/vecImpulseParam[3]) * (vecImpulseParam[2] + (vecImpulseParam[3] - vecImpulseParam[2]) * (1/(1 + exp(-vecImpulseParam[1] * (t - vecImpulseParam[5]))))) * (vecImpulseParam[4] + ...
6.ImpulseDE2:::evalImpulse_comp(vecImpulseParam = get_lsModelFits(obj = objectImpulseDE2)$case[[x]]$lsImpulseFit$vecImpulseParam, vecTimepoints = dfAnnot$Time)
5.FUN(X[[i]], ...)
4.lapply(objectImpulseDE2@vecAllIDs, function(x) { vecSfValues <- get_vecSizeFactors(obj = objectImpulseDE2) vecImpulseValuesCase <- ImpulseDE2:::evalImpulse_comp(vecImpulseParam = get_lsModelFits(obj = objectImpulseDE2)$case[[x]]$lsImpulseFit$vecImpulseParam, vecTimepoints = dfAnnot$Time) ...
3.lapply(objectImpulseDE2@vecAllIDs, function(x) { vecSfValues <- get_vecSizeFactors(obj = objectImpulseDE2) vecImpulseValuesCase <- ImpulseDE2:::evalImpulse_comp(vecImpulseParam = get_lsModelFits(obj = objectImpulseDE2)$case[[x]]$lsImpulseFit$vecImpulseParam, vecTimepoints = dfAnnot$Time) ...
2.do.call(rbind, lapply(objectImpulseDE2@vecAllIDs, function(x) { vecSfValues <- get_vecSizeFactors(obj = objectImpulseDE2) vecImpulseValuesCase <- ImpulseDE2:::evalImpulse_comp(vecImpulseParam = get_lsModelFits(obj = objectImpulseDE2)$case[[x]]$lsImpulseFit$vecImpulseParam, vecTimepoints = dfAnnot$Time) ...
1.computeModelFits(objectImpulseDE2 = objectImpulseDE2)

Edit: I think it has to do with the evalImpulse function. Any ideas? Simulated data seems to return things just fine.

@davidsebfischer
Copy link
Contributor

Hi @gomeznick86, the input format may be wrong, can you check that the count data is numeric and the time is numeric?

@gomeznick86
Copy link
Author

I double checked and they both are numeric.

is.numeric(txi_counts_ordered)
[1] TRUE
is.numeric(df_annotation_ordered$Time)
[1] TRUE

Then I used this command which completes successfully.

objectImpulseDE2_2 <- runImpulseDE2(
  matCountData    = txi_counts_ordered, 
  dfAnnotation    = df_annotation_ordered,
  boolCaseCtrl    = FALSE,
  vecConfounders  = NULL,
  boolIdentifyTransients =TRUE,
  scaNProc        = 12)

I'm able to plot heatmaps which makes me think that its able to compute and fit a model. Is there another way to extract the values from the object?

@davidsebfischer
Copy link
Contributor

Can you post me the full call from the code snippet involving runImpulseDE2 until the error? This might just a minor mistake in code usage but I am not 100% sure what you are doing. This here might be related too: #11

@EinarBaldvin
Copy link

Hi,

I am quite late to the party but there is a bug in the computeModelFits code.

computeModelFits uses all vecAllIDs in objectImpulseDE2 but if your input had any IDs that got discarded due to having zero counts across all samples that throws the error as those IDs will not have any data behind them.

First and easiest solution is to manually remove these entries first with mat <- mat[as.logical(rowSums(mat != 0)), ]

Second would be to modify the function code to use "names(ObjectImpulseDE2@vecDispersions)" instead of objectImpulseDE2@vecAllIDs.

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

3 participants