fastamodeller 1.0.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 (45) hide show
  1. fastamodeller-1.0.0/LICENSE +21 -0
  2. fastamodeller-1.0.0/MANIFEST.in +5 -0
  3. fastamodeller-1.0.0/PKG-INFO +271 -0
  4. fastamodeller-1.0.0/README.md +238 -0
  5. fastamodeller-1.0.0/examples/config-example.json +54 -0
  6. fastamodeller-1.0.0/fastamodeller/__init__.py +46 -0
  7. fastamodeller-1.0.0/fastamodeller/__main__.py +4 -0
  8. fastamodeller-1.0.0/fastamodeller/cli.py +115 -0
  9. fastamodeller-1.0.0/fastamodeller/config/__init__.py +18 -0
  10. fastamodeller-1.0.0/fastamodeller/config/alphabets.py +95 -0
  11. fastamodeller-1.0.0/fastamodeller/config/composition.py +69 -0
  12. fastamodeller-1.0.0/fastamodeller/config/loader.py +56 -0
  13. fastamodeller-1.0.0/fastamodeller/config/models.py +96 -0
  14. fastamodeller-1.0.0/fastamodeller/config/validation.py +239 -0
  15. fastamodeller-1.0.0/fastamodeller/errors.py +17 -0
  16. fastamodeller-1.0.0/fastamodeller/generation/__init__.py +19 -0
  17. fastamodeller-1.0.0/fastamodeller/generation/assembler.py +27 -0
  18. fastamodeller-1.0.0/fastamodeller/generation/inserts.py +60 -0
  19. fastamodeller-1.0.0/fastamodeller/generation/models.py +63 -0
  20. fastamodeller-1.0.0/fastamodeller/generation/mutation.py +48 -0
  21. fastamodeller-1.0.0/fastamodeller/generation/random_sequence.py +17 -0
  22. fastamodeller-1.0.0/fastamodeller/generation/repeats.py +31 -0
  23. fastamodeller-1.0.0/fastamodeller/generation/rng.py +33 -0
  24. fastamodeller-1.0.0/fastamodeller/generation/service.py +197 -0
  25. fastamodeller-1.0.0/fastamodeller/output/__init__.py +19 -0
  26. fastamodeller-1.0.0/fastamodeller/output/writers.py +89 -0
  27. fastamodeller-1.0.0/fastamodeller/py.typed +0 -0
  28. fastamodeller-1.0.0/fastamodeller/reporting/__init__.py +4 -0
  29. fastamodeller-1.0.0/fastamodeller/reporting/formatter.py +56 -0
  30. fastamodeller-1.0.0/fastamodeller/reporting/stats.py +111 -0
  31. fastamodeller-1.0.0/fastamodeller/resources/config_template.json +39 -0
  32. fastamodeller-1.0.0/fastamodeller.egg-info/PKG-INFO +271 -0
  33. fastamodeller-1.0.0/fastamodeller.egg-info/SOURCES.txt +43 -0
  34. fastamodeller-1.0.0/fastamodeller.egg-info/dependency_links.txt +1 -0
  35. fastamodeller-1.0.0/fastamodeller.egg-info/entry_points.txt +3 -0
  36. fastamodeller-1.0.0/fastamodeller.egg-info/requires.txt +8 -0
  37. fastamodeller-1.0.0/fastamodeller.egg-info/top_level.txt +1 -0
  38. fastamodeller-1.0.0/pyproject.toml +80 -0
  39. fastamodeller-1.0.0/setup.cfg +4 -0
  40. fastamodeller-1.0.0/tests/test_alphabets.py +43 -0
  41. fastamodeller-1.0.0/tests/test_cli.py +100 -0
  42. fastamodeller-1.0.0/tests/test_config_loader.py +233 -0
  43. fastamodeller-1.0.0/tests/test_generation.py +218 -0
  44. fastamodeller-1.0.0/tests/test_report.py +140 -0
  45. fastamodeller-1.0.0/tests/test_writers.py +46 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-2026 Daniel Pérez Rodríguez
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,5 @@
1
+ include LICENSE
2
+ include README.md
3
+ include fastamodeller/py.typed
4
+ recursive-include fastamodeller/resources *.json
5
+ recursive-include examples *.json
@@ -0,0 +1,271 @@
1
+ Metadata-Version: 2.4
2
+ Name: fastamodeller
3
+ Version: 1.0.0
4
+ Summary: Generate random DNA, RNA and protein sequences in FASTA format from a JSON configuration.
5
+ Author-email: Daniel Pérez Rodríguez <dperez@iim.csic.es>
6
+ Maintainer-email: Daniel Pérez Rodríguez <dperez@iim.csic.es>
7
+ License-Expression: MIT
8
+ Project-URL: Homepage, https://github.com/Dannyzimmer/fastaModeller
9
+ Project-URL: Repository, https://github.com/Dannyzimmer/fastaModeller
10
+ Project-URL: Issues, https://github.com/Dannyzimmer/fastaModeller/issues
11
+ Keywords: fasta,dna,rna,protein,bioinformatics,sequence-generator
12
+ Classifier: Development Status :: 5 - Production/Stable
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
22
+ Requires-Python: >=3.10
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: click>=8.1
26
+ Provides-Extra: dev
27
+ Requires-Dist: pytest>=8; extra == "dev"
28
+ Requires-Dist: ruff>=0.6; extra == "dev"
29
+ Requires-Dist: mypy>=1.10; extra == "dev"
30
+ Requires-Dist: build>=1.2; extra == "dev"
31
+ Requires-Dist: twine>=5; extra == "dev"
32
+ Dynamic: license-file
33
+
34
+ # fastaModeller
35
+
36
+ [![PyPI](https://img.shields.io/pypi/v/fastamodeller.svg)](https://pypi.org/project/fastamodeller/)
37
+ [![Python](https://img.shields.io/pypi/pyversions/fastamodeller.svg)](https://pypi.org/project/fastamodeller/)
38
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
39
+
40
+ Generate random DNA, RNA or protein sequences in FASTA format from a JSON
41
+ configuration file.
42
+
43
+ `fastaModeller` is a command-line tool, but the same engine is available as a
44
+ small Python library.
45
+
46
+ ## Features
47
+
48
+ - Random sequences with a **final length** between `min_len` and `max_len`
49
+ (inserts and repeats are included in the final length).
50
+ - Configurable residue composition for DNA, RNA and protein alphabets.
51
+ - IUPAC ambiguity symbols (`N`, `R`, `Y`, ...) and protein `B`, `Z`, `X`, `J`.
52
+ - Tandem repeat motifs with per-sequence likelihood.
53
+ - Inserts that can be split into fragments, separated by random gaps and
54
+ mutated.
55
+ - Reproducible generation from a seed. Each batch derives an independent RNG
56
+ from the master seed, so adding or reordering batches does not alter others.
57
+ - Streaming FASTA output (sequences are not retained in memory) and an
58
+ incremental report.
59
+ - Reports include composition, GC content for nucleic acids, ambiguous
60
+ fraction, insert mutations/gaps and repeat counts.
61
+
62
+ ## Installation
63
+
64
+ ```bash
65
+ python -m pip install fastamodeller
66
+ ```
67
+
68
+ Or install it as an isolated command-line application:
69
+
70
+ ```bash
71
+ pipx install fastamodeller
72
+ ```
73
+
74
+ Python 3.10 or newer is required.
75
+
76
+ ## Command line
77
+
78
+ ```bash
79
+ # Write FASTA to stdout; the seed notice goes to stderr.
80
+ fastamodeller generate config.json
81
+
82
+ # Write files explicitly.
83
+ fastamodeller generate config.json -o output.fasta -r report.txt
84
+
85
+ # Only print the report.
86
+ fastamodeller generate config.json --only-report
87
+
88
+ # Override the seed (0 is a valid seed).
89
+ fastamodeller generate config.json --seed 0
90
+
91
+ # Read the configuration from stdin.
92
+ fastamodeller generate - -o output.fasta -r report.txt -q < config.json
93
+
94
+ # Validate without generating.
95
+ fastamodeller validate config.json
96
+
97
+ # Create a template.
98
+ fastamodeller template ./examples
99
+ ```
100
+
101
+ `python -m fastamodeller` is equivalent to the `fastamodeller` command.
102
+ The alias `fastaModeller` is also installed for backwards compatibility.
103
+
104
+ Use `-q/--quiet` to suppress the seed notice. The seed is always included in
105
+ the report.
106
+
107
+ ## Configuration format
108
+
109
+ ```json
110
+ {
111
+ "molecule": "dna",
112
+ "id_padding": 4,
113
+ "seq_wrap": 70,
114
+ "seed": false,
115
+ "sequences": [
116
+ {
117
+ "base_id": "TEST",
118
+ "generate": 10,
119
+ "min_len": 500,
120
+ "max_len": 1000,
121
+ "proportion": {"A": 0.20, "T": 0.25, "C": 0.20, "G": 0.35},
122
+ "repeats": [
123
+ {
124
+ "likelihood": 0.5,
125
+ "pattern": "ATCATT",
126
+ "pattern_min_reps": 10,
127
+ "pattern_max_reps": 50
128
+ }
129
+ ],
130
+ "inserts": [
131
+ {
132
+ "total": 4,
133
+ "min_split": 0,
134
+ "max_split": 5,
135
+ "ave_gap": 5,
136
+ "sd_gap": 2,
137
+ "mutation_rate": 0.05,
138
+ "sequence": "CCCCCCTTAAACACTTATACGGTAG"
139
+ }
140
+ ]
141
+ }
142
+ ]
143
+ }
144
+ ```
145
+
146
+ ### Top-level fields
147
+
148
+ | Field | Meaning |
149
+ |---|---|
150
+ | `molecule` | `dna` (default), `rna` or `protein`. One molecule per file. |
151
+ | `id_padding` | Width of the numeric suffix in FASTA identifiers. |
152
+ | `seq_wrap` | Line width. `false` or `0` disables wrapping. |
153
+ | `seed` | Optional integer for reproducibility. Omit or use `false` for a random seed. |
154
+ | `sequences` | List of sequence groups (batches). Required and non-empty. |
155
+
156
+ ### Sequence fields
157
+
158
+ - `base_id`: unique prefix for FASTA identifiers (`TEST0001`, ...).
159
+ - `generate`: number of sequences in the batch.
160
+ - `min_len` / `max_len`: bounds for the **final** sequence length. If the
161
+ inserts and repeats of a given sequence exceed `max_len`, generation raises a
162
+ clear error rather than silently exceeding the limit.
163
+ - `proportion`: relative weight per residue. If omitted, a uniform composition
164
+ over the canonical alphabet is used.
165
+ - `repeats`: for each sequence, the repeat is included with probability
166
+ `likelihood`; its tandem copy count is sampled between
167
+ `pattern_min_reps` and `pattern_max_reps`.
168
+ - `inserts`: `total` copies are distributed across the batch, so every
169
+ requested copy is used. Each copy may be split into fragments
170
+ (`min_split`/`max_split`), separated by normally distributed gaps
171
+ (`ave_gap`/`sd_gap`) and mutated per residue (`mutation_rate`).
172
+
173
+ ### Alphabets
174
+
175
+ - DNA: `A C G T`, plus IUPAC ambiguity `R Y S W K M B D H V N`.
176
+ - RNA: `A C G U`, plus the same ambiguity codes.
177
+ - Protein: the 20 standard amino acids, plus `B Z X J U O`.
178
+
179
+ Ambiguity symbols are accepted in inserts, repeats and compositions. To emit
180
+ them in the random filler, include them in `proportion`.
181
+
182
+ ## Python API
183
+
184
+ ```python
185
+ from fastamodeller import ConfigLoader, generate_to_files
186
+
187
+ config = ConfigLoader("config.json").load()
188
+ result = generate_to_files(
189
+ config,
190
+ fasta_path="output.fasta",
191
+ report_path="report.txt",
192
+ )
193
+ print(result.seed)
194
+ ```
195
+
196
+ The CLI is the recommended integration path for other applications.
197
+
198
+ ## Integration with SeqModeller
199
+
200
+ SeqModeller can invoke the CLI without depending on the old `libs/` package:
201
+
202
+ ```python
203
+ import json
204
+ import subprocess
205
+ import sys
206
+
207
+ result = subprocess.run(
208
+ [
209
+ sys.executable,
210
+ "-m",
211
+ "fastamodeller",
212
+ "generate",
213
+ "-",
214
+ "-o",
215
+ str(fasta_path),
216
+ "-r",
217
+ str(report_path),
218
+ "-q",
219
+ ],
220
+ input=json.dumps(config),
221
+ text=True,
222
+ capture_output=True,
223
+ )
224
+
225
+ if result.returncode != 0:
226
+ raise RuntimeError(result.stderr.strip())
227
+ ```
228
+
229
+ Exit codes: `0` success, `1` configuration or generation error, `2` command
230
+ usage error. Errors are written to stderr. FASTA, report and configuration
231
+ files are written atomically.
232
+
233
+ ## Architecture
234
+
235
+ ```text
236
+ fastamodeller/
237
+ config/ # immutable models, alphabets, composition, loader, validation
238
+ generation/ # RNG, mutation, repeats, inserts, assembly, service
239
+ reporting/ # incremental statistics and text formatting
240
+ output/ # atomic FASTA/report/config writers
241
+ cli.py # Click commands
242
+ ```
243
+
244
+ Generation depends on small protocols (composition sampling, mutation,
245
+ sequence types) and receives them from the configuration. Adding a new molecule
246
+ is a matter of registering a `SequenceType` and its composition; the generation
247
+ and reporting code contains no DNA-specific conditions.
248
+
249
+ ## Development
250
+
251
+ ```bash
252
+ python -m pip install -e ".[dev]"
253
+ python -m pytest
254
+ python -m ruff check fastamodeller tests fastaModeller.py deploy.py
255
+ python -m mypy fastamodeller/config fastamodeller/generation fastamodeller/reporting fastamodeller/output fastamodeller/cli.py
256
+ ```
257
+
258
+ To build and inspect a release locally:
259
+
260
+ ```bash
261
+ python -m build
262
+ python -m twine check dist/*
263
+ ```
264
+
265
+ Releases are published to PyPI from GitHub Actions when a GitHub release is
266
+ created. The workflow uses PyPI trusted publishing and requires the `pypi`
267
+ environment configured in the repository.
268
+
269
+ ## License
270
+
271
+ MIT. See [LICENSE](LICENSE).
@@ -0,0 +1,238 @@
1
+ # fastaModeller
2
+
3
+ [![PyPI](https://img.shields.io/pypi/v/fastamodeller.svg)](https://pypi.org/project/fastamodeller/)
4
+ [![Python](https://img.shields.io/pypi/pyversions/fastamodeller.svg)](https://pypi.org/project/fastamodeller/)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
6
+
7
+ Generate random DNA, RNA or protein sequences in FASTA format from a JSON
8
+ configuration file.
9
+
10
+ `fastaModeller` is a command-line tool, but the same engine is available as a
11
+ small Python library.
12
+
13
+ ## Features
14
+
15
+ - Random sequences with a **final length** between `min_len` and `max_len`
16
+ (inserts and repeats are included in the final length).
17
+ - Configurable residue composition for DNA, RNA and protein alphabets.
18
+ - IUPAC ambiguity symbols (`N`, `R`, `Y`, ...) and protein `B`, `Z`, `X`, `J`.
19
+ - Tandem repeat motifs with per-sequence likelihood.
20
+ - Inserts that can be split into fragments, separated by random gaps and
21
+ mutated.
22
+ - Reproducible generation from a seed. Each batch derives an independent RNG
23
+ from the master seed, so adding or reordering batches does not alter others.
24
+ - Streaming FASTA output (sequences are not retained in memory) and an
25
+ incremental report.
26
+ - Reports include composition, GC content for nucleic acids, ambiguous
27
+ fraction, insert mutations/gaps and repeat counts.
28
+
29
+ ## Installation
30
+
31
+ ```bash
32
+ python -m pip install fastamodeller
33
+ ```
34
+
35
+ Or install it as an isolated command-line application:
36
+
37
+ ```bash
38
+ pipx install fastamodeller
39
+ ```
40
+
41
+ Python 3.10 or newer is required.
42
+
43
+ ## Command line
44
+
45
+ ```bash
46
+ # Write FASTA to stdout; the seed notice goes to stderr.
47
+ fastamodeller generate config.json
48
+
49
+ # Write files explicitly.
50
+ fastamodeller generate config.json -o output.fasta -r report.txt
51
+
52
+ # Only print the report.
53
+ fastamodeller generate config.json --only-report
54
+
55
+ # Override the seed (0 is a valid seed).
56
+ fastamodeller generate config.json --seed 0
57
+
58
+ # Read the configuration from stdin.
59
+ fastamodeller generate - -o output.fasta -r report.txt -q < config.json
60
+
61
+ # Validate without generating.
62
+ fastamodeller validate config.json
63
+
64
+ # Create a template.
65
+ fastamodeller template ./examples
66
+ ```
67
+
68
+ `python -m fastamodeller` is equivalent to the `fastamodeller` command.
69
+ The alias `fastaModeller` is also installed for backwards compatibility.
70
+
71
+ Use `-q/--quiet` to suppress the seed notice. The seed is always included in
72
+ the report.
73
+
74
+ ## Configuration format
75
+
76
+ ```json
77
+ {
78
+ "molecule": "dna",
79
+ "id_padding": 4,
80
+ "seq_wrap": 70,
81
+ "seed": false,
82
+ "sequences": [
83
+ {
84
+ "base_id": "TEST",
85
+ "generate": 10,
86
+ "min_len": 500,
87
+ "max_len": 1000,
88
+ "proportion": {"A": 0.20, "T": 0.25, "C": 0.20, "G": 0.35},
89
+ "repeats": [
90
+ {
91
+ "likelihood": 0.5,
92
+ "pattern": "ATCATT",
93
+ "pattern_min_reps": 10,
94
+ "pattern_max_reps": 50
95
+ }
96
+ ],
97
+ "inserts": [
98
+ {
99
+ "total": 4,
100
+ "min_split": 0,
101
+ "max_split": 5,
102
+ "ave_gap": 5,
103
+ "sd_gap": 2,
104
+ "mutation_rate": 0.05,
105
+ "sequence": "CCCCCCTTAAACACTTATACGGTAG"
106
+ }
107
+ ]
108
+ }
109
+ ]
110
+ }
111
+ ```
112
+
113
+ ### Top-level fields
114
+
115
+ | Field | Meaning |
116
+ |---|---|
117
+ | `molecule` | `dna` (default), `rna` or `protein`. One molecule per file. |
118
+ | `id_padding` | Width of the numeric suffix in FASTA identifiers. |
119
+ | `seq_wrap` | Line width. `false` or `0` disables wrapping. |
120
+ | `seed` | Optional integer for reproducibility. Omit or use `false` for a random seed. |
121
+ | `sequences` | List of sequence groups (batches). Required and non-empty. |
122
+
123
+ ### Sequence fields
124
+
125
+ - `base_id`: unique prefix for FASTA identifiers (`TEST0001`, ...).
126
+ - `generate`: number of sequences in the batch.
127
+ - `min_len` / `max_len`: bounds for the **final** sequence length. If the
128
+ inserts and repeats of a given sequence exceed `max_len`, generation raises a
129
+ clear error rather than silently exceeding the limit.
130
+ - `proportion`: relative weight per residue. If omitted, a uniform composition
131
+ over the canonical alphabet is used.
132
+ - `repeats`: for each sequence, the repeat is included with probability
133
+ `likelihood`; its tandem copy count is sampled between
134
+ `pattern_min_reps` and `pattern_max_reps`.
135
+ - `inserts`: `total` copies are distributed across the batch, so every
136
+ requested copy is used. Each copy may be split into fragments
137
+ (`min_split`/`max_split`), separated by normally distributed gaps
138
+ (`ave_gap`/`sd_gap`) and mutated per residue (`mutation_rate`).
139
+
140
+ ### Alphabets
141
+
142
+ - DNA: `A C G T`, plus IUPAC ambiguity `R Y S W K M B D H V N`.
143
+ - RNA: `A C G U`, plus the same ambiguity codes.
144
+ - Protein: the 20 standard amino acids, plus `B Z X J U O`.
145
+
146
+ Ambiguity symbols are accepted in inserts, repeats and compositions. To emit
147
+ them in the random filler, include them in `proportion`.
148
+
149
+ ## Python API
150
+
151
+ ```python
152
+ from fastamodeller import ConfigLoader, generate_to_files
153
+
154
+ config = ConfigLoader("config.json").load()
155
+ result = generate_to_files(
156
+ config,
157
+ fasta_path="output.fasta",
158
+ report_path="report.txt",
159
+ )
160
+ print(result.seed)
161
+ ```
162
+
163
+ The CLI is the recommended integration path for other applications.
164
+
165
+ ## Integration with SeqModeller
166
+
167
+ SeqModeller can invoke the CLI without depending on the old `libs/` package:
168
+
169
+ ```python
170
+ import json
171
+ import subprocess
172
+ import sys
173
+
174
+ result = subprocess.run(
175
+ [
176
+ sys.executable,
177
+ "-m",
178
+ "fastamodeller",
179
+ "generate",
180
+ "-",
181
+ "-o",
182
+ str(fasta_path),
183
+ "-r",
184
+ str(report_path),
185
+ "-q",
186
+ ],
187
+ input=json.dumps(config),
188
+ text=True,
189
+ capture_output=True,
190
+ )
191
+
192
+ if result.returncode != 0:
193
+ raise RuntimeError(result.stderr.strip())
194
+ ```
195
+
196
+ Exit codes: `0` success, `1` configuration or generation error, `2` command
197
+ usage error. Errors are written to stderr. FASTA, report and configuration
198
+ files are written atomically.
199
+
200
+ ## Architecture
201
+
202
+ ```text
203
+ fastamodeller/
204
+ config/ # immutable models, alphabets, composition, loader, validation
205
+ generation/ # RNG, mutation, repeats, inserts, assembly, service
206
+ reporting/ # incremental statistics and text formatting
207
+ output/ # atomic FASTA/report/config writers
208
+ cli.py # Click commands
209
+ ```
210
+
211
+ Generation depends on small protocols (composition sampling, mutation,
212
+ sequence types) and receives them from the configuration. Adding a new molecule
213
+ is a matter of registering a `SequenceType` and its composition; the generation
214
+ and reporting code contains no DNA-specific conditions.
215
+
216
+ ## Development
217
+
218
+ ```bash
219
+ python -m pip install -e ".[dev]"
220
+ python -m pytest
221
+ python -m ruff check fastamodeller tests fastaModeller.py deploy.py
222
+ python -m mypy fastamodeller/config fastamodeller/generation fastamodeller/reporting fastamodeller/output fastamodeller/cli.py
223
+ ```
224
+
225
+ To build and inspect a release locally:
226
+
227
+ ```bash
228
+ python -m build
229
+ python -m twine check dist/*
230
+ ```
231
+
232
+ Releases are published to PyPI from GitHub Actions when a GitHub release is
233
+ created. The workflow uses PyPI trusted publishing and requires the `pypi`
234
+ environment configured in the repository.
235
+
236
+ ## License
237
+
238
+ MIT. See [LICENSE](LICENSE).
@@ -0,0 +1,54 @@
1
+ {
2
+ "molecule": "dna",
3
+ "id_padding": 4,
4
+ "seq_wrap": 70,
5
+ "seed": false,
6
+ "sequences": [
7
+ {
8
+ "base_id": "TEST",
9
+ "generate": 10,
10
+ "max_len": 1000,
11
+ "min_len": 500,
12
+ "proportion": {
13
+ "A": 0.2,
14
+ "T": 0.25,
15
+ "C": 0.2,
16
+ "G": 0.35
17
+ },
18
+ "repeats": [
19
+ {
20
+ "likelihood": 0.5,
21
+ "pattern": "ATCATT",
22
+ "pattern_max_reps": 50,
23
+ "pattern_min_reps": 10
24
+ },
25
+ {
26
+ "likelihood": 0.04,
27
+ "pattern": "CA",
28
+ "pattern_max_reps": 10,
29
+ "pattern_min_reps": 5
30
+ }
31
+ ],
32
+ "inserts": [
33
+ {
34
+ "total": 4,
35
+ "max_split": 0,
36
+ "min_split": 0,
37
+ "ave_gap": 0,
38
+ "sd_gap": 0,
39
+ "mutation_rate": 0.05,
40
+ "sequence": "CCCCCCTTAAACACTTATACGGTAG"
41
+ },
42
+ {
43
+ "total": 10,
44
+ "max_split": 5,
45
+ "min_split": 0,
46
+ "ave_gap": 5,
47
+ "sd_gap": 2,
48
+ "mutation_rate": 0.5,
49
+ "sequence": "AAAAAAAATGTGTAATTTTGACCAC"
50
+ }
51
+ ]
52
+ }
53
+ ]
54
+ }
@@ -0,0 +1,46 @@
1
+ """fastaModeller: random FASTA sequence generation from JSON configuration."""
2
+
3
+ __version__ = "1.0.0"
4
+
5
+ from .config import ( # noqa: E402
6
+ Composition,
7
+ Config,
8
+ ConfigLoader,
9
+ Insert,
10
+ Repeat,
11
+ SequenceSpec,
12
+ SequenceType,
13
+ get_sequence_type,
14
+ )
15
+ from .errors import ( # noqa: E402
16
+ ConfigError,
17
+ FastaModellerError,
18
+ GenerationError,
19
+ OutputError,
20
+ )
21
+ from .generation import ( # noqa: E402
22
+ GenerationService,
23
+ generate_to_files,
24
+ resolve_seed,
25
+ )
26
+ from .reporting import format_report # noqa: E402
27
+
28
+ __all__ = [
29
+ "__version__",
30
+ "Composition",
31
+ "Config",
32
+ "ConfigError",
33
+ "ConfigLoader",
34
+ "FastaModellerError",
35
+ "GenerationError",
36
+ "GenerationService",
37
+ "Insert",
38
+ "OutputError",
39
+ "Repeat",
40
+ "SequenceSpec",
41
+ "SequenceType",
42
+ "format_report",
43
+ "generate_to_files",
44
+ "get_sequence_type",
45
+ "resolve_seed",
46
+ ]
@@ -0,0 +1,4 @@
1
+ from .cli import cli
2
+
3
+ if __name__ == "__main__":
4
+ cli()