Skip to content

Commit 196a69d

Browse files
Backport PR #690 to 0.12.x (#691)
1 parent 71f09a8 commit 196a69d

File tree

419 files changed

+1462
-1422
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

419 files changed

+1462
-1422
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# openpipelines 0.12.6
2+
3+
## BUG FIXES
4+
5+
* `move_obsm_to_obs`: fix setting output columns when they already exist (PR #690).
6+
17
# openpipelines 0.12.5
28

39
## BUG FIXES

src/metadata/move_obsm_to_obs/script.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@ def setup_logger():
4747
try:
4848
logger.info(f".obs names: {mod_data.obs_names}")
4949
logger.info(f".obsm index: {obsm_matrix.index}")
50-
mod_data.obs = mod_data.obs.merge(obsm_matrix, how="left",
51-
validate="one_to_one",
52-
left_index=True, right_index=True)
50+
new_obs = mod_data.obs.drop(obsm_matrix.columns, axis=1, errors="ignore")
51+
new_obs = new_obs.merge(obsm_matrix, how="left",
52+
validate="one_to_one",
53+
left_index=True, right_index=True)
54+
mod_data.obs = new_obs
5355
except MergeError as e:
5456
raise ValueError(f"Could not join .obsm matrix at {par['obsm_key']} to .obs because there "
5557
"are some observation that are not overlapping between the two matrices "

src/metadata/move_obsm_to_obs/test.py

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import pytest
22
import re
33
import pandas as pd
4+
import uuid
45
from anndata import AnnData
56
from mudata import MuData, read_h5mu
67
from subprocess import CalledProcessError
@@ -10,7 +11,7 @@
1011
'functionality_name': 'move_obsm_to_obs',
1112
'resources_dir': 'resources_test/',
1213
'executable': 'target/docker/metadata/move_obsm_to_obs/move_obsm_to_obs',
13-
'config': '/home/di/code/openpipeline/src/metadata/move_obsm_to_obs/config.vsh.yaml'
14+
'config': 'src/metadata/move_obsm_to_obs/config.vsh.yaml'
1415
}
1516
## VIASH END
1617

@@ -31,9 +32,9 @@ def h5mu():
3132
@pytest.fixture
3233
def write_temp_h5mu(tmp_path):
3334
def wrapper(test_h5mu):
34-
test_h5mu_path = tmp_path / "input.h5mu"
35-
test_h5mu.write_h5mu(test_h5mu_path.name)
36-
return test_h5mu_path.name
35+
test_h5mu_path = tmp_path / f"{str(uuid.uuid4())}.h5mu"
36+
test_h5mu.write_h5mu(test_h5mu_path)
37+
return test_h5mu_path
3738
return wrapper
3839

3940
@pytest.fixture
@@ -80,6 +81,33 @@ def test_error_non_existing_modality(run_component, h5mu, write_temp_h5mu, tmp_p
8081
])
8182
re.search(r"ValueError: Modality foo does not exist\.",
8283
err.value.stdout.decode('utf-8'))
84+
85+
def test_execute_twice_overwrites(run_component, h5mu, write_temp_h5mu, tmp_path):
86+
output_run_1 = tmp_path/ "output1.h5mu"
87+
run_component(["--input", write_temp_h5mu(h5mu),
88+
"--modality", "mod1",
89+
"--obsm_key", "obsm_key",
90+
"--output", output_run_1
91+
])
92+
output_data_run_1 = read_h5mu(output_run_1)
93+
output_data_run_1.mod["mod1"].obsm = \
94+
{"obsm_key": pd.DataFrame([["dolor", "amet"], ["jommeke", "filiberke"]],
95+
index=output_data_run_1.mod["mod1"].obs_names,
96+
columns=["obsm_col1", "obsm_col2"])}
97+
98+
output_run_2 = tmp_path / "output2.h5mu"
99+
input_run_2 = write_temp_h5mu(output_data_run_1)
100+
run_component(["--input", input_run_2,
101+
"--modality", "mod1",
102+
"--obsm_key", "obsm_key",
103+
"--output", output_run_2
104+
])
105+
assert output_run_2.is_file(), "Some output file must have been created."
106+
output_data = read_h5mu(output_run_2)
107+
pd.testing.assert_index_equal(output_data.mod['mod1'].obs.index, pd.Index(['obs1', 'obs2']))
108+
pd.testing.assert_index_equal(output_data.mod['mod1'].obs.columns,
109+
pd.Index(['Obs', 'sample_id', 'obsm_key_obsm_col1', 'obsm_key_obsm_col2']))
110+
assert 'obsm_key' not in output_data.mod['mod1'].obsm
83111

84112
if __name__ == '__main__':
85113
exit(pytest.main([__file__]))

