YosefLab/ImpulseDE2

How can I extract impulse model parameters?

nicolerg opened this issue · 1 comments

Hello, I am having some trouble extracting the fitted impulse model parameters (beta, h0, h1, h2, t1, t2) from the ImpulseDE2Object. names(ImpulseDE2Object) only gives me "dfImpulseDE2Results", "vecDEGenes", not "lsModelFits". ImpulseDE2::fitModels(ImpulseDE2Object) gives me Error: 'fitModels' is not an exported object from 'namespace:ImpulseDE2'. I have no trouble getting the model parameters with the earlier ImpulseDE package. I am using ImpulseDE2 v1.8. Here is the command I used:

impulse_results = runImpulseDE2(matCountData = counts_round, 
                                dfAnnotation = annot,
                                boolCaseCtrl = FALSE, 
                                vecConfounders = NULL, 
                                scaNProc = 14,
                                scaQThres = 0.05, 
                                boolIdentifyTransients = TRUE,
                                boolVerbose = TRUE)

Am I doing something wrong? Thanks in advance!

I was able to use this workaround:

fit = get_lsModelFits(obj=impulse_results)
params_list = list()
for (gene in names(fit$case)){
  fit_params = data.table(t(fit$case[[gene]]$lsImpulseFit$vecImpulseParam))
  fit_params[,ENSEMBL := gene]
  params_list[[gene]] = fit_params
}
all_params = rbindlist(params_list)

It might be helpful if get_lsModelFits() was more clearly added to the documentation.