Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions Cluster/DpEngine.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,15 @@ def __init__(self, data, N_iter, Pi_k, use_fixed=False, co_assign_flag=False, ig
if N_iter == 0:
return None

mut_iter = iter(data.items())
# NDHistogram has .iteritems(), not .items()
if hasattr(data, "items"):
mut_iter = iter(data.items())
elif hasattr(data, "iteritems"):
mut_iter = data.iteritems()
# elif hasattr(data, "_hist_array"):
# mut_iter = ((i, v) for i, v in enumerate(data._hist_array))
else:
raise TypeError("Unsupported data type for DpEngine: {}".format(type(data)))
s_cluster = DP_cluster(self, DP_item(next(mut_iter)[0], self))

for label, mut_hist in mut_iter:
Expand Down Expand Up @@ -242,8 +250,13 @@ def tree_cluster_DP(self, co_assign, K, clonal_threshold=0.95, var_loc=None, DP_
# Flatten for TSNE and summary.
log_data_flattened = []

for label, mutation in self.data.items():
log_data_flattened.append(mutation.flatten())
# NDHistogram has .iteritems(), not .items()
if hasattr(self.data, "items"):
for label, mutation in self.data.items():
log_data_flattened.append(mutation.flatten())
elif hasattr(self.data, "iteritems"):
for label, mutation in self.data.iteritems():
log_data_flattened.append(mutation.flatten())

'''Normalize for TSNE'''

Expand Down
24 changes: 24 additions & 0 deletions envs/phylogicndt_py3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: phylogicndt_py3
channels:
- conda-forge
- defaults
dependencies:
- python=3.9
- pip
- setuptools
- wheel
# scientific stack from conda
- numpy=1.24.2
- scipy=1.10.1
- pandas=1.5.3
- matplotlib=3.6.3
- seaborn=0.12.2
- scikit-learn=1.3.0
- networkx=2.8.8
- intervaltree=2.1.0
- graphviz
- python-graphviz
# optional R support
- r-base=4.3
- pip:
- sselogsumexp @ git+https://github.com/rmcgibbo/logsumexp.git