Skip to content
Commits on Source (2)
[run]
branch = True
omit =
*/tests*
*/__init__.py
q2_types/_version.py
versioneer.py
[report]
omit =
*/tests*
*/__init__.py
q2_types/_version.py
versioneer.py
q2cli/_version.py export-subst
q2_types/_version.py export-subst
......@@ -63,3 +63,5 @@ target/
# vi
.*.swp
.DS_Store
......@@ -14,12 +14,12 @@ install:
- wget -q https://raw.githubusercontent.com/qiime2/environment-files/master/latest/staging/qiime2-latest-py36-linux-conda.yml
- conda env create -q -n test-env --file qiime2-latest-py36-linux-conda.yml
- source activate test-env
- conda install -q nose
- pip install -q flake8
- conda install -q pytest-cov
- pip install -q flake8 coveralls
- pip install -q https://github.com/qiime2/q2lint/archive/master.zip
- make install
script:
- make lint
- make test
- QIIMETEST= source tab-qiime
- QIIMETEST= qiime info
- make test-cov
after_success:
- coveralls
include versioneer.py
include q2cli/_version.py
include q2_types/_version.py
.PHONY: all lint test install dev clean distclean
.PHONY: all lint test test-cov install dev clean distclean
PYTHON ?= python
PREFIX ?= $(CONDA_PREFIX)
all: ;
......@@ -10,17 +9,16 @@ lint:
flake8
test: all
QIIMETEST= nosetests
py.test
test-cov: all
py.test --cov=q2_types
install: all
$(PYTHON) setup.py install && \
mkdir -p $(PREFIX)/etc/conda/activate.d && \
cp hooks/50_activate_q2cli_tab_completion.sh $(PREFIX)/etc/conda/activate.d/
$(PYTHON) setup.py install
dev: all
pip install -e . && \
mkdir -p $(PREFIX)/etc/conda/activate.d && \
cp hooks/50_activate_q2cli_tab_completion.sh $(PREFIX)/etc/conda/activate.d/
pip install -e .
clean: distclean
......
# q2cli
A [click-based](http://click.pocoo.org/) command line interface for [QIIME 2](https://github.com/qiime2/qiime2).
# q2-types
## Installation and getting help
[![Build Status](https://travis-ci.org/qiime2/q2-types.svg?branch=master)](https://travis-ci.org/qiime2/q2-types)
[![Coverage Status](https://coveralls.io/repos/github/qiime2/q2-types/badge.svg?branch=master)](https://coveralls.io/github/qiime2/q2-types?branch=master)
Visit https://qiime2.org to learn more about q2cli and the QIIME 2 project.
## Enabling tab completion
### Bash
To enable tab completion in Bash, run the following command or add it to your `.bashrc`/`.bash_profile`:
```bash
source tab-qiime
```
### ZSH
To enable tab completion in ZSH, run the following commands or add them to your `.zshrc`:
```bash
autoload bashcompinit && bashcompinit && source tab-qiime
```
This is a QIIME 2 plugin. For details on QIIME 2, see https://qiime2.org.
#!/usr/bin/env bash
# Bash completion script that defers to a cached completion script representing
# the state of the current QIIME 2 deployment.
#
# This script is intended to be executed on the command-line or in
# .bashrc/.bash_profile:
#
# source tab-qiime
#
_qiime_completion()
{
# Attempt to find the cached completion script. If q2cli isn't installed, or
# is an incompatible version, don't attempt completion.
local completion_path="$(python -c "import q2cli.util; print(q2cli.util.get_completion_path())" 2> /dev/null)"
if [[ $? != 0 ]]; then
unset COMPREPLY
return 0
fi
# If the completion script exists, attempt completion by invoking the script
# in a subshell, supplying COMP_WORDS and COMP_CWORD. Capture the output as
# the completion reply. If the completion script failed, don't attempt
# completion.
if [[ -f "$completion_path" ]] ; then
COMPREPLY=( $(COMP_WORDS="${COMP_WORDS[*]}" COMP_CWORD="${COMP_CWORD}" "$completion_path" 2> /dev/null) )
if [[ $? != 0 ]]; then
unset COMPREPLY
return 0
fi
else
unset COMPREPLY
return 0
fi
return 0
}
# Enable default readline and bash completion behavior when `_qiime_completion`
# doesn't have a reply.
complete -F _qiime_completion -o default -o bashdefault qiime
# Execute a `qiime` command (any command will do) so that tab-completion will
# work out-of-the-box (e.g. with a fresh installation of q2cli). Running a
# command will create or refresh the cache if necessary, which contains the
# actual completion script.
#
# Ignore stdout to avoid displaying help text to users enabling tab-completion.
# stderr displays the note about cache refreshing, as that can take a few
# moments to complete.
qiime > /dev/null
......@@ -3,16 +3,13 @@
{% set release = '.'.join(version.split('.')[:2]) %}
package:
name: q2cli
name: q2-types
version: {{ version }}
source:
path: ../..
build:
script: make install
entry_points:
- qiime=q2cli.__main__:qiime
requirements:
host:
......@@ -21,16 +18,19 @@ requirements:
run:
- python {{ python }}
- pip
- click
- scikit-bio >=0.5.4
- numpy
- blas=*=openblas
- pandas
- biom-format >=2.1.5,<2.2.0
- ijson
- h5py
- qiime2 {{ release }}.*
test:
imports:
- q2cli
commands:
- QIIMETEST= qiime --help
- q2_types
- qiime2.plugins.types
about:
home: https://qiime2.org
......
if [ -n "${ZSH_VERSION-}" ]; then
autoload bashcompinit && bashcompinit && source tab-qiime
elif [ -n "${BASH_VERSION-}" ]; then
source tab-qiime
fi
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2019, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ----------------------------------------------------------------------------
import importlib
from ._version import get_versions
__version__ = get_versions()['version']
del get_versions
# feature_data needs to be imported before feature_table to avoid circular
# import.
importlib.import_module('q2_types.feature_data')
importlib.import_module('q2_types.feature_table')
importlib.import_module('q2_types.distance_matrix')
importlib.import_module('q2_types.tree')
importlib.import_module('q2_types.ordination')
importlib.import_module('q2_types.sample_data')
importlib.import_module('q2_types.per_sample_sequences')
......@@ -24,8 +24,8 @@ def get_keywords():
# each be defined on a line of their own. _version.py will just call
# get_keywords().
git_refnames = " (tag: 2019.4.0)"
git_full = "dc80fad32777035091692ce1083088380a6ac509"
git_date = "2019-05-03 04:14:45 +0000"
git_full = "da22ce35c8e3c3740d92867833612d753898c72c"
git_date = "2019-05-03 04:14:46 +0000"
keywords = {"refnames": git_refnames, "full": git_full, "date": git_date}
return keywords
......@@ -42,8 +42,8 @@ def get_config():
cfg.VCS = "git"
cfg.style = "pep440"
cfg.tag_prefix = ""
cfg.parentdir_prefix = "q2cli-"
cfg.versionfile_source = "q2cli/_version.py"
cfg.parentdir_prefix = "q2-types-"
cfg.versionfile_source = "q2_types/_version.py"
cfg.verbose = False
return cfg
......
@article{mcdonald2012biological,
title={The Biological Observation Matrix (BIOM) format or: how I learned to stop worrying and love the ome-ome},
author={McDonald, Daniel and Clemente, Jose C and Kuczynski, Justin and Rideout, Jai Ram and Stombaugh, Jesse and Wendel, Doug and Wilke, Andreas and Huse, Susan and Hufnagle, John and Meyer, Folker and Knight, Rob and Caporaso, J Gregory},
journal={GigaScience},
volume={1},
number={1},
pages={7},
year={2012},
publisher={BioMed Central},
doi={10.1186/2047-217X-1-7}
}
@InProceedings{ mckinney-proc-scipy-2010,
author = { Wes McKinney },
title = { Data Structures for Statistical Computing in Python },
booktitle = { Proceedings of the 9th Python in Science Conference },
pages = { 51 -- 56 },
year = { 2010 },
editor = { St{\'e}fan van der Walt and Jarrod Millman }
}
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2019, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ----------------------------------------------------------------------------
import importlib
from ._format import LSMatFormat, DistanceMatrixDirectoryFormat
from ._type import DistanceMatrix
__all__ = ['LSMatFormat', 'DistanceMatrixDirectoryFormat', 'DistanceMatrix']
importlib.import_module('q2_types.distance_matrix._transformer')
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2019, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ----------------------------------------------------------------------------
import skbio.io
import qiime2.plugin.model as model
from ..plugin_setup import plugin
class LSMatFormat(model.TextFileFormat):
def sniff(self):
sniffer = skbio.io.io_registry.get_sniffer('lsmat')
return sniffer(str(self))[0]
DistanceMatrixDirectoryFormat = model.SingleFileDirectoryFormat(
'DistanceMatrixDirectoryFormat', 'distance-matrix.tsv', LSMatFormat)
plugin.register_formats(LSMatFormat, DistanceMatrixDirectoryFormat)
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2019, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ----------------------------------------------------------------------------
import skbio
from ..plugin_setup import plugin
from . import LSMatFormat
@plugin.register_transformer
def _1(data: skbio.DistanceMatrix) -> LSMatFormat:
ff = LSMatFormat()
with ff.open() as fh:
data.write(fh, format='lsmat')
return ff
@plugin.register_transformer
def _2(ff: LSMatFormat) -> skbio.DistanceMatrix:
return skbio.DistanceMatrix.read(str(ff), format='lsmat', verify=False)
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2019, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ----------------------------------------------------------------------------
from qiime2.plugin import SemanticType
from ..plugin_setup import plugin
from . import DistanceMatrixDirectoryFormat
DistanceMatrix = SemanticType('DistanceMatrix')
plugin.register_semantic_types(DistanceMatrix)
plugin.register_semantic_type_to_format(
DistanceMatrix,
artifact_format=DistanceMatrixDirectoryFormat
)