biofiles 0.0.2__py3-none-any.whl → 0.0.4__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 +23 -2
- {biofiles-0.0.2.dist-info → biofiles-0.0.4.dist-info}/METADATA +2 -2
- {biofiles-0.0.2.dist-info → biofiles-0.0.4.dist-info}/RECORD +6 -6
- {biofiles-0.0.2.dist-info → biofiles-0.0.4.dist-info}/WHEEL +1 -1
- {biofiles-0.0.2.dist-info → biofiles-0.0.4.dist-info}/LICENSE +0 -0
- {biofiles-0.0.2.dist-info → biofiles-0.0.4.dist-info}/top_level.txt +0 -0
biofiles/gff.py
CHANGED
@@ -4,10 +4,10 @@ from dataclasses import dataclass, field
|
|
4
4
|
from pathlib import Path
|
5
5
|
from typing import Iterator, cast, TextIO
|
6
6
|
|
7
|
-
from biofiles.common import Strand, Reader
|
7
|
+
from biofiles.common import Strand, Reader, Writer
|
8
8
|
from biofiles.types.feature import Feature, Gene, Exon
|
9
9
|
|
10
|
-
__all__ = ["GFFReader"]
|
10
|
+
__all__ = ["GFFReader", "GFF3Writer"]
|
11
11
|
|
12
12
|
|
13
13
|
@dataclass
|
@@ -261,6 +261,27 @@ class GFFReader(Reader):
|
|
261
261
|
}
|
262
262
|
|
263
263
|
|
264
|
+
class GFF3Writer(Writer):
|
265
|
+
def __init__(self, output: TextIO | Path | str) -> None:
|
266
|
+
super().__init__(output)
|
267
|
+
self._output.write(f"{_VERSION_PREFIX}3\n")
|
268
|
+
|
269
|
+
def write(self, feature: Feature) -> None:
|
270
|
+
fields = (
|
271
|
+
feature.sequence_id,
|
272
|
+
feature.source,
|
273
|
+
feature.type_,
|
274
|
+
str(feature.start_original),
|
275
|
+
str(feature.end_original),
|
276
|
+
str(feature.score) if feature.score is not None else ".",
|
277
|
+
str(feature.strand) if feature.strand is not None else ".",
|
278
|
+
str(feature.phase) if feature.phase is not None else ".",
|
279
|
+
";".join(f"{k}={v}" for k, v in feature.attributes.items()),
|
280
|
+
)
|
281
|
+
self._output.write("\t".join(fields))
|
282
|
+
self._output.write("\n")
|
283
|
+
|
284
|
+
|
264
285
|
_VERSION_PREFIX = "##gff-version "
|
265
286
|
|
266
287
|
|
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.2
|
2
2
|
Name: biofiles
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.4
|
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=Bag0Z1xNR8l4IDEGct6OU2gCjmRldKRrhKcw8gNjbMY,10629
|
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
7
|
biofiles/types/feature.py,sha256=c9m_DU_EaUIWG6-xsiPxQIiGkfDs96nm5ls2T5SMeuA,826
|
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.4.dist-info/LICENSE,sha256=CbR8ssdFyViKj25JAlMjIt1_FbiZ1tAC5t-uwUbxqak,1070
|
11
|
+
biofiles-0.0.4.dist-info/METADATA,sha256=X4kN2G9g266dSlVtZ7RPuh2PUXtdu_0W41rPL_-hPzE,3033
|
12
|
+
biofiles-0.0.4.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
13
|
+
biofiles-0.0.4.dist-info/top_level.txt,sha256=laFaFv8hpkI4U-Pgs0yBaAJXN2_CJKl7jb-m3-tGfSc,9
|
14
|
+
biofiles-0.0.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|