Skip to content

Commit

Permalink
Merge branch 'release/v1.1.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
pinin4fjords committed Mar 2, 2022
2 parents 574071f + 211aa67 commit 1d71784
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
4 changes: 3 additions & 1 deletion scanpy-scripts-tests.bats
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ setup() {
batch_obs="${data_dir}/batch_obs.txt"
read_opt="-x $data_dir --show-obj stdout"
read_obj="${output_dir}/read.h5ad"
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"
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"
filter_obj="${output_dir}/filter.h5ad"
filter_mtx_gz="${output_dir}/filtered_matrix.mtx.gz"
test_clustering='louvain_k10_r0_5'
scrublet_tsv="${output_dir}/scrublet.tsv"
scrublet_png="${output_dir}/scrublet.png"
Expand Down Expand Up @@ -189,6 +190,7 @@ setup() {

[ "$status" -eq 0 ]
[ -f "$filter_obj" ]
[ -f "$filter_mtx_gz" ]
}

# Normalise
Expand Down
8 changes: 8 additions & 0 deletions scanpy_scripts/cmd_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@
'If not empty and not ending with "/" or "_", a "_" will be '
"appended.",
),
click.option(
"--mtx-compression",
"-G",
type=click.Choice(["zip", "gzip", "bz2", "zstd"]),
default=None,
show_default=True,
help="Compression type for MTX output.",
),
click.option(
"--show-obj",
type=click.Choice(["stdout", "stderr"]),
Expand Down
9 changes: 8 additions & 1 deletion scanpy_scripts/cmd_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def cmd(
zarr_chunk_size=None,
loom_write_obsm_varm=False,
export_mtx=None,
mtx_compression=None,
show_obj=None,
**kwargs,
):
Expand All @@ -56,6 +57,7 @@ def cmd(
chunk_size=zarr_chunk_size,
write_obsm_varm=loom_write_obsm_varm,
export_mtx=export_mtx,
mtx_compression=mtx_compression,
show_obj=show_obj,
)
return 0
Expand Down Expand Up @@ -107,6 +109,7 @@ def _write_obj(
output_format="anndata",
chunk_size=None,
export_mtx=None,
mtx_compression=None,
show_obj=None,
write_obsm_varm=False,
**kwargs,
Expand All @@ -120,7 +123,11 @@ def _write_obj(
else:
raise NotImplementedError("Unsupported output format: {}".format(output_format))
if export_mtx:
write_mtx(adata, fname_prefix=export_mtx, **kwargs)
compression = None
if mtx_compression is not None:
compression = {"method": mtx_compression}

write_mtx(adata, fname_prefix=export_mtx, compression=compression, **kwargs)
if show_obj:
click.echo(adata, err=show_obj == "stderr")
return 0
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name="scanpy-scripts",
version="1.1.4",
version="1.1.5",
author="nh3",
author_email="[email protected]",
description="Scripts for using scanpy from the command line",
Expand Down

0 comments on commit 1d71784

Please sign in to comment.