From a07bdd5d2a388b0ea8cedf4470286ae8e67561ee Mon Sep 17 00:00:00 2001 From: Jamie Morton Date: Wed, 6 Jul 2016 11:13:20 -0700 Subject: [PATCH] Updating travis --- .coveragerc | 18 ++++++++++++++++++ .travis.yml | 5 ++++- Makefile | 6 +++++- README.md | 4 ++++ gneiss/balances.py | 40 ++++++++++++++++++++++++++++++++++++++-- 5 files changed, 69 insertions(+), 4 deletions(-) create mode 100644 .coveragerc diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..a2831f1 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,18 @@ +# this file is based on the examples provided on scikit-learn's .coveragerc + +[run] +omit = + */tests* + */__init__.py +source = gneiss +branch = True +include = */gneiss/* + +[report] +exclude_lines = + pragma: no cover + raise NotImplementedError + if __name__ == .__main__.: +omit = + */tests* + */__init__.py diff --git a/.travis.yml b/.travis.yml index c9ed192..ea76eec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,7 @@ before_install: # Update conda itself - conda update --yes conda # Useful for debugging any issues with conda + - conda info -a install: - conda create --yes -n test_env python=$PYVERSION --file ci/conda_requirements.txt -c biocore - conda install --yes -n test_env cython @@ -21,7 +22,9 @@ install: - pip install -r ci/pip_requirements.txt - pip install -e . script: - - make all + - WITH_COVERAGE=TRUE make all +after_success: + - coveralls notifications: webhooks: on_success: change diff --git a/Makefile b/Makefile index 23e878e..e0a02d1 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,10 @@ .DEFAULT_GOAL := help -TEST_COMMAND = nosetests --with-doctest +ifeq ($(WITH_COVERAGE), TRUE) + TEST_COMMAND = COVERAGE_FILE=.coverage coverage run --rcfile .coveragerc setup.py nosetests --with-doctest +else + TEST_COMMAND = nosetests --with-doctest +endif help: @echo 'Use "make test" to run all the unit tests and docstring tests.' diff --git a/README.md b/README.md index a1b960d..455ffce 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ # gneiss + +[[https://coveralls.io/github/biocore/micronota?branch=master][https://coveralls.io/repos/biocore/micronota/badge.svg?branch=master&service=github]] +[[https://travis-ci.org/biocore/micronota][https://travis-ci.org/biocore/micronota.svg?branch=master]] + Canonically pronouced *nice* A compositional statistics and visualization toolbox diff --git a/gneiss/balances.py b/gneiss/balances.py index 4893b08..8ac511a 100644 --- a/gneiss/balances.py +++ b/gneiss/balances.py @@ -134,6 +134,14 @@ def _count_matrix(treenode): def default_layout(node): + """ + Specifies the layout for the ete.TreeStyle object. + + Parameters + ---------- + node: ete.Tree + Input node for specifying which attributes. + """ if node.is_leaf(): # Add node name to leaf nodes N = AttrFace("name", fsize=14, fgcolor="black") @@ -157,6 +165,34 @@ def barchart_layout(node, name='name', fsize=14, fgcolor="black", alpha=0.5, rotation=270): + """ + Specifies the layout for the ete.TreeStyle object. + + Parameters + ---------- + node: ete.Tree + Input node for specifying which attributes. + name: str, optional + Attribute to look up the name of the node. + width: int, optional + Width of the barchart. + height: int, optional + Height of the barchart. + colors: list of str, optional + List of HTML colors to color the barchart values. + min_value: int, optional + Minimum value to set the scale of the chart. + max_value: int, optional + Maximum value to set the scale of the chart. + fsize: int, optional + Font size on the leafs. + fgcolor: str, optional + Font color of the leafs. + alpha: float, optional + Transparency of the barchart. + rotation: int, optional + Orientation of the barchart. + """ if colors is None: colors = ['#0000FF'] if node.is_leaf(): @@ -172,7 +208,7 @@ def barchart_layout(node, name='name', else: weight = node.weight C = BarChartFace(values=weight, width=width, height=height, - colors=['#0000FF'], min_value=min_value, + colors=colors, min_value=min_value, max_value=max_value) # Let's make the sphere transparent C.opacity = alpha @@ -269,7 +305,7 @@ def balanceplot(balances, tree, See Also -------- - TreeNode.levelorder + skbio.TreeNode.levelorder """ ete_tree = _attach_balances(balances, tree)