biofiles 0.0.4__py3-none-any.whl → 0.0.5__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.
- biofiles/gff.py +17 -2
- biofiles/types/feature.py +6 -0
- {biofiles-0.0.4.dist-info → biofiles-0.0.5.dist-info}/METADATA +1 -1
- {biofiles-0.0.4.dist-info → biofiles-0.0.5.dist-info}/RECORD +7 -7
- {biofiles-0.0.4.dist-info → biofiles-0.0.5.dist-info}/LICENSE +0 -0
- {biofiles-0.0.4.dist-info → biofiles-0.0.5.dist-info}/WHEEL +0 -0
- {biofiles-0.0.4.dist-info → biofiles-0.0.5.dist-info}/top_level.txt +0 -0
biofiles/gff.py
CHANGED
@@ -5,7 +5,7 @@ from pathlib import Path
|
|
5
5
|
from typing import Iterator, cast, TextIO
|
6
6
|
|
7
7
|
from biofiles.common import Strand, Reader, Writer
|
8
|
-
from biofiles.types.feature import Feature, Gene, Exon
|
8
|
+
from biofiles.types.feature import Feature, Gene, Exon, ThreePrimeUTR
|
9
9
|
|
10
10
|
__all__ = ["GFFReader", "GFF3Writer"]
|
11
11
|
|
@@ -173,11 +173,13 @@ class GFFReader(Reader):
|
|
173
173
|
yield from result.features
|
174
174
|
|
175
175
|
def _finalize_draft(self, draft: _FeatureDraft, result: _Features) -> Feature:
|
176
|
-
match draft.type_:
|
176
|
+
match draft.type_.lower():
|
177
177
|
case "gene":
|
178
178
|
feature = self._finalize_gene(draft, result)
|
179
179
|
case "exon":
|
180
180
|
feature = self._finalize_exon(draft, result)
|
181
|
+
case "three_prime_utr":
|
182
|
+
feature = self._finalize_three_prime_utr(draft, result)
|
181
183
|
case _:
|
182
184
|
feature = self._finalize_other(draft, result)
|
183
185
|
if feature.parent:
|
@@ -206,6 +208,19 @@ class GFFReader(Reader):
|
|
206
208
|
object.__setattr__(gene, "exons", gene.exons + (exon,))
|
207
209
|
return exon
|
208
210
|
|
211
|
+
def _finalize_three_prime_utr(
|
212
|
+
self, draft: _FeatureDraft, result: _Features
|
213
|
+
) -> Feature:
|
214
|
+
feature = self._finalize_other(draft, result)
|
215
|
+
|
216
|
+
gene = feature.parent
|
217
|
+
while gene and not isinstance(gene, Gene):
|
218
|
+
gene = gene.parent
|
219
|
+
|
220
|
+
if gene is None:
|
221
|
+
return feature
|
222
|
+
return ThreePrimeUTR(**feature.__dict__, gene=gene)
|
223
|
+
|
209
224
|
def _finalize_other(self, draft: _FeatureDraft, result: _Features) -> Feature:
|
210
225
|
parent_id = draft.attributes.get("Parent", None)
|
211
226
|
parent = result.by_id[parent_id] if parent_id is not None else None
|
biofiles/types/feature.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: biofiles
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.5
|
4
4
|
Summary: Pure-Python, zero-dependency collection of bioinformatics-related file readers and writers
|
5
5
|
Author-email: Tigran Saluev <tigran@saluev.com>
|
6
6
|
Maintainer-email: Tigran Saluev <tigran@saluev.com>
|
@@ -1,14 +1,14 @@
|
|
1
1
|
biofiles/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
2
|
biofiles/common.py,sha256=Yi0i85FpD2wR3vqL645LTUAE6TybGDxxZQsUmEGHqu4,1126
|
3
3
|
biofiles/fasta.py,sha256=ctIt5I_fcZx-xQN921zpmlZS7e9_ICf-3_i6mTs5qbs,2135
|
4
|
-
biofiles/gff.py,sha256=
|
4
|
+
biofiles/gff.py,sha256=lSS7XxS4rpCesCc9FTG87E8p4eJYgtzN9lcz9Y5WNDk,11148
|
5
5
|
biofiles/repeatmasker.py,sha256=DqD1z1hUfCP4-qnfjF-oMF-ZpW_6XhOf_nzA8VHhQbw,3079
|
6
6
|
biofiles/types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
|
-
biofiles/types/feature.py,sha256=
|
7
|
+
biofiles/types/feature.py,sha256=eMBrL0OQGo0MRjM7Sqmo-AKxMb0rJb1Cwc1ygp5BfPY,919
|
8
8
|
biofiles/types/repeat.py,sha256=63SqzAwEGIDIGP9pxC85RUdwXbbSm0S5WNL3lSiWlmc,641
|
9
9
|
biofiles/types/sequence.py,sha256=EOw_oKuMR0THpCYJqVE__27z7qrRqcdIPrRWTL4OFMw,152
|
10
|
-
biofiles-0.0.
|
11
|
-
biofiles-0.0.
|
12
|
-
biofiles-0.0.
|
13
|
-
biofiles-0.0.
|
14
|
-
biofiles-0.0.
|
10
|
+
biofiles-0.0.5.dist-info/LICENSE,sha256=CbR8ssdFyViKj25JAlMjIt1_FbiZ1tAC5t-uwUbxqak,1070
|
11
|
+
biofiles-0.0.5.dist-info/METADATA,sha256=cSInsFiXUGdvIK11QTD24SkhW1lWmd7DyHvd5hjE8PY,3033
|
12
|
+
biofiles-0.0.5.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
13
|
+
biofiles-0.0.5.dist-info/top_level.txt,sha256=laFaFv8hpkI4U-Pgs0yBaAJXN2_CJKl7jb-m3-tGfSc,9
|
14
|
+
biofiles-0.0.5.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|