From 5bf2fd42715b1e59f4e5812849333fb67297a904 Mon Sep 17 00:00:00 2001 From: Daniela Perry Date: Thu, 24 Feb 2022 13:34:33 -0800 Subject: [PATCH 01/12] no big changes --- q2_katharoseq/_methods.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/q2_katharoseq/_methods.py b/q2_katharoseq/_methods.py index 3959cac..bc0b9e7 100644 --- a/q2_katharoseq/_methods.py +++ b/q2_katharoseq/_methods.py @@ -208,7 +208,8 @@ def estimating_biomass( plt.savefig(os.path.join(output_dir, 'fit.svg')) plt.close() - # VISUALIZER + + # VISUALIZER: git push origin visualizer context = {'r_squared': r_squared} TEMPLATES = pkg_resources.resource_filename( 'q2_katharoseq', 'estimating_biomass_assets') From 9b4c92f50911dde27b096888bd98ce4f7cfcd55e Mon Sep 17 00:00:00 2001 From: Daniela Perry Date: Fri, 25 Feb 2022 13:36:44 -0800 Subject: [PATCH 02/12] added test for biomass_plot --- q2_katharoseq/tests/test_method.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/q2_katharoseq/tests/test_method.py b/q2_katharoseq/tests/test_method.py index a9b6f05..f8b9b74 100644 --- a/q2_katharoseq/tests/test_method.py +++ b/q2_katharoseq/tests/test_method.py @@ -189,10 +189,29 @@ def test_estimating_biomass(self): exp = pd.read_csv( f'{fp}/output_estimating_biomass.tsv', sep='\t', index_col=0) pd.testing.assert_frame_equal(obs, exp) - index_fp = os.path.join(output_dir, 'index.html') - self.assertTrue(os.path.exists(index_fp)) + def test_biomass_plot(self): + fp = join(dirname(abspath(getfile(currentframe()))), 'support_files') + + data = pd.read_csv( + f'{fp}/input_estimating_biomass.tsv', sep='\t', dtype={ + 'sample_name': str, 'total_reads': float, + 'control_cell_into_extraction': float, + 'extraction_mass_g': float, + 'positive_control': str}) + + data = qiime2.Metadata.load(f'{fp}/input_estimating_biomass.tsv') + + biomass_plot( + total_reads=data.get_column('total_reads'), + control_cell_extraction=data.get_column('control_cell_into_extraction'), # noqa + min_total_reads=1150, + positive_control_value='True', + positive_control_column=data.get_column('positive_control') + ) + self.assertTrue(os.path.exists(index_fp)) + if __name__ == '__main__': main() From 3f07e26fea136a6290f292797e1a25653e09ffa2 Mon Sep 17 00:00:00 2001 From: Daniela Perry Date: Tue, 1 Mar 2022 12:15:24 -0800 Subject: [PATCH 03/12] tests for biomass_plot --- q2_katharoseq/tests/test_method.py | 42 ++++++++++++++++-------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/q2_katharoseq/tests/test_method.py b/q2_katharoseq/tests/test_method.py index f8b9b74..1865511 100644 --- a/q2_katharoseq/tests/test_method.py +++ b/q2_katharoseq/tests/test_method.py @@ -15,6 +15,7 @@ from inspect import currentframe, getfile + class KatharoSeqTestCase(TestCase): def setUp(self): @@ -53,7 +54,7 @@ def setUp(self): self.control = 'classic' self.threshold = 50 - def test_outputs_index(self): + def test_outputs_index(self): # OK with tempfile.TemporaryDirectory() as output_dir: read_count_threshold( output_dir, @@ -67,7 +68,7 @@ def test_outputs_index(self): index_fp = os.path.join(output_dir, 'index.html') self.assertTrue(os.path.exists(index_fp)) - def test_invalid_threshold(self): + def test_invalid_threshold(self): # OK with tempfile.TemporaryDirectory() as output_dir, \ self.assertRaisesRegex( ValueError, @@ -98,7 +99,7 @@ def test_invalid_threshold(self): self.table, self.control) - def test_no_positive_controls_in_col(self): + def test_no_positive_controls_in_col(self): # OK ind = pd.Index(['s1', 's2', 's3', 's4'], name='sampleid') positive_control_column = pd.Series( @@ -123,7 +124,7 @@ def test_no_positive_controls_in_col(self): self.table, self.control) - def test_no_positive_controls_in_table(self): + def test_no_positive_controls_in_table(self): # OK ind = pd.Index( ['s5', 's6', 's7', 's8'], name='sampleid') @@ -150,29 +151,32 @@ def test_no_positive_controls_in_table(self): table, self.control) - def test_sigmoid(self): - x = 1 - h = 2 - k_prime = 3 + def test_sigmoid(self): # OK + x = 1.0 + h = 2.0 + k_prime = 3.0 a = allosteric_sigmoid(x, h, k_prime) self.assertTrue(a == .25) - def test_threshold(self): - r1 = 2 - r2 = 3 - thresh = 50 + def test_threshold(self): # OK + r1 = [3.5, 2.3, 1.3, 3.4] + r2 = [1.1, 2.2, 1.7, 2.3] + thresh = 50.0 min_freq = get_threshold(r1, r2, thresh) - self.assertTrue(min_freq == 37) + self.assertTrue(min_freq == 1) def test_estimating_biomass(self): fp = join(dirname(abspath(getfile(currentframe()))), 'support_files') - data = pd.read_csv( - f'{fp}/input_estimating_biomass.tsv', sep='\t', dtype={ - 'sample_name': str, 'total_reads': float, - 'control_cell_into_extraction': float, - 'extraction_mass_g': float, - 'positive_control': str}) + # One line at top of file describing dtype that throws this off + # data = pd.read_csv( + # f'{fp}/input_estimating_biomass.tsv', sep='\t', dtype={ + # 'sample_name': str, 'total_reads': float, + # 'control_cell_into_extraction': float, + # 'extraction_mass_g': float, + # 'positive_control': str}) + + data = qiime2.Metadata.load(f'{fp}/input_estimating_biomass.tsv') From c6d87a497b36392b9686ed1665f7b637100377e1 Mon Sep 17 00:00:00 2001 From: Daniela Perry Date: Tue, 1 Mar 2022 12:15:43 -0800 Subject: [PATCH 04/12] biomass_plot visualizer --- q2_katharoseq/_methods.py | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/q2_katharoseq/_methods.py b/q2_katharoseq/_methods.py index bc0b9e7..bfeec4d 100644 --- a/q2_katharoseq/_methods.py +++ b/q2_katharoseq/_methods.py @@ -191,6 +191,36 @@ def estimating_biomass( filtered['log_estimated_cells_per_g'] = \ filtered.estimated_cells_per_g.apply(math.log10) + return filtered + +def biomass_plot( + output_dir: str, + total_reads: qiime2.NumericMetadataColumn, + control_cell_extraction: qiime2.NumericMetadataColumn, + min_total_reads: int, + positive_control_value: str, + positive_control_column: qiime2.CategoricalMetadataColumn) -> None: + + total_reads = total_reads.to_series() + filtered = pd.DataFrame(total_reads[total_reads > min_total_reads]) + filtered['log_total_reads'] = filtered.total_reads.apply(math.log10) + + positive_control_column = positive_control_column.to_series().loc[ + filtered.index] + positive_controls = positive_control_column[ + 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['log_control_cell_extraction'] = \ + positive_controls.control_cell_extraction.apply(math.log10) + + lm = LinearRegression() + lm.fit( + positive_controls.log_total_reads.values.reshape(-1, 1), + positive_controls.log_control_cell_extraction) + # MAKE PLOT y = positive_controls['log_control_cell_extraction'] x = positive_controls['log_total_reads'] @@ -208,12 +238,8 @@ def estimating_biomass( plt.savefig(os.path.join(output_dir, 'fit.svg')) plt.close() - # VISUALIZER: git push origin visualizer - context = {'r_squared': r_squared} TEMPLATES = pkg_resources.resource_filename( 'q2_katharoseq', 'estimating_biomass_assets') index = os.path.join(TEMPLATES, 'index.html') - q2templates.render(index, output_dir, context=context) - - return filtered + q2templates.render(index, output_dir) From 0e41ea870208ca5305179a8590f1d8f7cd12d018 Mon Sep 17 00:00:00 2001 From: Daniela Perry Date: Tue, 1 Mar 2022 12:16:08 -0800 Subject: [PATCH 05/12] added plugin to plugin_setup --- q2_katharoseq/plugin_setup.py | 126 +++++++++++++++++++++++++++++++++- 1 file changed, 125 insertions(+), 1 deletion(-) diff --git a/q2_katharoseq/plugin_setup.py b/q2_katharoseq/plugin_setup.py index 6c7d98f..a9fb86d 100644 --- a/q2_katharoseq/plugin_setup.py +++ b/q2_katharoseq/plugin_setup.py @@ -2,7 +2,7 @@ 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 +from . import read_count_threshold, estimating_biomass, biomass_plot import q2_katharoseq from q2_katharoseq._type import EstimatedBiomass from q2_katharoseq._format import EstimatedBiomassFmt, EstimatedBiomassDirFmt @@ -120,4 +120,128 @@ ) +plugin.visualizers.register_function( + function=read_count_threshold, + inputs={ + 'table': FeatureTable[Frequency] + }, + parameters={ + 'control': Str % Choices(['zymobiomics', 'classic', 'atcc']), + 'threshold': Int, + 'positive_control_value': Str, + 'positive_control_column': MetadataColumn[Categorical], + 'cell_count_column': MetadataColumn[Numeric] + }, + input_descriptions={ + 'table': ( + 'A FeatureTable collapsed to the genus level (level 6) that ' + 'contains the control samples.' + ), + }, + parameter_descriptions={ + 'control': ( + 'The type of positive control used.' + ), + 'threshold': ( + 'Threshold to use in calculating minimum frequency. ' + 'Must be int in [0,100].' + ), + 'positive_control_value': ( + 'The value in the control column that demarks which samples are ' + 'the positive controls.' + ), + 'positive_control_column': ( + 'The column in the sample metadata that describes which samples ' + 'are and are not controls.' + ), + }, + name='Methods for the application of the KatharoSeq protocol', + description='KatharoSeq is high-throughput protocol combining laboratory ' + 'and bioinformatic methods that can differentiate a true ' + 'positive signal in samples with as few as 50 to 500 cells.', + citations=[citations['minich2018']] +) + + +plugin.methods.register_function( + function=estimating_biomass, + inputs={}, + parameters={'total_reads': MetadataColumn[Numeric], + 'control_cell_extraction': MetadataColumn[Numeric], + 'positive_control_column': MetadataColumn[Categorical], + 'positive_control_value': Str, + 'extraction_mass_g': MetadataColumn[Numeric], + 'min_total_reads': Int, + 'pcr_template_vol': Int, + 'dna_extract_vol': Int}, + outputs=[('estimated_biomass', EstimatedBiomass)], + input_descriptions={}, + parameter_descriptions={ + 'total_reads': 'The total sum of the reads or ASVs for each sample.', + 'control_cell_extraction': ( + 'The estimated number of cells or genomes used as input to your ' + 'library prep. One may typically estimate this by determining the ' + 'total number of cells from a stock solution used to make ' + 'standard titrations. Each titration will have an estimated ' + 'number of microbial cells put into the extraction. The final ' + 'estimate will depend on the elution volume and the final volume ' + 'used into the library prep (e.g. 16S PCR).'), + 'positive_control_column': ( + 'The column in the sample metadata that describes which samples ' + 'are and are not controls.'), + 'positive_control_value': ( + 'The value in the control column that demarks which samples are ' + 'the positive controls.'), + 'extraction_mass_g': ( + 'The column in the sample metadata that describes the sample ' + '(e.g. stool, tissue, soil, etc) mass (in grams - typically ' + 'converted from mg)'), + 'min_total_reads': 'The minimum threshold to apply.', + 'pcr_template_vol': ( + 'The volume of DNA used as template in the ' + 'library prep (PCR reaction)'), + 'dna_extract_vol': ( + 'The final elution volume used during DNA extraction')}, + output_descriptions={ + 'estimated_biomass': ( + 'A dataframe containing the details on estimated biomass') + }, + name='Estimate the biomass of samples using KatharoSeq controls.', + description='Estimate the biomass of samples using KatharoSeq controls.', + citations=[] +) + +plugin.visualizers.register_function( + function=biomass_plot, + inputs={}, + parameters={'total_reads': MetadataColumn[Numeric], + 'control_cell_extraction': MetadataColumn[Numeric], + 'positive_control_column': MetadataColumn[Categorical], + 'positive_control_value': Str, + 'min_total_reads': Int + }, + input_descriptions={}, + parameter_descriptions={ + 'total_reads': 'The total sum of the reads or ASVs for each sample.', + 'control_cell_extraction': ( + 'The estimated number of cells or genomes used as input to your ' + 'library prep. One may typically estimate this by determining the ' + 'total number of cells from a stock solution used to make ' + 'standard titrations. Each titration will have an estimated ' + 'number of microbial cells put into the extraction. The final ' + 'estimate will depend on the elution volume and the final volume ' + 'used into the library prep (e.g. 16S PCR).'), + 'positive_control_column': ( + 'The column in the sample metadata that describes which samples ' + 'are and are not controls.'), + 'positive_control_value': ( + 'The value in the control column that demarks which samples are ' + 'the positive controls.'), + 'min_total_reads': 'The minimum threshold to apply.', + }, + name='Plot the results of estimating_biomass.', + description='Plot the results of estimating_biomass.', + citations=[] +) + importlib.import_module('q2_katharoseq._transformer') From 818d90492824c9e6c6a843e773ea96f9f6976d79 Mon Sep 17 00:00:00 2001 From: Daniela Perry Date: Tue, 1 Mar 2022 13:23:00 -0800 Subject: [PATCH 06/12] import biomass_plot into init --- q2_katharoseq/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/q2_katharoseq/__init__.py b/q2_katharoseq/__init__.py index 1e2da02..d51d181 100644 --- a/q2_katharoseq/__init__.py +++ b/q2_katharoseq/__init__.py @@ -6,7 +6,7 @@ # 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, biomass_plot __version__ = _version.get_versions()['version'] __all__ = ['read_count_threshold', 'estimating_biomass'] From a5e5b359cb3d8ba7f57c0cd3db187b5a702b1343 Mon Sep 17 00:00:00 2001 From: Daniela Perry Date: Tue, 1 Mar 2022 13:35:15 -0800 Subject: [PATCH 07/12] flake8 fixes --- q2_katharoseq/__init__.py | 2 +- q2_katharoseq/_methods.py | 3 +- q2_katharoseq/tests/test_method.py | 48 +++++++++++++----------------- 3 files changed, 24 insertions(+), 29 deletions(-) diff --git a/q2_katharoseq/__init__.py b/q2_katharoseq/__init__.py index d51d181..6c0977a 100644 --- a/q2_katharoseq/__init__.py +++ b/q2_katharoseq/__init__.py @@ -9,4 +9,4 @@ from ._methods import read_count_threshold, estimating_biomass, biomass_plot __version__ = _version.get_versions()['version'] -__all__ = ['read_count_threshold', 'estimating_biomass'] +__all__ = ['read_count_threshold', 'estimating_biomass', 'biomass_plot'] diff --git a/q2_katharoseq/_methods.py b/q2_katharoseq/_methods.py index bfeec4d..9e77e1f 100644 --- a/q2_katharoseq/_methods.py +++ b/q2_katharoseq/_methods.py @@ -193,6 +193,7 @@ def estimating_biomass( return filtered + def biomass_plot( output_dir: str, total_reads: qiime2.NumericMetadataColumn, @@ -228,7 +229,7 @@ def biomass_plot( slope = lm.coef_[0] plt.clf() - plt.scatter(x,y, color='black') + plt.scatter(x, y, color='black') axes = plt.gca() x_vals = np.array(axes.get_xlim()) y_vals = intercept + slope * x_vals diff --git a/q2_katharoseq/tests/test_method.py b/q2_katharoseq/tests/test_method.py index 1865511..05ef9a4 100644 --- a/q2_katharoseq/tests/test_method.py +++ b/q2_katharoseq/tests/test_method.py @@ -7,7 +7,9 @@ from qiime2 import CategoricalMetadataColumn from qiime2 import NumericMetadataColumn -from q2_katharoseq import read_count_threshold, estimating_biomass +from q2_katharoseq import (read_count_threshold, + estimating_biomass, + biomass_plot) from q2_katharoseq._methods import allosteric_sigmoid from q2_katharoseq._methods import get_threshold @@ -15,7 +17,6 @@ from inspect import currentframe, getfile - class KatharoSeqTestCase(TestCase): def setUp(self): @@ -54,7 +55,7 @@ def setUp(self): self.control = 'classic' self.threshold = 50 - def test_outputs_index(self): # OK + def test_outputs_index(self): with tempfile.TemporaryDirectory() as output_dir: read_count_threshold( output_dir, @@ -68,7 +69,7 @@ def test_outputs_index(self): # OK index_fp = os.path.join(output_dir, 'index.html') self.assertTrue(os.path.exists(index_fp)) - def test_invalid_threshold(self): # OK + def test_invalid_threshold(self): with tempfile.TemporaryDirectory() as output_dir, \ self.assertRaisesRegex( ValueError, @@ -99,7 +100,7 @@ def test_invalid_threshold(self): # OK self.table, self.control) - def test_no_positive_controls_in_col(self): # OK + def test_no_positive_controls_in_col(self): ind = pd.Index(['s1', 's2', 's3', 's4'], name='sampleid') positive_control_column = pd.Series( @@ -124,7 +125,7 @@ def test_no_positive_controls_in_col(self): # OK self.table, self.control) - def test_no_positive_controls_in_table(self): # OK + def test_no_positive_controls_in_table(self): ind = pd.Index( ['s5', 's6', 's7', 's8'], name='sampleid') @@ -151,14 +152,14 @@ def test_no_positive_controls_in_table(self): # OK table, self.control) - def test_sigmoid(self): # OK + def test_sigmoid(self): x = 1.0 h = 2.0 k_prime = 3.0 a = allosteric_sigmoid(x, h, k_prime) self.assertTrue(a == .25) - def test_threshold(self): # OK + def test_threshold(self): r1 = [3.5, 2.3, 1.3, 3.4] r2 = [1.1, 2.2, 1.7, 2.3] thresh = 50.0 @@ -168,16 +169,6 @@ def test_threshold(self): # OK def test_estimating_biomass(self): fp = join(dirname(abspath(getfile(currentframe()))), 'support_files') - # One line at top of file describing dtype that throws this off - # data = pd.read_csv( - # f'{fp}/input_estimating_biomass.tsv', sep='\t', dtype={ - # 'sample_name': str, 'total_reads': float, - # 'control_cell_into_extraction': float, - # 'extraction_mass_g': float, - # 'positive_control': str}) - - - data = qiime2.Metadata.load(f'{fp}/input_estimating_biomass.tsv') obs = estimating_biomass( @@ -194,7 +185,6 @@ def test_estimating_biomass(self): f'{fp}/output_estimating_biomass.tsv', sep='\t', index_col=0) pd.testing.assert_frame_equal(obs, exp) - def test_biomass_plot(self): fp = join(dirname(abspath(getfile(currentframe()))), 'support_files') @@ -207,14 +197,18 @@ def test_biomass_plot(self): data = qiime2.Metadata.load(f'{fp}/input_estimating_biomass.tsv') - biomass_plot( - total_reads=data.get_column('total_reads'), - control_cell_extraction=data.get_column('control_cell_into_extraction'), # noqa - min_total_reads=1150, - positive_control_value='True', - positive_control_column=data.get_column('positive_control') - ) - self.assertTrue(os.path.exists(index_fp)) + with tempfile.TemporaryDirectory() as output_dir: + biomass_plot( + total_reads=data.get_column('total_reads'), + control_cell_extraction=data.get_column( + 'control_cell_into_extraction'), # noqa + min_total_reads=1150, + positive_control_value='True', + positive_control_column=data.get_column('positive_control') + ) + + index_fp = os.path.join(output_dir, 'index.html') + self.assertTrue(os.path.exists(index_fp)) if __name__ == '__main__': From f131d0e8cf3dac13668cb0e195199a6aeb7d12e7 Mon Sep 17 00:00:00 2001 From: Daniela Perry Date: Tue, 1 Mar 2022 13:41:26 -0800 Subject: [PATCH 08/12] flake8 --- q2_katharoseq/plugin_setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/q2_katharoseq/plugin_setup.py b/q2_katharoseq/plugin_setup.py index a9fb86d..bcac88b 100644 --- a/q2_katharoseq/plugin_setup.py +++ b/q2_katharoseq/plugin_setup.py @@ -219,7 +219,7 @@ 'positive_control_column': MetadataColumn[Categorical], 'positive_control_value': Str, 'min_total_reads': Int - }, + }, input_descriptions={}, parameter_descriptions={ 'total_reads': 'The total sum of the reads or ASVs for each sample.', From 94272c64eda23b9925d7d1ba99a0c8cf92a5e386 Mon Sep 17 00:00:00 2001 From: Daniela Perry Date: Tue, 1 Mar 2022 14:03:42 -0800 Subject: [PATCH 09/12] fixed tests --- q2_katharoseq/tests/test_method.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/q2_katharoseq/tests/test_method.py b/q2_katharoseq/tests/test_method.py index 05ef9a4..4c4b61a 100644 --- a/q2_katharoseq/tests/test_method.py +++ b/q2_katharoseq/tests/test_method.py @@ -188,13 +188,6 @@ def test_estimating_biomass(self): def test_biomass_plot(self): fp = join(dirname(abspath(getfile(currentframe()))), 'support_files') - data = pd.read_csv( - f'{fp}/input_estimating_biomass.tsv', sep='\t', dtype={ - 'sample_name': str, 'total_reads': float, - 'control_cell_into_extraction': float, - 'extraction_mass_g': float, - 'positive_control': str}) - data = qiime2.Metadata.load(f'{fp}/input_estimating_biomass.tsv') with tempfile.TemporaryDirectory() as output_dir: From a7683675cd1dc543d2bec90ff7e744e33113ac4a Mon Sep 17 00:00:00 2001 From: Daniela Perry Date: Tue, 1 Mar 2022 14:04:27 -0800 Subject: [PATCH 10/12] fix plugin setup --- q2_katharoseq/plugin_setup.py | 93 ----------------------------------- 1 file changed, 93 deletions(-) diff --git a/q2_katharoseq/plugin_setup.py b/q2_katharoseq/plugin_setup.py index bcac88b..f6afe23 100644 --- a/q2_katharoseq/plugin_setup.py +++ b/q2_katharoseq/plugin_setup.py @@ -67,102 +67,9 @@ description='KatharoSeq is high-throughput protocol combining laboratory ' 'and bioinformatic methods that can differentiate a true ' 'positive signal in samples with as few as 50 to 500 cells.', - citations=[citations['minich2018']] -) - - -plugin.methods.register_function( - function=estimating_biomass, - inputs={}, - parameters={'total_reads': MetadataColumn[Numeric], - 'control_cell_extraction': MetadataColumn[Numeric], - 'positive_control_column': MetadataColumn[Categorical], - 'positive_control_value': Str, - 'extraction_mass_g': MetadataColumn[Numeric], - 'min_total_reads': Int, - 'pcr_template_vol': Int, - 'dna_extract_vol': Int}, - outputs=[('estimated_biomass', EstimatedBiomass)], - input_descriptions={}, - parameter_descriptions={ - 'total_reads': 'The total sum of the reads or ASVs for each sample.', - 'control_cell_extraction': ( - 'The estimated number of cells or genomes used as input to your ' - 'library prep. One may typically estimate this by determining the ' - 'total number of cells from a stock solution used to make ' - 'standard titrations. Each titration will have an estimated ' - 'number of microbial cells put into the extraction. The final ' - 'estimate will depend on the elution volume and the final volume ' - 'used into the library prep (e.g. 16S PCR).'), - 'positive_control_column': ( - 'The column in the sample metadata that describes which samples ' - 'are and are not controls.'), - 'positive_control_value': ( - 'The value in the control column that demarks which samples are ' - 'the positive controls.'), - 'extraction_mass_g': ( - 'The column in the sample metadata that describes the sample ' - '(e.g. stool, tissue, soil, etc) mass (in grams - typically ' - 'converted from mg)'), - 'min_total_reads': 'The minimum threshold to apply.', - 'pcr_template_vol': ( - 'The volume of DNA used as template in the ' - 'library prep (PCR reaction)'), - 'dna_extract_vol': ( - 'The final elution volume used during DNA extraction')}, - output_descriptions={ - 'estimated_biomass': ( - 'A dataframe containing the details on estimated biomass') - }, - name='Estimate the biomass of samples using KatharoSeq controls.', - description='Estimate the biomass of samples using KatharoSeq controls.', citations=[] ) - -plugin.visualizers.register_function( - function=read_count_threshold, - inputs={ - 'table': FeatureTable[Frequency] - }, - parameters={ - 'control': Str % Choices(['zymobiomics', 'classic', 'atcc']), - 'threshold': Int, - 'positive_control_value': Str, - 'positive_control_column': MetadataColumn[Categorical], - 'cell_count_column': MetadataColumn[Numeric] - }, - input_descriptions={ - 'table': ( - 'A FeatureTable collapsed to the genus level (level 6) that ' - 'contains the control samples.' - ), - }, - parameter_descriptions={ - 'control': ( - 'The type of positive control used.' - ), - 'threshold': ( - 'Threshold to use in calculating minimum frequency. ' - 'Must be int in [0,100].' - ), - 'positive_control_value': ( - 'The value in the control column that demarks which samples are ' - 'the positive controls.' - ), - 'positive_control_column': ( - 'The column in the sample metadata that describes which samples ' - 'are and are not controls.' - ), - }, - name='Methods for the application of the KatharoSeq protocol', - description='KatharoSeq is high-throughput protocol combining laboratory ' - 'and bioinformatic methods that can differentiate a true ' - 'positive signal in samples with as few as 50 to 500 cells.', - citations=[citations['minich2018']] -) - - plugin.methods.register_function( function=estimating_biomass, inputs={}, From ca69a55dd84afb235f67aa54a608913881892538 Mon Sep 17 00:00:00 2001 From: Daniela Perry Date: Tue, 1 Mar 2022 14:27:21 -0800 Subject: [PATCH 11/12] fix typo --- q2_katharoseq/tests/test_method.py | 1 + 1 file changed, 1 insertion(+) diff --git a/q2_katharoseq/tests/test_method.py b/q2_katharoseq/tests/test_method.py index 4c4b61a..cfe56b3 100644 --- a/q2_katharoseq/tests/test_method.py +++ b/q2_katharoseq/tests/test_method.py @@ -192,6 +192,7 @@ def test_biomass_plot(self): with tempfile.TemporaryDirectory() as output_dir: biomass_plot( + output_dir, total_reads=data.get_column('total_reads'), control_cell_extraction=data.get_column( 'control_cell_into_extraction'), # noqa From 6f02570ee8c0d6fb507ee99b7a039a83d059276c Mon Sep 17 00:00:00 2001 From: Daniela Perry Date: Tue, 1 Mar 2022 14:37:19 -0800 Subject: [PATCH 12/12] fix typo --- q2_katharoseq/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/q2_katharoseq/__init__.py b/q2_katharoseq/__init__.py index 6c0977a..a395404 100644 --- a/q2_katharoseq/__init__.py +++ b/q2_katharoseq/__init__.py @@ -6,7 +6,8 @@ # The full license is in the file LICENSE, distributed with this software. # ---------------------------------------------------------------------------- from . import _version -from ._methods import read_count_threshold, estimating_biomass, biomass_plot +from ._methods import read_count_threshold, estimating_biomass +from ._methods import biomass_plot __version__ = _version.get_versions()['version'] __all__ = ['read_count_threshold', 'estimating_biomass', 'biomass_plot']