target/docker/annotate/popv/.config.vsh.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
functionality:
22
name: "popv"
33
namespace: "annotate"
4-
version: "0.12.5"
4+
version: "0.12.6"
55
authors:
66
- name: "Matthias Beyens"
77
roles:
@@ -341,6 +341,6 @@ info:
341341
output: "/home/runner/work/openpipeline/openpipeline/target/docker/annotate/popv"
342342
executable: "/home/runner/work/openpipeline/openpipeline/target/docker/annotate/popv/popv"
343343
viash_version: "0.7.5"
344-
git_commit: "5fa6062c47eb4206e52bc17f2cbcc04c27c4e953"
344+
git_commit: "8bf9c29a2c1223c2e4139d0372743537798fd3ea"
345345
git_remote: "https://github.com/openpipelines-bio/openpipeline"
346-
git_tag: "0.12.4-3-g5fa6062c47"
346+
git_tag: "0.12.5-3-g8bf9c29a2c"

target/docker/annotate/popv/popv

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
# popv 0.12.5
3+
# popv 0.12.6
44
#
55
# This wrapper script is auto-generated by viash 0.7.5 and is thus a derivative
66
# work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data
@@ -159,7 +159,7 @@ VIASH_META_TEMP_DIR="$VIASH_TEMP"
159159

160160
# ViashHelp: Display helpful explanation about this executable
161161
function ViashHelp {
162-
echo "popv 0.12.5"
162+
echo "popv 0.12.6"
163163
echo ""
164164
echo "Performs popular major vote cell typing on single cell sequence data using"
165165
echo "multiple algorithms. Note that this is a one-shot version of PopV."
@@ -488,10 +488,10 @@ RUN cd /opt && git clone --depth 1 https://github.com/YosefLab/PopV.git && \
488488
489489
LABEL org.opencontainers.image.authors="Matthias Beyens, Robrecht Cannoodt"
490490
LABEL org.opencontainers.image.description="Companion container for running component annotate popv"
491-
LABEL org.opencontainers.image.created="2024-02-02T13:20:49Z"
491+
LABEL org.opencontainers.image.created="2024-02-03T20:49:49Z"
492492
LABEL org.opencontainers.image.source="https://github.com/openpipelines-bio/openpipeline"
493-
LABEL org.opencontainers.image.revision="5fa6062c47eb4206e52bc17f2cbcc04c27c4e953"
494-
LABEL org.opencontainers.image.version="0.12.5"
493+
LABEL org.opencontainers.image.revision="8bf9c29a2c1223c2e4139d0372743537798fd3ea"
494+
LABEL org.opencontainers.image.version="0.12.6"
495495
496496
VIASHDOCKER
497497
}
@@ -642,7 +642,7 @@ while [[ $# -gt 0 ]]; do
642642
shift 1
643643
;;
644644
--version)
645-
echo "popv 0.12.5"
645+
echo "popv 0.12.6"
646646
exit
647647
;;
648648
--input)

target/docker/cluster/leiden/.config.vsh.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
functionality:
22
name: "leiden"
33
namespace: "cluster"
4-
version: "0.12.5"
4+
version: "0.12.6"
55
authors:
66
- name: "Dries De Maeyer"
77
roles:
@@ -214,6 +214,6 @@ info:
214214
output: "/home/runner/work/openpipeline/openpipeline/target/docker/cluster/leiden"
215215
executable: "/home/runner/work/openpipeline/openpipeline/target/docker/cluster/leiden/leiden"
216216
viash_version: "0.7.5"
217-
git_commit: "5fa6062c47eb4206e52bc17f2cbcc04c27c4e953"
217+
git_commit: "8bf9c29a2c1223c2e4139d0372743537798fd3ea"
218218
git_remote: "https://github.com/openpipelines-bio/openpipeline"
219-
git_tag: "0.12.4-3-g5fa6062c47"
219+
git_tag: "0.12.5-3-g8bf9c29a2c"

target/docker/cluster/leiden/leiden

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
# leiden 0.12.5
3+
# leiden 0.12.6
44
#
55
# This wrapper script is auto-generated by viash 0.7.5 and is thus a derivative
66
# work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data
@@ -158,7 +158,7 @@ VIASH_META_TEMP_DIR="$VIASH_TEMP"
158158

