From 1fe2db596c25c8ee8133059224fb1a8f7a6ef3db Mon Sep 17 00:00:00 2001 From: Robbe Fonteyn Date: Fri, 19 Dec 2025 15:49:40 +0100 Subject: [PATCH 1/2] Update aggregate_flowframes to work with list of flowframes --- pyproject.toml | 3 ++- src/flowsom/pp/fcs_functions.py | 16 +++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 0018048..eaade37 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,13 +4,14 @@ requires = [ "hatchling" ] [project] name = "flowsom" -version = "0.2.2" +version = "0.2.3" description = "The complete FlowSOM package known from R, now available in Python!" readme = "README.md" license = { file = "LICENSE" } maintainers = [ { name = "Artuur Couckuyt", email = "Artuur.Couckuyt@ugent.be" }, { name = "Benjamin Rombaut", email = "Benjamin.Rombaut@ugent.be" }, + { name = "Robbe Fonteyn", email = "Robbe.Fonteyn@ugent.be"}, { name = "Yvan Saeys", email = "Yvan.Saeys@UGent.be" }, { name = "Sofie Van Gassen", email = "Sofie.VanGassen@UGent.be" }, ] diff --git a/src/flowsom/pp/fcs_functions.py b/src/flowsom/pp/fcs_functions.py index d594e12..03171c1 100644 --- a/src/flowsom/pp/fcs_functions.py +++ b/src/flowsom/pp/fcs_functions.py @@ -8,12 +8,11 @@ from flowsom.io import read_FCS from flowsom.tl import get_markers - -def aggregate_flowframes(filenames, c_total, channels=None, keep_order=False): +def aggregate_flowframes(files, c_total, channels=None, keep_order=False): """Aggregate multiple FCS files together. - :param filenames: An array containing full paths to the FCS files - :type filenames: np.array + :param files: An array/list containing full paths to the FCS files or fcs files as anndata objects + :type files: np.array :param c_total: Total number of cells to write to the output file :type c_total: int :param channels: Channels/markers to keep in the aggregate. Default None @@ -26,12 +25,15 @@ def aggregate_flowframes(filenames, c_total, channels=None, keep_order=False): new file. Default = False. :type silent: boolean. """ - nFiles = len(filenames) + nFiles = len(files) cFile = int(np.ceil(c_total / nFiles)) flow_frame = [] - for i, file_path in enumerate(filenames): - f = read_FCS(file_path) + for i, f in enumerate(files): + + if not isinstance(f, ad.AnnData): + f = read_FCS(f) + if channels is not None: f = f[:, list(get_markers(f, channels).keys())] cPerFile = min([f.X.shape[0], cFile]) From 6b20514712a81050c6d5679ce6fa0655f09810a6 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 19 Dec 2025 15:24:56 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pyproject.toml | 2 +- src/flowsom/pp/fcs_functions.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index eaade37..99abd4b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,7 @@ license = { file = "LICENSE" } maintainers = [ { name = "Artuur Couckuyt", email = "Artuur.Couckuyt@ugent.be" }, { name = "Benjamin Rombaut", email = "Benjamin.Rombaut@ugent.be" }, - { name = "Robbe Fonteyn", email = "Robbe.Fonteyn@ugent.be"}, + { name = "Robbe Fonteyn", email = "Robbe.Fonteyn@ugent.be" }, { name = "Yvan Saeys", email = "Yvan.Saeys@UGent.be" }, { name = "Sofie Van Gassen", email = "Sofie.VanGassen@UGent.be" }, ] diff --git a/src/flowsom/pp/fcs_functions.py b/src/flowsom/pp/fcs_functions.py index 03171c1..d04f863 100644 --- a/src/flowsom/pp/fcs_functions.py +++ b/src/flowsom/pp/fcs_functions.py @@ -8,6 +8,7 @@ from flowsom.io import read_FCS from flowsom.tl import get_markers + def aggregate_flowframes(files, c_total, channels=None, keep_order=False): """Aggregate multiple FCS files together. @@ -30,7 +31,6 @@ def aggregate_flowframes(files, c_total, channels=None, keep_order=False): flow_frame = [] for i, f in enumerate(files): - if not isinstance(f, ad.AnnData): f = read_FCS(f)