Skip to content

Commit

Permalink
Merge pull request #5 from antgonza/single-control
Browse files Browse the repository at this point in the history
adding "single" control type
  • Loading branch information
antgonza authored Jun 1, 2022
2 parents 22157e6 + 0282cc2 commit 44979ab
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 41 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
q2_katharoseq.egg-info/
q2_katharoseq/__pycache__/
__pycache__/
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Installation assumes a working QIIME 2 environment with a minimum version of 202
git clone https://github.com/biocore/q2-katharoseq.git
cd q2-katharoseq
pip install -e .
```
```

## Use

Expand All @@ -24,6 +24,7 @@ classification, and the [`q2-taxa`](https://docs.qiime2.org/2021.11/plugins/avai
```
qiime katharoseq read_count_threshold \
--i-table a_genus_level_table.qza \
--p-threshold 80 \
--p-control classic \
--p-positive-control-value name_of_controls_in_metadata \
--m-positive-control-column-file your_metadata.tsv \
Expand All @@ -32,4 +33,3 @@ qiime katharoseq read_count_threshold \
--m-cell-count-column-column cell_count_variable_in_metadata \
--o-visualization result.qzv
```

5 changes: 3 additions & 2 deletions q2_katharoseq/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
# The full license is in the file LICENSE, distributed with this software.
# ----------------------------------------------------------------------------
from . import _version
from ._methods import read_count_threshold, estimating_biomass
from ._methods import read_count_threshold, estimating_biomass, control_type
from ._methods import biomass_plot

__version__ = _version.get_versions()['version']
__all__ = ['read_count_threshold', 'estimating_biomass', 'biomass_plot']
__all__ = ['read_count_threshold', 'estimating_biomass', 'biomass_plot',
'control_type']
75 changes: 40 additions & 35 deletions q2_katharoseq/_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,46 @@
from sklearn.linear_model import LinearRegression


control_type = {
'atcc': [
'd__Bacteria;p__Firmicutes;c__Clostridia;o__Clostridiales;'
'f__Clostridiaceae;g__Clostridium',
'd__Bacteria;p__Proteobacteria;c__Gammaproteobacteria;'
'o__Enterobacterales;f__Enterobacteriaceae;__',
'd__Bacteria;p__Proteobacteria;c__Gammaproteobacteria;'
'o__Enterobacterales;f__Enterobacteriaceae;'
'g__Escherichia-Shigella',
'd__Bacteria;p__Firmicutes;c__Bacilli;o__Staphylococcales;'
'f__Staphylococcaceae;g__Staphylococcus'],
'zymobiomics': [
'd__Bacteria;p__Firmicutes;c__Bacilli;'
'o__Lactobacillales;f__Listeriaceae;g__Listeria',
'd__Bacteria;p__Proteobacteria;c__Gammaproteobacteria;'
'o__Pseudomonadales;f__Pseudomonadaceae;g__Pseudomonas',
'd__Bacteria;p__Firmicutes;c__Bacilli;o__Bacillales;'
'f__Bacillaceae;g__Bacillus',
'd__Bacteria;p__Proteobacteria;c__Gammaproteobacteria;'
'o__Enterobacterales;f__Enterobacteriaceae;__',
'd__Bacteria;p__Proteobacteria;c__Gammaproteobacteria;'
'o__Enterobacterales;f__Enterobacteriaceae;'
'g__Escherichia-Shigella',
'd__Bacteria;p__Firmicutes;c__Bacilli;o__Lactobacillales;'
'f__Lactobacillaceae;g__Lactobacillus',
'd__Bacteria;p__Firmicutes;c__Bacilli;o__Lactobacillales;'
'f__Enterococcaceae;g__Enterococcus',
'd__Bacteria;p__Firmicutes;c__Bacilli;o__Staphylococcales'
';f__Staphylococcaceae;g__Staphylococcus'],
'classic': [
'd__Bacteria;p__Firmicutes;c__Bacilli;o__Bacillales;'
'f__Bacillaceae;g__Bacillus',
'd__Bacteria;p__Proteobacteria;c__Alphaproteobacteria;'
'o__Rhodobacterales;f__Rhodobacteraceae;g__Paracoccus'],
'single': [
'd__Bacteria;p__Proteobacteria;c__Gammaproteobacteria;'
'o__Burkholderiales;f__Comamonadaceae;g__Variovorax']
}


# Define the allosteric sigmoid equation
def allosteric_sigmoid(x, h, k_prime):
y = x ** h / (k_prime + x ** h)
Expand Down Expand Up @@ -65,41 +105,6 @@ def read_count_threshold(
max_input = df.loc[max_cell_counts]
max_inputT = max_input.T
max_inputT = max_inputT.sort_values(ascending=False).head(10)
control_type = {
'atcc': [
'd__Bacteria;p__Firmicutes;c__Clostridia;o__Clostridiales;'
'f__Clostridiaceae;g__Clostridium',
'd__Bacteria;p__Proteobacteria;c__Gammaproteobacteria;'
'o__Enterobacterales;f__Enterobacteriaceae;__',
'd__Bacteria;p__Proteobacteria;c__Gammaproteobacteria;'
'o__Enterobacterales;f__Enterobacteriaceae;'
'g__Escherichia-Shigella',
'd__Bacteria;p__Firmicutes;c__Bacilli;o__Staphylococcales;'
'f__Staphylococcaceae;g__Staphylococcus'],
'zymobiomics': [
'd__Bacteria;p__Firmicutes;c__Bacilli;'
'o__Lactobacillales;f__Listeriaceae;g__Listeria',
'd__Bacteria;p__Proteobacteria;c__Gammaproteobacteria;'
'o__Pseudomonadales;f__Pseudomonadaceae;g__Pseudomonas',
'd__Bacteria;p__Firmicutes;c__Bacilli;o__Bacillales;'
'f__Bacillaceae;g__Bacillus',
'd__Bacteria;p__Proteobacteria;c__Gammaproteobacteria;'
'o__Enterobacterales;f__Enterobacteriaceae;__',
'd__Bacteria;p__Proteobacteria;c__Gammaproteobacteria;'
'o__Enterobacterales;f__Enterobacteriaceae;'
'g__Escherichia-Shigella',
'd__Bacteria;p__Firmicutes;c__Bacilli;o__Lactobacillales;'
'f__Lactobacillaceae;g__Lactobacillus',
'd__Bacteria;p__Firmicutes;c__Bacilli;o__Lactobacillales;'
'f__Enterococcaceae;g__Enterococcus',
'd__Bacteria;p__Firmicutes;c__Bacilli;o__Staphylococcales'
';f__Staphylococcaceae;g__Staphylococcus'],
'classic': [
'd__Bacteria;p__Firmicutes;c__Bacilli;o__Bacillales;'
'f__Bacillaceae;g__Bacillus',
'd__Bacteria;p__Proteobacteria;c__Alphaproteobacteria;'
'o__Rhodobacterales;f__Rhodobacteraceae;g__Paracoccus']
}

# Calculate the total number of reads per sample
df['asv_reads'] = df.sum(axis=1)
Expand Down
5 changes: 3 additions & 2 deletions q2_katharoseq/plugin_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
from qiime2.plugin import (Plugin, Citations, Str, Int,
MetadataColumn, Categorical, Numeric, Choices)
from q2_types.feature_table import (FeatureTable, Frequency)
from . import read_count_threshold, estimating_biomass, biomass_plot
from . import (read_count_threshold, estimating_biomass, biomass_plot,
control_type)
import q2_katharoseq
from q2_katharoseq._type import EstimatedBiomass
from q2_katharoseq._format import EstimatedBiomassFmt, EstimatedBiomassDirFmt
Expand Down Expand Up @@ -34,7 +35,7 @@
'table': FeatureTable[Frequency]
},
parameters={
'control': Str % Choices(['zymobiomics', 'classic', 'atcc']),
'control': Str % Choices(control_type.keys()),
'threshold': Int,
'positive_control_value': Str,
'positive_control_column': MetadataColumn[Categorical],
Expand Down

0 comments on commit 44979ab

Please sign in to comment.