biocore / biom-format

The Biological Observation Matrix (BIOM) Format Project
http://biom-format.org
Other
89 stars 95 forks source link

biom head -n 0 and -m 0 not supported #899

Closed peterjc closed 1 year ago

peterjc commented 1 year ago

I consider this low priority, but probably an easy fix.

Observed behaviour

Attempting to use biom head -n 0 ... and/or -m 0 both fail with an ugly traceback ending IndexError: n cannot be <= 0. or IndexError: m cannot be <= 0.

Tested using macOS, biom-format installed via conda:

$ biom --version
biom, version 2.1.14

Expected behaviour:

Using -m 0 would show just the first column of identifiers (and no columns of samples). Work around:

$ biom head -m 1 example.biom | cut -f 1

Using -n 0 would show just the headers (including sample names unless -m 0), but none of the observations. Workaround:

$ biom head -n 1 example.biom | grep "^#"

wasade commented 1 year ago

Hah! Ya, good find :) Thank you by the way for taking such a deep dive with biom, it's extremely helpful