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
An error occurs in line 526 of plot_cn_1d2d.py when there is only one clone detected:
File "/software/team274/bl10/miniconda3/envs/hatchet/lib/python3.9/site-packages/hatchet/utils/plot_cn_1d2d.py", line 521, in <listcomp> my_colors = [cmap(mapping[r]) for r in bbc_.cn_clone1] KeyError: '1|1'
This is because the key in mapping is '('1|1',)' instead of '1|1'.
The error originated from line 78 of plot_cn_1d2d.py:
_, mapping = reindex([k for k, _ in bbc.groupby([f'cn_clone{i + 1}' for i in range(n_clones)])])
where a length-1 list is fed into bbc.groupby().
The newer version of pandas will return a length-1 tuple instead of a string, as highlighted here
The error can be overcome by deleting this:
if n_clones == 1: my_colors = [cmap(mapping[r]) for r in bbc_.cn_clone1] else: my_colors = [cmap(mapping[tuple(r)]) for _, r in bbc_[[f'cn_clone{i + 1}' for i in range(n_clones)]].iterrows()]
and replacing with:
my_colors = [cmap(mapping[tuple(r)]) for _, r in bbc_[[f'cn_clone{i + 1}' for i in range(n_clones)]].iterrows()]
A similar error occurs with plot_genome() in plot_cn_1d2d.py.
The text was updated successfully, but these errors were encountered:
Similar issue to an error which I posted earlier.
An error occurs in line 526 of
plot_cn_1d2d.py
when there is only one clone detected:File "/software/team274/bl10/miniconda3/envs/hatchet/lib/python3.9/site-packages/hatchet/utils/plot_cn_1d2d.py", line 521, in <listcomp> my_colors = [cmap(mapping[r]) for r in bbc_.cn_clone1] KeyError: '1|1'
This is because the key in
mapping
is'('1|1',)'
instead of'1|1'
.The error originated from line 78 of
plot_cn_1d2d.py
:_, mapping = reindex([k for k, _ in bbc.groupby([f'cn_clone{i + 1}' for i in range(n_clones)])])
where a length-1 list is fed into
bbc.groupby()
.The newer version of pandas will return a length-1 tuple instead of a string, as highlighted here
The error can be overcome by deleting this:
if n_clones == 1: my_colors = [cmap(mapping[r]) for r in bbc_.cn_clone1] else: my_colors = [cmap(mapping[tuple(r)]) for _, r in bbc_[[f'cn_clone{i + 1}' for i in range(n_clones)]].iterrows()]
and replacing with:
my_colors = [cmap(mapping[tuple(r)]) for _, r in bbc_[[f'cn_clone{i + 1}' for i in range(n_clones)]].iterrows()]
A similar error occurs with
plot_genome()
inplot_cn_1d2d.py
.The text was updated successfully, but these errors were encountered: