orphos 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.
- orphos-0.1.0/Cargo.toml +31 -0
- orphos-0.1.0/PKG-INFO +218 -0
- orphos-0.1.0/README.md +194 -0
- orphos-0.1.0/orphos-core/Cargo.toml +28 -0
- orphos-0.1.0/orphos-core/README.md +222 -0
- orphos-0.1.0/orphos-core/src/algorithms/dynamic_programming/gene_prediction.rs +445 -0
- orphos-0.1.0/orphos-core/src/algorithms/dynamic_programming/mod.rs +7 -0
- orphos-0.1.0/orphos-core/src/algorithms/dynamic_programming/overlap_resolution.rs +414 -0
- orphos-0.1.0/orphos-core/src/algorithms/dynamic_programming/path_optimization.rs +447 -0
- orphos-0.1.0/orphos-core/src/algorithms/dynamic_programming/scoring/connection_types.rs +270 -0
- orphos-0.1.0/orphos-core/src/algorithms/dynamic_programming/scoring/handlers.rs +1109 -0
- orphos-0.1.0/orphos-core/src/algorithms/dynamic_programming/scoring/mod.rs +2 -0
- orphos-0.1.0/orphos-core/src/algorithms/gene_finding/annotation.rs +963 -0
- orphos-0.1.0/orphos-core/src/algorithms/gene_finding/creation.rs +621 -0
- orphos-0.1.0/orphos-core/src/algorithms/gene_finding/mod.rs +6 -0
- orphos-0.1.0/orphos-core/src/algorithms/gene_finding/optimization.rs +285 -0
- orphos-0.1.0/orphos-core/src/algorithms/gene_finding/scoring.rs +347 -0
- orphos-0.1.0/orphos-core/src/algorithms/mod.rs +38 -0
- orphos-0.1.0/orphos-core/src/bitmap/mod.rs +156 -0
- orphos-0.1.0/orphos-core/src/config.rs +175 -0
- orphos-0.1.0/orphos-core/src/constants.rs +349 -0
- orphos-0.1.0/orphos-core/src/engine.rs +1239 -0
- orphos-0.1.0/orphos-core/src/lib.rs +112 -0
- orphos-0.1.0/orphos-core/src/metagenomic/mod.rs +329 -0
- orphos-0.1.0/orphos-core/src/metagenomic/presets.rs +28172 -0
- orphos-0.1.0/orphos-core/src/node/creation.rs +700 -0
- orphos-0.1.0/orphos-core/src/node/dicodon.rs +400 -0
- orphos-0.1.0/orphos-core/src/node/management.rs +531 -0
- orphos-0.1.0/orphos-core/src/node/mod.rs +213 -0
- orphos-0.1.0/orphos-core/src/node/motifs.rs +537 -0
- orphos-0.1.0/orphos-core/src/node/overlaps.rs +486 -0
- orphos-0.1.0/orphos-core/src/node/record_gc_bias.rs +507 -0
- orphos-0.1.0/orphos-core/src/node/scoring.rs +1523 -0
- orphos-0.1.0/orphos-core/src/node/utilities.rs +210 -0
- orphos-0.1.0/orphos-core/src/node/validation.rs +234 -0
- orphos-0.1.0/orphos-core/src/output/formats/gbk.rs +232 -0
- orphos-0.1.0/orphos-core/src/output/formats/gca.rs +213 -0
- orphos-0.1.0/orphos-core/src/output/formats/gff.rs +266 -0
- orphos-0.1.0/orphos-core/src/output/formats/sco.rs +226 -0
- orphos-0.1.0/orphos-core/src/output/mod.rs +261 -0
- orphos-0.1.0/orphos-core/src/results.rs +101 -0
- orphos-0.1.0/orphos-core/src/sequence/encoded.rs +78 -0
- orphos-0.1.0/orphos-core/src/sequence/io.rs +149 -0
- orphos-0.1.0/orphos-core/src/sequence/mod.rs +1193 -0
- orphos-0.1.0/orphos-core/src/sequence/processing.rs +448 -0
- orphos-0.1.0/orphos-core/src/training/common.rs +151 -0
- orphos-0.1.0/orphos-core/src/training/mod.rs +812 -0
- orphos-0.1.0/orphos-core/src/training/non_sd_training.rs +315 -0
- orphos-0.1.0/orphos-core/src/training/sd_training.rs +338 -0
- orphos-0.1.0/orphos-core/src/types.rs +514 -0
- orphos-0.1.0/orphos-python/.gitignore +52 -0
- orphos-0.1.0/orphos-python/Cargo.lock +964 -0
- orphos-0.1.0/orphos-python/Cargo.toml +22 -0
- orphos-0.1.0/orphos-python/README.md +194 -0
- orphos-0.1.0/orphos-python/examples/basic_usage.py +62 -0
- orphos-0.1.0/orphos-python/examples/file_processing.py +120 -0
- orphos-0.1.0/orphos-python/examples/minimal.py +15 -0
- orphos-0.1.0/orphos-python/python/orphos/__init__.py +19 -0
- orphos-0.1.0/orphos-python/src/lib.rs +290 -0
- orphos-0.1.0/orphos-python/test_bindings.py +107 -0
- orphos-0.1.0/pyproject.toml +38 -0
- orphos-0.1.0/python/orphos/__init__.py +19 -0
orphos-0.1.0/Cargo.toml
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
[workspace]
|
|
2
|
+
members = ["orphos-core", "orphos-cli", "orphos-wasm"]
|
|
3
|
+
exclude = ["orphos-python"]
|
|
4
|
+
resolver = "2"
|
|
5
|
+
|
|
6
|
+
[profile.release]
|
|
7
|
+
opt-level = 3
|
|
8
|
+
lto = "fat"
|
|
9
|
+
codegen-units = 1
|
|
10
|
+
panic = "abort"
|
|
11
|
+
|
|
12
|
+
[profile.release-debug]
|
|
13
|
+
inherits = "release"
|
|
14
|
+
debug = true
|
|
15
|
+
debug-assertions = false
|
|
16
|
+
overflow-checks = false
|
|
17
|
+
|
|
18
|
+
[profile.profiling]
|
|
19
|
+
inherits = "release"
|
|
20
|
+
debug = true
|
|
21
|
+
|
|
22
|
+
[profile.test]
|
|
23
|
+
opt-level = 3
|
|
24
|
+
|
|
25
|
+
# Coverage profile for faster tarpaulin runs
|
|
26
|
+
[profile.coverage]
|
|
27
|
+
inherits = "test"
|
|
28
|
+
opt-level = 0
|
|
29
|
+
debug = true
|
|
30
|
+
debug-assertions = true
|
|
31
|
+
overflow-checks = false
|
orphos-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: orphos
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Classifier: Development Status :: 4 - Beta
|
|
5
|
+
Classifier: Intended Audience :: Science/Research
|
|
6
|
+
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Rust
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
15
|
+
Summary: Python bindings for Orphos - a gene prediction tool for microbial genomes
|
|
16
|
+
Keywords: bioinformatics,genomics,gene-prediction,orphos
|
|
17
|
+
Author: Orphos Contributors
|
|
18
|
+
License: GPL-3.0-or-later
|
|
19
|
+
Requires-Python: >=3.8
|
|
20
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
21
|
+
Project-URL: Homepage, https://github.com/FullHuman/orphos
|
|
22
|
+
Project-URL: Repository, https://github.com/FullHuman/orphos
|
|
23
|
+
|
|
24
|
+
# Orphos Python Bindings
|
|
25
|
+
|
|
26
|
+
Python bindings for Orphos, a fast and accurate gene prediction tool for microbial genomes.
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
### From Source
|
|
31
|
+
|
|
32
|
+
You'll need Rust and Python 3.8+ installed. Then:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# Install maturin (the build tool for Python+Rust projects)
|
|
36
|
+
pip install maturin
|
|
37
|
+
|
|
38
|
+
# Build and install in development mode
|
|
39
|
+
cd orphos-python
|
|
40
|
+
maturin develop --release
|
|
41
|
+
|
|
42
|
+
# Or build a wheel
|
|
43
|
+
maturin build --release
|
|
44
|
+
pip install target/wheels/orphos-*.whl
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Quick Start
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
import orphos
|
|
51
|
+
|
|
52
|
+
# Analyze a FASTA file
|
|
53
|
+
result = orphos.analyze_file("genome.fasta")
|
|
54
|
+
print(f"Found {result.gene_count} genes in {result.sequence_count} sequences")
|
|
55
|
+
print(result.output) # GenBank formatted output
|
|
56
|
+
|
|
57
|
+
# Analyze a sequence string
|
|
58
|
+
fasta_string = """>seq1
|
|
59
|
+
ATGCGATCGATCGATCGATCGATCGATCG...
|
|
60
|
+
"""
|
|
61
|
+
result = orphos.analyze_sequence(fasta_string)
|
|
62
|
+
|
|
63
|
+
# Customize options
|
|
64
|
+
options = orphos.OrphosOptions(
|
|
65
|
+
mode="meta", # Use metagenomic mode
|
|
66
|
+
format="gff", # Output in GFF format
|
|
67
|
+
closed_ends=True, # Don't allow genes off edges
|
|
68
|
+
translation_table=11 # Use translation table 11
|
|
69
|
+
)
|
|
70
|
+
result = orphos.analyze_file("genome.fasta", options)
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## API Reference
|
|
74
|
+
|
|
75
|
+
### `analyze_sequence(fasta_content, options=None)`
|
|
76
|
+
|
|
77
|
+
Analyze DNA sequences from a FASTA-formatted string.
|
|
78
|
+
|
|
79
|
+
**Parameters:**
|
|
80
|
+
- `fasta_content` (str): FASTA-formatted sequence(s)
|
|
81
|
+
- `options` (OrphosOptions, optional): Configuration options
|
|
82
|
+
|
|
83
|
+
**Returns:** `OrphosResult`
|
|
84
|
+
|
|
85
|
+
### `analyze_file(file_path, options=None)`
|
|
86
|
+
|
|
87
|
+
Analyze DNA sequences from a FASTA file.
|
|
88
|
+
|
|
89
|
+
**Parameters:**
|
|
90
|
+
- `file_path` (str): Path to the FASTA file
|
|
91
|
+
- `options` (OrphosOptions, optional): Configuration options
|
|
92
|
+
|
|
93
|
+
**Returns:** `OrphosResult`
|
|
94
|
+
|
|
95
|
+
### `OrphosOptions`
|
|
96
|
+
|
|
97
|
+
Configuration options for gene prediction.
|
|
98
|
+
|
|
99
|
+
**Attributes:**
|
|
100
|
+
- `mode` (str): "single" for single genome mode, "meta" for metagenomic mode (default: "single")
|
|
101
|
+
- `format` (str): Output format - "gbk", "gff", "sco", or "gca" (default: "gbk")
|
|
102
|
+
- `closed_ends` (bool): Don't allow genes to run off edges (default: False)
|
|
103
|
+
- `mask_n_runs` (bool): Mask runs of N's in the sequence (default: False)
|
|
104
|
+
- `force_non_sd` (bool): Force non-Shine-Dalgarno model (default: False)
|
|
105
|
+
- `translation_table` (int, optional): Translation table 1-25 (excluding 7, 8, 17-20)
|
|
106
|
+
- `num_threads` (int, optional): Number of threads to use
|
|
107
|
+
- `quiet` (bool): Suppress informational output (default: True)
|
|
108
|
+
|
|
109
|
+
### `OrphosResult`
|
|
110
|
+
|
|
111
|
+
Result from gene prediction.
|
|
112
|
+
|
|
113
|
+
**Attributes:**
|
|
114
|
+
- `output` (str): Formatted output (GenBank, GFF, etc.)
|
|
115
|
+
- `gene_count` (int): Total number of genes predicted
|
|
116
|
+
- `sequence_count` (int): Number of sequences analyzed
|
|
117
|
+
|
|
118
|
+
## Examples
|
|
119
|
+
|
|
120
|
+
### Single Genome Mode (Default)
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
import orphos
|
|
124
|
+
|
|
125
|
+
# Analyze with default settings
|
|
126
|
+
result = orphos.analyze_file("ecoli.fasta")
|
|
127
|
+
print(f"Found {result.gene_count} genes")
|
|
128
|
+
|
|
129
|
+
# Save GenBank output
|
|
130
|
+
with open("output.gbk", "w") as f:
|
|
131
|
+
f.write(result.output)
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Metagenomic Mode
|
|
135
|
+
|
|
136
|
+
```python
|
|
137
|
+
import orphos
|
|
138
|
+
|
|
139
|
+
options = orphos.OrphosOptions(mode="meta")
|
|
140
|
+
result = orphos.analyze_file("metagenome.fasta", options)
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### GFF Output Format
|
|
144
|
+
|
|
145
|
+
```python
|
|
146
|
+
import orphos
|
|
147
|
+
|
|
148
|
+
options = orphos.OrphosOptions(format="gff")
|
|
149
|
+
result = orphos.analyze_file("genome.fasta", options)
|
|
150
|
+
|
|
151
|
+
# Save GFF output
|
|
152
|
+
with open("output.gff", "w") as f:
|
|
153
|
+
f.write(result.output)
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Custom Translation Table
|
|
157
|
+
|
|
158
|
+
```python
|
|
159
|
+
import orphos
|
|
160
|
+
|
|
161
|
+
# Use translation table 4 (Mycoplasma/Spiroplasma)
|
|
162
|
+
options = orphos.OrphosOptions(translation_table=4)
|
|
163
|
+
result = orphos.analyze_file("mycoplasma.fasta", options)
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Processing Multiple Files
|
|
167
|
+
|
|
168
|
+
```python
|
|
169
|
+
import orphos
|
|
170
|
+
import os
|
|
171
|
+
|
|
172
|
+
fasta_dir = "genomes"
|
|
173
|
+
output_dir = "predictions"
|
|
174
|
+
os.makedirs(output_dir, exist_ok=True)
|
|
175
|
+
|
|
176
|
+
options = orphos.OrphosOptions(format="gff")
|
|
177
|
+
|
|
178
|
+
for filename in os.listdir(fasta_dir):
|
|
179
|
+
if filename.endswith(".fasta"):
|
|
180
|
+
input_path = os.path.join(fasta_dir, filename)
|
|
181
|
+
output_path = os.path.join(output_dir, filename.replace(".fasta", ".gff"))
|
|
182
|
+
|
|
183
|
+
result = orphos.analyze_file(input_path, options)
|
|
184
|
+
|
|
185
|
+
with open(output_path, "w") as f:
|
|
186
|
+
f.write(result.output)
|
|
187
|
+
|
|
188
|
+
print(f"{filename}: {result.gene_count} genes")
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## Output Formats
|
|
192
|
+
|
|
193
|
+
### GenBank (gbk)
|
|
194
|
+
Standard GenBank feature table format with gene coordinates and annotations.
|
|
195
|
+
|
|
196
|
+
### GFF (gff)
|
|
197
|
+
GFF3 format with gene features and attributes.
|
|
198
|
+
|
|
199
|
+
### Simple Coordinates (sco)
|
|
200
|
+
Simple tab-delimited format with gene coordinates.
|
|
201
|
+
|
|
202
|
+
### Gene Calls (gca)
|
|
203
|
+
Detailed gene call information including scores and training data.
|
|
204
|
+
|
|
205
|
+
## Performance
|
|
206
|
+
|
|
207
|
+
The Python bindings have minimal overhead compared to the native Rust implementation. Large genomes and metagenomes can be processed efficiently.
|
|
208
|
+
|
|
209
|
+
## License
|
|
210
|
+
|
|
211
|
+
GPL-3.0-or-later
|
|
212
|
+
|
|
213
|
+
## Citation
|
|
214
|
+
|
|
215
|
+
If you use Orphos in your research, please cite:
|
|
216
|
+
|
|
217
|
+
Hyatt D, Chen GL, Locascio PF, Land ML, Larimer FW, Hauser LJ. Orphos: prokaryotic gene recognition and translation initiation site identification. BMC Bioinformatics. 2010 Mar 8;11:119.
|
|
218
|
+
|
orphos-0.1.0/README.md
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# Orphos Python Bindings
|
|
2
|
+
|
|
3
|
+
Python bindings for Orphos, a fast and accurate gene prediction tool for microbial genomes.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
### From Source
|
|
8
|
+
|
|
9
|
+
You'll need Rust and Python 3.8+ installed. Then:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# Install maturin (the build tool for Python+Rust projects)
|
|
13
|
+
pip install maturin
|
|
14
|
+
|
|
15
|
+
# Build and install in development mode
|
|
16
|
+
cd orphos-python
|
|
17
|
+
maturin develop --release
|
|
18
|
+
|
|
19
|
+
# Or build a wheel
|
|
20
|
+
maturin build --release
|
|
21
|
+
pip install target/wheels/orphos-*.whl
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Quick Start
|
|
25
|
+
|
|
26
|
+
```python
|
|
27
|
+
import orphos
|
|
28
|
+
|
|
29
|
+
# Analyze a FASTA file
|
|
30
|
+
result = orphos.analyze_file("genome.fasta")
|
|
31
|
+
print(f"Found {result.gene_count} genes in {result.sequence_count} sequences")
|
|
32
|
+
print(result.output) # GenBank formatted output
|
|
33
|
+
|
|
34
|
+
# Analyze a sequence string
|
|
35
|
+
fasta_string = """>seq1
|
|
36
|
+
ATGCGATCGATCGATCGATCGATCGATCG...
|
|
37
|
+
"""
|
|
38
|
+
result = orphos.analyze_sequence(fasta_string)
|
|
39
|
+
|
|
40
|
+
# Customize options
|
|
41
|
+
options = orphos.OrphosOptions(
|
|
42
|
+
mode="meta", # Use metagenomic mode
|
|
43
|
+
format="gff", # Output in GFF format
|
|
44
|
+
closed_ends=True, # Don't allow genes off edges
|
|
45
|
+
translation_table=11 # Use translation table 11
|
|
46
|
+
)
|
|
47
|
+
result = orphos.analyze_file("genome.fasta", options)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## API Reference
|
|
51
|
+
|
|
52
|
+
### `analyze_sequence(fasta_content, options=None)`
|
|
53
|
+
|
|
54
|
+
Analyze DNA sequences from a FASTA-formatted string.
|
|
55
|
+
|
|
56
|
+
**Parameters:**
|
|
57
|
+
- `fasta_content` (str): FASTA-formatted sequence(s)
|
|
58
|
+
- `options` (OrphosOptions, optional): Configuration options
|
|
59
|
+
|
|
60
|
+
**Returns:** `OrphosResult`
|
|
61
|
+
|
|
62
|
+
### `analyze_file(file_path, options=None)`
|
|
63
|
+
|
|
64
|
+
Analyze DNA sequences from a FASTA file.
|
|
65
|
+
|
|
66
|
+
**Parameters:**
|
|
67
|
+
- `file_path` (str): Path to the FASTA file
|
|
68
|
+
- `options` (OrphosOptions, optional): Configuration options
|
|
69
|
+
|
|
70
|
+
**Returns:** `OrphosResult`
|
|
71
|
+
|
|
72
|
+
### `OrphosOptions`
|
|
73
|
+
|
|
74
|
+
Configuration options for gene prediction.
|
|
75
|
+
|
|
76
|
+
**Attributes:**
|
|
77
|
+
- `mode` (str): "single" for single genome mode, "meta" for metagenomic mode (default: "single")
|
|
78
|
+
- `format` (str): Output format - "gbk", "gff", "sco", or "gca" (default: "gbk")
|
|
79
|
+
- `closed_ends` (bool): Don't allow genes to run off edges (default: False)
|
|
80
|
+
- `mask_n_runs` (bool): Mask runs of N's in the sequence (default: False)
|
|
81
|
+
- `force_non_sd` (bool): Force non-Shine-Dalgarno model (default: False)
|
|
82
|
+
- `translation_table` (int, optional): Translation table 1-25 (excluding 7, 8, 17-20)
|
|
83
|
+
- `num_threads` (int, optional): Number of threads to use
|
|
84
|
+
- `quiet` (bool): Suppress informational output (default: True)
|
|
85
|
+
|
|
86
|
+
### `OrphosResult`
|
|
87
|
+
|
|
88
|
+
Result from gene prediction.
|
|
89
|
+
|
|
90
|
+
**Attributes:**
|
|
91
|
+
- `output` (str): Formatted output (GenBank, GFF, etc.)
|
|
92
|
+
- `gene_count` (int): Total number of genes predicted
|
|
93
|
+
- `sequence_count` (int): Number of sequences analyzed
|
|
94
|
+
|
|
95
|
+
## Examples
|
|
96
|
+
|
|
97
|
+
### Single Genome Mode (Default)
|
|
98
|
+
|
|
99
|
+
```python
|
|
100
|
+
import orphos
|
|
101
|
+
|
|
102
|
+
# Analyze with default settings
|
|
103
|
+
result = orphos.analyze_file("ecoli.fasta")
|
|
104
|
+
print(f"Found {result.gene_count} genes")
|
|
105
|
+
|
|
106
|
+
# Save GenBank output
|
|
107
|
+
with open("output.gbk", "w") as f:
|
|
108
|
+
f.write(result.output)
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Metagenomic Mode
|
|
112
|
+
|
|
113
|
+
```python
|
|
114
|
+
import orphos
|
|
115
|
+
|
|
116
|
+
options = orphos.OrphosOptions(mode="meta")
|
|
117
|
+
result = orphos.analyze_file("metagenome.fasta", options)
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### GFF Output Format
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
import orphos
|
|
124
|
+
|
|
125
|
+
options = orphos.OrphosOptions(format="gff")
|
|
126
|
+
result = orphos.analyze_file("genome.fasta", options)
|
|
127
|
+
|
|
128
|
+
# Save GFF output
|
|
129
|
+
with open("output.gff", "w") as f:
|
|
130
|
+
f.write(result.output)
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Custom Translation Table
|
|
134
|
+
|
|
135
|
+
```python
|
|
136
|
+
import orphos
|
|
137
|
+
|
|
138
|
+
# Use translation table 4 (Mycoplasma/Spiroplasma)
|
|
139
|
+
options = orphos.OrphosOptions(translation_table=4)
|
|
140
|
+
result = orphos.analyze_file("mycoplasma.fasta", options)
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Processing Multiple Files
|
|
144
|
+
|
|
145
|
+
```python
|
|
146
|
+
import orphos
|
|
147
|
+
import os
|
|
148
|
+
|
|
149
|
+
fasta_dir = "genomes"
|
|
150
|
+
output_dir = "predictions"
|
|
151
|
+
os.makedirs(output_dir, exist_ok=True)
|
|
152
|
+
|
|
153
|
+
options = orphos.OrphosOptions(format="gff")
|
|
154
|
+
|
|
155
|
+
for filename in os.listdir(fasta_dir):
|
|
156
|
+
if filename.endswith(".fasta"):
|
|
157
|
+
input_path = os.path.join(fasta_dir, filename)
|
|
158
|
+
output_path = os.path.join(output_dir, filename.replace(".fasta", ".gff"))
|
|
159
|
+
|
|
160
|
+
result = orphos.analyze_file(input_path, options)
|
|
161
|
+
|
|
162
|
+
with open(output_path, "w") as f:
|
|
163
|
+
f.write(result.output)
|
|
164
|
+
|
|
165
|
+
print(f"{filename}: {result.gene_count} genes")
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Output Formats
|
|
169
|
+
|
|
170
|
+
### GenBank (gbk)
|
|
171
|
+
Standard GenBank feature table format with gene coordinates and annotations.
|
|
172
|
+
|
|
173
|
+
### GFF (gff)
|
|
174
|
+
GFF3 format with gene features and attributes.
|
|
175
|
+
|
|
176
|
+
### Simple Coordinates (sco)
|
|
177
|
+
Simple tab-delimited format with gene coordinates.
|
|
178
|
+
|
|
179
|
+
### Gene Calls (gca)
|
|
180
|
+
Detailed gene call information including scores and training data.
|
|
181
|
+
|
|
182
|
+
## Performance
|
|
183
|
+
|
|
184
|
+
The Python bindings have minimal overhead compared to the native Rust implementation. Large genomes and metagenomes can be processed efficiently.
|
|
185
|
+
|
|
186
|
+
## License
|
|
187
|
+
|
|
188
|
+
GPL-3.0-or-later
|
|
189
|
+
|
|
190
|
+
## Citation
|
|
191
|
+
|
|
192
|
+
If you use Orphos in your research, please cite:
|
|
193
|
+
|
|
194
|
+
Hyatt D, Chen GL, Locascio PF, Land ML, Larimer FW, Hauser LJ. Orphos: prokaryotic gene recognition and translation initiation site identification. BMC Bioinformatics. 2010 Mar 8;11:119.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "orphos-core"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
edition = "2024"
|
|
5
|
+
description = "Core library for Orphos, a tool for finding protein-coding genes in microbial genomes."
|
|
6
|
+
license = "GPL-3.0-or-later"
|
|
7
|
+
repository = "https://github.com/FullHuman/orphos"
|
|
8
|
+
documentation = "https://docs.rs/orphos-core"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
categories = ["science::bioinformatics"]
|
|
11
|
+
keywords = [
|
|
12
|
+
"orphos",
|
|
13
|
+
"bioinformatics",
|
|
14
|
+
"genomics",
|
|
15
|
+
"prodigal"
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
[package.metadata.docs.rs]
|
|
19
|
+
all-features = true
|
|
20
|
+
rustdoc-args = ["--cfg", "docsrs"]
|
|
21
|
+
|
|
22
|
+
[dependencies]
|
|
23
|
+
bio = "2.3.0"
|
|
24
|
+
rayon = "1.10.0"
|
|
25
|
+
thiserror = "2.0.12"
|
|
26
|
+
wide = "0.7.33"
|
|
27
|
+
|
|
28
|
+
[dev-dependencies]
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
# Orphos Core
|
|
2
|
+
|
|
3
|
+
[](https://crates.io/crates/orphos-core)
|
|
4
|
+
[](https://docs.rs/orphos-core)
|
|
5
|
+
[](https://www.gnu.org/licenses/gpl-3.0)
|
|
6
|
+
|
|
7
|
+
Core library for **Orphos**, a high-performance Rust implementation of Prodigal (prokaryotic gene prediction algorithms). This crate provides the foundational gene-finding capabilities for identifying protein-coding genes in microbial genomes.
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
`orphos-core` implements an unsupervised machine learning approach for finding genes in prokaryotic genomes. It uses dynamic programming and statistical models trained on genomic features to predict gene locations with high accuracy.
|
|
12
|
+
|
|
13
|
+
### Key Features
|
|
14
|
+
|
|
15
|
+
- 🚀 **High Performance**: Multi-threaded processing using Rayon for parallel analysis
|
|
16
|
+
- 🔒 **Type Safety**: Compile-time guarantees using type-state pattern for training states
|
|
17
|
+
- 🧬 **Dual Modes**: Single genome mode for complete genomes and metagenomic mode for fragments
|
|
18
|
+
- 📊 **Multiple Output Formats**: GenBank, GFF3, GCA, and SCO formats
|
|
19
|
+
- 🎯 **Accurate**: Advanced start codon recognition with Shine-Dalgarno detection
|
|
20
|
+
- 💾 **Memory Efficient**: Optimized data structures for large-scale genomic analysis
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
Add to your `Cargo.toml`:
|
|
25
|
+
|
|
26
|
+
```toml
|
|
27
|
+
[dependencies]
|
|
28
|
+
orphos-core = "0.1.0"
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Quick Start
|
|
32
|
+
|
|
33
|
+
### Basic Usage
|
|
34
|
+
|
|
35
|
+
```rust
|
|
36
|
+
use orphos_core::{OrphosAnalyzer, config::OrphosConfig};
|
|
37
|
+
|
|
38
|
+
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|
39
|
+
// Create analyzer with default configuration
|
|
40
|
+
let mut analyzer = OrphosAnalyzer::new(OrphosConfig::default());
|
|
41
|
+
|
|
42
|
+
// Analyze a FASTA file
|
|
43
|
+
let results = analyzer.analyze_file("genome.fasta")?;
|
|
44
|
+
|
|
45
|
+
println!("Found {} genes", results.genes.len());
|
|
46
|
+
println!("{}", results.output);
|
|
47
|
+
|
|
48
|
+
Ok(())
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Analyzing Sequences Directly
|
|
53
|
+
|
|
54
|
+
```rust
|
|
55
|
+
use orphos_core::{OrphosAnalyzer, config::OrphosConfig};
|
|
56
|
+
|
|
57
|
+
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|
58
|
+
let mut analyzer = OrphosAnalyzer::new(OrphosConfig::default());
|
|
59
|
+
|
|
60
|
+
let sequence = "ATGAAACGCATTAGCACCACCATTACCACCACCATCACCATTACCACAGGTAACGGTGCGGGCTGA...";
|
|
61
|
+
let results = analyzer.analyze_sequence(sequence, Some("MyGenome".to_string()))?;
|
|
62
|
+
|
|
63
|
+
for gene in &results.genes {
|
|
64
|
+
println!("Gene at {}..{} on {} strand",
|
|
65
|
+
gene.start, gene.end,
|
|
66
|
+
if gene.strand == bio::bio_types::strand::Strand::Forward { "+" } else { "-" }
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
Ok(())
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Custom Configuration
|
|
75
|
+
|
|
76
|
+
```rust
|
|
77
|
+
use orphos_core::config::{OrphosConfig, OutputFormat};
|
|
78
|
+
|
|
79
|
+
let config = OrphosConfig {
|
|
80
|
+
closed_ends: true, // Complete genome (circular)
|
|
81
|
+
mask_n_runs: true, // Mask stretches of N's
|
|
82
|
+
output_format: OutputFormat::Gff,
|
|
83
|
+
num_threads: Some(4), // Use 4 threads
|
|
84
|
+
..Default::default()
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
let mut analyzer = OrphosAnalyzer::new(config);
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Metagenomic Mode
|
|
91
|
+
|
|
92
|
+
For analyzing short contigs or mixed community samples:
|
|
93
|
+
|
|
94
|
+
```rust
|
|
95
|
+
use orphos_core::config::OrphosConfig;
|
|
96
|
+
|
|
97
|
+
let config = OrphosConfig {
|
|
98
|
+
metagenomic: true,
|
|
99
|
+
..Default::default()
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
let mut analyzer = OrphosAnalyzer::new(config);
|
|
103
|
+
let results = analyzer.analyze_file("metagenome.fasta")?;
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Module Organization
|
|
107
|
+
|
|
108
|
+
- **`config`**: Configuration options and output format settings
|
|
109
|
+
- **`engine`**: Main analysis engine with training and prediction logic
|
|
110
|
+
- **`types`**: Core data structures (Gene, Training, error types)
|
|
111
|
+
- **`results`**: Gene prediction results and sequence information
|
|
112
|
+
- **`sequence`**: Sequence encoding, I/O, and processing utilities
|
|
113
|
+
- **`algorithms`**: Gene-finding algorithms including:
|
|
114
|
+
- Dynamic programming for gene prediction
|
|
115
|
+
- Gene optimization and overlap resolution
|
|
116
|
+
- Scoring functions for connections
|
|
117
|
+
- **`node`**: Gene node management, creation, and scoring
|
|
118
|
+
- **`training`**: Training algorithms for Shine-Dalgarno and non-SD models
|
|
119
|
+
- **`output`**: Output formatters for GenBank, GFF, GCA, and SCO
|
|
120
|
+
- **`bitmap`**: Efficient sequence encoding utilities
|
|
121
|
+
- **`metagenomic`**: Metagenomic mode presets and models
|
|
122
|
+
|
|
123
|
+
## Output Formats
|
|
124
|
+
|
|
125
|
+
### GenBank (`.gbk`)
|
|
126
|
+
|
|
127
|
+
Rich annotation format with full feature information:
|
|
128
|
+
|
|
129
|
+
```
|
|
130
|
+
LOCUS MyGenome 4641652 bp DNA linear BCT
|
|
131
|
+
FEATURES Location/Qualifiers
|
|
132
|
+
CDS 190..255
|
|
133
|
+
/gene="1"
|
|
134
|
+
/protein_id="MyGenome_1"
|
|
135
|
+
/translation="MTKRSAAAAAAVAAGMTSA"
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### GFF3 (`.gff`)
|
|
139
|
+
|
|
140
|
+
Standard genome annotation format:
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
##gff-version 3
|
|
144
|
+
MyGenome Orphos CDS 190 255 . + 0 ID=MyGenome_1;
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### GCA (`.gca`)
|
|
148
|
+
|
|
149
|
+
Tab-delimited gene coordinate annotation.
|
|
150
|
+
|
|
151
|
+
### SCO (`.sco`)
|
|
152
|
+
|
|
153
|
+
Simple coordinate output with minimal information.
|
|
154
|
+
|
|
155
|
+
## Configuration Options
|
|
156
|
+
|
|
157
|
+
| Option | Type | Default | Description |
|
|
158
|
+
|--------|------|---------|-------------|
|
|
159
|
+
| `metagenomic` | `bool` | `false` | Enable metagenomic mode for fragments |
|
|
160
|
+
| `closed_ends` | `bool` | `false` | Treat sequences as complete genomes |
|
|
161
|
+
| `mask_n_runs` | `bool` | `false` | Mask runs of N characters |
|
|
162
|
+
| `force_non_sd` | `bool` | `false` | Disable Shine-Dalgarno detection |
|
|
163
|
+
| `quiet` | `bool` | `false` | Suppress informational output |
|
|
164
|
+
| `output_format` | `OutputFormat` | `Genbank` | Output format selection |
|
|
165
|
+
| `translation_table` | `Option<u8>` | `None` | NCBI genetic code table (1-25) |
|
|
166
|
+
| `num_threads` | `Option<usize>` | `None` | Number of parallel threads |
|
|
167
|
+
|
|
168
|
+
## Error Handling
|
|
169
|
+
|
|
170
|
+
All operations return `Result<T, OrphosError>` with detailed error types:
|
|
171
|
+
|
|
172
|
+
```rust
|
|
173
|
+
use orphos_core::types::OrphosError;
|
|
174
|
+
|
|
175
|
+
match analyzer.analyze_file("genome.fasta") {
|
|
176
|
+
Ok(results) => println!("Success: {} genes", results.genes.len()),
|
|
177
|
+
Err(OrphosError::SequenceTooShort { length, min }) => {
|
|
178
|
+
eprintln!("Sequence too short: {} bp (minimum: {} bp)", length, min);
|
|
179
|
+
}
|
|
180
|
+
Err(OrphosError::IoError(e)) => {
|
|
181
|
+
eprintln!("I/O error: {}", e);
|
|
182
|
+
}
|
|
183
|
+
Err(e) => eprintln!("Error: {}", e),
|
|
184
|
+
}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## Contributing
|
|
188
|
+
|
|
189
|
+
Contributions are welcome! Please see the main [Orphos repository](https://github.com/FullHuman/orphos) for contribution guidelines.
|
|
190
|
+
|
|
191
|
+
## License
|
|
192
|
+
|
|
193
|
+
This project is licensed under the GNU General Public License v3.0 or later - see the [LICENSE](../LICENSE) file for details.
|
|
194
|
+
|
|
195
|
+
## Citation
|
|
196
|
+
|
|
197
|
+
If you use Orphos in your research, please cite:
|
|
198
|
+
|
|
199
|
+
```bibtex
|
|
200
|
+
@software{orphos,
|
|
201
|
+
title = {Orphos: High-Performance Prokaryotic Gene Prediction},
|
|
202
|
+
author = {Floriel Fedry},
|
|
203
|
+
year = {2025},
|
|
204
|
+
url = {https://github.com/FullHuman/orphos}
|
|
205
|
+
}
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## Related Projects
|
|
209
|
+
|
|
210
|
+
- **[orphos-cli](../orphos-cli)**: Command-line interface for gene prediction
|
|
211
|
+
- **[orphos-python](../orphos-python)**: Python bindings via PyO3
|
|
212
|
+
- **[orphos-wasm](../orphos-wasm)**: WebAssembly module for browser/Node.js
|
|
213
|
+
|
|
214
|
+
## Acknowledgments
|
|
215
|
+
|
|
216
|
+
This implementation is based on Prodigal, originally developed by Doug Hyatt. Orphos provides a modern, type-safe Rust implementation while maintaining compatibility with the original algorithms.
|
|
217
|
+
|
|
218
|
+
## Support
|
|
219
|
+
|
|
220
|
+
- 📖 [Documentation](https://docs.rs/orphos-core)
|
|
221
|
+
- 🐛 [Issue Tracker](https://github.com/FullHuman/orphos/issues)
|
|
222
|
+
- 💬 [Discussions](https://github.com/FullHuman/orphos/discussions)
|