159159
# ViashHelp: Display helpful explanation about this executable
160160
function ViashHelp {
161-
echo "leiden 0.12.5"
161+
echo "leiden 0.12.6"
162162
echo ""
163163
echo "Cluster cells using the Leiden algorithm [Traag18] implemented in the Scanpy"
164164
echo "framework [Wolf18]."
@@ -445,10 +445,10 @@ RUN pip install --upgrade pip && \
445445
446446
LABEL org.opencontainers.image.authors="Dries De Maeyer"
447447
LABEL org.opencontainers.image.description="Companion container for running component cluster leiden"
448-
LABEL org.opencontainers.image.created="2024-02-02T13:20:49Z"
448+
LABEL org.opencontainers.image.created="2024-02-03T20:49:48Z"
449449
LABEL org.opencontainers.image.source="https://github.com/openpipelines-bio/openpipeline"
450-
LABEL org.opencontainers.image.revision="5fa6062c47eb4206e52bc17f2cbcc04c27c4e953"
451-
LABEL org.opencontainers.image.version="0.12.5"
450+
LABEL org.opencontainers.image.revision="8bf9c29a2c1223c2e4139d0372743537798fd3ea"
451+
LABEL org.opencontainers.image.version="0.12.6"
452452
453453
VIASHDOCKER
454454
}
@@ -599,7 +599,7 @@ while [[ $# -gt 0 ]]; do
599599
shift 1
600600
;;
601601
--version)
602-
echo "leiden 0.12.5"
602+
echo "leiden 0.12.6"
603603
exit
604604
;;
605605
--input)

target/docker/compression/compress_h5mu/.config.vsh.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
functionality:
22
name: "compress_h5mu"
33
namespace: "compression"
4-
version: "0.12.5"
4+
version: "0.12.6"
55
authors:
66
- name: "Dries Schaumont"
77
roles:
@@ -162,6 +162,6 @@ info:
162162
output: "/home/runner/work/openpipeline/openpipeline/target/docker/compression/compress_h5mu"
163163
executable: "/home/runner/work/openpipeline/openpipeline/target/docker/compression/compress_h5mu/compress_h5mu"
164164
viash_version: "0.7.5"
165-
git_commit: "5fa6062c47eb4206e52bc17f2cbcc04c27c4e953"
165+
git_commit: "8bf9c29a2c1223c2e4139d0372743537798fd3ea"
166166
git_remote: "https://github.com/openpipelines-bio/openpipeline"
167-
git_tag: "0.12.4-3-g5fa6062c47"
167+
git_tag: "0.12.5-3-g8bf9c29a2c"

target/docker/compression/compress_h5mu/compress_h5mu

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
# compress_h5mu 0.12.5
3+
# compress_h5mu 0.12.6
44
#
55
# This wrapper script is auto-generated by viash 0.7.5 and is thus a derivative
66
# work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data
@@ -158,7 +158,7 @@ VIASH_META_TEMP_DIR="$VIASH_TEMP"
158158

159159
# ViashHelp: Display helpful explanation about this executable
160160
function ViashHelp {
161-
echo "compress_h5mu 0.12.5"
161+
echo "compress_h5mu 0.12.6"
162162
echo ""
163163
echo "Compress a MuData file."
164164
echo ""
@@ -408,10 +408,10 @@ RUN pip install --upgrade pip && \
408408
409409
LABEL org.opencontainers.image.authors="Dries Schaumont"
410410
LABEL org.opencontainers.image.description="Companion container for running component compression compress_h5mu"
411-
LABEL org.opencontainers.image.created="2024-02-02T13:20:47Z"
411+
LABEL org.opencontainers.image.created="2024-02-03T20:49:49Z"
412412
LABEL org.opencontainers.image.source="https://github.com/openpipelines-bio/openpipeline"
413-
LABEL org.opencontainers.image.revision="5fa6062c47eb4206e52bc17f2cbcc04c27c4e953"
414-
LABEL org.opencontainers.image.version="0.12.5"
413+
LABEL org.opencontainers.image.revision="8bf9c29a2c1223c2e4139d0372743537798fd3ea"
414+
LABEL org.opencontainers.image.version="0.12.6"
415415
416416
VIASHDOCKER
417417
}
@@ -562,7 +562,7 @@ while [[ $# -gt 0 ]]; do
562562
shift 1
563563
;;
564564
--version)
565-
echo "compress_h5mu 0.12.5"
565+
echo "compress_h5mu 0.12.6"
566566
exit
567567
;;
568568
--input)

target/docker/compression/tar_extract/.config.vsh.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
functionality:
22
name: "tar_extract"
33
namespace: "compression"
4-
version: "0.12.5"
4+
version: "0.12.6"
55
arguments:
66
- type: "file"
77
name: "--input"
@@ -101,6 +101,6 @@ info:
101101
output: "/home/runner/work/openpipeline/openpipeline/target/docker/compression/tar_extract"
102102
executable: "/home/runner/work/openpipeline/openpipeline/target/docker/compression/tar_extract/tar_extract"
103103
viash_version: "0.7.5"
104-
git_commit: "5fa6062c47eb4206e52bc17f2cbcc04c27c4e953"
104+
git_commit: "8bf9c29a2c1223c2e4139d0372743537798fd3ea"
105105
git_remote: "https://github.com/openpipelines-bio/openpipeline"
106-
git_tag: "0.12.4-3-g5fa6062c47"
106+
git_tag: "0.12.5-3-g8bf9c29a2c"

0 commit comments

Comments
 (0)