From 7df08ca836b790423a3d0483cb6efcf4698f9632 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maren=20B=C3=BCttner?= Date: Thu, 28 Jan 2021 09:16:55 +0100 Subject: [PATCH 1/4] update readme --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d8a8943..a8e8ad1 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # scCODA - Single-cell differential composition analysis scCODA allows for identification of compositional changes in high-throughput sequencing count data, especially cell compositions from scRNA-seq. -It also provides a framework for integration of results directly from *scanpy* and other sources. +It also provides a framework for integration of results directly from [scanpy](https://scanpy.readthedocs.io/en/stable/) and other sources. ![scCODA](.github/Figures/Fig1_v10.png) The statistical methodology and benchmarking performance are described in: -Büttner, Ostner *et al.* (2020). **scCODA: A Bayesian model for compositional single-cell data analysis** +Büttner, Ostner *et al* (2020). **scCODA: A Bayesian model for compositional single-cell data analysis** [Link](https://www.biorxiv.org/content/10.1101/2020.12.14.422688v1) to article on *BioRxiv*. @@ -18,9 +18,9 @@ For further information, please refer to the ## Installation -A functioning python environment (>=3.7) is necessary to run this package. +Running the package requires a working Python environment (>=3.7). -This package uses the tensorflow (==2.3.2) and tensorflow-probability (==0.11.0) packages. +This package uses the `tensorflow` (`==2.3.2`) and `tensorflow-probability` (`==0.11.0`) packages. The GPU versions of these packages have not been tested with scCODA and are thus not recommended. **To install scCODA via pip, call**: From fe02081b0886609961392e8fa87261e492dd70d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maren=20B=C3=BCttner?= Date: Thu, 28 Jan 2021 09:20:53 +0100 Subject: [PATCH 2/4] update installation manual --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index a8e8ad1..154efc7 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,10 @@ The GPU versions of these packages have not been tested with scCODA and are thus `pip install -r requirements.txt` +- Install the package: + + `python setup.py install` + **Import scCODA in a Python session via**: import sccoda From d270c1ac5025e99378939b42c19252b556e93f86 Mon Sep 17 00:00:00 2001 From: redst4r Date: Thu, 11 Feb 2021 16:44:53 -0800 Subject: [PATCH 3/4] Added 'level_order' for custom ordering in stacked_barplot --- sccoda/util/data_visualization.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sccoda/util/data_visualization.py b/sccoda/util/data_visualization.py index f4d7be5..2e9d6e9 100644 --- a/sccoda/util/data_visualization.py +++ b/sccoda/util/data_visualization.py @@ -95,6 +95,7 @@ def stacked_barplot( dpi: Optional[int] = 100, cmap: Optional[ListedColormap] = cm.tab20, plot_legend: Optional[bool] = True, + level_order: List[str] = None ) -> plt.Subplot: """ @@ -130,6 +131,8 @@ def stacked_barplot( # option to plot one stacked barplot per sample if feature_name == "samples": + assert set(level_order) == set(data.obs.index), "level order is inconsistent with levels" + data = data[level_order] g = stackbar( data.X, type_names=data.var.index, @@ -141,7 +144,11 @@ def stacked_barplot( plot_legend=plot_legend, ) else: - levels = pd.unique(data.obs[feature_name]) + if level_order: + assert set(level_order) == set(data.obs[feature_name]), "level order is inconsistent with levels" + levels = level_order + else: + levels = pd.unique(data.obs[feature_name]) n_levels = len(levels) feature_totals = np.zeros([n_levels, data.X.shape[1]]) From 1936d9cb6cf933e08d540c0c5880d21fba107ba0 Mon Sep 17 00:00:00 2001 From: redst4r Date: Thu, 11 Feb 2021 17:00:37 -0800 Subject: [PATCH 4/4] bugfix --- sccoda/util/data_visualization.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sccoda/util/data_visualization.py b/sccoda/util/data_visualization.py index 2e9d6e9..d756df6 100644 --- a/sccoda/util/data_visualization.py +++ b/sccoda/util/data_visualization.py @@ -131,8 +131,9 @@ def stacked_barplot( # option to plot one stacked barplot per sample if feature_name == "samples": - assert set(level_order) == set(data.obs.index), "level order is inconsistent with levels" - data = data[level_order] + if level_order: + assert set(level_order) == set(data.obs.index), "level order is inconsistent with levels" + data = data[level_order] g = stackbar( data.X, type_names=data.var.index,