biofiles 0.0.2__py3-none-any.whl → 0.0.3__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 CHANGED
@@ -4,7 +4,7 @@ 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
10
  __all__ = ["GFFReader"]
@@ -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
1
  Metadata-Version: 2.1
2
2
  Name: biofiles
3
- Version: 0.0.2
3
+ Version: 0.0.3
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=8pDiMgKAemIubv7qwOi8Qi6KEXCJI98XJobRSlAeXAE,9824
4
+ biofiles/gff.py,sha256=9gkHreEH9UFPMJJ7R6e06Cqv9WkHQZy6ZoeKxbKGbPU,10612
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.2.dist-info/LICENSE,sha256=CbR8ssdFyViKj25JAlMjIt1_FbiZ1tAC5t-uwUbxqak,1070
11
- biofiles-0.0.2.dist-info/METADATA,sha256=eU82_wI02DtQOFeGE44s5HZeGQYutXXwa7TtjnNQxzg,3033
12
- biofiles-0.0.2.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
13
- biofiles-0.0.2.dist-info/top_level.txt,sha256=laFaFv8hpkI4U-Pgs0yBaAJXN2_CJKl7jb-m3-tGfSc,9
14
- biofiles-0.0.2.dist-info/RECORD,,
10
+ biofiles-0.0.3.dist-info/LICENSE,sha256=CbR8ssdFyViKj25JAlMjIt1_FbiZ1tAC5t-uwUbxqak,1070
11
+ biofiles-0.0.3.dist-info/METADATA,sha256=TuHtImTKqet3L2NjwbfxaJ1emfQC2Pnrh-hPQyOhwEg,3033
12
+ biofiles-0.0.3.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
13
+ biofiles-0.0.3.dist-info/top_level.txt,sha256=laFaFv8hpkI4U-Pgs0yBaAJXN2_CJKl7jb-m3-tGfSc,9
14
+ biofiles-0.0.3.dist-info/RECORD,,