viralbio-reporting 0.1.0__tar.gz
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.
- viralbio_reporting-0.1.0/LICENSE +21 -0
- viralbio_reporting-0.1.0/PKG-INFO +41 -0
- viralbio_reporting-0.1.0/README.md +23 -0
- viralbio_reporting-0.1.0/pyproject.toml +33 -0
- viralbio_reporting-0.1.0/setup.cfg +4 -0
- viralbio_reporting-0.1.0/viralbio_reporting/__init__.py +32 -0
- viralbio_reporting-0.1.0/viralbio_reporting/circular_annotator.py +294 -0
- viralbio_reporting-0.1.0/viralbio_reporting/cli.py +81 -0
- viralbio_reporting-0.1.0/viralbio_reporting/ncbi_packager.py +216 -0
- viralbio_reporting-0.1.0/viralbio_reporting.egg-info/PKG-INFO +41 -0
- viralbio_reporting-0.1.0/viralbio_reporting.egg-info/SOURCES.txt +13 -0
- viralbio_reporting-0.1.0/viralbio_reporting.egg-info/dependency_links.txt +1 -0
- viralbio_reporting-0.1.0/viralbio_reporting.egg-info/entry_points.txt +2 -0
- viralbio_reporting-0.1.0/viralbio_reporting.egg-info/requires.txt +2 -0
- viralbio_reporting-0.1.0/viralbio_reporting.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Molecular Plant Pathology Lab, ICAR-Indian Sugarcane Research Institute
|
|
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,41 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: viralbio-reporting
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Seamless circular wraparound ORF annotation, SHA-256 provenance logging, and NCBI GenBank submission builder
|
|
5
|
+
Author-email: "Molecular Plant Pathology Lab, ICAR-Indian Sugarcane Research Institute" <shwetabac@gmail.com>
|
|
6
|
+
Maintainer-email: "Dr. Shweta Singh" <shwetabac@gmail.com>
|
|
7
|
+
License: MIT
|
|
8
|
+
Project-URL: Homepage, https://github.com/molecularplantpathology/Virome-Suite
|
|
9
|
+
Project-URL: Repository, https://github.com/molecularplantpathology/Virome-Suite.git
|
|
10
|
+
Project-URL: Issues, https://github.com/molecularplantpathology/Virome-Suite/issues
|
|
11
|
+
Keywords: virome,genbank,annotation,circular-genome,table2asn,bioinformatics
|
|
12
|
+
Requires-Python: >=3.10
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Requires-Dist: biopython>=1.81
|
|
16
|
+
Requires-Dist: pandas>=2.0.0
|
|
17
|
+
Dynamic: license-file
|
|
18
|
+
|
|
19
|
+
# viralbio-reporting
|
|
20
|
+
|
|
21
|
+
**Seamless Circular Wraparound ORF Annotation, SHA-256 Provenance Auditing & NCBI GenBank Package Builder**
|
|
22
|
+
|
|
23
|
+
Part of the [Virome-Suite](https://github.com/molecularplantpathology/Virome-Suite) ecosystem developed at the **Molecular Plant Pathology Lab, ICAR-Indian Sugarcane Research Institute**.
|
|
24
|
+
|
|
25
|
+
## Key Features
|
|
26
|
+
- **360° Rotation-Invariant Circular ORF Discovery:** $2\times$ virtual sequence wrap (`Seq + Seq`) with modulo-$L$ biological stop-codon deduplication, recovering identical intact proteins regardless of where Coordinate 1 is cut.
|
|
27
|
+
- **Exact $(+)$ and $(-)$ Strand Origin-Spanning Intervals:** Projects forward and reverse-complement seam-crossing ORFs into compliant multi-line 1-based NCBI 5-column `.tbl` intervals.
|
|
28
|
+
- **Type-Aware Biological Feature Validation:** Supports complete and $5'/3'$-partial linear CDS features with `codon_start` phase verification.
|
|
29
|
+
- **Hash-Chained Provenance & `table2asn` Harness:** Emits SHA-256 sequence provenance logs and ready-to-submit `.fsa`/`.tbl`/`source.tsv` files.
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pip install viralbio-reporting
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Quick Start
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
viralbio-reporting annotate --fasta curated_monomer.fasta --topology circular -o out_genbank/
|
|
41
|
+
```
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# viralbio-reporting
|
|
2
|
+
|
|
3
|
+
**Seamless Circular Wraparound ORF Annotation, SHA-256 Provenance Auditing & NCBI GenBank Package Builder**
|
|
4
|
+
|
|
5
|
+
Part of the [Virome-Suite](https://github.com/molecularplantpathology/Virome-Suite) ecosystem developed at the **Molecular Plant Pathology Lab, ICAR-Indian Sugarcane Research Institute**.
|
|
6
|
+
|
|
7
|
+
## Key Features
|
|
8
|
+
- **360° Rotation-Invariant Circular ORF Discovery:** $2\times$ virtual sequence wrap (`Seq + Seq`) with modulo-$L$ biological stop-codon deduplication, recovering identical intact proteins regardless of where Coordinate 1 is cut.
|
|
9
|
+
- **Exact $(+)$ and $(-)$ Strand Origin-Spanning Intervals:** Projects forward and reverse-complement seam-crossing ORFs into compliant multi-line 1-based NCBI 5-column `.tbl` intervals.
|
|
10
|
+
- **Type-Aware Biological Feature Validation:** Supports complete and $5'/3'$-partial linear CDS features with `codon_start` phase verification.
|
|
11
|
+
- **Hash-Chained Provenance & `table2asn` Harness:** Emits SHA-256 sequence provenance logs and ready-to-submit `.fsa`/`.tbl`/`source.tsv` files.
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pip install viralbio-reporting
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Quick Start
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
viralbio-reporting annotate --fasta curated_monomer.fasta --topology circular -o out_genbank/
|
|
23
|
+
```
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=64", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "viralbio-reporting"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Seamless circular wraparound ORF annotation, SHA-256 provenance logging, and NCBI GenBank submission builder"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = {text = "MIT"}
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Molecular Plant Pathology Lab, ICAR-Indian Sugarcane Research Institute", email = "shwetabac@gmail.com" },
|
|
14
|
+
]
|
|
15
|
+
maintainers = [
|
|
16
|
+
{ name = "Dr. Shweta Singh", email = "shwetabac@gmail.com" },
|
|
17
|
+
]
|
|
18
|
+
keywords = ["virome", "genbank", "annotation", "circular-genome", "table2asn", "bioinformatics"]
|
|
19
|
+
dependencies = [
|
|
20
|
+
"biopython>=1.81",
|
|
21
|
+
"pandas>=2.0.0",
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
[project.urls]
|
|
25
|
+
Homepage = "https://github.com/molecularplantpathology/Virome-Suite"
|
|
26
|
+
Repository = "https://github.com/molecularplantpathology/Virome-Suite.git"
|
|
27
|
+
Issues = "https://github.com/molecularplantpathology/Virome-Suite/issues"
|
|
28
|
+
|
|
29
|
+
[project.scripts]
|
|
30
|
+
viralbio-reporting = "viralbio_reporting.cli:main"
|
|
31
|
+
|
|
32
|
+
[tool.setuptools]
|
|
33
|
+
packages = ["viralbio_reporting"]
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"""Package 4: viralbio_reporting — Seamless Circular Seam-Wrapping ORF Annotation & NCBI Deposition."""
|
|
2
|
+
|
|
3
|
+
from viralbio_reporting.circular_annotator import (
|
|
4
|
+
AnnotatedCDS,
|
|
5
|
+
annotate_genome_orfs,
|
|
6
|
+
reconstruct_cds_nt_from_intervals,
|
|
7
|
+
revcomp,
|
|
8
|
+
validate_cds_feature,
|
|
9
|
+
)
|
|
10
|
+
from viralbio_reporting.ncbi_packager import (
|
|
11
|
+
ProvenanceRecord,
|
|
12
|
+
SequenceProvenanceChain,
|
|
13
|
+
build_ncbi_submission_package,
|
|
14
|
+
format_ncbi_feature_table,
|
|
15
|
+
validate_tbl_syntax,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
__version__ = "0.1.0"
|
|
19
|
+
|
|
20
|
+
__all__ = [
|
|
21
|
+
"__version__",
|
|
22
|
+
"AnnotatedCDS",
|
|
23
|
+
"ProvenanceRecord",
|
|
24
|
+
"SequenceProvenanceChain",
|
|
25
|
+
"annotate_genome_orfs",
|
|
26
|
+
"build_ncbi_submission_package",
|
|
27
|
+
"format_ncbi_feature_table",
|
|
28
|
+
"reconstruct_cds_nt_from_intervals",
|
|
29
|
+
"revcomp",
|
|
30
|
+
"validate_cds_feature",
|
|
31
|
+
"validate_tbl_syntax",
|
|
32
|
+
]
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
"""2x Circular Seam Wraparound ORF Annotator & Type-Aware CDS Validator (`viralbio_reporting.circular_annotator`)."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import dataclasses
|
|
6
|
+
from typing import Dict, List, Tuple
|
|
7
|
+
|
|
8
|
+
from Bio.Seq import Seq
|
|
9
|
+
|
|
10
|
+
_COMP = str.maketrans("ACGTacgtNn", "TGCAtgcaNn")
|
|
11
|
+
_STOP_CODONS = {"TAA", "TAG", "TGA"}
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def revcomp(seq: str) -> str:
|
|
15
|
+
return seq.translate(_COMP)[::-1]
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@dataclasses.dataclass
|
|
19
|
+
class AnnotatedCDS:
|
|
20
|
+
"""Biologically validated complete or partial viral coding feature."""
|
|
21
|
+
|
|
22
|
+
feature_id: str
|
|
23
|
+
strand: str # "+" or "-"
|
|
24
|
+
intervals_1based: List[Tuple[int, int]] # 1-based inclusive NCBI .tbl intervals
|
|
25
|
+
partial_5prime: bool
|
|
26
|
+
partial_3prime: bool
|
|
27
|
+
codon_start: int # 1, 2, or 3
|
|
28
|
+
spans_origin: bool
|
|
29
|
+
aa_sequence: str
|
|
30
|
+
nt_length: int
|
|
31
|
+
product: str = "hypothetical viral protein"
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _project_circular_intervals(
|
|
35
|
+
s0: int,
|
|
36
|
+
e0: int,
|
|
37
|
+
genome_len: int,
|
|
38
|
+
strand: str,
|
|
39
|
+
) -> List[Tuple[int, int]]:
|
|
40
|
+
"""Project 0-based [s0, e0) on S_2x (or rc(S_2x)) into 1-based inclusive NCBI .tbl intervals (`P0-VBR-2`)."""
|
|
41
|
+
l_nt = genome_len
|
|
42
|
+
if strand == "+":
|
|
43
|
+
if e0 <= l_nt:
|
|
44
|
+
return [(s0 + 1, e0)]
|
|
45
|
+
return [(s0 + 1, l_nt), (1, e0 - l_nt)]
|
|
46
|
+
|
|
47
|
+
# Negative strand (`-`) on rc(S + S) = rc(S) + rc(S) (`P0-VBR-2`)
|
|
48
|
+
if e0 <= l_nt:
|
|
49
|
+
return [(l_nt - s0, l_nt - e0 + 1)]
|
|
50
|
+
return [(l_nt - s0, 1), (l_nt, 2 * l_nt - e0 + 1)]
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def reconstruct_cds_nt_from_intervals(
|
|
54
|
+
genome_seq: str,
|
|
55
|
+
feature: AnnotatedCDS,
|
|
56
|
+
) -> str:
|
|
57
|
+
"""Independently splice nucleotide sequence from parent genome using 1-based .tbl intervals & codon_start."""
|
|
58
|
+
s = genome_seq.upper()
|
|
59
|
+
parts: List[str] = []
|
|
60
|
+
for st_1, en_1 in feature.intervals_1based:
|
|
61
|
+
if feature.strand == "+":
|
|
62
|
+
parts.append(s[st_1 - 1 : en_1])
|
|
63
|
+
else:
|
|
64
|
+
# Descending 1-based inclusive interval [st_1, en_1] where st_1 >= en_1
|
|
65
|
+
lo = min(st_1, en_1)
|
|
66
|
+
hi = max(st_1, en_1)
|
|
67
|
+
parts.append(revcomp(s[lo - 1 : hi]))
|
|
68
|
+
spliced = "".join(parts)
|
|
69
|
+
offset = max(0, int(feature.codon_start) - 1)
|
|
70
|
+
return spliced[offset:]
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def validate_cds_feature(genome_seq: str, feature: AnnotatedCDS) -> Tuple[bool, str]:
|
|
74
|
+
"""Type-aware biological invariant verification (coordinates, frame, start/stop, exact translation)."""
|
|
75
|
+
g_len = len(genome_seq)
|
|
76
|
+
if not feature.intervals_1based:
|
|
77
|
+
return False, "Empty interval list"
|
|
78
|
+
|
|
79
|
+
for st_1, en_1 in feature.intervals_1based:
|
|
80
|
+
if st_1 < 1 or st_1 > g_len or en_1 < 1 or en_1 > g_len:
|
|
81
|
+
return False, f"Interval ({st_1}, {en_1}) out of genome bounds [1, {g_len}]"
|
|
82
|
+
if feature.strand == "+" and st_1 > en_1:
|
|
83
|
+
return False, f"Forward interval ({st_1}, {en_1}) must be ascending"
|
|
84
|
+
if feature.strand == "-" and st_1 < en_1:
|
|
85
|
+
return False, f"Reverse interval ({st_1}, {en_1}) must be descending"
|
|
86
|
+
|
|
87
|
+
coding_nt = reconstruct_cds_nt_from_intervals(genome_seq, feature)
|
|
88
|
+
trim_len = (len(coding_nt) // 3) * 3
|
|
89
|
+
if trim_len < 3:
|
|
90
|
+
return False, "Coding sequence shorter than 1 codon"
|
|
91
|
+
|
|
92
|
+
if not feature.partial_5prime and coding_nt[:3] not in ("ATG", "CTG", "GTG"):
|
|
93
|
+
return False, f"Complete CDS lacks valid start codon (found {coding_nt[:3]})"
|
|
94
|
+
|
|
95
|
+
if not feature.partial_3prime:
|
|
96
|
+
if len(coding_nt) % 3 != 0:
|
|
97
|
+
return False, "Complete CDS nucleotide length is not a multiple of 3"
|
|
98
|
+
if coding_nt[-3:] not in _STOP_CODONS:
|
|
99
|
+
return False, f"Complete CDS lacks terminal stop codon (found {coding_nt[-3:]})"
|
|
100
|
+
aa_full = str(Seq(coding_nt).translate(table=1))
|
|
101
|
+
if not aa_full.endswith("*"):
|
|
102
|
+
return False, "Translated complete CDS does not end with '*'"
|
|
103
|
+
aa_body = aa_full[:-1]
|
|
104
|
+
else:
|
|
105
|
+
aa_full = str(Seq(coding_nt[:trim_len]).translate(table=1))
|
|
106
|
+
aa_body = aa_full.rstrip("*")
|
|
107
|
+
|
|
108
|
+
if "*" in aa_body:
|
|
109
|
+
return False, "Premature internal stop codon detected"
|
|
110
|
+
|
|
111
|
+
if aa_body != feature.aa_sequence:
|
|
112
|
+
return False, "Reconstructed translation does not match annotated aa_sequence"
|
|
113
|
+
|
|
114
|
+
return True, "VALID"
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
def annotate_genome_orfs(
|
|
118
|
+
genome_seq: str,
|
|
119
|
+
topology: str = "circular",
|
|
120
|
+
min_aa: int = 60,
|
|
121
|
+
include_partial_linear: bool = True,
|
|
122
|
+
) -> List[AnnotatedCDS]:
|
|
123
|
+
"""Discover ORFs with 360-degree rotation invariance on circular genomes (`P0-VBR-1`, `P0-VBR-2`, `P1-VBR-3`)."""
|
|
124
|
+
s = genome_seq.upper().strip()
|
|
125
|
+
l_nt = len(s)
|
|
126
|
+
if l_nt < 3:
|
|
127
|
+
return []
|
|
128
|
+
|
|
129
|
+
is_circular = (topology.lower() == "circular")
|
|
130
|
+
rc = revcomp(s)
|
|
131
|
+
|
|
132
|
+
if is_circular:
|
|
133
|
+
# Group by modulo-L biological stop coordinate `(strand, (e0 - 1) % L)` (`P0-VBR-1`)
|
|
134
|
+
best_by_stop: Dict[Tuple[str, int], Tuple[int, int, str]] = {}
|
|
135
|
+
|
|
136
|
+
for strand, template in (("+", s + s), ("-", rc + rc)):
|
|
137
|
+
for frame in (0, 1, 2):
|
|
138
|
+
# Scan codons step by step in frame
|
|
139
|
+
pos = frame
|
|
140
|
+
active_start: int | None = None
|
|
141
|
+
while pos + 3 <= 2 * l_nt:
|
|
142
|
+
codon = template[pos : pos + 3]
|
|
143
|
+
if active_start is None:
|
|
144
|
+
if codon == "ATG":
|
|
145
|
+
if pos < l_nt:
|
|
146
|
+
active_start = pos
|
|
147
|
+
else:
|
|
148
|
+
# Past first revolution with no active ORF started in [0, L)
|
|
149
|
+
break
|
|
150
|
+
elif codon in _STOP_CODONS:
|
|
151
|
+
e0 = pos + 3 # Exclusive 0-based end INCLUDING 3 bp stop codon (`P0-VBR-1`)
|
|
152
|
+
nt_len = e0 - active_start
|
|
153
|
+
# Rule 1 & Rule 2: 0 <= s0 < L and nt_len <= L (`EC-4.3`)
|
|
154
|
+
if nt_len <= l_nt:
|
|
155
|
+
aa_len = (nt_len // 3) - 1
|
|
156
|
+
if aa_len >= min_aa:
|
|
157
|
+
aa_seq = str(Seq(template[active_start : e0 - 3]).translate(table=1))
|
|
158
|
+
if "*" not in aa_seq:
|
|
159
|
+
stop_key = (strand, (e0 - 1) % l_nt)
|
|
160
|
+
prev = best_by_stop.get(stop_key)
|
|
161
|
+
if prev is None or nt_len > (prev[1] - prev[0]):
|
|
162
|
+
best_by_stop[stop_key] = (active_start, e0, aa_seq)
|
|
163
|
+
active_start = None
|
|
164
|
+
pos += 3
|
|
165
|
+
|
|
166
|
+
features: List[AnnotatedCDS] = []
|
|
167
|
+
sorted_items = sorted(
|
|
168
|
+
best_by_stop.items(),
|
|
169
|
+
key=lambda kv: (-len(kv[1][2]), kv[0][0], kv[1][0]),
|
|
170
|
+
)
|
|
171
|
+
for idx, ((strand, _stop_mod), (s0, e0, aa_seq)) in enumerate(sorted_items, start=1):
|
|
172
|
+
intervals = _project_circular_intervals(s0, e0, l_nt, strand)
|
|
173
|
+
features.append(
|
|
174
|
+
AnnotatedCDS(
|
|
175
|
+
feature_id=f"ORF_{idx}",
|
|
176
|
+
strand=strand,
|
|
177
|
+
intervals_1based=intervals,
|
|
178
|
+
partial_5prime=False,
|
|
179
|
+
partial_3prime=False,
|
|
180
|
+
codon_start=1,
|
|
181
|
+
spans_origin=(e0 > l_nt),
|
|
182
|
+
aa_sequence=aa_seq,
|
|
183
|
+
nt_length=e0 - s0,
|
|
184
|
+
product="polyprotein" if len(aa_seq) >= 500 else f"hypothetical protein ORF{idx}",
|
|
185
|
+
)
|
|
186
|
+
)
|
|
187
|
+
return features
|
|
188
|
+
|
|
189
|
+
# Linear genome annotation (supporting complete ORFs and optional 5'/3' boundary partial ORFs `P1-VBR-3`)
|
|
190
|
+
linear_candidates: List[AnnotatedCDS] = []
|
|
191
|
+
orf_counter = 0
|
|
192
|
+
|
|
193
|
+
for strand, template in (("+", s), ("-", rc)):
|
|
194
|
+
for frame in (0, 1, 2):
|
|
195
|
+
pos = frame
|
|
196
|
+
first_stop_seen = False
|
|
197
|
+
active_start: int | None = None
|
|
198
|
+
while pos + 3 <= l_nt:
|
|
199
|
+
codon = template[pos : pos + 3]
|
|
200
|
+
if codon in _STOP_CODONS:
|
|
201
|
+
if active_start is not None:
|
|
202
|
+
e0 = pos + 3
|
|
203
|
+
aa_len = ((e0 - active_start) // 3) - 1
|
|
204
|
+
if aa_len >= min_aa:
|
|
205
|
+
aa_seq = str(Seq(template[active_start : e0 - 3]).translate(table=1))
|
|
206
|
+
orf_counter += 1
|
|
207
|
+
ivs = [(active_start + 1, e0)] if strand == "+" else [(l_nt - active_start, l_nt - e0 + 1)]
|
|
208
|
+
linear_candidates.append(
|
|
209
|
+
AnnotatedCDS(
|
|
210
|
+
feature_id=f"ORF_{orf_counter}",
|
|
211
|
+
strand=strand,
|
|
212
|
+
intervals_1based=ivs,
|
|
213
|
+
partial_5prime=False,
|
|
214
|
+
partial_3prime=False,
|
|
215
|
+
codon_start=1,
|
|
216
|
+
spans_origin=False,
|
|
217
|
+
aa_sequence=aa_seq,
|
|
218
|
+
nt_length=e0 - active_start,
|
|
219
|
+
)
|
|
220
|
+
)
|
|
221
|
+
active_start = None
|
|
222
|
+
elif not first_stop_seen and include_partial_linear:
|
|
223
|
+
# 5'-partial ORF extending from contig boundary to first stop codon (`P1-VBR-3`)
|
|
224
|
+
e0 = pos + 3
|
|
225
|
+
aa_len = (pos - frame) // 3
|
|
226
|
+
if aa_len >= min_aa:
|
|
227
|
+
aa_seq = str(Seq(template[frame : e0 - 3]).translate(table=1))
|
|
228
|
+
orf_counter += 1
|
|
229
|
+
# Anchor interval start at 1 (or L on '-' strand) and set codon_start = frame + 1 (`P1-VBR-3`)
|
|
230
|
+
ivs = [(1, e0)] if strand == "+" else [(l_nt, l_nt - e0 + 1)]
|
|
231
|
+
linear_candidates.append(
|
|
232
|
+
AnnotatedCDS(
|
|
233
|
+
feature_id=f"ORF_{orf_counter}",
|
|
234
|
+
strand=strand,
|
|
235
|
+
intervals_1based=ivs,
|
|
236
|
+
partial_5prime=True,
|
|
237
|
+
partial_3prime=False,
|
|
238
|
+
codon_start=frame + 1,
|
|
239
|
+
spans_origin=False,
|
|
240
|
+
aa_sequence=aa_seq,
|
|
241
|
+
nt_length=e0,
|
|
242
|
+
)
|
|
243
|
+
)
|
|
244
|
+
first_stop_seen = True
|
|
245
|
+
elif active_start is None and codon == "ATG":
|
|
246
|
+
active_start = pos
|
|
247
|
+
pos += 3
|
|
248
|
+
|
|
249
|
+
# Check trailing 3'-partial ORF running off 3' end of linear contig (`P1-VBR-3`)
|
|
250
|
+
if include_partial_linear:
|
|
251
|
+
if active_start is not None:
|
|
252
|
+
rem_codons = (l_nt - active_start) // 3
|
|
253
|
+
if rem_codons >= min_aa:
|
|
254
|
+
aa_seq = str(Seq(template[active_start : active_start + 3 * rem_codons]).translate(table=1))
|
|
255
|
+
orf_counter += 1
|
|
256
|
+
ivs = [(active_start + 1, l_nt)] if strand == "+" else [(l_nt - active_start, 1)]
|
|
257
|
+
linear_candidates.append(
|
|
258
|
+
AnnotatedCDS(
|
|
259
|
+
feature_id=f"ORF_{orf_counter}",
|
|
260
|
+
strand=strand,
|
|
261
|
+
intervals_1based=ivs,
|
|
262
|
+
partial_5prime=False,
|
|
263
|
+
partial_3prime=True,
|
|
264
|
+
codon_start=1,
|
|
265
|
+
spans_origin=False,
|
|
266
|
+
aa_sequence=aa_seq,
|
|
267
|
+
nt_length=l_nt - active_start,
|
|
268
|
+
)
|
|
269
|
+
)
|
|
270
|
+
elif not first_stop_seen:
|
|
271
|
+
# Both 5'-partial and 3'-partial (internal fragment of a large polyprotein)
|
|
272
|
+
rem_codons = (l_nt - frame) // 3
|
|
273
|
+
if rem_codons >= min_aa:
|
|
274
|
+
aa_seq = str(Seq(template[frame : frame + 3 * rem_codons]).translate(table=1))
|
|
275
|
+
orf_counter += 1
|
|
276
|
+
ivs = [(1, l_nt)] if strand == "+" else [(l_nt, 1)]
|
|
277
|
+
linear_candidates.append(
|
|
278
|
+
AnnotatedCDS(
|
|
279
|
+
feature_id=f"ORF_{orf_counter}",
|
|
280
|
+
strand=strand,
|
|
281
|
+
intervals_1based=ivs,
|
|
282
|
+
partial_5prime=True,
|
|
283
|
+
partial_3prime=True,
|
|
284
|
+
codon_start=frame + 1,
|
|
285
|
+
spans_origin=False,
|
|
286
|
+
aa_sequence=aa_seq,
|
|
287
|
+
nt_length=l_nt,
|
|
288
|
+
)
|
|
289
|
+
)
|
|
290
|
+
|
|
291
|
+
linear_candidates.sort(key=lambda f: -len(f.aa_sequence))
|
|
292
|
+
for i, feat in enumerate(linear_candidates, start=1):
|
|
293
|
+
feat.feature_id = f"ORF_{i}"
|
|
294
|
+
return linear_candidates
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"""CLI Entrypoint and Pipeline Runner for Package 4: `viralbio-reporting`."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import argparse
|
|
6
|
+
import json
|
|
7
|
+
import pathlib
|
|
8
|
+
import sys
|
|
9
|
+
from typing import List, Optional
|
|
10
|
+
|
|
11
|
+
from Bio import SeqIO
|
|
12
|
+
|
|
13
|
+
from viralbio_reporting import __version__
|
|
14
|
+
from viralbio_reporting.circular_annotator import annotate_genome_orfs
|
|
15
|
+
from viralbio_reporting.ncbi_packager import build_ncbi_submission_package
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def build_parser() -> argparse.ArgumentParser:
|
|
19
|
+
parser = argparse.ArgumentParser(
|
|
20
|
+
prog="viralbio-reporting",
|
|
21
|
+
description="viralbio_reporting: Modulo-L circular seam wraparound ORF annotation and NCBI table2asn package builder.",
|
|
22
|
+
)
|
|
23
|
+
parser.add_argument("--version", action="version", version=f"viralbio-reporting {__version__}")
|
|
24
|
+
sub = parser.add_subparsers(dest="subcommand", required=True)
|
|
25
|
+
|
|
26
|
+
ann_p = sub.add_parser("annotate", help="Annotate circular or linear viral genomes and generate GenBank .tbl/.fsa.")
|
|
27
|
+
ann_p.add_argument("--fasta", type=pathlib.Path, required=True, help="Curated viral genome FASTA.")
|
|
28
|
+
ann_p.add_argument("--topology", choices=["circular", "linear"], default="circular", help="Genome topology.")
|
|
29
|
+
ann_p.add_argument("--min-aa", type=int, default=60, help="Minimum ORF length in amino acids.")
|
|
30
|
+
ann_p.add_argument("--organism", type=str, default="Unclassified virus", help="Organism name for GenBank header.")
|
|
31
|
+
ann_p.add_argument("--host", type=str, default="Plant host", help="Host organism qualifier.")
|
|
32
|
+
ann_p.add_argument("--country", type=str, default="Unspecified", help="Geographic location qualifier.")
|
|
33
|
+
ann_p.add_argument("-o", "--output", type=pathlib.Path, required=True, help="Output directory.")
|
|
34
|
+
return parser
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def main(argv: Optional[List[str]] = None) -> int:
|
|
38
|
+
parser = build_parser()
|
|
39
|
+
try:
|
|
40
|
+
args = parser.parse_args(argv)
|
|
41
|
+
except SystemExit as exc:
|
|
42
|
+
return int(exc.code) if exc.code is not None else 2
|
|
43
|
+
|
|
44
|
+
if args.subcommand == "annotate":
|
|
45
|
+
if not args.fasta.exists():
|
|
46
|
+
print(f"Error: Input FASTA not found: {args.fasta}", file=sys.stderr)
|
|
47
|
+
return 2
|
|
48
|
+
|
|
49
|
+
records = list(SeqIO.parse(str(args.fasta), "fasta"))
|
|
50
|
+
if not records:
|
|
51
|
+
print("Error: Input FASTA contains zero sequences.", file=sys.stderr)
|
|
52
|
+
return 2
|
|
53
|
+
|
|
54
|
+
args.output.mkdir(parents=True, exist_ok=True)
|
|
55
|
+
summaries = []
|
|
56
|
+
for rec in records:
|
|
57
|
+
seq_str = str(rec.seq).upper()
|
|
58
|
+
orfs = annotate_genome_orfs(seq_str, topology=args.topology, min_aa=args.min_aa)
|
|
59
|
+
pkg_res = build_ncbi_submission_package(
|
|
60
|
+
seq_id=rec.id,
|
|
61
|
+
sequence=seq_str,
|
|
62
|
+
features=orfs,
|
|
63
|
+
output_dir=args.output / rec.id if len(records) > 1 else args.output,
|
|
64
|
+
topology=args.topology,
|
|
65
|
+
organism=args.organism,
|
|
66
|
+
host=args.host,
|
|
67
|
+
country=args.country,
|
|
68
|
+
)
|
|
69
|
+
summaries.append(pkg_res)
|
|
70
|
+
|
|
71
|
+
(args.output / "annotation_summary.json").write_text(
|
|
72
|
+
json.dumps({"records": summaries}, indent=2),
|
|
73
|
+
encoding="utf-8",
|
|
74
|
+
)
|
|
75
|
+
return 0
|
|
76
|
+
|
|
77
|
+
return 0
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
if __name__ == "__main__":
|
|
81
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
"""NCBI 5-Column Feature Table Exporter, Provenance Chain & `table2asn` Harness (`viralbio_reporting.ncbi_packager`)."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import dataclasses
|
|
6
|
+
import datetime
|
|
7
|
+
import hashlib
|
|
8
|
+
import json
|
|
9
|
+
import pathlib
|
|
10
|
+
import shutil
|
|
11
|
+
import subprocess
|
|
12
|
+
from typing import Any, Dict, List, Optional, Sequence, Tuple
|
|
13
|
+
|
|
14
|
+
from viralbio_reporting.circular_annotator import AnnotatedCDS, validate_cds_feature
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@dataclasses.dataclass
|
|
18
|
+
class ProvenanceRecord:
|
|
19
|
+
"""Hash-chained transformation provenance entry."""
|
|
20
|
+
|
|
21
|
+
step: str
|
|
22
|
+
input_sha256: str
|
|
23
|
+
output_sha256: str
|
|
24
|
+
details: Dict[str, Any]
|
|
25
|
+
previous_hash: str
|
|
26
|
+
timestamp_utc: str = dataclasses.field(
|
|
27
|
+
default_factory=lambda: datetime.datetime.now(datetime.timezone.utc).isoformat()
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
def record_hash(self) -> str:
|
|
31
|
+
payload = json.dumps(dataclasses.asdict(self), sort_keys=True).encode("utf-8")
|
|
32
|
+
return hashlib.sha256(payload).hexdigest()
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class SequenceProvenanceChain:
|
|
36
|
+
"""Self-contained append-only SHA-256 provenance logger."""
|
|
37
|
+
|
|
38
|
+
def __init__(self, log_path: pathlib.Path | str) -> None:
|
|
39
|
+
self.log_path = pathlib.Path(log_path)
|
|
40
|
+
self.records: List[ProvenanceRecord] = []
|
|
41
|
+
|
|
42
|
+
def append(
|
|
43
|
+
self,
|
|
44
|
+
step: str,
|
|
45
|
+
input_sha256: str,
|
|
46
|
+
output_sha256: str,
|
|
47
|
+
details: Optional[Dict[str, Any]] = None,
|
|
48
|
+
) -> ProvenanceRecord:
|
|
49
|
+
prev = self.records[-1].record_hash() if self.records else "GENESIS"
|
|
50
|
+
rec = ProvenanceRecord(
|
|
51
|
+
step=step,
|
|
52
|
+
input_sha256=input_sha256,
|
|
53
|
+
output_sha256=output_sha256,
|
|
54
|
+
details=details or {},
|
|
55
|
+
previous_hash=prev,
|
|
56
|
+
)
|
|
57
|
+
self.records.append(rec)
|
|
58
|
+
self.log_path.parent.mkdir(parents=True, exist_ok=True)
|
|
59
|
+
self.log_path.write_text(
|
|
60
|
+
json.dumps(
|
|
61
|
+
{
|
|
62
|
+
"record_count": len(self.records),
|
|
63
|
+
"head_sha256": rec.record_hash(),
|
|
64
|
+
"records": [
|
|
65
|
+
{**dataclasses.asdict(r), "entry_sha256": r.record_hash()}
|
|
66
|
+
for r in self.records
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
indent=2,
|
|
70
|
+
),
|
|
71
|
+
encoding="utf-8",
|
|
72
|
+
)
|
|
73
|
+
return rec
|
|
74
|
+
|
|
75
|
+
def verify_integrity(self) -> bool:
|
|
76
|
+
expected_prev = "GENESIS"
|
|
77
|
+
for r in self.records:
|
|
78
|
+
if r.previous_hash != expected_prev:
|
|
79
|
+
return False
|
|
80
|
+
expected_prev = r.record_hash()
|
|
81
|
+
return True
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def format_ncbi_feature_table(seq_id: str, features: Sequence[AnnotatedCDS]) -> str:
|
|
85
|
+
"""Format compliant NCBI 5-column `.tbl` feature table (`P0-VBR-2`, `P1-VBR-3`)."""
|
|
86
|
+
lines: List[str] = [f">Feature {seq_id}"]
|
|
87
|
+
for feat in features:
|
|
88
|
+
n_iv = len(feat.intervals_1based)
|
|
89
|
+
for idx, (st_1, en_1) in enumerate(feat.intervals_1based):
|
|
90
|
+
s_str = f"<{st_1}" if (idx == 0 and feat.partial_5prime) else str(st_1)
|
|
91
|
+
e_str = f">{en_1}" if (idx == n_iv - 1 and feat.partial_3prime) else str(en_1)
|
|
92
|
+
if idx == 0:
|
|
93
|
+
lines.append(f"{s_str}\t{e_str}\tCDS")
|
|
94
|
+
else:
|
|
95
|
+
lines.append(f"{s_str}\t{e_str}")
|
|
96
|
+
lines.append(f"\t\t\tproduct\t{feat.product}")
|
|
97
|
+
lines.append(f"\t\t\tcodon_start\t{feat.codon_start}")
|
|
98
|
+
lines.append("\t\t\ttransl_table\t1")
|
|
99
|
+
lines.append(f"\t\t\tnote\t{feat.feature_id}")
|
|
100
|
+
return "\n".join(lines) + "\n"
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def validate_tbl_syntax(tbl_text: str) -> Tuple[bool, List[str]]:
|
|
104
|
+
"""Strict internal syntax check for NCBI 5-column `.tbl` compliance."""
|
|
105
|
+
errors: List[str] = []
|
|
106
|
+
lines = tbl_text.splitlines()
|
|
107
|
+
if not lines or not lines[0].startswith(">Feature "):
|
|
108
|
+
return False, ["Missing '>Feature <SeqID>' header on line 1"]
|
|
109
|
+
|
|
110
|
+
seen_cds = False
|
|
111
|
+
for line_no, ln in enumerate(lines[1:], start=2):
|
|
112
|
+
if not ln.strip():
|
|
113
|
+
continue
|
|
114
|
+
if ln.startswith(">Feature "):
|
|
115
|
+
seen_cds = False
|
|
116
|
+
continue
|
|
117
|
+
if "join(" in ln or ".." in ln:
|
|
118
|
+
errors.append(f"Line {line_no}: Illegal flatfile syntax ('join(' or '..') in .tbl")
|
|
119
|
+
cols = ln.split("\t")
|
|
120
|
+
if ln[0] != "\t":
|
|
121
|
+
# Interval line
|
|
122
|
+
if len(cols) not in (2, 3):
|
|
123
|
+
errors.append(f"Line {line_no}: Expected 2 or 3 tab-separated columns on interval line")
|
|
124
|
+
for coord_tok in cols[:2]:
|
|
125
|
+
clean = coord_tok.lstrip("<>")
|
|
126
|
+
if not clean.isdigit() or int(clean) < 1:
|
|
127
|
+
errors.append(f"Line {line_no}: Invalid 1-based coordinate '{coord_tok}'")
|
|
128
|
+
if len(cols) == 3:
|
|
129
|
+
seen_cds = True
|
|
130
|
+
elif not seen_cds:
|
|
131
|
+
errors.append(f"Line {line_no}: Continuation interval before feature key")
|
|
132
|
+
else:
|
|
133
|
+
# Qualifier line: must start with 3 leading tabs (`\t\t\tkey\tval`)
|
|
134
|
+
if len(cols) < 4 or cols[0] != "" or cols[1] != "" or cols[2] != "":
|
|
135
|
+
errors.append(f"Line {line_no}: Qualifier must begin with 3 leading tabs")
|
|
136
|
+
|
|
137
|
+
return len(errors) == 0, errors
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
def build_ncbi_submission_package(
|
|
141
|
+
seq_id: str,
|
|
142
|
+
sequence: str,
|
|
143
|
+
features: Sequence[AnnotatedCDS],
|
|
144
|
+
output_dir: pathlib.Path,
|
|
145
|
+
topology: str = "circular",
|
|
146
|
+
organism: str = "Unclassified virus",
|
|
147
|
+
host: str = "Plant host",
|
|
148
|
+
country: str = "Unspecified",
|
|
149
|
+
run_table2asn: bool = True,
|
|
150
|
+
) -> Dict[str, Any]:
|
|
151
|
+
"""Export `.fsa`, `.tbl`, `source.tsv`, provenance JSON, and run validation."""
|
|
152
|
+
output_dir.mkdir(parents=True, exist_ok=True)
|
|
153
|
+
clean_seq = sequence.upper().strip()
|
|
154
|
+
|
|
155
|
+
# Validate every CDS feature biologically before writing
|
|
156
|
+
bio_errors: List[str] = []
|
|
157
|
+
for feat in features:
|
|
158
|
+
ok, msg = validate_cds_feature(clean_seq, feat)
|
|
159
|
+
if not ok:
|
|
160
|
+
bio_errors.append(f"{feat.feature_id}: {msg}")
|
|
161
|
+
|
|
162
|
+
fsa_path = output_dir / f"{seq_id}.fsa"
|
|
163
|
+
tbl_path = output_dir / f"{seq_id}.tbl"
|
|
164
|
+
src_path = output_dir / "source.tsv"
|
|
165
|
+
prov_path = output_dir / "provenance_chain.json"
|
|
166
|
+
|
|
167
|
+
topo_tag = "[topology=circular]" if topology.lower() == "circular" else "[topology=linear]"
|
|
168
|
+
fsa_text = f">{seq_id} [organism={organism}] {topo_tag} [gcode=1]\n{clean_seq}\n"
|
|
169
|
+
tbl_text = format_ncbi_feature_table(seq_id, features)
|
|
170
|
+
src_text = f"Sequence_ID\tOrganism\tHost\tCountry\n{seq_id}\t{organism}\t{host}\t{country}\n"
|
|
171
|
+
|
|
172
|
+
fsa_path.write_text(fsa_text, encoding="utf-8")
|
|
173
|
+
tbl_path.write_text(tbl_text, encoding="utf-8")
|
|
174
|
+
src_path.write_text(src_text, encoding="utf-8")
|
|
175
|
+
|
|
176
|
+
syntax_ok, syntax_errors = validate_tbl_syntax(tbl_text)
|
|
177
|
+
|
|
178
|
+
seq_hash = hashlib.sha256(clean_seq.encode("utf-8")).hexdigest()
|
|
179
|
+
tbl_hash = hashlib.sha256(tbl_text.encode("utf-8")).hexdigest()
|
|
180
|
+
chain = SequenceProvenanceChain(prov_path)
|
|
181
|
+
chain.append("normalize_fasta", seq_hash, hashlib.sha256(fsa_text.encode("utf-8")).hexdigest(), {"topology": topology})
|
|
182
|
+
chain.append("generate_ncbi_tbl", seq_hash, tbl_hash, {"feature_count": len(features)})
|
|
183
|
+
|
|
184
|
+
t2a_status = "SKIPPED_BINARY_NOT_IN_PATH"
|
|
185
|
+
t2a_fatal = 0
|
|
186
|
+
t2a_exe = shutil.which("table2asn")
|
|
187
|
+
if run_table2asn and t2a_exe is not None:
|
|
188
|
+
proc = subprocess.run(
|
|
189
|
+
[t2a_exe, "-i", str(fsa_path), "-f", str(tbl_path), "-V", "vb"],
|
|
190
|
+
capture_output=True,
|
|
191
|
+
text=True,
|
|
192
|
+
check=False,
|
|
193
|
+
)
|
|
194
|
+
t2a_status = "EXECUTED" if proc.returncode == 0 else f"EXIT_{proc.returncode}"
|
|
195
|
+
val_file = output_dir / f"{seq_id}.val"
|
|
196
|
+
if val_file.exists():
|
|
197
|
+
for ln in val_file.read_text(encoding="utf-8", errors="ignore").splitlines():
|
|
198
|
+
if "ERROR:" in ln or "REJECT:" in ln:
|
|
199
|
+
t2a_fatal += 1
|
|
200
|
+
|
|
201
|
+
return {
|
|
202
|
+
"seq_id": seq_id,
|
|
203
|
+
"length_bp": len(clean_seq),
|
|
204
|
+
"topology": topology,
|
|
205
|
+
"feature_count": len(features),
|
|
206
|
+
"origin_spanning_count": sum(1 for f in features if f.spans_origin),
|
|
207
|
+
"biological_validation_passed": len(bio_errors) == 0,
|
|
208
|
+
"biological_errors": bio_errors,
|
|
209
|
+
"tbl_syntax_passed": syntax_ok,
|
|
210
|
+
"tbl_syntax_errors": syntax_errors,
|
|
211
|
+
"table2asn_status": t2a_status,
|
|
212
|
+
"table2asn_fatal_errors": t2a_fatal,
|
|
213
|
+
"provenance_verified": chain.verify_integrity(),
|
|
214
|
+
"sequence_sha256": seq_hash,
|
|
215
|
+
"tbl_sha256": tbl_hash,
|
|
216
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: viralbio-reporting
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Seamless circular wraparound ORF annotation, SHA-256 provenance logging, and NCBI GenBank submission builder
|
|
5
|
+
Author-email: "Molecular Plant Pathology Lab, ICAR-Indian Sugarcane Research Institute" <shwetabac@gmail.com>
|
|
6
|
+
Maintainer-email: "Dr. Shweta Singh" <shwetabac@gmail.com>
|
|
7
|
+
License: MIT
|
|
8
|
+
Project-URL: Homepage, https://github.com/molecularplantpathology/Virome-Suite
|
|
9
|
+
Project-URL: Repository, https://github.com/molecularplantpathology/Virome-Suite.git
|
|
10
|
+
Project-URL: Issues, https://github.com/molecularplantpathology/Virome-Suite/issues
|
|
11
|
+
Keywords: virome,genbank,annotation,circular-genome,table2asn,bioinformatics
|
|
12
|
+
Requires-Python: >=3.10
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Requires-Dist: biopython>=1.81
|
|
16
|
+
Requires-Dist: pandas>=2.0.0
|
|
17
|
+
Dynamic: license-file
|
|
18
|
+
|
|
19
|
+
# viralbio-reporting
|
|
20
|
+
|
|
21
|
+
**Seamless Circular Wraparound ORF Annotation, SHA-256 Provenance Auditing & NCBI GenBank Package Builder**
|
|
22
|
+
|
|
23
|
+
Part of the [Virome-Suite](https://github.com/molecularplantpathology/Virome-Suite) ecosystem developed at the **Molecular Plant Pathology Lab, ICAR-Indian Sugarcane Research Institute**.
|
|
24
|
+
|
|
25
|
+
## Key Features
|
|
26
|
+
- **360° Rotation-Invariant Circular ORF Discovery:** $2\times$ virtual sequence wrap (`Seq + Seq`) with modulo-$L$ biological stop-codon deduplication, recovering identical intact proteins regardless of where Coordinate 1 is cut.
|
|
27
|
+
- **Exact $(+)$ and $(-)$ Strand Origin-Spanning Intervals:** Projects forward and reverse-complement seam-crossing ORFs into compliant multi-line 1-based NCBI 5-column `.tbl` intervals.
|
|
28
|
+
- **Type-Aware Biological Feature Validation:** Supports complete and $5'/3'$-partial linear CDS features with `codon_start` phase verification.
|
|
29
|
+
- **Hash-Chained Provenance & `table2asn` Harness:** Emits SHA-256 sequence provenance logs and ready-to-submit `.fsa`/`.tbl`/`source.tsv` files.
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pip install viralbio-reporting
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Quick Start
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
viralbio-reporting annotate --fasta curated_monomer.fasta --topology circular -o out_genbank/
|
|
41
|
+
```
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
viralbio_reporting/__init__.py
|
|
5
|
+
viralbio_reporting/circular_annotator.py
|
|
6
|
+
viralbio_reporting/cli.py
|
|
7
|
+
viralbio_reporting/ncbi_packager.py
|
|
8
|
+
viralbio_reporting.egg-info/PKG-INFO
|
|
9
|
+
viralbio_reporting.egg-info/SOURCES.txt
|
|
10
|
+
viralbio_reporting.egg-info/dependency_links.txt
|
|
11
|
+
viralbio_reporting.egg-info/entry_points.txt
|
|
12
|
+
viralbio_reporting.egg-info/requires.txt
|
|
13
|
+
viralbio_reporting.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
viralbio_reporting
|