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

Problems running scDALI-Het/Hom #1

Open
lucia-ramirez opened this issue Mar 10, 2022 · 1 comment
Open

Problems running scDALI-Het/Hom #1

lucia-ramirez opened this issue Mar 10, 2022 · 1 comment

Comments

@lucia-ramirez
Copy link

Hello, I am trying to run scDALI on my data. I can run scDALI-Joint without any problems but when I try to run either scDALI-Het or scDALI-Hom I get some errors, even though is the same line of code (I only remove base_rate or cell_states depending on the mode).

This is the error that I get for scDALI-Het:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-48-8ea9456083cd> in <module>()
      1 res = run_tests(A = A.transpose(),D = D.transpose() , model = 'scDALI-Het', 
----> 2                 cell_state = cell_states)

/software/teamtrynka/conda/sex_diff_upgrade/lib/python3.6/site-packages/scdali/run_scdali_tests.py in run_tests(A, D, model, X, cell_state, return_rho, base_rate, n_cores)
    108             f,
    109             mat_dict={'A':A, 'D':D},
--> 110             n_cores=n_cores)
    111 
    112     out = dict()

/software/teamtrynka/conda/sex_diff_upgrade/lib/python3.6/site-packages/scdali/utils/parallel.py in process_parallel(fun_sequential, mat_dict, n_cores, verbose, show_progress)
     53     if n_cores==1:
     54         # don't invoke joblib
---> 55         results = fun_sequential(**mat_dict)
     56     else:
     57         blocks = np.linspace(0, n_cols, n_cores + 1).astype(int)

/software/teamtrynka/conda/sex_diff_upgrade/lib/python3.6/site-packages/scdali/utils/run_model.py in run_model(model, A, D, init_kwargs, fit_kwargs, callbacks, show_progress, verbose)
     54 
     55         # fit model
---> 56         mod.fit(**fit_kwargs)
     57 
     58         # run callbacks on fitted model

/software/teamtrynka/conda/sex_diff_upgrade/lib/python3.6/site-packages/scdali/models/glmm.py in fit(self, maxiter, tol)
    127         if self.X is not None:
    128             self.Lh = cho_factor(
--> 129                 (self.W0 * self.X).T @ self.X + JITTER * np.eye(self.X.shape[1]))
    130 
    131 

/software/teamtrynka/conda/sex_diff_upgrade/lib/python3.6/site-packages/scipy/linalg/decomp_cholesky.py in cho_factor(a, lower, overwrite_a, check_finite)
    151     """
    152     c, lower = _cholesky(a, lower=lower, overwrite_a=overwrite_a, clean=False,
--> 153                          check_finite=check_finite)
    154     return c, lower
    155 

/software/teamtrynka/conda/sex_diff_upgrade/lib/python3.6/site-packages/scipy/linalg/decomp_cholesky.py in _cholesky(a, lower, overwrite_a, clean, check_finite)
     25     if a1.shape[0] != a1.shape[1]:
     26         raise ValueError('Input array is expected to be square but has '
---> 27                          'the shape: {}.'.format(a1.shape))
     28 
     29     # Quick return for square empty array

ValueError: Input array is expected to be square but has the shape: (8, 1).

And this is the error that I get with scDALI-Hom:


---------------------------------------------------------------------------
SystemExit                                Traceback (most recent call last)
<ipython-input-52-318a46fce7e4> in <module>()
----> 1 res = run_tests(A = A.transpose(),D = D.transpose() , model = 'scDALI-Hom', base_rate = 0.025)

/software/teamtrynka/conda/sex_diff_upgrade/lib/python3.6/site-packages/scdali/run_scdali_tests.py in run_tests(A, D, model, X, cell_state, return_rho, base_rate, n_cores)
    108             f,
    109             mat_dict={'A':A, 'D':D},
--> 110             n_cores=n_cores)
    111 
    112     out = dict()

/software/teamtrynka/conda/sex_diff_upgrade/lib/python3.6/site-packages/scdali/utils/parallel.py in process_parallel(fun_sequential, mat_dict, n_cores, verbose, show_progress)
     53     if n_cores==1:
     54         # don't invoke joblib
---> 55         results = fun_sequential(**mat_dict)
     56     else:
     57         blocks = np.linspace(0, n_cols, n_cores + 1).astype(int)

/software/teamtrynka/conda/sex_diff_upgrade/lib/python3.6/site-packages/scdali/utils/run_model.py in run_model(model, A, D, init_kwargs, fit_kwargs, callbacks, show_progress, verbose)
     59         region_results = list()
     60         for cb in callbacks:
---> 61             region_results.append(cb(mod))
     62         results.append(region_results)
     63     return results

/software/teamtrynka/conda/sex_diff_upgrade/lib/python3.6/site-packages/scdali/utils/run_model.py in callback_method(model)
     82     """
     83     def callback_method(model):
---> 84         return getattr(model, method_name)(**kwargs)
     85     return callback_method
     86 

/software/teamtrynka/conda/sex_diff_upgrade/lib/python3.6/site-packages/scdali/models/glmm.py in test(self, return_rho)
    148         if len(self.rhos) == 1:
    149             # approximate null distribution using Davies method
--> 150             pvalue = davies_pval(Q_rho[0], Fs[0])
    151             if return_rho:
    152                 return pvalue, self.rhos[0]

/software/teamtrynka/conda/sex_diff_upgrade/lib/python3.6/site-packages/scdali/models/glmm.py in davies_pval(Q, F)
    351     """Wrapper around davies_pvalue that catches AssertionError."""
    352     try:
--> 353         pval = davies_pvalue(Q, F)
    354     except AssertionError:
    355         print('Warning - Davies pvalue assertion error: zero p-value')

/software/teamtrynka/conda/sex_diff_upgrade/lib/python3.6/site-packages/chiscore/_davies.py in davies_pvalue(q, w, return_info)
     32         w = w / maxq
     33 
---> 34     re = _pvalue_lambda(_lambda(w), q)
     35     if return_info:
     36         return re["p_value"][0], re

/software/teamtrynka/conda/sex_diff_upgrade/lib/python3.6/site-packages/chiscore/_davies.py in _lambda(K)
    102 
    103     if len(idx2) == 0:
--> 104         sys.exit("No Eigenvalue is bigger than 0!!")
    105     return lambda1[idx2]
    106 

SystemExit: No Eigenvalue is bigger than 0!!

Thanks!

@seanken
Copy link

seanken commented Oct 18, 2023

Hey! Following up on this, I am having the same issue with scDALI-Het, it fails about half way through.

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