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

ov.single.cytotrace2 function error #146

Closed
WeiQin2001 opened this issue Sep 8, 2024 · 1 comment
Closed

ov.single.cytotrace2 function error #146

WeiQin2001 opened this issue Sep 8, 2024 · 1 comment

Comments

@WeiQin2001
Copy link

Prediction of absolute developmental potential using CytoTrace2部分:
运行到这一步时:
results = ov.single.cytotrace2(adata,
use_model_dir="cymodels/5_models_weights",
species="mouse",
batch_size = 10000,
smooth_batch_size = 1000,
disable_parallelization = False,
max_cores = None,
max_pcs = 200,
seed = 14,
output_dir = 'cytotrace2_results'
)

出现以下报错:”

AttributeError Traceback (most recent call last)
Cell In[6], line 1
----> 1 results = ov.single.cytotrace2(adata,
2 use_model_dir="cymodels/5_models_weights",
3 species="mouse",
4 batch_size = 10000,
5 smooth_batch_size = 1000,
6 disable_parallelization = False,
7 max_cores = None,
8 max_pcs = 200,
9 seed = 14,
10 output_dir = 'cytotrace2_results'
11 )

File ~/miniconda3/envs/omicverse/lib/python3.10/site-packages/omicverse/single/_cytotrace2.py:219, in cytotrace2(adata, use_model_dir, species, batch_size, smooth_batch_size, disable_parallelization, max_cores, max_pcs, seed, output_dir)
213 results.append(executor.submit(process_subset, idx,
214 chunked_expression, smooth_batch_size,
215 smooth_cores_to_use, species,
216 use_model_dir, output_dir, max_pcs, seed))
218 for f in concurrent.futures.as_completed(results):
--> 219 smooth_by_knn_df = f.result()
220 predictions.append(smooth_by_knn_df)
224 for idx in range(chunk_number):

File ~/miniconda3/envs/omicverse/lib/python3.10/concurrent/futures/_base.py:451, in Future.result(self, timeout)
449 raise CancelledError()
450 elif self._state == FINISHED:
--> 451 return self.__get_result()
453 self._condition.wait(timeout)
455 if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]:

File ~/miniconda3/envs/omicverse/lib/python3.10/concurrent/futures/_base.py:403, in Future.__get_result(self)
401 if self._exception:
402 try:
--> 403 raise self._exception
404 finally:
405 # Break a reference cycle with the exception in self._exception
406 self = None

File ~/miniconda3/envs/omicverse/lib/python3.10/concurrent/futures/thread.py:58, in _WorkItem.run(self)
55 return
57 try:
---> 58 result = self.fn(*self.args, **self.kwargs)
59 except BaseException as exc:
60 self.future.set_exception(exc)

File ~/miniconda3/envs/omicverse/lib/python3.10/site-packages/omicverse/single/_cytotrace2.py:33, in process_subset(idx, chunked_expression, smooth_batch_size, smooth_cores_to_use, species, use_model_dir, output_dir, max_pcs, seed)
30 top_col_names = gene_names[top_col_inds]
32 # predict by unrandomized chunked batches
---> 33 predicted_df = predict(ranked_data, cell_names, use_model_dir , chunked_expression.shape[0])
35 smooth_score = smoothing_by_diffusion(predicted_df, ranked_data,
36 top_col_inds, smooth_batch_size, seed)
38 binned_score_pred_df = binning(predicted_df, smooth_score)

File ~/miniconda3/envs/omicverse/lib/python3.10/site-packages/omicverse/externel/cytotrace2/gen_utils.py:154, in predict(ranked_data, cell_names, model_dir, batch_size)
151 all_order_test = []
153 all_models_path = pd.Series(np.array([os.path.join(dp, f) for dp, dn, fn in os.walk(os.path.expanduser(model_dir)) for f in fn]))
--> 154 all_models_path = all_models_path[all_models_path.str.endswith('.pt')]
157 data_loader = generic_data_loader(ranked_data, batch_size)
159 #print(' Started prediction')

File ~/miniconda3/envs/omicverse/lib/python3.10/site-packages/pandas/core/generic.py:6299, in NDFrame.getattr(self, name)
6292 if (
6293 name not in self._internal_names_set
6294 and name not in self._metadata
6295 and name not in self._accessors
6296 and self._info_axis._can_hold_identifiers_and_holds_name(name)
6297 ):
6298 return self[name]
-> 6299 return object.getattribute(self, name)

File ~/miniconda3/envs/omicverse/lib/python3.10/site-packages/pandas/core/accessor.py:224, in CachedAccessor.get(self, obj, cls)
221 if obj is None:
222 # we're accessing the attribute of the class, i.e., Dataset.geo
223 return self._accessor
--> 224 accessor_obj = self._accessor(obj)
225 # Replace the property with the accessor object. Inspired by:
226 # https://www.pydanny.com/cached-property.html
227 # We need to use object.setattr because we overwrite setattr on
228 # NDFrame
229 object.setattr(obj, self._name, accessor_obj)

File ~/miniconda3/envs/omicverse/lib/python3.10/site-packages/pandas/core/strings/accessor.py:191, in StringMethods.init(self, data)
188 def init(self, data) -> None:
189 from pandas.core.arrays.string_ import StringDtype
--> 191 self._inferred_dtype = self._validate(data)
192 self._is_categorical = isinstance(data.dtype, CategoricalDtype)
193 self._is_string = isinstance(data.dtype, StringDtype)

File ~/miniconda3/envs/omicverse/lib/python3.10/site-packages/pandas/core/strings/accessor.py:245, in StringMethods._validate(data)
242 inferred_dtype = lib.infer_dtype(values, skipna=True)
244 if inferred_dtype not in allowed_types:
--> 245 raise AttributeError("Can only use .str accessor with string values!")
246 return inferred_dtype

AttributeError: Can only use .str accessor with string values!“

@Starlitnightly
Copy link
Owner

I have fixed this issue in the latest version.

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