Repository: phac-nml/biohansel (language: python)

Issue:
Update to S. Typhi scheme and metadata
7 new genotypes were added to the S. Typhi scheme, and S. Typhi metadata table was updates with these additional genotypes and with results from an analysis of ~8,100 public S. Typhi genomes in new metadata fields. Readme was updated with 3 additional citations for the expanded S. Typhi scheme. Test file and Typhi scheme version were updated. This addresses Issue #128 


Discussion / hints:

Fix patch:
diff --git a/.github/workflows/pypi_deploy.yml b/.github/workflows/pypi_deploy.yml
new file mode 100644
index 0000000..a9b4124
--- /dev/null
+++ b/.github/workflows/pypi_deploy.yml
@@ -0,0 +1,24 @@
+name: PyPI Deploy
+
+on:
+  push:
+    branches:
+      - master
+  release:
+    types: [published]
+
+jobs:
+  pypi_deploy:
+    name: PyPI Deploy
+    runs-on: ubuntu-latest
+    # Only run for the phac-nml/biohansel repo, for releases and pushes to master
+    if: ${{ github.repository == 'phac-nml/biohansel' }}
+    steps:
+      - uses: actions/checkout@v2
+      - uses: actions/setup-python@v2
+      - uses: casperdcl/deploy-pypi@v2
+        with:
+          password: ${{ secrets.pypi_token }}
+          build: true
+          # only upload if a tag is pushed (otherwise just build & check)
+          upload: ${{ github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') }}
\ No newline at end of file
diff --git a/README.rst b/README.rst
index 9cc0cb3..932b487 100644
--- a/README.rst
+++ b/README.rst
@@ -23,11 +23,11 @@
 
 Subtype microbial whole-genome sequencing (WGS) data using SNV targeting k-mer subtyping schemes.
 
-Includes 33 bp k-mer SNV subtyping schemes for *Salmonella enterica* subsp. enterica serovars Heidelberg, Enteritidis, and Typhimurium genomes developed by Genevieve Labbe et al., and for *S*. ser Typhi adapted from Wong et al. (https://www.nature.com/articles/ncomms12827).
+Includes 33 bp k-mer SNV subtyping schemes for *Salmonella enterica* subsp. enterica serovars Heidelberg, Enteritidis, and Typhimurium genomes developed by Genevieve Labbe et al., and for *S*. ser Typhi adapted from `Wong et al. <https://www.nature.com/articles/ncomms12827)>`_, `Britto et al. <https://journals.plos.org/plosntds/article?id=10.1371/journal.pntd.0006408>`_, `Rahman et al. <https://journals.plos.org/plosntds/article?id=10.1371/journal.pntd.0008036>`_, and `Klemm et al. <https://mbio.asm.org/content/9/1/e00105-18>`_.
 
 Works on genome assemblies (FASTA files) or reads (FASTQ files)! Accepts Gzipped FASTA/FASTQ files as input!
 
-Also includes a *Mycobacterium tuberculosis* lineage scheme adapted from Coll et al. (https://www.nature.com/articles/ncomms5812) by Daniel Kein.
+Also includes a *Mycobacterium tuberculosis* lineage scheme adapted from `Coll et al. <https://www.nature.com/articles/ncomms5812>`_ by Daniel Kein.
 
 
 Citation
@@ -37,9 +37,9 @@ If you find the ``biohansel`` tool useful, please cite as:
 
 .. epigraph::
 
-    Rapid and robust genotyping of highly clonal bacterial pathogens using BioHansel, a SNP-based k-mer search pipeline.
-    Geneviève Labbé, Peter Kruczkiewicz, Philip Mabon, James Robertson, Justin Schonfeld, Daniel Kein, Marisa A. Rankin, Matthew Gopez, Darian Hole, David Son, Natalie Knox, Chad R. Laing, Kyrylo Bessonov, Eduardo Taboada, Catherine Yoshida, Roger P. Johnson, Gary Van Domselaar and John H.E. Nash.
-    [Manuscript in preparation]
+    Rapid and accurate SNP genotyping of clonal bacterial pathogens with BioHansel.
+    Geneviève Labbé, Peter Kruczkiewicz, Philip Mabon, James Robertson, Justin Schonfeld, Daniel Kein, Marisa A. Rankin, Matthew Gopez, Darian Hole, David Son, Natalie Knox, Chad R. Laing, Kyrylo Bessonov, Eduardo Taboada, Catherine Yoshida, Kim Ziebell, Anil Nichani, Roger P. Johnson, Gary Van Domselaar and John H.E. Nash.
+    bioRxiv 2020.01.10.902056; doi: https://doi.org/10.1101/2020.01.10.902056
 
 
 Read_The_Docs
@@ -130,7 +130,7 @@ If you run ``hansel -h``, you should see the following usage statement:
 
     Subtype microbial genomes using SNV targeting k-mer subtyping schemes.
     Includes schemes for Salmonella enterica spp. enterica serovar Heidelberg, Enteritidis, Typhi, and Typhimurium subtyping. Also includes a Mycobacterium tuberculosis scheme called 'tb_lineage'.
-    Developed by Geneviève Labbé, James Robertson, Peter Kruczkiewicz, Marisa Rankin, Matthew Gopez, Chad R. Laing, Philip Mabon, Kim Ziebell, Aleisha R. Reimer, Lorelee Tschetter, Gary Van Domselaar, Sadjia Bekal, Kimberley A. MacDonald, Linda Hoang, Linda Chui, Danielle Daignault, Durda Slavic, Frank Pollari, E. Jane Parmley, David Son, Darian Hole, Philip Mabon, Elissa Giang, Lok Kan Lee, Jonathan Moffat, Marisa Rankin, Joanne MacKinnon, Roger Johnson, John H.E. Nash.
+    Developed by Geneviève Labbé, Peter Kruczkiewicz, Philip Mabon, James Robertson, Justin Schonfeld, Daniel Kein, Marisa A. Rankin, Matthew Gopez, Darian Hole, David Son, Natalie Knox, Chad R. Laing, Kyrylo Bessonov, Eduardo Taboada, Catherine Yoshida, Kim Ziebell, Anil Nichani, Roger P. Johnson, Gary Van Domselaar and John H.E. Nash.
 
     positional arguments:
       F                     Input genome FASTA/FASTQ files (can be Gzipped)
@@ -369,7 +369,7 @@ specific language governing permissions and limitations under the License.
 Contact
 =======
 
-**Gary van Domselaar**: gary.vandomselaar@phac-aspc.gc.ca
+**Gary van Domselaar**: gary.vandomselaar@canada.ca
 
 
 .. _PyPI: https://pypi.org/project/bio-hansel/
diff --git a/bio_hansel/__init__.py b/bio_hansel/__init__.py
index d0ceda6..a2a71d4 100644
--- a/bio_hansel/__init__.py
+++ b/bio_hansel/__init__.py
@@ -5,5 +5,5 @@
 program_summary = 'Subtype microbial genomes using SNV targeting k-mer subtyping schemes.'
 program_desc = program_summary + '''
 Includes schemes for Salmonella enterica spp. enterica serovar Heidelberg, Enteritidis, Typhi, and Typhimurium subtyping. Also includes a Mycobacterium tuberculosis scheme called 'tb_lineage'. 
-Developed by Geneviève Labbé, Peter Kruczkiewicz, Philip Mabon, James Robertson, Justin Schonfeld, Daniel Kein, Marisa A. Rankin, Matthew Gopez, Darian Hole, David Son, Natalie Knox, Chad R. Laing, Kyrylo Bessonov, Eduardo Taboada, Catherine Yoshida, Roger P. Johnson, Gary Van Domselaar and John H.E. Nash.
+Developed by Geneviève Labbé, Peter Kruczkiewicz, Philip Mabon, James Robertson, Justin Schonfeld, Daniel Kein, Marisa A. Rankin, Matthew Gopez, Darian Hole, David Son, Natalie Knox, Chad R. Laing, Kyrylo Bessonov, Eduardo Taboada, Catherine Yoshida, Kim Ziebell, Anil Nichani, Roger P. Johnson, Gary Van Domselaar and John H.E. Nash.
 '''
diff --git a/bio_hansel/const.py b/bio_hansel/const.py
index 2a643cd..0ff5284 100644
--- a/bio_hansel/const.py
+++ b/bio_hansel/const.py
@@ -13,7 +13,7 @@
                                  'version': '1.0.7',
                                  'subtyping_params': SubtypingParams(low_coverage_depth_freq=20)},
                  'typhi': {'file': resource_filename(program_name, 'data/typhi/kmers.fasta'),
-                                 'version': '1.2.0',
+                                 'version': '1.3.0',
                                  'subtyping_params': SubtypingParams(low_coverage_depth_freq=20)},
                  'tb_lineage': {'file': resource_filename(program_name, 'data/tb_lineage/kmers.fasta'),
                                  'version': '1.0.5',
diff --git a/bio_hansel/data/tb_lineage/metadata.tsv b/bio_hansel/data/tb_lineage/metadata.tsv
index 7a57bb9..4cb6aa9 100644
--- a/bio_hansel/data/tb_lineage/metadata.tsv
+++ b/bio_hansel/data/tb_lineage/metadata.tsv
@@ -2,6 +2,7 @@ subtype	Coll_et_al_genotype
 1	1
 1.1	1.1
 2.1	2.1
+2.2	2.2
 3	3
 4	4
 4.1	4.1
@@ -58,4 +59,4 @@ subtype	Coll_et_al_genotype
 4.6.1.2	4.6.1.2
 4.6.2	4.6.2
 4.6.2.1	4.6.2.1
-4.6.2.2	4.6.2.2
\ No newline at end of file
+4.6.2.2	4.6.2.2
diff --git a/bio_hansel/data/typhi/kmers.fasta b/bio_hansel/data/typhi/kmers.fasta
index f384275..5bf2a50 100644
--- a/bio_hansel/data/typhi/kmers.fasta
+++ b/bio_hansel/data/typhi/kmers.fasta
@@ -269,4 +269,32 @@ AGAAGACGGTGGCCGAGTATTACAAAATCAAAA
 >negative1611156-2.3.6.2.3
 GGCAGGCGCGATTGCAGCAACGTAAATTGCGCT
 >negative2348902-2.3.6.3
-TTGATGGCTTCATTACCATTACCGGCGGGAAGC
\ No newline at end of file
+TTGATGGCTTCATTACCATTACCGGCGGGAAGC
+>1193220-2.3.6.3.1
+CCGACGGTAAAGGCGGCCACACATTTAACACCA 
+>3694947-2.3.6.3.2
+ATTATTGTCATCACATGCTGTTGCGCCCAGGGT
+>955875-2.3.6.3.1.1
+CCGTGCTGGCAGCCGAAGTGAGCCGTCGTGGTT
+>3498544-2.3.3.2
+TTGCAGGATATCCCGCGGCCACAAATCCGCGTG
+>2424394-2.3.3.2.1
+TACCCTCGCGTAAATCACCCATATCCACCATCA
+>2272144-2.3.3.2.2
+TCGGTGAACGCTTCCGAACTCACGCCAGCCGGT
+>561056-2.3.6.3.3
+CATTGGGGAAATCGCTAGAACGTTCGCAGCAGT
+>negative1193220-2.3.6.3.1
+CCGACGGTAAAGGCGGTCACACATTTAACACCA 
+>negative3694947-2.3.6.3.2
+ATTATTGTCATCACATCCTGTTGCGCCCAGGGT
+>negative955875-2.3.6.3.1.1
+CCGTGCTGGCAGCCGAGGTGAGCCGTCGTGGTT
+>negative3498544-2.3.3.2
+TTGCAGGATATCCCGCAGCCACAAATCCGCGTG
+>negative2424394-2.3.3.2.1
+TACCCTCGCGTAAATCGCCCATATCCACCATCA
+>negative2272144-2.3.3.2.2
+TCGGTGAACGCTTCCGGACTCACGCCAGCCGGT
+>negative561056-2.3.6.3.3
+CATTGGGGAAATCGCTCGAACGTTCGCAGCAGT
diff --git a/bio_hansel/data/typhi/metadata.tsv b/bio_hansel/data/typhi/metadata.tsv
index 0443d79..b66cb0e 100644
--- a/bio_hansel/data/typhi/metadata.tsv
+++ b/bio_hansel/data/typhi/metadata.tsv
@@ -1,69 +1,76 @@
-subtype	Wong_et_al_genotype
-0	Typhi_1.0.0
-0.1	Typhi_0.1.0
-1	Typhi_1.1.0
-3	Typhi_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.1	Typhi_4.1.1
-2.3.6.2	Typhi_4.2.0
-2.3.6.2.1	Typhi_4.2.1
-2.3.6.2.2	Typhi_4.2.2
-2.3.6.2.3	Typhi_4.2.3
-2.3.6.3	Typhi_4.3.1
-2.4.1	Typhi_2.4.1
-2.5.1	Typhi_2.5.1
\ No newline at end of file
+subtype	Genotyphi_genotype	count	earliest_year_collected	latest_year_collected	top_geo_loc_name
+0.4	Typhi_0.0.1	5	1998	2016	Africa
+0.2	Typhi_0.0.2	6	2010	2017	Asia
+0.3	Typhi_0.0.3	20	2002	2018	Asia
+0.1	Typhi_0.1.0	8	1939	2018	Africa
+0.1.1	Typhi_0.1.1	2	1958	2014	Cameroon
+0.1.2	Typhi_0.1.2	1	1999	1999	Algeria
+0.1.3	Typhi_0.1.3	1	1998	1998	Peru
+0	Typhi_1.0.0	0	-	-	-
+1	Typhi_1.1.0	4	1936	2018	Vietnam
+1.1	Typhi_1.1.1	1	2005	2005	Algeria
+1.2	Typhi_1.1.2	2	2007	2012	South Africa
+1.3	Typhi_1.1.3	4	1976	2019	Africa
+1.4	Typhi_1.1.4	0	2011	2011	unknown
+3	Typhi_1.2.0	2	2012	2016	Vietnam
+3.1	Typhi_1.2.1	9	1935	2018	Asia
+2	Typhi_2.0.0	108	1936	2020	Asia
+2.6	Typhi_2.0.1	25	2003	2019	Asia
+2.7	Typhi_2.0.2	14	1999	2019	Asia
+2.1	Typhi_2.1.0	12	2010	2019	Africa
+2.1.1	Typhi_2.1.1	3	2006	2006	Indonesia
+2.1.2	Typhi_2.1.2	1	2002	2013	Indonesia
+2.1.3	Typhi_2.1.3	3	2004	2011	Indonesia
+2.1.4	Typhi_2.1.4	0	2002	2002	unknown
+2.1.5	Typhi_2.1.5	2	2010	2011	Indonesia
+2.1.6	Typhi_2.1.6	9	2008	2012	Indonesia
+2.1.7	Typhi_2.1.7	89	1939	2019	Papua New Guinea
+2.1.8	Typhi_2.1.8	6	2006	2011	Indonesia
+2.1.9	Typhi_2.1.9	12	2005	2012	Indonesia
+2.2	Typhi_2.2.0	58	1942	2020	Africa
+2.2.1	Typhi_2.2.1	19	2003	2019	Asia
+2.2.2	Typhi_2.2.2	45	2001	2019	Asia
+2.2.2.1	Typhi_2.2.3	7	2002	2010	Laos
+2.2.4	Typhi_2.2.4	3	2004	2017	India
+2.2.3	Typhi_2.3.0	4	2013	2016	Asia
+2.2.3.2.1	Typhi_2.3.1	40	1958	2020	Africa
+2.2.3.2	Typhi_2.3.2	75	1905	2019	Africa
+2.2.3.3	Typhi_2.3.3	61	1905	2019	Asia
+2.2.3.4	Typhi_2.3.4	13	1981	2017	Asia
+2.2.3.5	Typhi_2.3.5	14	1983	2017	Oceania
+2.4	Typhi_2.4.0	39	1973	2018	Asia
+2.4.1	Typhi_2.4.1	23	2004	2012	Africa
+2.5	Typhi_2.5.0	70	1977	2019	Africa
+2.5.1	Typhi_2.5.1	167	2005	2019	Africa
+2.3	Typhi_3.0.0	252	1939	2019	Asia
+2.3.7	Typhi_3.0.1	15	2000	2019	Asia
+2.3.8	Typhi_3.0.2	8	2009	2017	Asia
+2.3.1	Typhi_3.1.0	19	1958	2018	Asia
+2.3.1.1	Typhi_3.1.1	241	2002	2019	Africa
+2.3.1.2	Typhi_3.1.2	36	1937	2018	Asia
+2.3.2	Typhi_3.2.0	0	2016	2017	unknown
+2.3.2.1	Typhi_3.2.1	143	1973	2019	Asia
+2.3.2.2	Typhi_3.2.2	72	2003	2020	Asia
+2.3.3	Typhi_3.3.0	149	1937	2019	Asia
+2.3.3.1	Typhi_3.3.1	60	2000	2019	Africa
+2.3.3.2	Typhi_3.3.2	0	-	-	-
+2.3.3.2.1	Typhi_3.3.2.Bd1	0	-	-	-
+2.3.3.2.2	Typhi_3.3.2.Bd2	0	-	-	-
+2.3.4	Typhi_3.4.0	62	1972	2018	Asia
+2.3.5	Typhi_3.5.0	20	1991	2017	Asia
+2.3.5.1	Typhi_3.5.1	1	1985	1985	Fiji
+2.3.5.2	Typhi_3.5.2	5	2009	2010	Laos
+2.3.5.4.1	Typhi_3.5.3	5	2004	2011	Samoa
+2.3.5.4	Typhi_3.5.4	99	1992	2017	Samoa
+2.3.6	Typhi_4.0.0	17	2015	2019	Vietnam
+2.3.6.1	Typhi_4.1.0	156	1905	2019	Asia
+2.3.6.1.1	Typhi_4.1.1	25	1998	2019	Africa
+2.3.6.2	Typhi_4.2.0	11	1980	2003	Oceania
+2.3.6.2.1	Typhi_4.2.1	35	1981	2013	Fiji
+2.3.6.2.2	Typhi_4.2.2	70	2007	2018	Fiji
+2.3.6.2.3	Typhi_4.2.3	12	1993	1996	Fiji
+2.3.6.3	Typhi_4.3.1	204	1999	2019	Asia
+2.3.6.3.1	Typhi_4.3.1.1	1907	1992	2020	Asia
+2.3.6.3.1.1	Typhi_4.3.1.1.P1	0	-	-	-
+2.3.6.3.2	Typhi_4.3.1.2	477	2000	2020	Asia
+2.3.6.3.3	Typhi_4.3.1.3	0	-	-	-
diff --git a/bio_hansel/qc/const.py b/bio_hansel/qc/const.py
index c0cc6fa..5485a83 100644
--- a/bio_hansel/qc/const.py
+++ b/bio_hansel/qc/const.py
@@ -5,6 +5,6 @@ class QC:
     WARNING = 'WARNING'
     PASS = 'PASS'
     AMBIGUOUS_RESULTS_ERROR_3 = 'Ambiguous Results Error 3'
-    UNCONFIDENT_RESULTS_ERROR_4 = 'Unconfident Results Error 4'
+    UNCONFIDENT_RESULTS_ERROR_4 = 'Inconclusive Results Error 4'
     NO_SUBTYPE_RESULT = 'No subtype result!'
     NO_TARGETS_FOUND = 'No kmers/targets were found in this sample.'


Test patch:
diff --git a/tests/test_subtyping_contigs.py b/tests/test_subtyping_contigs.py
index 9d2d1e5..9f319fb 100644
--- a/tests/test_subtyping_contigs.py
+++ b/tests/test_subtyping_contigs.py
@@ -102,8 +102,8 @@ def test_enteritidis_scheme_vs_qc_failing_contigs_unconfident_ac(subtype_enterit
     assert isinstance(stgz, Subtype)
     assert isinstance(dfgz, DataFrame)
     check_subtype_attrs(st, stgz, subtype_enteritidis_fail_unconfident)
-    assert 'Unconfident Results Error 4' in st.qc_message
-    assert 'Unconfident Results Error 4' in stgz.qc_message
+    assert 'Inconclusive Results Error 4' in st.qc_message
+    assert 'Inconclusive Results Error 4' in stgz.qc_message
     check_df_fasta_cols(df)
     check_df_fasta_cols(dfgz)
 
diff --git a/tests/test_subtyping_reads.py b/tests/test_subtyping_reads.py
index 48edc32..736dc02 100644
--- a/tests/test_subtyping_reads.py
+++ b/tests/test_subtyping_reads.py
@@ -84,8 +84,8 @@ def subtype_typhi_AE014613_pass():
                    subtype='2.3.6.1',
                    file_path=fasta_typhi_pass,
                    are_subtypes_consistent=True,
-                   n_kmers_matching_all=68,
-                   n_kmers_matching_all_expected='68',
+                   n_kmers_matching_all=75,
+                   n_kmers_matching_all_expected='75',
                    n_kmers_matching_positive=4,
                    n_kmers_matching_positive_expected='4',
                    n_kmers_matching_subtype=1,
@@ -160,4 +160,4 @@ def test_typhimurium_scheme(subtype_typhimurium_pass):
     st, df = subtype_contigs(fasta_path=fasta_typhimurium_pass, genome_name=genome_name, scheme=scheme_typhimurium)
     assert isinstance(st, Subtype)
     assert isinstance(df, DataFrame)
-    check_subtype_attrs(st,subtype_typhimurium_pass)
\ No newline at end of file
+    check_subtype_attrs(st,subtype_typhimurium_pass)