Skip to content

Commit 1319621

Browse files
committed
Add CLI help in docs
1 parent 5b98c43 commit 1319621

File tree

5 files changed

+52
-32
lines changed

5 files changed

+52
-32
lines changed

docs/quickstart.rst

+30-19
Original file line numberDiff line numberDiff line change
@@ -36,34 +36,45 @@ The result will be written to ``example.hamsta_result.txt`` in tab-delimited for
3636
Single value decomposition of local ancestry data
3737
-------------------------------------------------
3838

39-
::
39+
.. argparse::
40+
:module: hamsta.cli
41+
:func: parse_args
42+
:prog: hamsta
43+
:path: preprocess
44+
45+
46+
.. note::
4047

41-
usage: hamsta preprocess [-h] [--rfmixfb RFMIXFB RFMIXFB] [--zarr ZARR ZARR] [--nc NC NC] [--global-ancestry GLOBAL_ANCESTRY] [--N N] [--out OUT] [--keep KEEP] [--k K] [--version] [-v] [-vv]
42-
43-
options:
44-
-h, --help show this help message and exit
45-
--rfmixfb RFMIXFB RFMIXFB
46-
rfmix output .fb.tsv, two args require, (filepath, ancestry)
47-
--zarr ZARR ZARR Xarray dataset in zarr, two args require, (filepath, data_var)
48-
--nc NC NC Xarray dataset in netcdf, two args require, (filepath, data_var)
49-
--global-ancestry GLOBAL_ANCESTRY
50-
Path to rfmix.Q
51-
--N N Number of individuals
52-
--out OUT output prefix
53-
--keep KEEP list of individual to keep
54-
--k K Number of components to compute
55-
--version show program's version number and exit
56-
-v, --verbose set loglevel to INFO
57-
-vv, --very-verbose set loglevel to DEBUG
48+
Expect the following structure when Xarray dataset is used.
5849

50+
::
51+
52+
<xarray.Dataset>
53+
Dimensions: (ancestry: 2, marker: 8, sample: 39, ploidy: 2)
54+
Coordinates:
55+
* ancestry (ancestry) <U3 'HCB' 'JPT'
56+
* marker (marker) uint32 1 6 12 20 25 31 36 43
57+
* ploidy (ploidy) int8 0 1
58+
* sample (sample) <U6 'HCB182' 'HCB190' ... 'JPT266' 'JPT267'
59+
Data variables:
60+
genetic_position (marker) float32 ...
61+
locanc (marker, sample, ploidy, ancestry) float32 ...
62+
63+
64+
65+
Running HAMSTA
66+
--------------
5967

6068
.. argparse::
6169
:module: hamsta.cli
6270
:func: parse_args
6371
:prog: hamsta
64-
:path: preprocess
72+
:path: infer
73+
74+
6575

6676
Python api
6777
==========
6878

79+
6980
Coming soon

docs/requirements.txt

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
pytest-accept
2+
pytest-cov
13
# Requirements file for ReadTheDocs, check .readthedocs.yml.
24
# To build the module reference correctly, make sure every external package
35
# under `install_requires` in `setup.cfg` is also listed here!
4-
sphinx>=3.2.1
5-
# sphinx_rtd_theme
6+
sphinx==4.2
7+
sphinx-argparse
8+
sphinx-autodoc-typehints
9+
sphinx-book-theme

requirement_dev.txt

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ sphinx-book-theme
55
pytest-cov
66
pytest-accept
77
sphinx-argparse
8+
setuptools-scm

src/hamsta/cli.py

+11-9
Original file line numberDiff line numberDiff line change
@@ -55,30 +55,32 @@ def parse_args():
5555

5656
# preprocess parser
5757
preprocess_parser = argparse.ArgumentParser(add_help=False)
58-
# preprocess_parser.add_argument("--pgen", help="Path to pgen")
59-
# preprocess_parser.add_argument("--nc", help="Path to xarray nc")
6058
preprocess_parser.add_argument(
6159
"--rfmixfb",
6260
nargs=2,
63-
help="rfmix output .fb.tsv, two args require, (filepath, ancestry)",
61+
help="Input local ancestry in rfmix .fb.tsv format, two args require, (filepath, ancestry)", # noqa: E501
6462
)
6563
preprocess_parser.add_argument(
6664
"--zarr",
6765
nargs=2,
68-
help="Xarray dataset in zarr, two args require, (filepath, ancestry)",
66+
help="Input local ancestry in zarr format storing an Xarray dataset, two args require, (filepath, ancestry)", # noqa: E501
6967
)
7068
preprocess_parser.add_argument(
7169
"--nc",
7270
nargs=2,
73-
help="Xarray dataset in netcdf, two args require, (filepath, ancestry)",
71+
help="Input local ancestry in netcdf format storing an Xarray dataset, two args require, (filepath, ancestry)", # noqa: E501
72+
)
73+
preprocess_parser.add_argument(
74+
"--global-ancestry", help="Path to global ancestry file in rfmix.Q format"
7475
)
75-
preprocess_parser.add_argument("--global-ancestry", help="Path to rfmix.Q")
7676
# preprocess_parser.add_argument("--LADmat", help="Path to LAD matrix")
77-
preprocess_parser.add_argument("--N", help="Number of individuals", type=float)
77+
# preprocess_parser.add_argument("--N", help="Number of individuals", type=float)
7878
preprocess_parser.add_argument("--out", help="output prefix")
79-
preprocess_parser.add_argument("--keep", help="list of individual to keep")
8079
preprocess_parser.add_argument(
81-
"--k", help="Number of components to compute", type=int
80+
"--keep", help="file of a list of individual to keep"
81+
)
82+
preprocess_parser.add_argument(
83+
"--k", help="Number of singular values to compute", type=int
8284
)
8385
preprocess_parser.set_defaults(func=pprocess_main)
8486

tox.ini

+4-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ skip_install = True
3131
changedir = {toxinidir}
3232
deps =
3333
build: build[virtualenv]
34-
-rrequirement.txt
34+
build: -rrequirement.txt
3535
commands =
3636
clean: python -c 'from shutil import rmtree; rmtree("build", True); rmtree("dist", True)'
3737
build: python -m build .
@@ -50,7 +50,9 @@ setenv =
5050
doctests: BUILD = doctest
5151
linkcheck: BUILD = linkcheck
5252
deps =
53-
-r {toxinidir}/docs/requirements.txt
53+
-r requirement.txt
54+
-r requirement_dev.txt
55+
#-r {toxinidir}/docs/requirements.txt
5456
# ^ requirements.txt shared with Read The Docs
5557
commands =
5658
sphinx-build --color -b {env:BUILD} -d "{env:BUILDDIR}/doctrees" "{env:DOCSDIR}" "{env:BUILDDIR}/{env:BUILD}" {posargs}

0 commit comments

Comments
 (0)