Skip to content

Commit 1d71784

Browse files
committed
Merge branch 'release/v1.1.5'
2 parents 574071f + 211aa67 commit 1d71784

File tree

4 files changed

+20
-3
lines changed

4 files changed

+20
-3
lines changed

scanpy-scripts-tests.bats

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ setup() {
1313
batch_obs="${data_dir}/batch_obs.txt"
1414
read_opt="-x $data_dir --show-obj stdout"
1515
read_obj="${output_dir}/read.h5ad"
16-
filter_opt="--save-raw -p n_genes 200 2500 -p c:n_counts 0 50000 -p n_cells 3 inf -p pct_counts_mito 0 0.2 -c mito '!True' --show-obj stdout"
16+
filter_opt="--save-raw -p n_genes 200 2500 -p c:n_counts 0 50000 -p n_cells 3 inf -p pct_counts_mito 0 0.2 -c mito '!True' --show-obj stdout --export-mtx ${output_dir}/filtered --mtx-compression gzip"
1717
filter_obj="${output_dir}/filter.h5ad"
18+
filter_mtx_gz="${output_dir}/filtered_matrix.mtx.gz"
1819
test_clustering='louvain_k10_r0_5'
1920
scrublet_tsv="${output_dir}/scrublet.tsv"
2021
scrublet_png="${output_dir}/scrublet.png"
@@ -189,6 +190,7 @@ setup() {
189190

190191
[ "$status" -eq 0 ]
191192
[ -f "$filter_obj" ]
193+
[ -f "$filter_mtx_gz" ]
192194
}
193195

194196
# Normalise

scanpy_scripts/cmd_options.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,14 @@
6868
'If not empty and not ending with "/" or "_", a "_" will be '
6969
"appended.",
7070
),
71+
click.option(
72+
"--mtx-compression",
73+
"-G",
74+
type=click.Choice(["zip", "gzip", "bz2", "zstd"]),
75+
default=None,
76+
show_default=True,
77+
help="Compression type for MTX output.",
78+
),
7179
click.option(
7280
"--show-obj",
7381
type=click.Choice(["stdout", "stderr"]),

scanpy_scripts/cmd_utils.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ def cmd(
3838
zarr_chunk_size=None,
3939
loom_write_obsm_varm=False,
4040
export_mtx=None,
41+
mtx_compression=None,
4142
show_obj=None,
4243
**kwargs,
4344
):
@@ -56,6 +57,7 @@ def cmd(
5657
chunk_size=zarr_chunk_size,
5758
write_obsm_varm=loom_write_obsm_varm,
5859
export_mtx=export_mtx,
60+
mtx_compression=mtx_compression,
5961
show_obj=show_obj,
6062
)
6163
return 0
@@ -107,6 +109,7 @@ def _write_obj(
107109
output_format="anndata",
108110
chunk_size=None,
109111
export_mtx=None,
112+
mtx_compression=None,
110113
show_obj=None,
111114
write_obsm_varm=False,
112115
**kwargs,
@@ -120,7 +123,11 @@ def _write_obj(
120123
else:
121124
raise NotImplementedError("Unsupported output format: {}".format(output_format))
122125
if export_mtx:
123-
write_mtx(adata, fname_prefix=export_mtx, **kwargs)
126+
compression = None
127+
if mtx_compression is not None:
128+
compression = {"method": mtx_compression}
129+
130+
write_mtx(adata, fname_prefix=export_mtx, compression=compression, **kwargs)
124131
if show_obj:
125132
click.echo(adata, err=show_obj == "stderr")
126133
return 0

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setup(
77
name="scanpy-scripts",
8-
version="1.1.4",
8+
version="1.1.5",
99
author="nh3",
1010
author_email="[email protected]",
1111
description="Scripts for using scanpy from the command line",

0 commit comments

Comments
 (0)