CHPGenetics / COMPOSITE

MIT License
10 stars 1 forks source link

Error in default RNA_modality #3

Open qingjian1991 opened 4 months ago

qingjian1991 commented 4 months ago

Hi:

I use this tools at default paramters by running the code below multiplet_classification, consistency = RNA_modality.composite_rna("RNA.mtx")

The RNA.mxt is the default output of 10x cellrange.

Most of my samples are errors as below:

`

multiplet_classification, consistency = RNA_modality.composite_rna(f"{path}/{name}/filtered_feature_bc_matrix/matrix.mtx.gz") Cuda is not available; Fitting the COMPOSITE model on RNA modality Traceback (most recent call last): File "", line 1, in File "/data1/qingjian/miniconda3/lib/python3.10/site-packages/sccomposite/RNA_modality.py", line 254, in composite_rna theta,alpha,beta,decay, loss,p = MLE_rna(stable, N=N, p=p, lr=lr, tolerance=tolerance) File "/data1/qingjian/miniconda3/lib/python3.10/site-packages/sccomposite/RNA_modality.py", line 88, in MLE_rna NLL = -loglik_rna(N, theta, alpha, beta, decay, x) File "/data1/qingjian/miniconda3/lib/python3.10/site-packages/sccomposite/RNA_modality.py", line 51, in loglik_rna gamma = torch.distributions.Gamma(alpha*(1+torch.tensor(k, device = dev)/(1+torch.exp(-decay))), beta) File "/data1/qingjian/miniconda3/lib/python3.10/site-packages/torch/distributions/gamma.py", line 54, in init super().init(batch_shape, validate_args=validate_args) File "/data1/qingjian/miniconda3/lib/python3.10/site-packages/torch/distributions/distribution.py", line 62, in init raise ValueError( ValueError: Expected parameter rate (Tensor of shape (300,)) of distribution Gamma(concentration: torch.Size([300]), rate: torch.Size([300])) to satisfy the constraint GreaterThan(lower_bound=0.0), but found invalid values: tensor([ 1.6409e-01, 1.6189e-01, 9.3748e-03, 1.0825e-01, 3.2169e-02, 6.9167e-02, 3.6890e-01, 2.4163e-01, 3.2167e-01, 5.2185e-03, 9.4338e-02, 2.0939e-01, 9.6202e-02, 3.7098e-01, 2.6605e-01, 1.7913e-01, 1.0665e-02, 2.0813e-02, 4.0756e-03, 1.2661e-02, ` How to deal with such error?

Qingjian Chen

CHPGenetics commented 3 months ago

Thank you for your interest in our method!

Our code is currently not compatible with the direct output from cellranger. Please first convert the data to a Seurat object and then follow our tutorial (https://htmlpreview.github.io/?https://github.com/CHPGenetics/COMPOSITE/blob/main/composite_data_preparation.html) to preprocess the data.