Skip to content

Commit

Permalink
Merge pull request #2 from biocore/things
Browse files Browse the repository at this point in the history
versioneer, documentation things, etc
  • Loading branch information
wasade authored Feb 22, 2022
2 parents 8784236 + ae21189 commit 559908a
Show file tree
Hide file tree
Showing 13 changed files with 2,863 additions and 97 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
q2_katharoseq/_version.py export-subst
28 changes: 16 additions & 12 deletions .github/workflows/python-package-conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,44 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: 3.8
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
- name: Add conda to system path
run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
echo $CONDA/bin >> $GITHUB_PATH
- name: Install dependencies
run: |
pip install -e .
wget -q https://raw.githubusercontent.com/qiime2/environment-files/master/latest/staging/qiime2-latest-py38-linux-conda.yml
conda env create -q -n test-env --file qiime2-latest-py38-linux-conda.yml
source activate test-env
conda install flake8 pytest
pip install -e . --no-deps
- name: Lint with flake8
run: |
conda install flake8
source activate test-env
flake8 q2_katharoseq
- name: Test with pytest
run: |
conda install pytest
source activate test-env
pytest
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

lint:
runs-on: ubuntu-latest
steps:
- name: flake8
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: 3.8
- name: install dependencies
run: python -m pip install --upgrade pip
run: |
python -m pip install --upgrade pip
- name: Check out repository code
uses: actions/checkout@v2
- name: lint
Expand Down
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include versioneer.py
include q2_katharoseq/_version.py
52 changes: 32 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,35 @@
# katharoseq
![](https://github.com/qiime2/q2templates/workflows/ci/badge.svg)
# KatharoSeq

Katharoseq is a qiime2 plugin for analyzing samples with low biomass.
An implementation of the KatharoSeq protocol, originally defined in [Minich et al 2018 mSystems](https://journals.asm.org/doi/10.1128/mSystems.00218-17).

## Installation
To install, download this repository and navigate to the `q2_katharoseq` folder and run:
pip install -e .

## Usage

qiime katharoseq read-count-threshold \
--p-threshold 50 \
--i-table table.qza \
--m-positive-control-column-column p_control \
--m-positive-control-column-file metadata.tsv \
--p-positive-control-value katharoseq_control \
--p-control classic \
--m-cell-count-column-column max_cell_count \
--m-cell-count-column-file metadata.tsv \
--o-visualization visualization.qzv \



Installation assumes a working QIIME 2 environment with a minimum version of 2021.8. Details on installing QIIME 2 can be found [here](https://docs.qiime2.org/2021.11/install/).

```
git clone https://github.com/biocore/q2-katharoseq.git
cd q2-katharoseq
pip install -e .
```

## Use

Computation of a minimum read count threshold can be performed with the
`read_count_threshold` plugin action. Computation assumes that the user has
classified their 16S features against SILVA, and that the
`FeatureTable[Frequency]` has been collapsed to the genus level. Please see the
[`q2-feature-classifier`](https://docs.qiime2.org/2021.11/plugins/available/feature-classifier/classify-sklearn) for detail on how to perform taxonomy
classification, and the [`q2-taxa`](https://docs.qiime2.org/2021.11/plugins/available/taxa/collapse) plugin for information on collapsing to a taxonomic level.

```
qiime katharoseq read_count_threshold \
--i-table a_genus_level_table.qza \
--p-control classic \
--p-positive-control-value name_of_controls_in_metadata \
--m-positive-control-column-file your_metadata.tsv \
--m-positive-control-column-column sample_type_variable_in_metadata \
--m-cell-count-column-file your_metadata.tsv \
--m-cell-count-column-column cell_count_variable_in_metadata \
--o-visualization result.qzv
```

4 changes: 3 additions & 1 deletion q2_katharoseq/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#
# The full license is in the file LICENSE, distributed with this software.
# ----------------------------------------------------------------------------
from . import _version
from ._methods import read_count_threshold, estimating_biomass
__version__ = "0.0.1"

__version__ = _version.get_versions()['version']
__all__ = ['read_count_threshold', 'estimating_biomass']
10 changes: 5 additions & 5 deletions q2_katharoseq/_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def read_count_threshold(
df['correct_assign'] = df['control_reads'] / df['asv_reads']

# DEFINE KATHARO
katharo = df[['correct_assign', 'control_reads', 'asv_reads']]
katharo = df[['correct_assign', 'control_reads', 'asv_reads']].copy()
katharo['log_asv_reads'] = np.log10(katharo['asv_reads'].values)

# FIT CURVE TO DATA
Expand All @@ -134,8 +134,8 @@ def read_count_threshold(

# FIND THRESHOLD
min_freq = get_threshold(katharo['log_asv_reads'],
katharo['correct_assign'],
threshold/100)
katharo['correct_assign'],
threshold/100)

# VISUALIZER
max_input_html = q2templates.df_to_html(max_inputT.to_frame())
Expand Down Expand Up @@ -168,8 +168,8 @@ def estimating_biomass(
positive_control_column == positive_control_value]
positive_controls = filtered.loc[positive_controls.index]

positive_controls['control_cell_extraction'] = control_cell_extraction.to_series().loc[
positive_controls.index]
positive_controls['control_cell_extraction'] = \
control_cell_extraction.to_series().loc[positive_controls.index]
positive_controls['log_control_cell_extraction'] = \
positive_controls.control_cell_extraction.apply(math.log10)

Expand Down
Loading

0 comments on commit 559908a

Please sign in to comment.