From 8da537946cc64ae2854acc3884e069e364d3f9ac Mon Sep 17 00:00:00 2001 From: Zewen Kelvin Tuong Date: Fri, 19 Apr 2024 11:39:22 +1000 Subject: [PATCH] Update plot_cpdb_heatmap.py (#67) * Update plot_cpdb_heatmap.py * Update tests.yaml * Update tests.yaml * Update tests.yaml * Update tests.yaml * Update tests.yaml --- .github/workflows/tests.yaml | 8 +++----- ktplotspy/plot/plot_cpdb_heatmap.py | 5 ++++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 58d98c3..c8bd1bd 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -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 diff --git a/ktplotspy/plot/plot_cpdb_heatmap.py b/ktplotspy/plot/plot_cpdb_heatmap.py index 36a129e..053d77f 100644 --- a/ktplotspy/plot/plot_cpdb_heatmap.py +++ b/ktplotspy/plot/plot_cpdb_heatmap.py @@ -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. @@ -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. @@ -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))