Skip to content

Commit 1fe2db5

Browse files
committed
Update aggregate_flowframes to work with list of flowframes
1 parent d8cb6a5 commit 1fe2db5

2 files changed

Lines changed: 11 additions & 8 deletions

File tree

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@ requires = [ "hatchling" ]
44

55
[project]
66
name = "flowsom"
7-
version = "0.2.2"
7+
version = "0.2.3"
88
description = "The complete FlowSOM package known from R, now available in Python!"
99
readme = "README.md"
1010
license = { file = "LICENSE" }
1111
maintainers = [
1212
{ name = "Artuur Couckuyt", email = "Artuur.Couckuyt@ugent.be" },
1313
{ name = "Benjamin Rombaut", email = "Benjamin.Rombaut@ugent.be" },
14+
{ name = "Robbe Fonteyn", email = "Robbe.Fonteyn@ugent.be"},
1415
{ name = "Yvan Saeys", email = "Yvan.Saeys@UGent.be" },
1516
{ name = "Sofie Van Gassen", email = "Sofie.VanGassen@UGent.be" },
1617
]

src/flowsom/pp/fcs_functions.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@
88
from flowsom.io import read_FCS
99
from flowsom.tl import get_markers
1010

11-
12-
def aggregate_flowframes(filenames, c_total, channels=None, keep_order=False):
11+
def aggregate_flowframes(files, c_total, channels=None, keep_order=False):
1312
"""Aggregate multiple FCS files together.
1413
15-
:param filenames: An array containing full paths to the FCS files
16-
:type filenames: np.array
14+
:param files: An array/list containing full paths to the FCS files or fcs files as anndata objects
15+
:type files: np.array
1716
:param c_total: Total number of cells to write to the output file
1817
:type c_total: int
1918
: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):
2625
new file. Default = False.
2726
:type silent: boolean.
2827
"""
29-
nFiles = len(filenames)
28+
nFiles = len(files)
3029
cFile = int(np.ceil(c_total / nFiles))
3130

3231
flow_frame = []
33-
for i, file_path in enumerate(filenames):
34-
f = read_FCS(file_path)
32+
for i, f in enumerate(files):
33+
34+
if not isinstance(f, ad.AnnData):
35+
f = read_FCS(f)
36+
3537
if channels is not None:
3638
f = f[:, list(get_markers(f, channels).keys())]
3739
cPerFile = min([f.X.shape[0], cFile])

0 commit comments

Comments
 (0)