spestimator 0.1.0.232__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 (32) hide show
  1. spestimator-0.1.0.232/LICENSE +21 -0
  2. spestimator-0.1.0.232/MANIFEST.in +3 -0
  3. spestimator-0.1.0.232/PKG-INFO +233 -0
  4. spestimator-0.1.0.232/README.md +189 -0
  5. spestimator-0.1.0.232/pyproject.toml +56 -0
  6. spestimator-0.1.0.232/setup.cfg +4 -0
  7. spestimator-0.1.0.232/src/spestimator/__init__.py +6 -0
  8. spestimator-0.1.0.232/src/spestimator/cli.py +316 -0
  9. spestimator-0.1.0.232/src/spestimator/data/bacteria.16SrRNA.ndb +0 -0
  10. spestimator-0.1.0.232/src/spestimator/data/bacteria.16SrRNA.nhr +0 -0
  11. spestimator-0.1.0.232/src/spestimator/data/bacteria.16SrRNA.nin +0 -0
  12. spestimator-0.1.0.232/src/spestimator/data/bacteria.16SrRNA.nog +0 -0
  13. spestimator-0.1.0.232/src/spestimator/data/bacteria.16SrRNA.nos +0 -0
  14. spestimator-0.1.0.232/src/spestimator/data/bacteria.16SrRNA.not +0 -0
  15. spestimator-0.1.0.232/src/spestimator/data/bacteria.16SrRNA.nsq +0 -0
  16. spestimator-0.1.0.232/src/spestimator/data/bacteria.16SrRNA.ntf +0 -0
  17. spestimator-0.1.0.232/src/spestimator/data/bacteria.16SrRNA.nto +0 -0
  18. spestimator-0.1.0.232/src/spestimator/data/metadata.csv.gz +0 -0
  19. spestimator-0.1.0.232/src/spestimator/database.py +309 -0
  20. spestimator-0.1.0.232/src/spestimator/estimation.py +184 -0
  21. spestimator-0.1.0.232/src/spestimator/genome.py +97 -0
  22. spestimator-0.1.0.232/src/spestimator/metadata.py +64 -0
  23. spestimator-0.1.0.232/src/spestimator.egg-info/PKG-INFO +233 -0
  24. spestimator-0.1.0.232/src/spestimator.egg-info/SOURCES.txt +30 -0
  25. spestimator-0.1.0.232/src/spestimator.egg-info/dependency_links.txt +1 -0
  26. spestimator-0.1.0.232/src/spestimator.egg-info/entry_points.txt +2 -0
  27. spestimator-0.1.0.232/src/spestimator.egg-info/requires.txt +10 -0
  28. spestimator-0.1.0.232/src/spestimator.egg-info/top_level.txt +1 -0
  29. spestimator-0.1.0.232/tests/test_cli.py +47 -0
  30. spestimator-0.1.0.232/tests/test_database.py +112 -0
  31. spestimator-0.1.0.232/tests/test_estimation.py +65 -0
  32. spestimator-0.1.0.232/tests/test_genomes.py +47 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Young
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.
@@ -0,0 +1,3 @@
1
+ include LICENSE
2
+ include README.md
3
+ recursive-include src/spestimator/data *
@@ -0,0 +1,233 @@
1
+ Metadata-Version: 2.4
2
+ Name: spestimator
3
+ Version: 0.1.0.232
4
+ Summary: A tool to predict bacterial species from fasta files using RefSeq 16S.
5
+ Author-email: Erin Young <eriny@utah.gov>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2024 Young
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/erinyoung/Spestimator
29
+ Classifier: Programming Language :: Python :: 3
30
+ Classifier: Operating System :: OS Independent
31
+ Requires-Python: >=3.9
32
+ Description-Content-Type: text/markdown
33
+ License-File: LICENSE
34
+ Requires-Dist: pandas
35
+ Requires-Dist: requests
36
+ Requires-Dist: tqdm
37
+ Requires-Dist: ncbi-datasets-pyclient
38
+ Provides-Extra: dev
39
+ Requires-Dist: pytest; extra == "dev"
40
+ Requires-Dist: pytest-cov; extra == "dev"
41
+ Requires-Dist: build; extra == "dev"
42
+ Requires-Dist: twine; extra == "dev"
43
+ Dynamic: license-file
44
+
45
+ <div align="center">
46
+ <img src="assets/logo.png" width="200" alt="Spestimator Logo">
47
+ <h1>Spestimator</h1>
48
+ </div>
49
+
50
+ ![PyPI - Version](https://img.shields.io/pypi/v/Spestimator)
51
+ ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/Spestimator)
52
+ ![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/erinyoung/Spestimator/test.yml?label=tests)
53
+ ![GitHub License](https://img.shields.io/github/license/erinyoung/Spestimator)
54
+
55
+ **Species Estimator & Genome Retriever**
56
+
57
+ Species + Estimator = Spestimator
58
+
59
+ Spestimator is a lightweight Python command-line tool designed to quickly identify bacterial species from input FASTA sequences (contigs or reads) and automatically retrieve their corresponding reference genomes from NCBI RefSeq.
60
+
61
+
62
+ ## Why Spestimator?
63
+
64
+ I needed a tool that could:
65
+ 1. Quickly estimate a range of potential reference genomes for an input sample.
66
+ 2. Use a database maintained by a trustworthy, authoritative group (NCBI RefSeq) rather than maintaining a custom, static database that gets outdated.
67
+
68
+ ---
69
+
70
+ ## Installation
71
+
72
+ ### From Pip/From Source
73
+ Spestimator requires [NCBI BLAST+](https://blast.ncbi.nlm.nih.gov/doc/blast-help/downloadblastdata.html#downloadblastdata) to be installed and available in your system path.
74
+
75
+ ```bash
76
+ sudo apt-get install ncbi-blast+
77
+ ```
78
+
79
+ ```bash
80
+ # installation from pypi
81
+ pip install spestimator
82
+ ```
83
+
84
+ ```bash
85
+ # from source
86
+ git clone https://github.com/erinyoung/Spestimator.git
87
+ cd Spestimator
88
+ pip install .
89
+ ```
90
+
91
+ ### From Conda (includes blast)
92
+ ```bash
93
+ conda install -c bioconda spestimator
94
+ ```
95
+
96
+
97
+
98
+
99
+ ---
100
+
101
+ ## Quick Start
102
+
103
+ Identify organisms in your FASTA file(s)
104
+
105
+ ```bash
106
+ spestimator -i *.fasta -o results.csv
107
+ ```
108
+
109
+ Identify organisms and download the matched RefSeq genomes to a folder:
110
+
111
+ ```bash
112
+ spestimator -i *.fasta -o results.csv -d genomes_dir/
113
+ ```
114
+
115
+ ### Updating the database
116
+
117
+ RefSeq updates quarterly. There is an attempt to keep this package on a similar update schedule, but this may not be feasible. To get a current version of the database.
118
+
119
+ ```bash
120
+ # downloads https://ftp.ncbi.nlm.nih.gov/refseq/TargetedLoci/Bacteria/bacteria.16SrRNA.fna.gz for blast database
121
+ # uses eutils to get taxids for blast database (NCBI api-key will speed this step up)
122
+ # downloads https://ftp.ncbi.nlm.nih.gov/genomes/refseq/bacteria/assembly_summary.txt for refseq accesions
123
+ spestimator --update-db --db-dir database --api-key NCBI_API_KEY
124
+ ```
125
+ This database can then be used by
126
+
127
+ ```bash
128
+ spestimator -i *.fasta -o results.csv -d genomes_dir/ --db-dir database
129
+ ```
130
+
131
+ ---
132
+
133
+ ## Usage & Options
134
+
135
+ ```
136
+ usage: spestimator [-h] [-v] [-i INPUT [INPUT ...]] [-o OUTPUT] [-d [DIR]] [--db-dir DB_DIR] [--db-name DB_NAME] [-u] [--api-key API_KEY] [-t THREADS]
137
+ [--max-target-seqs MAX_TARGET_SEQS] [--min-identity MIN_IDENTITY] [--min-coverage MIN_COVERAGE] [--min-hits MIN_HITS]
138
+ [--min-alignment-len MIN_ALIGNMENT_LEN] [--top-k-taxa TOP_K_TAXA]
139
+
140
+ Spestimator: Predict bacterial TaxIDs from 16S and download genomes.
141
+
142
+ options:
143
+ -h, --help show this help message and exit
144
+ -v, --version show program's version number and exit
145
+ -i, --input INPUT [INPUT ...]
146
+ Input FASTA files
147
+ -o, --output OUTPUT Output CSV file
148
+ -d, --download-genomes [DIR]
149
+ Download found genomes. Defaults to 'genomes/' if flag is used without a path.
150
+ --db-dir DB_DIR Override path to BLAST database directory
151
+ --db-name DB_NAME Custom name for the database to appear in results (Default: DB filename)
152
+ -u, --update-db Download database and generate metadata
153
+ --api-key API_KEY NCBI API Key (Speeds up metadata generation)
154
+ -t, --threads THREADS
155
+ BLAST threads
156
+
157
+ Filtering Options:
158
+ --max-target-seqs MAX_TARGET_SEQS
159
+ BLAST: Hits to keep per read (Default: 10)
160
+ --min-identity MIN_IDENTITY
161
+ Filter: Minimum Percent Identity (0-100). Default: 90.0
162
+ --min-coverage MIN_COVERAGE
163
+ Filter: Minimum Query Coverage (0-100). Default: 0.0
164
+ --min-hits MIN_HITS Filter: Minimum reads required to report an organism
165
+ --min-alignment-len MIN_ALIGNMENT_LEN
166
+ Filter: Minimum Alignment Length in bp (Default: 0/No Filter)
167
+ --top-k-taxa TOP_K_TAXA
168
+ Report: Only keep the top K unique organisms per file (Default: 10)
169
+ ```
170
+
171
+ ## How It Works
172
+ - Runs [blastn](https://blast.ncbi.nlm.nih.gov/doc/blast-help/downloadblastdata.html#downloadblastdata) of your input against the 16S database in the repo.
173
+ - Filters hits based on identity and coverage.
174
+ - Aggregates hits to identify the most likely species present.
175
+ - (Optional): Uses [ncbi-datasets-pyclient](https://github.com/misialq/ncbi-datasets-pyclient) to download the reference genome assembly (`GCF_xxxx`) associated with the identified species.
176
+
177
+ ---
178
+
179
+ ## Output Format
180
+
181
+ The results CSV contains the following columns:
182
+
183
+ - **organism:** The clean species name (e.g., *E. coli*).
184
+ - **taxid:** NCBI Taxonomy ID.
185
+ - **refseq_accession:** The Assembly ID (e.g., `GCF_000005845.2`) used for downloading.
186
+ - **blast_sacc:** The specific 16S sequence accession hit.
187
+ - **count:** Number of input sequences matching this organism.
188
+ - **avg_pident:** Average percent identity of the matches.
189
+ - **avg_bitscore:** A metric combining match quality and length.
190
+
191
+ ## Example
192
+
193
+ ```bash
194
+ spestimator -i tests/sample_positive.fasta
195
+ ```
196
+
197
+ The results should look like this
198
+
199
+ ```
200
+ input file,organism,taxid,refseq_accession,blast_sacc,count,total_bitscore,avg_bitscore,avg_pident,max_pident,avg_qcov,best_evalue
201
+ sample_positive.fasta,Streptococcus pyogenes,1314,GCF_900475035.1,NR_112088,1,2772,2772.0,100.0,100.0,33.25947263461113,0.0
202
+ sample_positive.fasta,Streptococcus canis,1329,GCF_900636575.1,NR_115729,1,2545,2545.0,98.085,98.085,32.395302459561265,0.0
203
+ sample_positive.fasta,Streptococcus canis,1329,GCF_900636575.1,NR_024633,1,2536,2536.0,97.202,97.202,33.25947263461113,0.0
204
+ sample_positive.fasta,Streptococcus urinalis,149016,GCF_900636885.1,NR_037101,1,2534,2534.0,97.135,97.135,33.25947263461113,0.0
205
+ sample_positive.fasta,Streptococcus dysgalactiae subsp. equisimilis,119602,,NR_043661,1,2534,2534.0,97.443,97.443,32.92709949036118,0.0
206
+ sample_positive.fasta,Streptococcus iniae,1346,GCF_000831485.1,NR_025148,1,2532,2532.0,96.422,96.422,34.05716818081099,0.0
207
+ sample_positive.fasta,Streptococcus ictaluri 707-05,764299,,NR_115802,1,2523,2523.0,97.627,97.627,32.68335918457789,0.0
208
+ sample_positive.fasta,Streptococcus penaeicida,1765960,GCF_965139625.1,NR_178901,1,2514,2514.0,96.217,96.217,33.96853534234434,0.0
209
+ sample_positive.fasta,Streptococcus tangpeifui,2709400,GCF_011038795.1,NR_199923,1,2494,2494.0,95.858,95.858,34.23443385774429,0.0
210
+ sample_positive.fasta,Streptococcus agalactiae ATCC 13813,888745,,NR_040821,1,2484,2484.0,96.536,96.536,33.25947263461113,0.0
211
+ ```
212
+
213
+ ## Disclaimer: NCBI Datasets
214
+
215
+ Spestimator relies on [ncbi-datasets-pyclient](https://github.com/misialq/ncbi-datasets-pyclient) to retrieve genomes. This library updates frequently, as does the underlying [datasets](https://github.com/ncbi/datasets) tool. If you encounter unexpected errors during genome download (e.g., `ApiException` or connection drops), please [submit an issue](https://github.com/erinyoung/Spestimator/issues) and use the accessions in the "refseq_accession" column to download with [datasets](https://github.com/ncbi/datasets) separately.
216
+
217
+ ```bash
218
+ # download datasets
219
+ wget https://ftp.ncbi.nlm.nih.gov/pub/datasets/command-line/v2/linux-amd64/datasets && chmod +x datasets
220
+
221
+ # get a list of accessions
222
+ cut -f 4 -d , results.csv | grep GCF > id_list.txt
223
+
224
+ # use the list of accessions to download genomes
225
+ ./datasets download genome accession --inputfile id_list.txt --filename ncbi_dataset.zip
226
+
227
+ # decompress file and use for additional analysis
228
+ unzip ncbi_dataset.zip
229
+ ```
230
+
231
+ ## AI Usage
232
+
233
+ Spestimator began as a set of custom shell and Python scripts used for ad-hoc analysis. To make these tools more reliable and accessible, Google's Gemini was used to accelerate the transition into a Python package. Gemini assisted in modularizing the codebase, replacing parsing logic with Pandas operations, and implementing a "mocked" testing suite that allows for safe CI/CD without hitting NCBI servers. Gemini also created the logo.
@@ -0,0 +1,189 @@
1
+ <div align="center">
2
+ <img src="assets/logo.png" width="200" alt="Spestimator Logo">
3
+ <h1>Spestimator</h1>
4
+ </div>
5
+
6
+ ![PyPI - Version](https://img.shields.io/pypi/v/Spestimator)
7
+ ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/Spestimator)
8
+ ![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/erinyoung/Spestimator/test.yml?label=tests)
9
+ ![GitHub License](https://img.shields.io/github/license/erinyoung/Spestimator)
10
+
11
+ **Species Estimator & Genome Retriever**
12
+
13
+ Species + Estimator = Spestimator
14
+
15
+ Spestimator is a lightweight Python command-line tool designed to quickly identify bacterial species from input FASTA sequences (contigs or reads) and automatically retrieve their corresponding reference genomes from NCBI RefSeq.
16
+
17
+
18
+ ## Why Spestimator?
19
+
20
+ I needed a tool that could:
21
+ 1. Quickly estimate a range of potential reference genomes for an input sample.
22
+ 2. Use a database maintained by a trustworthy, authoritative group (NCBI RefSeq) rather than maintaining a custom, static database that gets outdated.
23
+
24
+ ---
25
+
26
+ ## Installation
27
+
28
+ ### From Pip/From Source
29
+ Spestimator requires [NCBI BLAST+](https://blast.ncbi.nlm.nih.gov/doc/blast-help/downloadblastdata.html#downloadblastdata) to be installed and available in your system path.
30
+
31
+ ```bash
32
+ sudo apt-get install ncbi-blast+
33
+ ```
34
+
35
+ ```bash
36
+ # installation from pypi
37
+ pip install spestimator
38
+ ```
39
+
40
+ ```bash
41
+ # from source
42
+ git clone https://github.com/erinyoung/Spestimator.git
43
+ cd Spestimator
44
+ pip install .
45
+ ```
46
+
47
+ ### From Conda (includes blast)
48
+ ```bash
49
+ conda install -c bioconda spestimator
50
+ ```
51
+
52
+
53
+
54
+
55
+ ---
56
+
57
+ ## Quick Start
58
+
59
+ Identify organisms in your FASTA file(s)
60
+
61
+ ```bash
62
+ spestimator -i *.fasta -o results.csv
63
+ ```
64
+
65
+ Identify organisms and download the matched RefSeq genomes to a folder:
66
+
67
+ ```bash
68
+ spestimator -i *.fasta -o results.csv -d genomes_dir/
69
+ ```
70
+
71
+ ### Updating the database
72
+
73
+ RefSeq updates quarterly. There is an attempt to keep this package on a similar update schedule, but this may not be feasible. To get a current version of the database.
74
+
75
+ ```bash
76
+ # downloads https://ftp.ncbi.nlm.nih.gov/refseq/TargetedLoci/Bacteria/bacteria.16SrRNA.fna.gz for blast database
77
+ # uses eutils to get taxids for blast database (NCBI api-key will speed this step up)
78
+ # downloads https://ftp.ncbi.nlm.nih.gov/genomes/refseq/bacteria/assembly_summary.txt for refseq accesions
79
+ spestimator --update-db --db-dir database --api-key NCBI_API_KEY
80
+ ```
81
+ This database can then be used by
82
+
83
+ ```bash
84
+ spestimator -i *.fasta -o results.csv -d genomes_dir/ --db-dir database
85
+ ```
86
+
87
+ ---
88
+
89
+ ## Usage & Options
90
+
91
+ ```
92
+ usage: spestimator [-h] [-v] [-i INPUT [INPUT ...]] [-o OUTPUT] [-d [DIR]] [--db-dir DB_DIR] [--db-name DB_NAME] [-u] [--api-key API_KEY] [-t THREADS]
93
+ [--max-target-seqs MAX_TARGET_SEQS] [--min-identity MIN_IDENTITY] [--min-coverage MIN_COVERAGE] [--min-hits MIN_HITS]
94
+ [--min-alignment-len MIN_ALIGNMENT_LEN] [--top-k-taxa TOP_K_TAXA]
95
+
96
+ Spestimator: Predict bacterial TaxIDs from 16S and download genomes.
97
+
98
+ options:
99
+ -h, --help show this help message and exit
100
+ -v, --version show program's version number and exit
101
+ -i, --input INPUT [INPUT ...]
102
+ Input FASTA files
103
+ -o, --output OUTPUT Output CSV file
104
+ -d, --download-genomes [DIR]
105
+ Download found genomes. Defaults to 'genomes/' if flag is used without a path.
106
+ --db-dir DB_DIR Override path to BLAST database directory
107
+ --db-name DB_NAME Custom name for the database to appear in results (Default: DB filename)
108
+ -u, --update-db Download database and generate metadata
109
+ --api-key API_KEY NCBI API Key (Speeds up metadata generation)
110
+ -t, --threads THREADS
111
+ BLAST threads
112
+
113
+ Filtering Options:
114
+ --max-target-seqs MAX_TARGET_SEQS
115
+ BLAST: Hits to keep per read (Default: 10)
116
+ --min-identity MIN_IDENTITY
117
+ Filter: Minimum Percent Identity (0-100). Default: 90.0
118
+ --min-coverage MIN_COVERAGE
119
+ Filter: Minimum Query Coverage (0-100). Default: 0.0
120
+ --min-hits MIN_HITS Filter: Minimum reads required to report an organism
121
+ --min-alignment-len MIN_ALIGNMENT_LEN
122
+ Filter: Minimum Alignment Length in bp (Default: 0/No Filter)
123
+ --top-k-taxa TOP_K_TAXA
124
+ Report: Only keep the top K unique organisms per file (Default: 10)
125
+ ```
126
+
127
+ ## How It Works
128
+ - Runs [blastn](https://blast.ncbi.nlm.nih.gov/doc/blast-help/downloadblastdata.html#downloadblastdata) of your input against the 16S database in the repo.
129
+ - Filters hits based on identity and coverage.
130
+ - Aggregates hits to identify the most likely species present.
131
+ - (Optional): Uses [ncbi-datasets-pyclient](https://github.com/misialq/ncbi-datasets-pyclient) to download the reference genome assembly (`GCF_xxxx`) associated with the identified species.
132
+
133
+ ---
134
+
135
+ ## Output Format
136
+
137
+ The results CSV contains the following columns:
138
+
139
+ - **organism:** The clean species name (e.g., *E. coli*).
140
+ - **taxid:** NCBI Taxonomy ID.
141
+ - **refseq_accession:** The Assembly ID (e.g., `GCF_000005845.2`) used for downloading.
142
+ - **blast_sacc:** The specific 16S sequence accession hit.
143
+ - **count:** Number of input sequences matching this organism.
144
+ - **avg_pident:** Average percent identity of the matches.
145
+ - **avg_bitscore:** A metric combining match quality and length.
146
+
147
+ ## Example
148
+
149
+ ```bash
150
+ spestimator -i tests/sample_positive.fasta
151
+ ```
152
+
153
+ The results should look like this
154
+
155
+ ```
156
+ input file,organism,taxid,refseq_accession,blast_sacc,count,total_bitscore,avg_bitscore,avg_pident,max_pident,avg_qcov,best_evalue
157
+ sample_positive.fasta,Streptococcus pyogenes,1314,GCF_900475035.1,NR_112088,1,2772,2772.0,100.0,100.0,33.25947263461113,0.0
158
+ sample_positive.fasta,Streptococcus canis,1329,GCF_900636575.1,NR_115729,1,2545,2545.0,98.085,98.085,32.395302459561265,0.0
159
+ sample_positive.fasta,Streptococcus canis,1329,GCF_900636575.1,NR_024633,1,2536,2536.0,97.202,97.202,33.25947263461113,0.0
160
+ sample_positive.fasta,Streptococcus urinalis,149016,GCF_900636885.1,NR_037101,1,2534,2534.0,97.135,97.135,33.25947263461113,0.0
161
+ sample_positive.fasta,Streptococcus dysgalactiae subsp. equisimilis,119602,,NR_043661,1,2534,2534.0,97.443,97.443,32.92709949036118,0.0
162
+ sample_positive.fasta,Streptococcus iniae,1346,GCF_000831485.1,NR_025148,1,2532,2532.0,96.422,96.422,34.05716818081099,0.0
163
+ sample_positive.fasta,Streptococcus ictaluri 707-05,764299,,NR_115802,1,2523,2523.0,97.627,97.627,32.68335918457789,0.0
164
+ sample_positive.fasta,Streptococcus penaeicida,1765960,GCF_965139625.1,NR_178901,1,2514,2514.0,96.217,96.217,33.96853534234434,0.0
165
+ sample_positive.fasta,Streptococcus tangpeifui,2709400,GCF_011038795.1,NR_199923,1,2494,2494.0,95.858,95.858,34.23443385774429,0.0
166
+ sample_positive.fasta,Streptococcus agalactiae ATCC 13813,888745,,NR_040821,1,2484,2484.0,96.536,96.536,33.25947263461113,0.0
167
+ ```
168
+
169
+ ## Disclaimer: NCBI Datasets
170
+
171
+ Spestimator relies on [ncbi-datasets-pyclient](https://github.com/misialq/ncbi-datasets-pyclient) to retrieve genomes. This library updates frequently, as does the underlying [datasets](https://github.com/ncbi/datasets) tool. If you encounter unexpected errors during genome download (e.g., `ApiException` or connection drops), please [submit an issue](https://github.com/erinyoung/Spestimator/issues) and use the accessions in the "refseq_accession" column to download with [datasets](https://github.com/ncbi/datasets) separately.
172
+
173
+ ```bash
174
+ # download datasets
175
+ wget https://ftp.ncbi.nlm.nih.gov/pub/datasets/command-line/v2/linux-amd64/datasets && chmod +x datasets
176
+
177
+ # get a list of accessions
178
+ cut -f 4 -d , results.csv | grep GCF > id_list.txt
179
+
180
+ # use the list of accessions to download genomes
181
+ ./datasets download genome accession --inputfile id_list.txt --filename ncbi_dataset.zip
182
+
183
+ # decompress file and use for additional analysis
184
+ unzip ncbi_dataset.zip
185
+ ```
186
+
187
+ ## AI Usage
188
+
189
+ Spestimator began as a set of custom shell and Python scripts used for ad-hoc analysis. To make these tools more reliable and accessible, Google's Gemini was used to accelerate the transition into a Python package. Gemini assisted in modularizing the codebase, replacing parsing logic with Pandas operations, and implementing a "mocked" testing suite that allows for safe CI/CD without hitting NCBI servers. Gemini also created the logo.
@@ -0,0 +1,56 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "spestimator"
7
+ version = "0.1.0.232"
8
+ description = "A tool to predict bacterial species from fasta files using RefSeq 16S."
9
+ readme = "README.md"
10
+ authors = [
11
+ { name = "Erin Young", email = "eriny@utah.gov" },
12
+ ]
13
+ license = { file = "LICENSE" }
14
+ classifiers = [
15
+ "Programming Language :: Python :: 3",
16
+ "Operating System :: OS Independent",
17
+ ]
18
+ requires-python = ">=3.9"
19
+ dependencies = [
20
+ "pandas",
21
+ "requests",
22
+ "tqdm",
23
+ "ncbi-datasets-pyclient",
24
+ ]
25
+
26
+ [project.scripts]
27
+ spestimator = "spestimator.cli:main"
28
+
29
+ [project.urls]
30
+ "Homepage" = "https://github.com/erinyoung/Spestimator"
31
+
32
+ [project.optional-dependencies]
33
+ dev = [
34
+ "pytest",
35
+ "pytest-cov",
36
+ "build",
37
+ "twine"
38
+ ]
39
+
40
+ [tool.pytest.ini_options]
41
+ minversion = "6.0"
42
+ addopts = "-ra -q"
43
+ testpaths = ["tests"]
44
+ pythonpath = ["src"]
45
+
46
+ [tool.setuptools]
47
+ include-package-data = true
48
+
49
+ [tool.setuptools.packages.find]
50
+ where = ["src"]
51
+
52
+ [tool.setuptools.package-data]
53
+ spestimator = [
54
+ "data/*.gz",
55
+ "data/bacteria.16SrRNA.*"
56
+ ]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,6 @@
1
+ try:
2
+ from importlib.metadata import version, PackageNotFoundError
3
+
4
+ __version__ = version("spestimator")
5
+ except PackageNotFoundError:
6
+ __version__ = "unknown"