Skip to content
Commits on Source (3)
[run]
branch = True
omit =
*/tests*
*/__init__.py
q2_types/_version.py
versioneer.py
[report]
omit =
*/tests*
*/__init__.py
q2_types/_version.py
versioneer.py
q2_types/_version.py export-subst
q2cli/_version.py export-subst
......@@ -59,6 +59,9 @@ Sorted alphabetically by repo name.
- The q2-diversity plugin
https://github.com/qiime2/q2-diversity/issues
- The q2-diversity-lib plugin
https://github.com/qiime2/q2-diversity-lib/issues
- The q2-emperor plugin
https://github.com/qiime2/q2-emperor/issues
......
......@@ -52,6 +52,8 @@ Sorted alphabetically by repo name.
| The q2-demux plugin
- [q2-diversity](https://github.com/qiime2/q2-diversity/issues)
| The q2-diversity plugin
- [q2-diversity-lib](https://github.com/qiime2/q2-diversity-lib/issues)
| The q2-diversity-lib plugin
- [q2-emperor](https://github.com/qiime2/q2-emperor/issues)
| The q2-emperor plugin
- [q2-feature-classifier](https://github.com/qiime2/q2-feature-classifier/issues)
......
......@@ -63,5 +63,3 @@ 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 pytest-cov
- pip install -q flake8 coveralls
- conda install -q nose
- pip install -q flake8
- pip install -q https://github.com/qiime2/q2lint/archive/master.zip
- make install
script:
- make lint
- make test-cov
after_success:
- coveralls
- make test
- QIIMETEST= source tab-qiime
- QIIMETEST= qiime info
include versioneer.py
include q2_types/_version.py
include q2cli/_version.py
.PHONY: all lint test test-cov install dev clean distclean
.PHONY: all lint test install dev clean distclean
PYTHON ?= python
PREFIX ?= $(CONDA_PREFIX)
all: ;
......@@ -9,16 +10,17 @@ lint:
flake8
test: all
py.test
test-cov: all
py.test --cov=q2_types
QIIMETEST= nosetests
install: all
$(PYTHON) setup.py install
$(PYTHON) setup.py install && \
mkdir -p $(PREFIX)/etc/conda/activate.d && \
cp hooks/50_activate_q2cli_tab_completion.sh $(PREFIX)/etc/conda/activate.d/
dev: all
pip install -e .
pip install -e . && \
mkdir -p $(PREFIX)/etc/conda/activate.d && \
cp hooks/50_activate_q2cli_tab_completion.sh $(PREFIX)/etc/conda/activate.d/
clean: distclean
......
# q2-types
# q2cli
A [click-based](http://click.pocoo.org/) command line interface for [QIIME 2](https://github.com/qiime2/qiime2).
[![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)
## Installation and getting help
This is a QIIME 2 plugin. For details on QIIME 2, see https://qiime2.org.
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
```
#!/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,33 +3,34 @@
{% set release = '.'.join(version.split('.')[:2]) %}
package:
name: q2-types
name: q2cli
version: {{ version }}
source:
path: ../..
build:
script: make install
entry_points:
- qiime=q2cli.__main__:qiime
requirements:
host:
- python {{ python }}
- python {{ python }}
- setuptools
run:
- python {{ python }}
- scikit-bio >=0.5.4
# TODO: unset this pin once pandas 0.24.x is sorted out upstream
- pandas 0.23.4
- biom-format >=2.1.5,<2.2.0
- ijson
- h5py
- python {{ python }}
- pip
- click
- qiime2 {{ release }}.*
test:
imports:
- q2_types
- qiime2.plugins.types
- q2cli
commands:
- QIIMETEST= qiime --help
about:
home: https://qiime2.org
......
q2-types (2019.4.0-1) UNRELEASED; urgency=medium
* New upstream version
-- Liubov Chuprikova <chuprikovalv@gmail.com> Thu, 13 Jun 2019 22:21:11 +0200
q2-types (2019.1.0-1) unstable; urgency=medium
* Initial release (Closes: #925931)
......
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')
@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
)