You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi Team, I have multi-sample data, and previously I was trying to run sctransform on that. It was giving out-of-memory error on the server, even when I allocated 500GB memory to it. I also noticed around that time, that I haven't filtered out the non-protein-coding genes. So I proceeded with that first, and filtered out those genes, which reduced my gene count from 26k to 17k. Now, when I'm running the scTransform on it again, I'm getting the following error:
# Let's read the saved datafile_name="01-msdata_filtered_protein_coding.h5ms"ms_data=st.io.read_h5ms(here() /config.data_processed/file_name)
# set scope and modems_data.tl.set_scope_and_mode(
scope=slice_generator[:],
mode='integrate'
)
ms_data.tl.sctransform()
---
{
"name": "LinAlgError",
"message": "Singular matrix",
"stack": "---------------------------------------------------------------------------_RemoteTracebackTraceback (mostrecentcalllast)
_RemoteTraceback:
\"\"\"Traceback (mostrecentcalllast):
File \"/N/u/mraadam/BigRed200/.conda/envs/stereo_pdac/lib/python3.8/site-packages/joblib/_utils.py\", line72, in__call__returnself.func(**kwargs)
File \"/N/u/mraadam/BigRed200/.conda/envs/stereo_pdac/lib/python3.8/site-packages/joblib/parallel.py\", line598, in__call__return [func(*args, **kwargs)
File \"/N/u/mraadam/BigRed200/.conda/envs/stereo_pdac/lib/python3.8/site-packages/joblib/parallel.py\", line598, in<listcomp>return [func(*args, **kwargs)
File \"<__array_function__ internals>\", line180, ininvFile \"/N/u/mraadam/BigRed200/.conda/envs/stereo_pdac/lib/python3.8/site-packages/numpy/linalg/linalg.py\", line552, ininvainv=_umath_linalg.inv(a, signature=signature, extobj=extobj)
File \"/N/u/mraadam/BigRed200/.conda/envs/stereo_pdac/lib/python3.8/site-packages/numpy/linalg/linalg.py\", line89, in_raise_linalgerror_singularraiseLinAlgError(\"Singularmatrix\")
numpy.linalg.LinAlgError: Singularmatrix
\"\"\"Theaboveexceptionwasthedirectcauseofthefollowingexception:
LinAlgErrorTraceback (mostrecentcalllast)
CellIn[6], line71# set scope and mode2ms_data.tl.set_scope_and_mode(
3scope=slice_generator[:],
4mode='integrate'5 )
---->7ms_data.tl.sctransform()
File~/.conda/envs/stereo_pdac/lib/python3.8/site-packages/stereo/core/ms_pipeline.py:223, inMSDataPipeLine.__getattr__.<locals>.temp(*args, **kwargs)
220kwargs[\"mode\"] =self.__mode222ifkwargs[\"mode\"] == \"integrate\":
-->223returnself._use_integrate_method(item, *args, **kwargs)
224elifkwargs[\"mode\"] == \"isolated\":
225self._run_isolated_method(item, *args, **kwargs)
File~/.conda/envs/stereo_pdac/lib/python3.8/site-packages/stereo/core/ms_pipeline.py:136, inMSDataPipeLine._use_integrate_method(self, item, *args, **kwargs)
133returnnew_attr(*args, **kwargs)
135logger.info(f'data_obj(idx=0) in ms_data start to run {item}')
-->136returnnew_attr(
137ms_data_view.merged_data.__getattribute__(self.__class__.ATTR_NAME),
138*args,
139**kwargs140 )
File~/.conda/envs/stereo_pdac/lib/python3.8/site-packages/stereo/core/st_pipeline.py:43, inlogit.<locals>.wrapped(*args, **kwargs)
41logger.info('start to run {}...'.format(func.__name__))
42tk=tc.start()
--->43res=func(*args, **kwargs)
44logger.info('{} end, consume time {:.4f}s.'.format(func.__name__, tc.get_time_consumed(key=tk, restart=False)))
45returnresFile~/.conda/envs/stereo_pdac/lib/python3.8/site-packages/stereo/core/st_pipeline.py:583, inStPipeline.sctransform(self, n_cells, n_genes, filter_hvgs, var_features_n, inplace, res_key, exp_matrix_key, seed_use, filter_raw, **kwargs)
581from ..preprocess.filterimportfilter_genes582data=self.dataifinplaceelsecopy.deepcopy(self.data)
-->583self.result[res_key] =sc_transform(data, n_cells, n_genes, filter_hvgs, var_features_n,
584exp_matrix_key=exp_matrix_key, seed_use=seed_use, **kwargs)
585key='sct'586self.reset_key_record(key, res_key)
File~/.conda/envs/stereo_pdac/lib/python3.8/site-packages/stereo/preprocess/sc_transform.py:25, insc_transform(data, n_cells, n_genes, filter_hvgs, var_features_n, do_correct_umi, exp_matrix_key, seed_use, **kwargs)
22data.exp_matrix=csr_matrix(data.exp_matrix)
24# set do_correct_umi as False for less memory cost--->25res=SCTransform(
26data.exp_matrix.T.tocsr(),
27data.gene_names,
28data.cell_names,
29n_genes=n_genes,
30n_cells=n_cells,
31do_correct_umi=do_correct_umi,
32return_only_var_genes=filter_hvgs,
33variable_features_n=var_features_n,
34seed_use=seed_use,
35**kwargs36 )
37new_exp_matrix=res[0][exp_matrix_key]
38ifissparse(new_exp_matrix):
39# data.sub_by_index(gene_index=res[1]['umi_genes'])File~/.conda/envs/stereo_pdac/lib/python3.8/site-packages/stereo/algorithm/sctransform/sctransform.py:133, inSCTransform(umi, genes, cells, reference_sct_model, do_correct_umi, n_cells, residual_features, variable_features_n, variable_features_rv_th, vars_to_regress, do_scale, do_center, clip_range, conserve_memory, return_only_var_genes, seed_use, **kwargs)
130sct_method='default'132ifsct_method=='default':
-->133vst_out=vst(**vst_args)
134else:
135raiseNotImplementedErrorFile~/.conda/envs/stereo_pdac/lib/python3.8/site-packages/stereo/algorithm/sctransform/vst.py:132, invst(umi, genes, cells, latent_var, batch_var, latent_var_nonreg, n_genes, n_cells, method, do_regularize, theta_regularization, res_clip_range, bin_size, min_cells, residual_type, return_cell_attr, return_gene_attr, return_corrected_umi, min_variance, bw_adjust, gmean_eps, theta_estimation_fun, theta_given, exclude_poisson, use_geometric_mean, use_geometric_mean_offset, fix_intercept, fix_slope, scale_factor, vst_flavor, seed_use)
130genes_step1_bool_list=np.isin(genes, genes_step1)
131start_time=time.time()
-->132model_pars=get_model_pars(
133genes_step1, bin_size, umi[genes_step1_bool_list,][:, cells_step1_bool_list],
134model_str, cells_step1, method, data_step1, theta_given,
135theta_estimation_fun, exclude_poisson, fix_intercept, fix_slope, use_geometric_mean,
136use_geometric_mean_offset)
137logger.info(f'get_model_pars finished, cost {time.time() -start_time} seconds')
139min_theta=1e-07File~/.conda/envs/stereo_pdac/lib/python3.8/site-packages/stereo/algorithm/sctransform/vst.py:235, inget_model_pars(genes_step1, bin_size, umi, model_str, cells_step1, method, data_step1, theta_given, theta_estimation_fun, exclude_poisson, fix_intercept, fix_slope, use_geometric_mean, use_geometric_mean_offset)
233raiseNotImplementedError234ifmethod=='poisson':
-->235model_pars=fit_poisson(umi=umi, model_str=model_str, data=data_step1,
236theta_estimation_fun=theta_estimation_fun)
237else:
238raiseNotImplementedErrorFile~/.conda/envs/stereo_pdac/lib/python3.8/site-packages/stereo/algorithm/sctransform/utils.py:68, infit_poisson(umi, model_str, data, theta_estimation_fun)
65deffit_poisson(umi, model_str, data, theta_estimation_fun=\"theta.ml\") ->pd.DataFrame:
66# TODO: ignore `theta_estimation_fun`67regressor_data=dmatrix(\"~log_umi\", data, return_type='dataframe')
--->68results=Parallel(n_jobs=cpu_count(), backend=\"threading\")(
69delayed(one_row_fit_poission)(regressor_data, y.toarray()[0], theta_estimation_fun)
70foryinumi71 )
72returnpd.DataFrame(results, columns=[\"theta\", \"Intercept\", \"log_umi\"])
File~/.conda/envs/stereo_pdac/lib/python3.8/site-packages/joblib/parallel.py:2007, inParallel.__call__(self, iterable)
2001# The first item from the output is blank, but it makes the interpreter2002# progress until it enters the Try/Except block of the generator and2003# reaches the first `yield` statement. This starts the asynchronous2004# dispatch of the tasks to the workers.2005next(output)
->2007returnoutputifself.return_generatorelselist(output)
File~/.conda/envs/stereo_pdac/lib/python3.8/site-packages/joblib/parallel.py:1650, inParallel._get_outputs(self, iterator, pre_dispatch)
1647yield1649withself._backend.retrieval_context():
->1650yieldfromself._retrieve()
1652exceptGeneratorExit:
1653# The generator has been garbage collected before being fully1654# consumed. This aborts the remaining tasks if possible and warn1655# the user if necessary.1656self._exception=TrueFile~/.conda/envs/stereo_pdac/lib/python3.8/site-packages/joblib/parallel.py:1754, inParallel._retrieve(self)
1747whileself._wait_retrieval():
17481749# If the callback thread of a worker has signaled that its task1750# triggered an exception, or if the retrieval loop has raised an1751# exception (e.g. `GeneratorExit`), exit the loop and surface the1752# worker traceback.1753ifself._aborting:
->1754self._raise_error_fast()
1755break1757# If the next job is not ready for retrieval yet, we just wait for1758# async callbacks to progress.File~/.conda/envs/stereo_pdac/lib/python3.8/site-packages/joblib/parallel.py:1789, inParallel._raise_error_fast(self)
1785# If this error job exists, immediately raise the error by1786# calling get_result. This job might not exists if abort has been1787# called directly or if the generator is gc'ed.1788iferror_jobisnotNone:
->1789error_job.get_result(self.timeout)
File~/.conda/envs/stereo_pdac/lib/python3.8/site-packages/joblib/parallel.py:745, inBatchCompletionCallBack.get_result(self, timeout)
739backend=self.parallel._backend741ifbackend.supports_retrieve_callback:
742# We assume that the result has already been retrieved by the743# callback thread, and is stored internally. It's just waiting to744# be returned.-->745returnself._return_or_raise()
747# For other backends, the main thread needs to run the retrieval step.748try:
File~/.conda/envs/stereo_pdac/lib/python3.8/site-packages/joblib/parallel.py:763, inBatchCompletionCallBack._return_or_raise(self)
761try:
762ifself.status==TASK_ERROR:
-->763raiseself._result764returnself._result765finally:
LinAlgError: Singularmatrix"
}
Before filtering, this step was working fine, and the OOM error was thrown later on. But now, it's throwing this error. Am I missing some step here, or is this a bug? I'd really appreciate it if someone can tell me a fix for this.
Thanks, and best regards.
The text was updated successfully, but these errors were encountered:
Hi Team, I have multi-sample data, and previously I was trying to run
sctransform
on that. It was giving out-of-memory error on the server, even when I allocated 500GB memory to it. I also noticed around that time, that I haven't filtered out the non-protein-coding genes. So I proceeded with that first, and filtered out those genes, which reduced my gene count from 26k to 17k. Now, when I'm running the scTransform on it again, I'm getting the following error:Before filtering, this step was working fine, and the OOM error was thrown later on. But now, it's throwing this error. Am I missing some step here, or is this a bug? I'd really appreciate it if someone can tell me a fix for this.
Thanks, and best regards.
The text was updated successfully, but these errors were encountered: