gmlst 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. gmlst-0.1.0/.gitignore +56 -0
  2. gmlst-0.1.0/LICENSE +21 -0
  3. gmlst-0.1.0/PKG-INFO +396 -0
  4. gmlst-0.1.0/README.md +363 -0
  5. gmlst-0.1.0/gmlst/__init__.py +3 -0
  6. gmlst-0.1.0/gmlst/__main__.py +6 -0
  7. gmlst-0.1.0/gmlst/aligners/__init__.py +44 -0
  8. gmlst-0.1.0/gmlst/aligners/base.py +181 -0
  9. gmlst-0.1.0/gmlst/aligners/blastn.py +287 -0
  10. gmlst-0.1.0/gmlst/aligners/kma.py +165 -0
  11. gmlst-0.1.0/gmlst/aligners/minimap2.py +1369 -0
  12. gmlst-0.1.0/gmlst/aligners/nucmer.py +221 -0
  13. gmlst-0.1.0/gmlst/calling/__init__.py +6 -0
  14. gmlst-0.1.0/gmlst/calling/allele.py +185 -0
  15. gmlst-0.1.0/gmlst/calling/chew_policy.py +286 -0
  16. gmlst-0.1.0/gmlst/calling/confidence.py +53 -0
  17. gmlst-0.1.0/gmlst/calling/st_lookup.py +199 -0
  18. gmlst-0.1.0/gmlst/cli.py +43 -0
  19. gmlst-0.1.0/gmlst/commands/__init__.py +31 -0
  20. gmlst-0.1.0/gmlst/commands/common.py +138 -0
  21. gmlst-0.1.0/gmlst/commands/scheme.py +1329 -0
  22. gmlst-0.1.0/gmlst/commands/typing.py +1336 -0
  23. gmlst-0.1.0/gmlst/commands/typing_output.py +84 -0
  24. gmlst-0.1.0/gmlst/commands/typing_runner.py +128 -0
  25. gmlst-0.1.0/gmlst/commands/typing_runtime.py +54 -0
  26. gmlst-0.1.0/gmlst/commands/typing_scheme.py +70 -0
  27. gmlst-0.1.0/gmlst/commands/utils.py +1006 -0
  28. gmlst-0.1.0/gmlst/core/__init__.py +230 -0
  29. gmlst-0.1.0/gmlst/core/adapters_cds.py +49 -0
  30. gmlst-0.1.0/gmlst/core/adapters_exact_hash.py +148 -0
  31. gmlst-0.1.0/gmlst/core/adapters_index_prefilter.py +157 -0
  32. gmlst-0.1.0/gmlst/core/adapters_refinement.py +251 -0
  33. gmlst-0.1.0/gmlst/core/cds.py +125 -0
  34. gmlst-0.1.0/gmlst/core/config.py +65 -0
  35. gmlst-0.1.0/gmlst/core/exact_hash.py +440 -0
  36. gmlst-0.1.0/gmlst/core/indexing.py +206 -0
  37. gmlst-0.1.0/gmlst/core/pipeline.py +690 -0
  38. gmlst-0.1.0/gmlst/core/prefilter.py +215 -0
  39. gmlst-0.1.0/gmlst/core/ranking.py +67 -0
  40. gmlst-0.1.0/gmlst/core/refinement.py +534 -0
  41. gmlst-0.1.0/gmlst/core/sequences.py +98 -0
  42. gmlst-0.1.0/gmlst/core/types.py +70 -0
  43. gmlst-0.1.0/gmlst/core_config.py +199 -0
  44. gmlst-0.1.0/gmlst/data/__init__.py +0 -0
  45. gmlst-0.1.0/gmlst/data/blocked_schemes.json +10 -0
  46. gmlst-0.1.0/gmlst/data/catalogs/__init__.py +0 -0
  47. gmlst-0.1.0/gmlst/data/catalogs/cgmlst.json +368 -0
  48. gmlst-0.1.0/gmlst/data/catalogs/enterobase.json +261 -0
  49. gmlst-0.1.0/gmlst/data/catalogs/pasteur.json +776 -0
  50. gmlst-0.1.0/gmlst/data/catalogs/pubmlst.json +2792 -0
  51. gmlst-0.1.0/gmlst/data/organism_mapping.json +18 -0
  52. gmlst-0.1.0/gmlst/database/__init__.py +6 -0
  53. gmlst-0.1.0/gmlst/database/atomic.py +17 -0
  54. gmlst-0.1.0/gmlst/database/cache.py +576 -0
  55. gmlst-0.1.0/gmlst/database/download.py +527 -0
  56. gmlst-0.1.0/gmlst/database/providers/__init__.py +63 -0
  57. gmlst-0.1.0/gmlst/database/providers/base.py +126 -0
  58. gmlst-0.1.0/gmlst/database/providers/bigsdb.py +767 -0
  59. gmlst-0.1.0/gmlst/database/providers/cgmlst.py +277 -0
  60. gmlst-0.1.0/gmlst/database/providers/cgmlst_schemes.py +286 -0
  61. gmlst-0.1.0/gmlst/database/providers/enterobase.py +509 -0
  62. gmlst-0.1.0/gmlst/database/schema.py +159 -0
  63. gmlst-0.1.0/gmlst/fasta_io.py +55 -0
  64. gmlst-0.1.0/gmlst/kmer_prefilter.py +91 -0
  65. gmlst-0.1.0/gmlst/metadata_io.py +23 -0
  66. gmlst-0.1.0/gmlst/novel/__init__.py +12 -0
  67. gmlst-0.1.0/gmlst/novel/reader.py +188 -0
  68. gmlst-0.1.0/gmlst/novel/service.py +170 -0
  69. gmlst-0.1.0/gmlst/novel/writer.py +226 -0
  70. gmlst-0.1.0/gmlst/readers/__init__.py +7 -0
  71. gmlst-0.1.0/gmlst/readers/fasta.py +69 -0
  72. gmlst-0.1.0/gmlst/readers/fastq.py +67 -0
  73. gmlst-0.1.0/gmlst/readers/sample.py +177 -0
  74. gmlst-0.1.0/gmlst/schemefree/__init__.py +53 -0
  75. gmlst-0.1.0/gmlst/schemefree/assembly_engine.py +96 -0
  76. gmlst-0.1.0/gmlst/schemefree/cluster_engine.py +124 -0
  77. gmlst-0.1.0/gmlst/schemefree/config.py +197 -0
  78. gmlst-0.1.0/gmlst/schemefree/gene_predictor.py +286 -0
  79. gmlst-0.1.0/gmlst/schemefree/hasher.py +463 -0
  80. gmlst-0.1.0/gmlst/schemefree/io_handler.py +91 -0
  81. gmlst-0.1.0/gmlst/schemefree/typing_engine.py +428 -0
  82. gmlst-0.1.0/gmlst/utils.py +173 -0
  83. gmlst-0.1.0/gmlst/visual/__init__.py +6 -0
  84. gmlst-0.1.0/gmlst/visual/app.py +606 -0
  85. gmlst-0.1.0/gmlst/visual/cli.py +995 -0
  86. gmlst-0.1.0/gmlst/visual/mst.py +335 -0
  87. gmlst-0.1.0/gmlst/visual/mst_edmonds.py +527 -0
  88. gmlst-0.1.0/gmlst/visual/mst_grapetree.py +543 -0
  89. gmlst-0.1.0/gmlst/visual/mst_shared.py +527 -0
  90. gmlst-0.1.0/gmlst/web/README.md +33 -0
  91. gmlst-0.1.0/gmlst/web/frontend/index.html +15 -0
  92. gmlst-0.1.0/gmlst/web/frontend/package-lock.json +1591 -0
  93. gmlst-0.1.0/gmlst/web/frontend/package.json +20 -0
  94. gmlst-0.1.0/gmlst/web/frontend/src/App.vue +4176 -0
  95. gmlst-0.1.0/gmlst/web/frontend/src/main.js +5 -0
  96. gmlst-0.1.0/gmlst/web/frontend/src/style.css +1364 -0
  97. gmlst-0.1.0/gmlst/web/frontend/src/visualSelection.js +264 -0
  98. gmlst-0.1.0/gmlst/web/frontend/src/visualSelection.test.js +304 -0
  99. gmlst-0.1.0/gmlst/web/frontend/vite.config.js +32 -0
  100. gmlst-0.1.0/gmlst/web/static/visual/dist/app.css +1 -0
  101. gmlst-0.1.0/gmlst/web/static/visual/dist/app.js +6 -0
  102. gmlst-0.1.0/gmlst/web/static/visual/dist/index.html +16 -0
  103. gmlst-0.1.0/gmlst/web/templates/visual/index.html +16 -0
  104. gmlst-0.1.0/pyproject.toml +89 -0
gmlst-0.1.0/.gitignore ADDED
@@ -0,0 +1,56 @@
1
+ # pixi environments
2
+ .pixi/
3
+ *.egg-info/
4
+
5
+ # Python cache
6
+ __pycache__/
7
+ *.py[cod]
8
+ *$py.class
9
+ *.so
10
+ .Python
11
+
12
+ # IDE
13
+ .vscode/
14
+ .idea/
15
+ *.swp
16
+ *.swo
17
+ *~
18
+ .opencode/
19
+ .sisyphus/
20
+
21
+ # OS
22
+ .DS_Store
23
+ Thumbs.db
24
+
25
+ # Testing
26
+ .pytest_cache/
27
+ .ci-venv/
28
+ .coverage
29
+ htmlcov/
30
+ .tox/
31
+ tracecov/
32
+
33
+ # Build artifacts
34
+ /dist/
35
+ build/
36
+ *.whl
37
+ *.tar.gz
38
+ gmlst/web/frontend/node_modules/
39
+ gmlst/web/frontend/.vite/
40
+
41
+ # Logs
42
+ *.log
43
+
44
+ # Benchmark and temp files
45
+ benchmark_results/
46
+
47
+ # Ruff cache
48
+ .ruff_cache/
49
+
50
+ # Documentation build
51
+ docs/_build/
52
+ site/
53
+
54
+ # Dev
55
+ dev/
56
+ tests/
gmlst-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 gmlst contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
gmlst-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,396 @@
1
+ Metadata-Version: 2.4
2
+ Name: gmlst
3
+ Version: 0.1.0
4
+ Summary: Fast bacterial genome typing with MLST, cgMLST, and scheme-free discovery
5
+ Project-URL: Homepage, https://github.com/indexofire/gmlst
6
+ Project-URL: Documentation, https://indexofire.github.io/gmlst/
7
+ Project-URL: Repository, https://github.com/indexofire/gmlst
8
+ Project-URL: Issues, https://github.com/indexofire/gmlst/issues
9
+ Project-URL: Changelog, https://github.com/indexofire/gmlst/blob/main/CHANGELOG.md
10
+ Author: gmlst contributors
11
+ License: MIT
12
+ License-File: LICENSE
13
+ Keywords: bacteria,bioinformatics,blast,cgmlst,genomics,minimap2,mlst,mummer,typing
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
21
+ Requires-Python: <3.13,>=3.12
22
+ Requires-Dist: click>=8.1
23
+ Requires-Dist: flask>=3.0
24
+ Requires-Dist: pyrodigal>=3.4
25
+ Requires-Dist: pyyaml>=6.0
26
+ Requires-Dist: requests>=2.31
27
+ Requires-Dist: rich>=13.0
28
+ Requires-Dist: xxhash>=3.0
29
+ Provides-Extra: dev
30
+ Requires-Dist: pytest>=8.0; extra == 'dev'
31
+ Requires-Dist: ruff>=0.4; extra == 'dev'
32
+ Description-Content-Type: text/markdown
33
+
34
+ # gmlst
35
+
36
+ [![License: MIT](https://img.shields.io/badge/license-MIT-yellow.svg)](LICENSE)
37
+ [![Python 3.12](https://img.shields.io/badge/python-3.12-blue.svg)](https://www.python.org/downloads/)
38
+ [![Bioinformatics](https://img.shields.io/badge/domain-bioinformatics-green.svg)](https://github.com/indexofire/gmlst)
39
+
40
+ `gmlst` is a fast Python 3.12 CLI for bacterial genome typing with classical MLST, large cgMLST and wgMLST schemes, and scheme-free discovery workflows. It supports assembled genomes and raw reads, several alignment backends, multiple public data providers, custom local schemes, offline cache reuse, and local MST visualization from one command-line interface.
41
+
42
+ English | [简体中文](README_ZH.md)
43
+
44
+ ## Features
45
+
46
+ - 🧬 **Broad typing support**: run `gmlst typing mlst`, `gmlst typing cgmlst`, and `gmlst typing tgmlst` from the same CLI.
47
+ - ⚡ **Multiple backends**: use BLAST+, KMA, minimap2, MUMmer4, with built-in exact-hash pre-resolution for cgMLST workflows.
48
+ - 🧫 **FASTA and FASTQ input**: type assembled genomes and paired-end raw reads with backend-aware handling.
49
+ - 🗂️ **Multiple providers**: work with PubMLST, Pasteur BIGSdb, Enterobase, cgmlst.org, and local custom schemes.
50
+ - 🧠 **Smart cgMLST modes**: choose `standard`, `chew-fast`, `chew-ultrafast`, `chew-bsr`, or `chew-balanced` depending on speed and evidence needs.
51
+ - 🆕 **Novel allele workflow**: detect novel alleles, extract novel profiles, and build custom laboratory databases.
52
+ - 🔍 **Scheme-free typing**: run `tgmlst` for de novo allele discovery without a preselected public scheme.
53
+ - 📦 **Rich outputs**: export `tsv`, `json`, `pretty`, and GrapeTree-compatible tables.
54
+ - 🌐 **Local visualization**: launch a Flask + Vue web app with `gmlst visual web` to inspect MST results locally.
55
+ - 💾 **Cache-first operation**: downloaded schemes and built indexes are reused for offline or repeated runs.
56
+ - 🧵 **Batch processing**: use sample-level workers and backend threads for high-throughput workflows.
57
+ - 🧬 **CDS-aware calling**: cgMLST workflows can use Pyrodigal for CDS prediction and chewBBACA-compatible classification paths.
58
+
59
+ ## Installation
60
+
61
+ ### Option 1, pixi, recommended
62
+
63
+ Pixi installs Python, external bioinformatics tools, and the editable package in one environment.
64
+
65
+ ```bash
66
+ curl -fsSL https://pixi.sh/install.sh | bash
67
+ git clone https://github.com/indexofire/gmlst.git
68
+ cd gmlst
69
+ pixi install
70
+ pixi run gmlst --version
71
+ ```
72
+
73
+ ### Option 2, pip
74
+
75
+ Use this if you already manage your own Python and system tools.
76
+
77
+ ```bash
78
+ python3 -m venv .venv
79
+ source .venv/bin/activate
80
+ pip install gmlst
81
+
82
+ # Install external tools separately, for example with conda or mamba
83
+ conda install -c bioconda blast minimap2 mummer4 mmseqs2 prodigal kma kmc samtools
84
+ ```
85
+
86
+ ### Option 3, from source
87
+
88
+ ```bash
89
+ git clone https://github.com/indexofire/gmlst.git
90
+ cd gmlst
91
+ python3 -m venv .venv
92
+ source .venv/bin/activate
93
+ pip install -e .
94
+ gmlst --help
95
+ ```
96
+
97
+ ### External tools managed by pixi
98
+
99
+ - `blast >=2.14`
100
+ - `minimap2 >=2.26`
101
+ - `mummer4 >=4.0`
102
+ - `mmseqs2 >=15`
103
+ - `prodigal >=2.6`
104
+ - `kma >=1.6.8`
105
+ - `kmc >=3.2.4`
106
+ - `samtools >=1.23.1`
107
+
108
+ ### Python package requirements
109
+
110
+ - `click`
111
+ - `flask`
112
+ - `requests`
113
+ - `rich`
114
+ - `xxhash`
115
+ - `pyyaml`
116
+ - `pyrodigal`
117
+
118
+ ## Quick Start
119
+
120
+ ### 1. Browse and download a scheme
121
+
122
+ ```bash
123
+ # List cached and available schemes
124
+ gmlst scheme list
125
+
126
+ # Restrict to one provider
127
+ gmlst scheme list -p pubmlst
128
+
129
+ # Download a scheme to the local cache
130
+ gmlst scheme download -s saureus_1
131
+ ```
132
+
133
+ ### 2. Type one sample
134
+
135
+ ```bash
136
+ # MLST on an assembled genome
137
+ gmlst typing mlst -s saureus_1 sample.fasta
138
+
139
+ # MLST on paired-end reads
140
+ gmlst typing mlst -s saureus_1 -b minimap2 sample_R1.fastq.gz sample_R2.fastq.gz
141
+
142
+ # cgMLST on an assembly
143
+ gmlst typing cgmlst -s vparahaemolyticus_3 --cgmlst-mode chew-fast sample.fna
144
+ ```
145
+
146
+ ### 3. Batch processing
147
+
148
+ ```bash
149
+ # Write TSV output for many assemblies
150
+ gmlst typing mlst -s saureus_1 --max-workers 8 samples/*.fasta -o results.tsv
151
+
152
+ # Save machine-readable JSON for downstream novel extraction
153
+ gmlst typing mlst -s saureus_1 --format json samples/*.fasta -o results.json
154
+ ```
155
+
156
+ ### 4. Understand the output
157
+
158
+ Default output is TSV, compatible with the familiar `tseemann/mlst` style.
159
+
160
+ ```text
161
+ FILE SCHEME ST arcC aroE glpF gmk pta tpi yqiL
162
+ sample1.fasta saureus_1 1 1 1 1 1 1 1 1
163
+ sample2.fasta saureus_1 - 1 ~2 3? - 1 1 1
164
+ ```
165
+
166
+ - plain allele number, exact known allele match
167
+ - `~23`, non-exact high-coverage call, typically a closest or novel-style locus depending on identity
168
+ - `15?`, partial locus hit with insufficient coverage
169
+ - `-`, locus not found
170
+
171
+ Use `--format pretty` for human-readable terminal output and `--format json` for downstream automation.
172
+
173
+ ## Alignment Backends
174
+
175
+ | Backend | CLI selectable | FASTA | FASTQ | Best fit | Notes |
176
+ | --- | --- | --- | --- | --- | --- |
177
+ | `blastn` | Yes | Yes | No | Classical MLST on assemblies | Strong baseline for exact allele calls and targeted review |
178
+ | `kma` | Yes | Yes | Yes | FASTQ typing and cgMLST FASTQ routes | Good fit for mapping-based allele calling on reads |
179
+ | `minimap2` | Yes | Yes | Yes | Fast assembly typing and flexible read workflows | Used heavily in cgMLST optimization paths |
180
+ | `nucmer` | Yes | Yes | No | Sensitive assembly comparison | Useful for distant matches and alternate evidence |
181
+
182
+ ### Backend notes
183
+
184
+ - `typing mlst` and `typing cgmlst` auto-detect common paired FASTQ naming patterns such as `_R1/_R2`, `_1/_2`, and `.1/.2`.
185
+ - `typing cgmlst` uses `minimap2` by default for FASTA assemblies.
186
+ - For FASTQ cgMLST, the CLI follows a KMA-first policy and treats chew-style cgMLST modes as FASTA-oriented compatibility options.
187
+ - `GMLST_MINIMAP2_KMER_ENGINE=python|kmc|auto` controls the minimap2 k-mer support scorer.
188
+
189
+ ## Data Providers
190
+
191
+ | Provider | Source | Typical use |
192
+ | --- | --- | --- |
193
+ | `pubmlst` | PubMLST REST catalogs | Common public MLST schemes |
194
+ | `pasteur` | Pasteur BIGSdb API | BIGSdb-hosted species collections |
195
+ | `enterobase` | Enterobase scheme downloads | Large curated scheme sets |
196
+ | `cgmlst` | cgmlst.org | cgMLST-focused public schemes |
197
+ | `local` | Local cache and custom schemes | Private laboratory databases and exported custom schemes |
198
+
199
+ Examples:
200
+
201
+ ```bash
202
+ gmlst scheme list -p pubmlst
203
+ gmlst scheme list -p enterobase -t cgmlst
204
+ gmlst scheme list -p local
205
+ gmlst scheme show -s saureus_1
206
+ ```
207
+
208
+ ## Novel Data Workflow
209
+
210
+ Build a local custom scheme from novel calls collected during routine typing.
211
+
212
+ ```bash
213
+ # 1. Type samples and save JSON
214
+ gmlst typing mlst -s saureus_1 --format json *.fasta -o typing_results.json
215
+
216
+ # 2. Extract novel alleles and novel profiles
217
+ gmlst utils extract -i typing_results.json --novel-allele --novel-profile --data-dir novel_data
218
+
219
+ # 3. Create a local custom scheme
220
+ gmlst scheme create -t mlst -s saureus_1 --data-dir novel_data --desc "Lab collection 2024"
221
+
222
+ # 4. Add more novel data later
223
+ gmlst scheme update-custom -s custom_1 --data-dir more_novel_data
224
+
225
+ # 5. Export for downstream MST work
226
+ gmlst scheme export -s custom_1 --format grapetree -o custom_1_grapetree.tsv
227
+ ```
228
+
229
+ TSV fallback is also supported when you only have tabular typing output and the original sample files are available:
230
+
231
+ ```bash
232
+ gmlst utils extract -i typing_results.tsv -s saureus_1 --novel-allele --novel-profile \
233
+ --samples-dir ./samples --data-dir novel_data
234
+ ```
235
+
236
+ ## cgMLST Modes
237
+
238
+ `gmlst typing cgmlst` supports several calling modes for different speed and evidence trade-offs.
239
+
240
+ | Mode | What it does | Good default |
241
+ | --- | --- | --- |
242
+ | `standard` | Conservative baseline behavior | Start here if you want predictable generic settings |
243
+ | `chew-fast` | Exact-hash plus minimap2 prefilter with targeted rescue | Fast everyday assembly typing |
244
+ | `chew-ultrafast` | More aggressive speed profile with bounded second-pass rescue | Large batches where turnaround matters most |
245
+ | `chew-bsr` | Adds protein-level exact-hash style resolution on top of `chew-fast` | Cases where protein evidence is useful |
246
+ | `chew-balanced` | Hash-first path with targeted `blastn` fallback | Balance speed with stronger low-confidence review |
247
+
248
+ Examples:
249
+
250
+ ```bash
251
+ gmlst typing cgmlst -s vparahaemolyticus_3 --cgmlst-mode standard sample.fna
252
+ gmlst typing cgmlst -s vparahaemolyticus_3 --cgmlst-mode chew-fast sample.fna
253
+ gmlst typing cgmlst -s vparahaemolyticus_3 --cgmlst-mode chew-ultrafast sample.fna
254
+ gmlst typing cgmlst -s vparahaemolyticus_3 --cgmlst-mode chew-bsr sample.fna
255
+ gmlst typing cgmlst -s vparahaemolyticus_3 --cgmlst-mode chew-balanced sample.fna
256
+ ```
257
+
258
+ ## Scheme-free Typing (`tgmlst`)
259
+
260
+ Use `tgmlst` when you want scheme-free allele discovery and optional scheme reuse.
261
+
262
+ ```bash
263
+ # Run scheme-free typing
264
+ gmlst typing tgmlst sample.fna --stats
265
+
266
+ # Save a discovered scheme for reuse
267
+ gmlst typing tgmlst sample.fna --save-scheme tgmlst_scheme.json
268
+
269
+ # Reuse a previously saved scheme
270
+ gmlst typing tgmlst another_sample.fna --load-scheme tgmlst_scheme.json --format json
271
+ ```
272
+
273
+ Useful options include `--hash-strategy`, `--summary-report`, `--error-report`, and `--fail-on-error`.
274
+
275
+ ## Visualization
276
+
277
+ Launch the local web application to build an MST from cgMLST or exported GrapeTree-style profiles.
278
+
279
+ ```bash
280
+ gmlst visual web --open-browser
281
+ ```
282
+
283
+ Or bind to a custom address:
284
+
285
+ ```bash
286
+ gmlst visual web --host 0.0.0.0 --port 8787
287
+ ```
288
+
289
+ The web UI accepts TSV data, builds a minimum spanning tree, and serves a local Flask API with a Vue frontend.
290
+
291
+ ## Configuration
292
+
293
+ Key environment variables:
294
+
295
+ | Variable | Purpose |
296
+ | --- | --- |
297
+ | `GMLST_CACHE_DIR` | Override the default cache root, usually `~/.cache/gmlst` |
298
+ | `GMLST_TMPDIR` | Override temporary working directory used during typing and refinement |
299
+ | `GMLST_MINIMAP2_KMER_ENGINE` | Choose minimap2 k-mer support engine: `python`, `kmc`, or `auto` |
300
+ | `GMLST_PUBMLST_BASE_URL` | Override PubMLST API base URL |
301
+ | `GMLST_PASTEUR_BASE_URL` | Override Pasteur BIGSdb API base URL |
302
+ | `GMLST_PRIVATE_BIGSDB_URL` | Register a private BIGSdb instance as an extra provider |
303
+ | `GMLST_PRIVATE_BIGSDB_NAME` | Name shown for the private BIGSdb provider |
304
+ | `GMLST_PRIVATE_BIGSDB_LABEL` | Human-readable label for the private BIGSdb provider |
305
+
306
+ Example:
307
+
308
+ ```bash
309
+ export GMLST_CACHE_DIR="$HOME/.cache/gmlst"
310
+ export GMLST_TMPDIR="$PWD/.tmp/gmlst"
311
+ export GMLST_MINIMAP2_KMER_ENGINE=auto
312
+ export GMLST_PUBMLST_BASE_URL="https://rest.pubmlst.org/db"
313
+ export GMLST_PASTEUR_BASE_URL="https://bigsdb.pasteur.fr/api/db"
314
+ ```
315
+
316
+ Private BIGSdb example:
317
+
318
+ ```bash
319
+ export GMLST_PRIVATE_BIGSDB_URL="http://127.0.0.1:9000/api/db"
320
+ export GMLST_PRIVATE_BIGSDB_NAME="labdb"
321
+ export GMLST_PRIVATE_BIGSDB_LABEL="Lab BIGSdb"
322
+ gmlst scheme list -p labdb
323
+ ```
324
+
325
+ ## Output Format Details
326
+
327
+ The default TSV format uses compact markers per locus.
328
+
329
+ | Marker | Meaning |
330
+ | --- | --- |
331
+ | `23` | Exact allele call |
332
+ | `~23` | Non-exact but high-coverage call, used for closest hits and novel-like loci |
333
+ | `15?` | Partial call, coverage below the confident threshold |
334
+ | `-` | Missing locus |
335
+
336
+ JSON output is the best choice when you want structured fields such as per-locus call metadata and `novel_sequence` extraction data.
337
+
338
+ ## Multicopy Loci Notes
339
+
340
+ - Conflicting multicopy calls are reported with comma notation such as `1,2`.
341
+ - When conflicting multicopy loci are present, ST is reported as `-` to avoid overconfident profile assignment.
342
+ - Same-allele copy counting such as `1,1` is optional and currently exposed through `--count-same-copy` for `blastn` workflows.
343
+
344
+ Recommended review pattern:
345
+
346
+ ```bash
347
+ # Fast first pass
348
+ gmlst typing mlst -s vparahaemolyticus_1 *.fna -o pass1.tsv
349
+
350
+ # Targeted second pass on flagged samples
351
+ gmlst typing mlst -s vparahaemolyticus_1 -b blastn --count-same-copy flagged_sample.fna
352
+ ```
353
+
354
+ ## Development
355
+
356
+ Set up the development environment:
357
+
358
+ ```bash
359
+ pixi install
360
+ pixi run install-dev
361
+ ```
362
+
363
+ Common tasks:
364
+
365
+ ```bash
366
+ pixi run lint
367
+ pixi run format-check
368
+ pixi run test
369
+ pixi run check
370
+ ```
371
+
372
+ Direct Ruff commands also work:
373
+
374
+ ```bash
375
+ pixi run ruff check .
376
+ pixi run ruff format .
377
+ ```
378
+
379
+ See [docs/contributing.md](docs/contributing.md) for contributor workflow and [docs/architecture.md](docs/architecture.md) for module boundaries and typing-path contracts.
380
+
381
+ ## Documentation Index
382
+
383
+ - [docs/README.md](docs/README.md) for the full documentation map
384
+ - [docs/installation.md](docs/installation.md) for installation details
385
+ - [docs/quickstart.md](docs/quickstart.md) for a guided first run
386
+ - [docs/commands.md](docs/commands.md) for the CLI reference
387
+ - [README_ZH.md](README_ZH.md) for the Chinese root guide
388
+
389
+ ## License
390
+
391
+ Released under the [MIT License](LICENSE).
392
+
393
+ ## Acknowledgments
394
+
395
+ - Inspired by [tseemann/mlst](https://github.com/tseemann/mlst)
396
+ - Uses public scheme data from [PubMLST](https://pubmlst.org/)