biofiles 0.0.6__py3-none-any.whl → 0.0.7__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/feature.py +11 -6
- biofiles/gff.py +2 -2
- biofiles/types/feature.py +7 -2
- {biofiles-0.0.6.dist-info → biofiles-0.0.7.dist-info}/METADATA +1 -1
- {biofiles-0.0.6.dist-info → biofiles-0.0.7.dist-info}/RECORD +8 -8
- {biofiles-0.0.6.dist-info → biofiles-0.0.7.dist-info}/LICENSE +0 -0
- {biofiles-0.0.6.dist-info → biofiles-0.0.7.dist-info}/WHEEL +0 -0
- {biofiles-0.0.6.dist-info → biofiles-0.0.7.dist-info}/top_level.txt +0 -0
biofiles/feature.py
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
from collections import deque
|
2
2
|
from dataclasses import dataclass, field
|
3
3
|
from pathlib import Path
|
4
|
-
from typing import Iterator, TextIO
|
4
|
+
from typing import Iterator, TextIO, Type
|
5
5
|
|
6
6
|
from biofiles.common import Reader, Strand
|
7
|
-
from biofiles.types.feature import Feature, Gene, ThreePrimeUTR, Exon
|
7
|
+
from biofiles.types.feature import Feature, Gene, ThreePrimeUTR, Exon, UTR
|
8
8
|
|
9
9
|
|
10
10
|
@dataclass
|
@@ -67,6 +67,9 @@ class FeatureReader(Reader):
|
|
67
67
|
super().__init__(input_)
|
68
68
|
self._streaming_window = streaming_window
|
69
69
|
|
70
|
+
def __iter__(self) -> Iterator[Feature]:
|
71
|
+
raise NotImplementedError
|
72
|
+
|
70
73
|
def _finalize_drafts(
|
71
74
|
self, drafts: FeatureDrafts, w: int | None
|
72
75
|
) -> Iterator[Feature]:
|
@@ -109,7 +112,9 @@ class FeatureReader(Reader):
|
|
109
112
|
case "exon":
|
110
113
|
feature = self._finalize_exon(draft, result)
|
111
114
|
case "three_prime_utr":
|
112
|
-
feature = self.
|
115
|
+
feature = self._finalize_utr(draft, result, ThreePrimeUTR)
|
116
|
+
case "utr":
|
117
|
+
feature = self._finalize_utr(draft, result, UTR)
|
113
118
|
case _:
|
114
119
|
feature = self._finalize_other(draft, result)
|
115
120
|
if feature.parent:
|
@@ -138,8 +143,8 @@ class FeatureReader(Reader):
|
|
138
143
|
object.__setattr__(gene, "exons", gene.exons + (exon,))
|
139
144
|
return exon
|
140
145
|
|
141
|
-
def
|
142
|
-
self, draft: FeatureDraft, result: Features
|
146
|
+
def _finalize_utr(
|
147
|
+
self, draft: FeatureDraft, result: Features, type_: Type[UTR]
|
143
148
|
) -> Feature:
|
144
149
|
feature = self._finalize_other(draft, result)
|
145
150
|
|
@@ -149,7 +154,7 @@ class FeatureReader(Reader):
|
|
149
154
|
|
150
155
|
if gene is None:
|
151
156
|
return feature
|
152
|
-
return
|
157
|
+
return type_(**feature.__dict__, gene=gene)
|
153
158
|
|
154
159
|
def _finalize_other(self, draft: FeatureDraft, result: Features) -> Feature:
|
155
160
|
parent_id = self._extract_parent_id(draft)
|
biofiles/gff.py
CHANGED
@@ -122,8 +122,8 @@ class GFF3Writer(Writer):
|
|
122
122
|
feature.sequence_id,
|
123
123
|
feature.source,
|
124
124
|
feature.type_,
|
125
|
-
str(feature.
|
126
|
-
str(feature.
|
125
|
+
str(feature.start_c + 1),
|
126
|
+
str(feature.end_c),
|
127
127
|
str(feature.score) if feature.score is not None else ".",
|
128
128
|
str(feature.strand) if feature.strand is not None else ".",
|
129
129
|
str(feature.phase) if feature.phase is not None else ".",
|
biofiles/types/feature.py
CHANGED
@@ -14,7 +14,7 @@ class Feature:
|
|
14
14
|
|
15
15
|
start_original: int
|
16
16
|
end_original: int
|
17
|
-
# Original
|
17
|
+
# Original values as they were present in the file (1-based inclusive for .gff and .gtf).
|
18
18
|
|
19
19
|
start_c: int
|
20
20
|
end_c: int
|
@@ -47,6 +47,11 @@ class Exon(Feature):
|
|
47
47
|
|
48
48
|
|
49
49
|
@dataclass(frozen=True)
|
50
|
-
class
|
50
|
+
class UTR(Feature):
|
51
51
|
gene: Gene
|
52
52
|
# TODO transcript
|
53
|
+
|
54
|
+
|
55
|
+
@dataclass(frozen=True)
|
56
|
+
class ThreePrimeUTR(UTR):
|
57
|
+
pass
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: biofiles
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.7
|
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,16 +1,16 @@
|
|
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/feature.py,sha256=
|
5
|
-
biofiles/gff.py,sha256=
|
4
|
+
biofiles/feature.py,sha256=wga91SYc2cMh5r5nH2m9IRM5hnVObesrxYr31kBU4WA,6874
|
5
|
+
biofiles/gff.py,sha256=W5AjaQL_iYk4OF-H7C2pOjtpeLDEKfVg5uTOFxPDJ5I,5506
|
6
6
|
biofiles/gtf.py,sha256=hWfjQjzwsrXLjCGr9ia6GdHNdYtlwkBrG1ldJYhRD-4,1251
|
7
7
|
biofiles/repeatmasker.py,sha256=DqD1z1hUfCP4-qnfjF-oMF-ZpW_6XhOf_nzA8VHhQbw,3079
|
8
8
|
biofiles/types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
9
|
-
biofiles/types/feature.py,sha256=
|
9
|
+
biofiles/types/feature.py,sha256=gdywZKp7_TXiiZcXfbVs6oSHIWtju2-bqfQOmjH71Dg,1041
|
10
10
|
biofiles/types/repeat.py,sha256=63SqzAwEGIDIGP9pxC85RUdwXbbSm0S5WNL3lSiWlmc,641
|
11
11
|
biofiles/types/sequence.py,sha256=EOw_oKuMR0THpCYJqVE__27z7qrRqcdIPrRWTL4OFMw,152
|
12
|
-
biofiles-0.0.
|
13
|
-
biofiles-0.0.
|
14
|
-
biofiles-0.0.
|
15
|
-
biofiles-0.0.
|
16
|
-
biofiles-0.0.
|
12
|
+
biofiles-0.0.7.dist-info/LICENSE,sha256=CbR8ssdFyViKj25JAlMjIt1_FbiZ1tAC5t-uwUbxqak,1070
|
13
|
+
biofiles-0.0.7.dist-info/METADATA,sha256=jd6-bM7tz1laNRX_wUCnDP4FRvQwGO0sxqqWYAvowiQ,3033
|
14
|
+
biofiles-0.0.7.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
15
|
+
biofiles-0.0.7.dist-info/top_level.txt,sha256=laFaFv8hpkI4U-Pgs0yBaAJXN2_CJKl7jb-m3-tGfSc,9
|
16
|
+
biofiles-0.0.7.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|