RNApolis 0.4.3__tar.gz → 0.11.3__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.
- rnapolis-0.11.3/MANIFEST.in +2 -0
- {rnapolis-0.4.3/src/RNApolis.egg-info → rnapolis-0.11.3}/PKG-INFO +15 -2
- {rnapolis-0.4.3 → rnapolis-0.11.3}/setup.py +22 -3
- {rnapolis-0.4.3 → rnapolis-0.11.3/src/RNApolis.egg-info}/PKG-INFO +15 -2
- rnapolis-0.11.3/src/RNApolis.egg-info/SOURCES.txt +63 -0
- {rnapolis-0.4.3 → rnapolis-0.11.3}/src/RNApolis.egg-info/entry_points.txt +5 -0
- {rnapolis-0.4.3 → rnapolis-0.11.3}/src/RNApolis.egg-info/requires.txt +3 -0
- rnapolis-0.11.3/src/RNApolis.egg-info/top_level.txt +1 -0
- rnapolis-0.11.3/src/rnapolis/adapter.py +204 -0
- rnapolis-0.11.3/src/rnapolis/adapters/__init__.py +7 -0
- rnapolis-0.11.3/src/rnapolis/adapters/__pycache__/__init__.cpython-313.pyc +0 -0
- rnapolis-0.11.3/src/rnapolis/adapters/__pycache__/barnaba.cpython-313.pyc +0 -0
- rnapolis-0.11.3/src/rnapolis/adapters/__pycache__/bpnet.cpython-313.pyc +0 -0
- rnapolis-0.11.3/src/rnapolis/adapters/__pycache__/dssr.cpython-313.pyc +0 -0
- rnapolis-0.11.3/src/rnapolis/adapters/__pycache__/fr3d.cpython-313.pyc +0 -0
- rnapolis-0.11.3/src/rnapolis/adapters/__pycache__/maxit.cpython-313.pyc +0 -0
- rnapolis-0.11.3/src/rnapolis/adapters/__pycache__/mc_annotate.cpython-313.pyc +0 -0
- rnapolis-0.11.3/src/rnapolis/adapters/__pycache__/rnaview.cpython-313.pyc +0 -0
- rnapolis-0.11.3/src/rnapolis/adapters/barnaba.py +250 -0
- rnapolis-0.11.3/src/rnapolis/adapters/bpnet.py +228 -0
- rnapolis-0.11.3/src/rnapolis/adapters/dssr.py +101 -0
- rnapolis-0.11.3/src/rnapolis/adapters/fr3d.py +206 -0
- rnapolis-0.11.3/src/rnapolis/adapters/maxit.py +152 -0
- rnapolis-0.11.3/src/rnapolis/adapters/mc_annotate.py +360 -0
- rnapolis-0.11.3/src/rnapolis/adapters/rnaview.py +364 -0
- rnapolis-0.11.3/src/rnapolis/aligner.py +119 -0
- {rnapolis-0.4.3 → rnapolis-0.11.3}/src/rnapolis/annotator.py +268 -76
- {rnapolis-0.4.3 → rnapolis-0.11.3}/src/rnapolis/clashfinder.py +4 -4
- {rnapolis-0.4.3 → rnapolis-0.11.3}/src/rnapolis/common.py +178 -16
- rnapolis-0.11.3/src/rnapolis/component_A.csv +38 -0
- rnapolis-0.11.3/src/rnapolis/component_C.csv +36 -0
- rnapolis-0.11.3/src/rnapolis/component_G.csv +39 -0
- rnapolis-0.11.3/src/rnapolis/component_U.csv +35 -0
- rnapolis-0.11.3/src/rnapolis/distiller.py +1187 -0
- rnapolis-0.11.3/src/rnapolis/mmcif_pdbx_v50.dic +173762 -0
- rnapolis-0.11.3/src/rnapolis/molecule_filter.py +264 -0
- {rnapolis-0.4.3 → rnapolis-0.11.3}/src/rnapolis/motif_extractor.py +12 -0
- {rnapolis-0.4.3 → rnapolis-0.11.3}/src/rnapolis/parser.py +84 -10
- rnapolis-0.11.3/src/rnapolis/parser_v2.py +1127 -0
- rnapolis-0.11.3/src/rnapolis/py.typed +0 -0
- rnapolis-0.11.3/src/rnapolis/splitter.py +128 -0
- rnapolis-0.11.3/src/rnapolis/tertiary.py +1098 -0
- rnapolis-0.11.3/src/rnapolis/tertiary_v2.py +1148 -0
- rnapolis-0.11.3/src/rnapolis/transformer.py +134 -0
- rnapolis-0.11.3/src/rnapolis/unifier.py +168 -0
- rnapolis-0.11.3/tests/test_adapter.py +205 -0
- {rnapolis-0.4.3 → rnapolis-0.11.3}/tests/test_annotator.py +21 -7
- {rnapolis-0.4.3 → rnapolis-0.11.3}/tests/test_bugfixes.py +7 -7
- {rnapolis-0.4.3 → rnapolis-0.11.3}/tests/test_common.py +106 -9
- rnapolis-0.11.3/tests/test_molecule_filter.py +39 -0
- rnapolis-0.11.3/tests/test_parser.py +52 -0
- {rnapolis-0.4.3 → rnapolis-0.11.3}/tests/test_quadruplexes.py +5 -5
- rnapolis-0.11.3/tests/test_transformer.py +63 -0
- rnapolis-0.11.3/tests/test_v2.py +448 -0
- rnapolis-0.4.3/src/RNApolis.egg-info/SOURCES.txt +0 -29
- rnapolis-0.4.3/src/RNApolis.egg-info/top_level.txt +0 -1
- rnapolis-0.4.3/src/rnapolis/molecule_filter.py +0 -210
- rnapolis-0.4.3/src/rnapolis/tertiary.py +0 -653
- rnapolis-0.4.3/src/rnapolis/transformer.py +0 -65
- rnapolis-0.4.3/tests/test_parser.py +0 -18
- {rnapolis-0.4.3 → rnapolis-0.11.3}/LICENSE +0 -0
- {rnapolis-0.4.3 → rnapolis-0.11.3}/README.md +0 -0
- {rnapolis-0.4.3 → rnapolis-0.11.3}/pyproject.toml +0 -0
- {rnapolis-0.4.3 → rnapolis-0.11.3}/setup.cfg +0 -0
- {rnapolis-0.4.3 → rnapolis-0.11.3}/src/RNApolis.egg-info/dependency_links.txt +0 -0
- {rnapolis-0.4.3 → rnapolis-0.11.3}/src/rnapolis/metareader.py +0 -0
- {rnapolis-0.4.3 → rnapolis-0.11.3}/src/rnapolis/rfam_folder.py +0 -0
- {rnapolis-0.4.3 → rnapolis-0.11.3}/src/rnapolis/util.py +0 -0
- {rnapolis-0.4.3 → rnapolis-0.11.3}/tests/test_metareader.py +0 -0
- {rnapolis-0.4.3 → rnapolis-0.11.3}/tests/test_rfam_folder.py +0 -0
- {rnapolis-0.4.3 → rnapolis-0.11.3}/tests/test_tertiary.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: RNApolis
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.11.3
|
|
4
4
|
Summary: A Python library containing RNA-related bioinformatics functions and classes
|
|
5
5
|
Home-page: https://github.com/tzok/rnapolis-py
|
|
6
6
|
Author: Tomasz Zok
|
|
@@ -16,6 +16,7 @@ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
|
16
16
|
Description-Content-Type: text/markdown
|
|
17
17
|
License-File: LICENSE
|
|
18
18
|
Requires-Dist: appdirs
|
|
19
|
+
Requires-Dist: faiss-cpu
|
|
19
20
|
Requires-Dist: graphviz
|
|
20
21
|
Requires-Dist: mmcif
|
|
21
22
|
Requires-Dist: numpy
|
|
@@ -24,8 +25,20 @@ Requires-Dist: orjson
|
|
|
24
25
|
Requires-Dist: pandas
|
|
25
26
|
Requires-Dist: pulp
|
|
26
27
|
Requires-Dist: requests
|
|
28
|
+
Requires-Dist: scikit-learn
|
|
27
29
|
Requires-Dist: scipy
|
|
30
|
+
Requires-Dist: tqdm
|
|
28
31
|
Requires-Dist: viennarna
|
|
32
|
+
Dynamic: author
|
|
33
|
+
Dynamic: author-email
|
|
34
|
+
Dynamic: classifier
|
|
35
|
+
Dynamic: description
|
|
36
|
+
Dynamic: description-content-type
|
|
37
|
+
Dynamic: home-page
|
|
38
|
+
Dynamic: license-file
|
|
39
|
+
Dynamic: project-url
|
|
40
|
+
Dynamic: requires-dist
|
|
41
|
+
Dynamic: summary
|
|
29
42
|
|
|
30
43
|
# RNApolis
|
|
31
44
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
from setuptools import setup
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
2
|
|
|
3
3
|
with open("README.md") as f:
|
|
4
4
|
long_description = f.read()
|
|
5
5
|
|
|
6
6
|
setup(
|
|
7
7
|
name="RNApolis",
|
|
8
|
-
version="0.
|
|
9
|
-
packages=["rnapolis"],
|
|
8
|
+
version="0.11.3",
|
|
9
|
+
packages=find_packages(where="src", include=["rnapolis", "rnapolis.*"]),
|
|
10
10
|
package_dir={"": "src"},
|
|
11
11
|
author="Tomasz Zok",
|
|
12
12
|
author_email="tomasz.zok@cs.put.poznan.pl",
|
|
@@ -27,16 +27,33 @@ setup(
|
|
|
27
27
|
entry_points={
|
|
28
28
|
"console_scripts": [
|
|
29
29
|
"annotator=rnapolis.annotator:main",
|
|
30
|
+
"adapter=rnapolis.adapter:main",
|
|
31
|
+
"aligner=rnapolis.aligner:main",
|
|
30
32
|
"clashfinder=rnapolis.clashfinder:main",
|
|
33
|
+
"distiller=rnapolis.distiller:main",
|
|
31
34
|
"metareader=rnapolis.metareader:main",
|
|
32
35
|
"molecule-filter=rnapolis.molecule_filter:main",
|
|
33
36
|
"motif-extractor=rnapolis.motif_extractor:main",
|
|
34
37
|
"transformer=rnapolis.transformer:main",
|
|
35
38
|
"rfam-folder=rnapolis.rfam_folder:main",
|
|
39
|
+
"unifier=rnapolis.unifier:main",
|
|
40
|
+
"splitter=rnapolis.splitter:main",
|
|
36
41
|
]
|
|
37
42
|
},
|
|
43
|
+
include_package_data=True,
|
|
44
|
+
package_data={
|
|
45
|
+
"rnapolis": [
|
|
46
|
+
"component_A.csv",
|
|
47
|
+
"component_C.csv",
|
|
48
|
+
"component_G.csv",
|
|
49
|
+
"component_U.csv",
|
|
50
|
+
"mmcif_pdbx_v50.dic",
|
|
51
|
+
],
|
|
52
|
+
"rnapolis.adapters": ["*"],
|
|
53
|
+
},
|
|
38
54
|
install_requires=[
|
|
39
55
|
"appdirs",
|
|
56
|
+
"faiss-cpu",
|
|
40
57
|
"graphviz",
|
|
41
58
|
"mmcif",
|
|
42
59
|
"numpy",
|
|
@@ -45,7 +62,9 @@ setup(
|
|
|
45
62
|
"pandas",
|
|
46
63
|
"pulp",
|
|
47
64
|
"requests",
|
|
65
|
+
"scikit-learn",
|
|
48
66
|
"scipy",
|
|
67
|
+
"tqdm",
|
|
49
68
|
"viennarna",
|
|
50
69
|
],
|
|
51
70
|
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: RNApolis
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.11.3
|
|
4
4
|
Summary: A Python library containing RNA-related bioinformatics functions and classes
|
|
5
5
|
Home-page: https://github.com/tzok/rnapolis-py
|
|
6
6
|
Author: Tomasz Zok
|
|
@@ -16,6 +16,7 @@ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
|
16
16
|
Description-Content-Type: text/markdown
|
|
17
17
|
License-File: LICENSE
|
|
18
18
|
Requires-Dist: appdirs
|
|
19
|
+
Requires-Dist: faiss-cpu
|
|
19
20
|
Requires-Dist: graphviz
|
|
20
21
|
Requires-Dist: mmcif
|
|
21
22
|
Requires-Dist: numpy
|
|
@@ -24,8 +25,20 @@ Requires-Dist: orjson
|
|
|
24
25
|
Requires-Dist: pandas
|
|
25
26
|
Requires-Dist: pulp
|
|
26
27
|
Requires-Dist: requests
|
|
28
|
+
Requires-Dist: scikit-learn
|
|
27
29
|
Requires-Dist: scipy
|
|
30
|
+
Requires-Dist: tqdm
|
|
28
31
|
Requires-Dist: viennarna
|
|
32
|
+
Dynamic: author
|
|
33
|
+
Dynamic: author-email
|
|
34
|
+
Dynamic: classifier
|
|
35
|
+
Dynamic: description
|
|
36
|
+
Dynamic: description-content-type
|
|
37
|
+
Dynamic: home-page
|
|
38
|
+
Dynamic: license-file
|
|
39
|
+
Dynamic: project-url
|
|
40
|
+
Dynamic: requires-dist
|
|
41
|
+
Dynamic: summary
|
|
29
42
|
|
|
30
43
|
# RNApolis
|
|
31
44
|
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
MANIFEST.in
|
|
3
|
+
README.md
|
|
4
|
+
pyproject.toml
|
|
5
|
+
setup.py
|
|
6
|
+
src/RNApolis.egg-info/PKG-INFO
|
|
7
|
+
src/RNApolis.egg-info/SOURCES.txt
|
|
8
|
+
src/RNApolis.egg-info/dependency_links.txt
|
|
9
|
+
src/RNApolis.egg-info/entry_points.txt
|
|
10
|
+
src/RNApolis.egg-info/requires.txt
|
|
11
|
+
src/RNApolis.egg-info/top_level.txt
|
|
12
|
+
src/rnapolis/adapter.py
|
|
13
|
+
src/rnapolis/aligner.py
|
|
14
|
+
src/rnapolis/annotator.py
|
|
15
|
+
src/rnapolis/clashfinder.py
|
|
16
|
+
src/rnapolis/common.py
|
|
17
|
+
src/rnapolis/component_A.csv
|
|
18
|
+
src/rnapolis/component_C.csv
|
|
19
|
+
src/rnapolis/component_G.csv
|
|
20
|
+
src/rnapolis/component_U.csv
|
|
21
|
+
src/rnapolis/distiller.py
|
|
22
|
+
src/rnapolis/metareader.py
|
|
23
|
+
src/rnapolis/mmcif_pdbx_v50.dic
|
|
24
|
+
src/rnapolis/molecule_filter.py
|
|
25
|
+
src/rnapolis/motif_extractor.py
|
|
26
|
+
src/rnapolis/parser.py
|
|
27
|
+
src/rnapolis/parser_v2.py
|
|
28
|
+
src/rnapolis/py.typed
|
|
29
|
+
src/rnapolis/rfam_folder.py
|
|
30
|
+
src/rnapolis/splitter.py
|
|
31
|
+
src/rnapolis/tertiary.py
|
|
32
|
+
src/rnapolis/tertiary_v2.py
|
|
33
|
+
src/rnapolis/transformer.py
|
|
34
|
+
src/rnapolis/unifier.py
|
|
35
|
+
src/rnapolis/util.py
|
|
36
|
+
src/rnapolis/adapters/__init__.py
|
|
37
|
+
src/rnapolis/adapters/barnaba.py
|
|
38
|
+
src/rnapolis/adapters/bpnet.py
|
|
39
|
+
src/rnapolis/adapters/dssr.py
|
|
40
|
+
src/rnapolis/adapters/fr3d.py
|
|
41
|
+
src/rnapolis/adapters/maxit.py
|
|
42
|
+
src/rnapolis/adapters/mc_annotate.py
|
|
43
|
+
src/rnapolis/adapters/rnaview.py
|
|
44
|
+
src/rnapolis/adapters/__pycache__/__init__.cpython-313.pyc
|
|
45
|
+
src/rnapolis/adapters/__pycache__/barnaba.cpython-313.pyc
|
|
46
|
+
src/rnapolis/adapters/__pycache__/bpnet.cpython-313.pyc
|
|
47
|
+
src/rnapolis/adapters/__pycache__/dssr.cpython-313.pyc
|
|
48
|
+
src/rnapolis/adapters/__pycache__/fr3d.cpython-313.pyc
|
|
49
|
+
src/rnapolis/adapters/__pycache__/maxit.cpython-313.pyc
|
|
50
|
+
src/rnapolis/adapters/__pycache__/mc_annotate.cpython-313.pyc
|
|
51
|
+
src/rnapolis/adapters/__pycache__/rnaview.cpython-313.pyc
|
|
52
|
+
tests/test_adapter.py
|
|
53
|
+
tests/test_annotator.py
|
|
54
|
+
tests/test_bugfixes.py
|
|
55
|
+
tests/test_common.py
|
|
56
|
+
tests/test_metareader.py
|
|
57
|
+
tests/test_molecule_filter.py
|
|
58
|
+
tests/test_parser.py
|
|
59
|
+
tests/test_quadruplexes.py
|
|
60
|
+
tests/test_rfam_folder.py
|
|
61
|
+
tests/test_tertiary.py
|
|
62
|
+
tests/test_transformer.py
|
|
63
|
+
tests/test_v2.py
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
[console_scripts]
|
|
2
|
+
adapter = rnapolis.adapter:main
|
|
3
|
+
aligner = rnapolis.aligner:main
|
|
2
4
|
annotator = rnapolis.annotator:main
|
|
3
5
|
clashfinder = rnapolis.clashfinder:main
|
|
6
|
+
distiller = rnapolis.distiller:main
|
|
4
7
|
metareader = rnapolis.metareader:main
|
|
5
8
|
molecule-filter = rnapolis.molecule_filter:main
|
|
6
9
|
motif-extractor = rnapolis.motif_extractor:main
|
|
7
10
|
rfam-folder = rnapolis.rfam_folder:main
|
|
11
|
+
splitter = rnapolis.splitter:main
|
|
8
12
|
transformer = rnapolis.transformer:main
|
|
13
|
+
unifier = rnapolis.unifier:main
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
#! /usr/bin/env python
|
|
2
|
+
import argparse
|
|
3
|
+
import logging
|
|
4
|
+
import os
|
|
5
|
+
from enum import Enum
|
|
6
|
+
from typing import List, Tuple
|
|
7
|
+
|
|
8
|
+
from rnapolis.adapters.barnaba import parse_barnaba_output
|
|
9
|
+
from rnapolis.adapters.bpnet import parse_bpnet_output
|
|
10
|
+
from rnapolis.adapters.dssr import parse_dssr_output
|
|
11
|
+
from rnapolis.adapters.fr3d import parse_fr3d_output
|
|
12
|
+
from rnapolis.adapters.maxit import parse_maxit_output
|
|
13
|
+
from rnapolis.adapters.mc_annotate import parse_mcannotate_output
|
|
14
|
+
from rnapolis.adapters.rnaview import parse_rnaview_output
|
|
15
|
+
from rnapolis.annotator import (
|
|
16
|
+
add_common_output_arguments,
|
|
17
|
+
handle_output_arguments,
|
|
18
|
+
)
|
|
19
|
+
from rnapolis.common import BaseInteractions, Structure2D
|
|
20
|
+
from rnapolis.parser import read_3d_structure
|
|
21
|
+
from rnapolis.tertiary import (
|
|
22
|
+
Mapping2D3D,
|
|
23
|
+
Structure3D,
|
|
24
|
+
)
|
|
25
|
+
from rnapolis.util import handle_input_file
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class ExternalTool(Enum):
|
|
29
|
+
FR3D = "fr3d"
|
|
30
|
+
DSSR = "dssr"
|
|
31
|
+
RNAVIEW = "rnaview"
|
|
32
|
+
BPNET = "bpnet"
|
|
33
|
+
MAXIT = "maxit"
|
|
34
|
+
BARNABA = "barnaba"
|
|
35
|
+
MCANNOTATE = "mc-annotate"
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
logging.basicConfig(level=os.getenv("LOGLEVEL", "INFO").upper())
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def auto_detect_tool(external_files: List[str]) -> ExternalTool:
|
|
42
|
+
"""
|
|
43
|
+
Auto-detect the external tool based on file patterns.
|
|
44
|
+
|
|
45
|
+
Args:
|
|
46
|
+
external_files: List of external tool output file paths
|
|
47
|
+
|
|
48
|
+
Returns:
|
|
49
|
+
ExternalTool enum value based on detected patterns
|
|
50
|
+
"""
|
|
51
|
+
if not external_files:
|
|
52
|
+
return ExternalTool.MAXIT
|
|
53
|
+
|
|
54
|
+
for file_path in external_files:
|
|
55
|
+
basename = os.path.basename(file_path)
|
|
56
|
+
|
|
57
|
+
# Check for FR3D pattern
|
|
58
|
+
if basename.endswith("basepair_detail.txt"):
|
|
59
|
+
return ExternalTool.FR3D
|
|
60
|
+
|
|
61
|
+
# Check for RNAView pattern
|
|
62
|
+
if basename.endswith(".out"):
|
|
63
|
+
return ExternalTool.RNAVIEW
|
|
64
|
+
|
|
65
|
+
# Check for BPNet pattern
|
|
66
|
+
if basename.endswith("basepair.json"):
|
|
67
|
+
return ExternalTool.BPNET
|
|
68
|
+
|
|
69
|
+
# Check for MC-Annotate pattern
|
|
70
|
+
if basename.endswith("stdout.txt"):
|
|
71
|
+
return ExternalTool.MCANNOTATE
|
|
72
|
+
|
|
73
|
+
# Check for Barnaba pattern
|
|
74
|
+
if "pairing" in basename or "stacking" in basename:
|
|
75
|
+
return ExternalTool.BARNABA
|
|
76
|
+
|
|
77
|
+
# Check for JSON files (DSSR)
|
|
78
|
+
if basename.endswith(".json"):
|
|
79
|
+
return ExternalTool.DSSR
|
|
80
|
+
|
|
81
|
+
# Default to MAXIT if no patterns match
|
|
82
|
+
return ExternalTool.MAXIT
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def parse_external_output(
|
|
86
|
+
file_paths: List[str], tool: ExternalTool, structure3d: Structure3D
|
|
87
|
+
) -> BaseInteractions:
|
|
88
|
+
"""
|
|
89
|
+
Parse the output from an external tool (FR3D, DSSR, etc.) and convert it to BaseInteractions.
|
|
90
|
+
|
|
91
|
+
Args:
|
|
92
|
+
file_paths: List of paths to external tool output files
|
|
93
|
+
tool: The external tool that generated the output
|
|
94
|
+
structure3d: The 3D structure parsed from PDB/mmCIF
|
|
95
|
+
|
|
96
|
+
Returns:
|
|
97
|
+
BaseInteractions object containing the interactions found by the external tool
|
|
98
|
+
"""
|
|
99
|
+
if tool == ExternalTool.FR3D:
|
|
100
|
+
return parse_fr3d_output(file_paths, structure3d)
|
|
101
|
+
elif tool == ExternalTool.DSSR:
|
|
102
|
+
return parse_dssr_output(file_paths, structure3d)
|
|
103
|
+
elif tool == ExternalTool.MAXIT:
|
|
104
|
+
return parse_maxit_output(file_paths, structure3d)
|
|
105
|
+
elif tool == ExternalTool.BPNET:
|
|
106
|
+
return parse_bpnet_output(file_paths, structure3d)
|
|
107
|
+
elif tool == ExternalTool.RNAVIEW:
|
|
108
|
+
return parse_rnaview_output(file_paths, structure3d)
|
|
109
|
+
elif tool == ExternalTool.BARNABA:
|
|
110
|
+
return parse_barnaba_output(file_paths, structure3d)
|
|
111
|
+
elif tool == ExternalTool.MCANNOTATE:
|
|
112
|
+
return parse_mcannotate_output(file_paths, structure3d)
|
|
113
|
+
else:
|
|
114
|
+
raise ValueError(f"Unsupported external tool: {tool}")
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
def process_external_tool_output(
|
|
118
|
+
structure3d: Structure3D,
|
|
119
|
+
external_file_paths: List[str],
|
|
120
|
+
tool: ExternalTool,
|
|
121
|
+
input_file_path: str,
|
|
122
|
+
find_gaps: bool = False,
|
|
123
|
+
) -> Tuple[Structure2D, Mapping2D3D]: # Added Mapping2D3D to return tuple
|
|
124
|
+
"""
|
|
125
|
+
Process external tool output and create a secondary structure representation.
|
|
126
|
+
|
|
127
|
+
This function can be used from other code to process external tool outputs
|
|
128
|
+
and get a Structure2D object with the secondary structure information.
|
|
129
|
+
|
|
130
|
+
Args:
|
|
131
|
+
structure3d: The 3D structure parsed from PDB/mmCIF
|
|
132
|
+
external_file_paths: List of paths to external tool output files (empty for MAXIT)
|
|
133
|
+
tool: The external tool that generated the output (FR3D, DSSR, etc.)
|
|
134
|
+
input_file_path: Path to the input file (used when external_file_paths is empty)
|
|
135
|
+
find_gaps: Whether to detect gaps in the structure
|
|
136
|
+
|
|
137
|
+
Returns:
|
|
138
|
+
A tuple containing the Structure2D object and the Mapping2D3D object.
|
|
139
|
+
"""
|
|
140
|
+
# Parse external tool output
|
|
141
|
+
if not external_file_paths:
|
|
142
|
+
# For MAXIT or when no external files are provided, use the input file
|
|
143
|
+
file_paths_to_process = [input_file_path]
|
|
144
|
+
elif tool == ExternalTool.MCANNOTATE or tool == ExternalTool.RNAVIEW:
|
|
145
|
+
# MC-Annotate and RNAView requires both the stdout and the PDB file
|
|
146
|
+
file_paths_to_process = external_file_paths + [input_file_path]
|
|
147
|
+
else:
|
|
148
|
+
# Process all external files
|
|
149
|
+
file_paths_to_process = external_file_paths
|
|
150
|
+
|
|
151
|
+
base_interactions = parse_external_output(file_paths_to_process, tool, structure3d)
|
|
152
|
+
|
|
153
|
+
# Extract secondary structure using the external tool's interactions
|
|
154
|
+
return structure3d.extract_secondary_structure(base_interactions, find_gaps)
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
def main():
|
|
158
|
+
parser = argparse.ArgumentParser()
|
|
159
|
+
parser.add_argument("input", help="Path to PDB or mmCIF file")
|
|
160
|
+
parser.add_argument(
|
|
161
|
+
"external_files",
|
|
162
|
+
nargs="*",
|
|
163
|
+
help="Path(s) to external tool output file(s) (FR3D, DSSR, etc.)",
|
|
164
|
+
)
|
|
165
|
+
parser.add_argument(
|
|
166
|
+
"--tool",
|
|
167
|
+
choices=[t.value for t in ExternalTool],
|
|
168
|
+
help="External tool that generated the output file (auto-detected if not specified)",
|
|
169
|
+
)
|
|
170
|
+
parser.add_argument(
|
|
171
|
+
"-f",
|
|
172
|
+
"--find-gaps",
|
|
173
|
+
action="store_true",
|
|
174
|
+
help="(optional) if set, the program will detect gaps and break the PDB chain into two or more strands",
|
|
175
|
+
)
|
|
176
|
+
add_common_output_arguments(parser)
|
|
177
|
+
# The --inter-stem-csv and --stems-csv arguments are now added by add_common_output_arguments
|
|
178
|
+
args = parser.parse_args()
|
|
179
|
+
|
|
180
|
+
file = handle_input_file(args.input)
|
|
181
|
+
structure3d = read_3d_structure(file, None)
|
|
182
|
+
|
|
183
|
+
# Auto-detect tool if not specified
|
|
184
|
+
if args.tool is not None:
|
|
185
|
+
tool = ExternalTool(args.tool)
|
|
186
|
+
else:
|
|
187
|
+
tool = auto_detect_tool(args.external_files)
|
|
188
|
+
logging.info(f"Auto-detected tool: {tool.value}")
|
|
189
|
+
|
|
190
|
+
# Process external tool output files and get secondary structure
|
|
191
|
+
# Always call process_external_tool_output, even for MAXIT (empty external files)
|
|
192
|
+
structure2d, mapping = process_external_tool_output(
|
|
193
|
+
structure3d,
|
|
194
|
+
args.external_files,
|
|
195
|
+
tool,
|
|
196
|
+
args.input,
|
|
197
|
+
args.find_gaps,
|
|
198
|
+
)
|
|
199
|
+
|
|
200
|
+
handle_output_arguments(args, structure2d, mapping, args.input)
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
if __name__ == "__main__":
|
|
204
|
+
main()
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|