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

failure to run plot_clustermaps() #11

Open
bkang-mit opened this issue Jan 23, 2023 · 1 comment
Open

failure to run plot_clustermaps() #11

bkang-mit opened this issue Jan 23, 2023 · 1 comment

Comments

@bkang-mit
Copy link

When running below line from colab tutorial (currently running in jupyter notebook)
analytics.plot_clustermaps()

I get the following errors. Please let me know how to resolve it.

Thanks!


ValueError Traceback (most recent call last)
/tmp/ipykernel_2025/1780327345.py in
----> 1 analytics.plot_clustermaps()

~/anaconda3/envs/cytoself/lib/python3.7/site-packages/cytoself/analysis/analytics.py in plot_clustermaps(self, data, corr_idx_idx, target_vq_layer, datatype, savepath, filename, format, num_cores)
631 fileName="corridx_" + datatype,
632 num_cores=num_cores,
--> 633 savepath=savepath,
634 )
635 corr_idx_idx = self.corr_idx_idx

~/anaconda3/envs/cytoself/lib/python3.7/site-packages/cytoself/analysis/analytics.py in calc_corr_idx_idx(self, data, fileName, num_cores, savepath)
567 for d in data:
568 if len(d) > 0:
--> 569 d = np.nan_to_num(selfpearson_multi(d, num_cores=num_cores))
570 self.corr_idx_idx.append(d)
571 # self.corr_idx_idx = np.stack(self.corr_idx_idx)

~/anaconda3/envs/cytoself/lib/python3.7/site-packages/cytoself/analysis/pearson_correlation.py in selfpearson_multi(data, num_cores, axis)
32 corr = Parallel(n_jobs=num_cores, prefer="threads")(
33 delayed(corr_single)(i1, ar1, data.shape[0], data[i1:])
---> 34 for i1, ar1 in enumerate(tqdm(data))
35 )
36 corr = np.vstack(corr)

~/anaconda3/envs/cytoself/lib/python3.7/site-packages/joblib/parallel.py in call(self, iterable)
1052
1053 with self._backend.retrieval_context():
-> 1054 self.retrieve()
1055 # Make sure that we get a last message telling us we are done
1056 elapsed_time = time.time() - self._start_time

~/anaconda3/envs/cytoself/lib/python3.7/site-packages/joblib/parallel.py in retrieve(self)
931 try:
932 if getattr(self._backend, 'supports_timeout', False):
--> 933 self._output.extend(job.get(timeout=self.timeout))
934 else:
935 self._output.extend(job.get())

~/anaconda3/envs/cytoself/lib/python3.7/multiprocessing/pool.py in get(self, timeout)
655 return self._value
656 else:
--> 657 raise self._value
658
659 def _set(self, i, obj):

~/anaconda3/envs/cytoself/lib/python3.7/multiprocessing/pool.py in worker(inqueue, outqueue, initializer, initargs, maxtasks, wrap_exception)
119 job, i, func, args, kwds = task
120 try:
--> 121 result = (True, func(*args, **kwds))
122 except Exception as e:
123 if wrap_exception and func is not _helper_reraises_exception:

~/anaconda3/envs/cytoself/lib/python3.7/site-packages/joblib/_parallel_backends.py in call(self, *args, **kwargs)
593 def call(self, *args, **kwargs):
594 try:
--> 595 return self.func(*args, **kwargs)
596 except KeyboardInterrupt as e:
597 # We capture the KeyboardInterrupt and reraise it as

~/anaconda3/envs/cytoself/lib/python3.7/site-packages/joblib/parallel.py in call(self)
261 with parallel_backend(self._backend, n_jobs=self._n_jobs):
262 return [func(*args, **kwargs)
--> 263 for func, args, kwargs in self.items]
264
265 def reduce(self):

~/anaconda3/envs/cytoself/lib/python3.7/site-packages/joblib/parallel.py in (.0)
261 with parallel_backend(self._backend, n_jobs=self._n_jobs):
262 return [func(*args, **kwargs)
--> 263 for func, args, kwargs in self.items]
264
265 def reduce(self):

~/anaconda3/envs/cytoself/lib/python3.7/site-packages/cytoself/analysis/pearson_correlation.py in corr_single(i1, ar1, dim, data1)
16 corr = np.zeros((1, dim))
17 for i2, ar2 in enumerate(data1):
---> 18 corr[:, i2 + i1] = pearsonr(ar1, ar2)[0]
19 return corr
20

~/anaconda3/envs/cytoself/lib/python3.7/site-packages/scipy/stats/stats.py in pearsonr(x, y)
4043 # scipy.linalg.norm(xm) does not overflow if xm is, for example,
4044 # [-5e210, 5e210, 3e200, -3e200]
-> 4045 normxm = linalg.norm(xm)
4046 normym = linalg.norm(ym)
4047

~/anaconda3/envs/cytoself/lib/python3.7/site-packages/scipy/linalg/misc.py in norm(a, ord, axis, keepdims, check_finite)
143 # Differs from numpy only in non-finite handling and the use of blas.
144 if check_finite:
--> 145 a = np.asarray_chkfinite(a)
146 else:
147 a = np.asarray(a)

~/anaconda3/envs/cytoself/lib/python3.7/site-packages/numpy/lib/function_base.py in asarray_chkfinite(a, dtype, order)
487 if a.dtype.char in typecodes['AllFloat'] and not np.isfinite(a).all():
488 raise ValueError(
--> 489 "array must not contain infs or NaNs")
490 return a
491

ValueError: array must not contain infs or NaNs

li-li-github pushed a commit that referenced this issue Feb 23, 2023
* initial commit, implemented

* patch from previous PR is reverted
@li-li-github
Copy link
Collaborator

Sorry for the belated reply. I recently upgraded the cytoself-pytorch branch to the main branch. There might be still some issues with installing python 3.9 (Google colab currently uses python3.8 but the updated cytoself requires python 3.9 so you'd have to manually install python 3.9 and pip in the beginning) but otherwise should work well. The safest way is to try the jupyter notebook on your local computer.

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