codeine 0.1.0__py3-none-any.whl

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.
@@ -0,0 +1,162 @@
1
+ Metadata-Version: 2.4
2
+ Name: codeine
3
+ Version: 0.1.0
4
+ Author: Michael Peter Dunne
5
+ Requires-Python: >=3.8
6
+ Description-Content-Type: text/markdown
7
+ License-File: LICENSE
8
+ Dynamic: license-file
9
+
10
+ # 🧬 Codeine
11
+
12
+ **Codeine** is a Python library for generating synonymous protein-coding sequences under biological constraints.
13
+
14
+
15
+ ## Installation & documentation
16
+
17
+ **Codeine** is available on PyPI:
18
+
19
+ ```bash
20
+ pip install codeine
21
+ ```
22
+
23
+ Full documentation: **https://codeine.readthedocs.io/**.
24
+
25
+ ## Quick start
26
+
27
+ ```python
28
+ from codeine import CodingSpace
29
+
30
+ space = CodingSpace('MKTIIALSYIFCLVF')
31
+
32
+ print(space.n_valid_sequences)
33
+ print(space.sample())
34
+ ```
35
+
36
+
37
+ ## Overview
38
+
39
+ A protein sequence can typically be encoded by an enormous number of synonymous DNA/RNA coding sequences.
40
+
41
+ For biotechnological applications such as recombinant expression, we typically must choose a coding sequence while respecting one or more practical constraints, for example:
42
+ - avoiding restriction enzyme sites,
43
+ - avoiding nucleotide homopolymers,
44
+ - fixing specific codons,
45
+ - mutating relative to a reference sequence.
46
+
47
+ Identifying valid coding sequences under such constraints quickly becomes challenging, especially for longer protein sequences.
48
+
49
+ **Codeine** represents the complete space of valid coding sequences for a given protein and experimental setup. It enables highly efficient sampling, enumeration and mutation library design while guaranteeing that the generated sequences satisfy user-specified constraints.
50
+
51
+ ## Examples
52
+
53
+ Count valid sequences:
54
+
55
+ ```python
56
+ from codeine import CodingSpace
57
+
58
+ space = CodingSpace('MKTLEFQNGSCPRYKKL')
59
+
60
+ print(space.n_valid_sequences)
61
+ ```
62
+
63
+ Sample a single valid sequences:
64
+
65
+ ```python
66
+ from codeine import CodingSpace
67
+
68
+ space = CodingSpace('MKTLEFQNGSCPRYKKL')
69
+
70
+ seq = space.sample()
71
+ print(seq)
72
+ ```
73
+
74
+ Sample many:
75
+ ```python
76
+ from codeine import CodingSpace
77
+
78
+ space = CodingSpace('MKTLEFQNGSCPRYKKL')
79
+
80
+ for seq in space.sample(n=5):
81
+ print(seq)
82
+ ```
83
+
84
+ Apply restrictions:
85
+
86
+ ```python
87
+ from codeine import CodingSpace, RestrictionSite
88
+
89
+ space = CodingSpace(
90
+ 'MKTLEFQNGSCPRYKKL',
91
+ forbidden_motifs=[
92
+ RestrictionSite.EcoRI,
93
+ RestrictionSite.BamHI,
94
+ 'CTGCAG',
95
+ ],
96
+ codon_restrictions={
97
+ 2: 'AAG',
98
+ 16: 'AAG',
99
+ },
100
+ max_homopolymer=4,
101
+ )
102
+
103
+ print(space.n_valid_sequences)
104
+ print(space.sample())
105
+ ```
106
+
107
+ Use custom codon weights to change sampling distribution:
108
+
109
+ ```python
110
+ from codeine import CodingSpace, CodonWeights
111
+
112
+ weights = CodonWeights.ecoli()
113
+
114
+ space = CodingSpace("MKTLEFQNGSCPRYKKL", codon_weights=weights)
115
+
116
+ seq = space.sample()
117
+ print(seq)
118
+ ```
119
+
120
+ Nonstandard translation tables and RNA:
121
+
122
+ ```python
123
+ from codeine import CodingSpace, TranslationTable
124
+
125
+ table = TranslationTable(table_id=2, rna=True)
126
+
127
+ space = CodingSpace("MKTLEFQNGSCPRYKKL", translation_table=table)
128
+
129
+ seq = space.sample()
130
+ print(seq)
131
+ ```
132
+
133
+ Enumerate all sequences (only recommended for small spaces):
134
+
135
+ ```python
136
+ from codeine import CodingSpace
137
+
138
+ space = CodingSpace('CYIQNCPLG')
139
+
140
+ for sequence in space:
141
+ print(sequence)
142
+ ```
143
+
144
+ Explore mutants of a chosen reference sequence:
145
+
146
+ ```python
147
+ from codeine import CodingSpace
148
+
149
+ space = CodingSpace('MKTLEFQNGSCPRYKKL')
150
+
151
+ reference = space.sample()
152
+
153
+ mutants = space.mutants(
154
+ reference,
155
+ free_positions=range(5, 14),
156
+ min_nts=2,
157
+ max_nts=5,
158
+ )
159
+
160
+ mutant = mutants.sample()
161
+ print(mutant)
162
+ ```
@@ -0,0 +1,28 @@
1
+ codeine/__init__.py,sha256=htuaeXUFkyF9hujDz2xY5B-s4gHksMwRI2dnhI1jYOQ,380
2
+ codeine/constraints/banned.py,sha256=_vcXW4YZ3AgUO_-db_xJtt_A71EX3ehqLKzEHSoftds,13719
3
+ codeine/constraints/base.py,sha256=4rA0QqRPf9nJGKzUGiEtFUUe48JJED2RPMPZ9COFq7I,993
4
+ codeine/constraints/mutations.py,sha256=RZ9A-WOcn8mqHhKCtOLPcMUBO-HQ3I1ylDeU6Bphtu8,3418
5
+ codeine/graph/base.py,sha256=aTxex50txKxGCtrp55JS16zMZ2Dg8UGj27aEocTOljg,8535
6
+ codeine/graph/compile.py,sha256=NCqLIgSxJi3-ziWr-KGutywjVszLi_XSsM3X53xGSjU,16405
7
+ codeine/graph/nodes.py,sha256=TkLOrX9leYQ3245GZTvqaaW5i3VajKM7l3e4yP-NnLI,2482
8
+ codeine/graph/view.py,sha256=la6OjWkWoSh19Sm5hQ2OmKuIEZOVwqensRczdWJ_Mt4,23083
9
+ codeine/motifs/restriction.py,sha256=G4UD9BHjOsab42G8O9O7ebssoh2ZQcLqvezy8ukslwE,2412
10
+ codeine/motifs/validate.py,sha256=vIiZ7JjsIetM2T7M0OJsGFdu0q_sAOUPcz1oOJKnwdg,3243
11
+ codeine/space/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
+ codeine/space/coding.py,sha256=G9XNmJnai8g1mbGHNaOjfFiDM2vrCvTVbMhDF-fdBx0,15418
13
+ codeine/space/mutation.py,sha256=EfJ6AYP46cnKSg1gMIdqQgIxFW5_aFyjJdR5--QaNFI,15502
14
+ codeine/translation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
+ codeine/translation/tables.py,sha256=tmM-5pw030YX69xNnkb8pi-9s1cPD1AUvInrtzSGoxI,5995
16
+ codeine/translation/weights.py,sha256=RyZUhi_ZuU7KSRtNc3du-YAAfOu1l8Nl6jW2JbjraVo,9698
17
+ codeine/translation/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
+ codeine/translation/data/tables.json,sha256=WjPanNn6qxvy0OdxuIGMWtWJiWCS3WiLqePaBn1htsk,38890
19
+ codeine/translation/data/weights.py,sha256=wKD_eLLAgjpLXVYxJwSI3C0_-mN4sK9j_ql5Eq65F_8,11330
20
+ codeine/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
+ codeine/utils/dict.py,sha256=woKX68oXYoHuf7aYEuydWr-Uv4naqqnhQrCQUsjekXI,521
22
+ codeine/utils/display.py,sha256=D29kGOWQE3EEC2IVY2JK7JbHf0iaCumoTcRNwPJDVkM,3015
23
+ codeine/utils/sampling.py,sha256=MFaCL45xhSvdUU-SWI7szHXzPzks6DLI78ZwrQEnlUE,2440
24
+ codeine-0.1.0.dist-info/licenses/LICENSE,sha256=32u-XTG2hRKXdpWqKnogQiHMIhdUpyrT4IsJW61wepU,1070
25
+ codeine-0.1.0.dist-info/METADATA,sha256=hZURnys_KY6BuoDfR0FjzpXmJwdxpeta60kcRbx8HeI,3333
26
+ codeine-0.1.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
27
+ codeine-0.1.0.dist-info/top_level.txt,sha256=eN1nlAn_yqn2c2wK-lvYDu0A5-CgB6WKOoZgD8aIYOU,8
28
+ codeine-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Michael Dunne
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 @@
1
+ codeine