MarioniLab / scran

Clone of the Bioconductor repository for the scran package.
https://bioconductor.org/packages/devel/bioc/html/scran.html
39 stars 23 forks source link

inter-cluster rescaling factors are not strictly positive #85

Closed Hrovatin closed 3 years ago

Hrovatin commented 3 years ago

I tried to run scran, but I get the below error. It goes away if I increase min.mean. Below is the image of my clusters (they are quite small).

image


---------------------------------------------------------------------------
RRuntimeError                             Traceback (most recent call last)
<ipython-input-186-9952eef1e205> in <module>
     24     ro.globalenv['data_mat'] = adata_sub.X.T
     25     ro.globalenv['input_groups'] = adata_sub_pp.obs['groups']
---> 26     size_factors = ro.r(f'calculateSumFactors(data_mat, clusters = input_groups, min.mean = 0.6, BPPARAM=MulticoreParam(workers = 16),positive=TRUE)')
     27     adata.obs.loc[adata_sub.obs.index,'size_factors_sample'] = size_factors
     28 

~/miniconda3/envs/rpy2_3/lib/python3.8/site-packages/rpy2/robjects/__init__.py in __call__(self, string)
    414     def __call__(self, string):
    415         p = rinterface.parse(string)
--> 416         res = self.eval(p)
    417         return conversion.rpy2py(res)
    418 

~/miniconda3/envs/rpy2_3/lib/python3.8/site-packages/rpy2/robjects/functions.py in __call__(self, *args, **kwargs)
    195                 v = kwargs.pop(k)
    196                 kwargs[r_k] = v
--> 197         return (super(SignatureTranslatedFunction, self)
    198                 .__call__(*args, **kwargs))
    199 

~/miniconda3/envs/rpy2_3/lib/python3.8/site-packages/rpy2/robjects/functions.py in __call__(self, *args, **kwargs)
    123             else:
    124                 new_kwargs[k] = conversion.py2rpy(v)
--> 125         res = super(Function, self).__call__(*new_args, **new_kwargs)
    126         res = conversion.rpy2py(res)
    127         return res

~/miniconda3/envs/rpy2_3/lib/python3.8/site-packages/rpy2/rinterface_lib/conversion.py in _(*args, **kwargs)
     42 def _cdata_res_to_rinterface(function):
     43     def _(*args, **kwargs):
---> 44         cdata = function(*args, **kwargs)
     45         # TODO: test cdata is of the expected CType
     46         return _cdata_to_rinterface(cdata)

~/miniconda3/envs/rpy2_3/lib/python3.8/site-packages/rpy2/rinterface.py in __call__(self, *args, **kwargs)
    622                     error_occured))
    623             if error_occured[0]:
--> 624                 raise embedded.RRuntimeError(_rinterface._geterrmessage())
    625         return res
    626 

RRuntimeError: Error in .rescale_clusters(clust.profile, ref.col = ref.clust, min.mean = min.mean) : 
  inter-cluster rescaling factors are not strictly positive
LTLA commented 3 years ago

Have a look at the discussion in LTLA/scuttle#7 for an explanation.

Hrovatin commented 3 years ago

Thanks. After removing clusters with avg(n_genes) < threshold (in my case 1000 separated the populations) the error was resolved.