Skip to content

Commit

Permalink
Update plot_cpdb_heatmap.py (#67)
Browse files Browse the repository at this point in the history
* Update plot_cpdb_heatmap.py

* Update tests.yaml

* Update tests.yaml

* Update tests.yaml

* Update tests.yaml

* Update tests.yaml
  • Loading branch information
zktuong committed Apr 19, 2024
1 parent 642bb98 commit 8da5379
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,13 @@ jobs:
coverage report
- name: Upload coverage to Codecov
if: matrix.config.os == 'ubuntu-latest' && matrix.config.python-version == '3.10' && github.actor != 'dependabot[bot]'
uses: codecov/codecov-action@v1
if: matrix.config.os == 'ubuntu-latest' && matrix.config.python-version == '3.10' && github.actor != 'dependabot[bot]' && github.actor == 'zktuong'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
directory: ./coverage/reports/
env_vars: ${{ format('OS={0},PYTHON={1}', matrix.config.os, matrix.config.python-version) }}
flags: unittests
name: codecov-umbrella
fail_ci_if_error: true
path_to_write_report: ./coverage/codecov_report.txt
fail_ci_if_error: false
verbose: true
5 changes: 4 additions & 1 deletion ktplotspy/plot/plot_cpdb_heatmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def plot_cpdb_heatmap(
title: str = "",
return_tables: bool = False,
symmetrical: bool = True,
default_sep: str = DEFAULT_CPDB_SEP,
**kwargs
) -> Union[sns.matrix.ClusterGrid, Dict]:
"""Plot cellphonedb results as total counts of interactions.
Expand Down Expand Up @@ -66,6 +67,8 @@ def plot_cpdb_heatmap(
Whether to return the dataframes storing the interaction network.
symmetrical : bool, optional
Whether to return the sum of interactions as symmetrical heatmap.
default_sep : str, optional
The default separator used when CellPhoneDB was run.
**kwargs
Passed to seaborn.clustermap.
Expand All @@ -83,7 +86,7 @@ def plot_cpdb_heatmap(
all_int = all_intr.iloc[:, col_start : all_intr.shape[1]].T
all_int.columns = intr_pairs
if cell_types is None:
cell_types = sorted(list(set([y for z in [x.split(DEFAULT_CPDB_SEP) for x in all_intr.columns[col_start:]] for y in z])))
cell_types = sorted(list(set([y for z in [x.split(default_sep) for x in all_intr.columns[col_start:]] for y in z])))
cell_types_comb = ["|".join(list(x)) for x in list(product(cell_types, cell_types))]
cell_types_keep = [ct for ct in all_int.index if ct in cell_types_comb]
empty_celltypes = list(set(cell_types_comb) ^ set(cell_types_keep))
Expand Down

0 comments on commit 8da5379

Please sign in to comment.