RNApolis 0.1.5__tar.gz → 0.2.0__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {RNApolis-0.1.5 → RNApolis-0.2.0}/PKG-INFO +2 -1
- {RNApolis-0.1.5 → RNApolis-0.2.0}/setup.py +2 -2
- {RNApolis-0.1.5 → RNApolis-0.2.0}/src/RNApolis.egg-info/PKG-INFO +2 -1
- {RNApolis-0.1.5 → RNApolis-0.2.0}/src/RNApolis.egg-info/requires.txt +1 -0
- {RNApolis-0.1.5 → RNApolis-0.2.0}/src/rnapolis/annotator.py +21 -12
- {RNApolis-0.1.5 → RNApolis-0.2.0}/src/rnapolis/common.py +6 -1
- {RNApolis-0.1.5 → RNApolis-0.2.0}/src/rnapolis/motif_extractor.py +0 -6
- {RNApolis-0.1.5 → RNApolis-0.2.0}/src/rnapolis/tertiary.py +0 -3
- {RNApolis-0.1.5 → RNApolis-0.2.0}/tests/test_annotator.py +7 -8
- {RNApolis-0.1.5 → RNApolis-0.2.0}/tests/test_bugfixes.py +9 -9
- {RNApolis-0.1.5 → RNApolis-0.2.0}/tests/test_common.py +3 -7
- {RNApolis-0.1.5 → RNApolis-0.2.0}/tests/test_quadruplexes.py +11 -11
- {RNApolis-0.1.5 → RNApolis-0.2.0}/LICENSE +0 -0
- {RNApolis-0.1.5 → RNApolis-0.2.0}/README.md +0 -0
- {RNApolis-0.1.5 → RNApolis-0.2.0}/pyproject.toml +0 -0
- {RNApolis-0.1.5 → RNApolis-0.2.0}/setup.cfg +0 -0
- {RNApolis-0.1.5 → RNApolis-0.2.0}/src/RNApolis.egg-info/SOURCES.txt +0 -0
- {RNApolis-0.1.5 → RNApolis-0.2.0}/src/RNApolis.egg-info/dependency_links.txt +0 -0
- {RNApolis-0.1.5 → RNApolis-0.2.0}/src/RNApolis.egg-info/entry_points.txt +0 -0
- {RNApolis-0.1.5 → RNApolis-0.2.0}/src/RNApolis.egg-info/top_level.txt +0 -0
- {RNApolis-0.1.5 → RNApolis-0.2.0}/src/rnapolis/clashfinder.py +0 -0
- {RNApolis-0.1.5 → RNApolis-0.2.0}/src/rnapolis/metareader.py +0 -0
- {RNApolis-0.1.5 → RNApolis-0.2.0}/src/rnapolis/parser.py +0 -0
- {RNApolis-0.1.5 → RNApolis-0.2.0}/src/rnapolis/transformer.py +0 -0
- {RNApolis-0.1.5 → RNApolis-0.2.0}/src/rnapolis/util.py +0 -0
- {RNApolis-0.1.5 → RNApolis-0.2.0}/tests/test_metareader.py +0 -0
- {RNApolis-0.1.5 → RNApolis-0.2.0}/tests/test_parser.py +0 -0
- {RNApolis-0.1.5 → RNApolis-0.2.0}/tests/test_tertiary.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: RNApolis
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.2.0
|
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
|
@@ -15,6 +15,7 @@ Classifier: Programming Language :: Python :: 3
|
|
15
15
|
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
16
16
|
Description-Content-Type: text/markdown
|
17
17
|
License-File: LICENSE
|
18
|
+
Requires-Dist: graphviz
|
18
19
|
Requires-Dist: mmcif
|
19
20
|
Requires-Dist: numpy
|
20
21
|
Requires-Dist: ordered-set
|
@@ -5,7 +5,7 @@ with open("README.md") as f:
|
|
5
5
|
|
6
6
|
setup(
|
7
7
|
name="RNApolis",
|
8
|
-
version="0.
|
8
|
+
version="0.2.0",
|
9
9
|
packages=["rnapolis"],
|
10
10
|
package_dir={"": "src"},
|
11
11
|
author="Tomasz Zok",
|
@@ -33,5 +33,5 @@ setup(
|
|
33
33
|
"motif-extractor=rnapolis.motif_extractor:main",
|
34
34
|
]
|
35
35
|
},
|
36
|
-
install_requires=["mmcif", "numpy", "ordered-set", "orjson", "pulp", "scipy"],
|
36
|
+
install_requires=["graphviz", "mmcif", "numpy", "ordered-set", "orjson", "pulp", "scipy"],
|
37
37
|
)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: RNApolis
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.2.0
|
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
|
@@ -15,6 +15,7 @@ Classifier: Programming Language :: Python :: 3
|
|
15
15
|
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
16
16
|
Description-Content-Type: text/markdown
|
17
17
|
License-File: LICENSE
|
18
|
+
Requires-Dist: graphviz
|
18
19
|
Requires-Dist: mmcif
|
19
20
|
Requires-Dist: numpy
|
20
21
|
Requires-Dist: ordered-set
|
@@ -5,7 +5,7 @@ import logging
|
|
5
5
|
import math
|
6
6
|
import os
|
7
7
|
from collections import Counter, defaultdict
|
8
|
-
from typing import
|
8
|
+
from typing import Dict, List, Optional, Set, Tuple
|
9
9
|
|
10
10
|
import numpy
|
11
11
|
import numpy.typing
|
@@ -15,6 +15,7 @@ from scipy.spatial import KDTree
|
|
15
15
|
|
16
16
|
from rnapolis.common import (
|
17
17
|
BR,
|
18
|
+
BaseInteractions,
|
18
19
|
BasePair,
|
19
20
|
BasePhosphate,
|
20
21
|
BaseRibose,
|
@@ -471,19 +472,27 @@ def find_stackings(structure: Structure3D, model: int = 1) -> List[Stacking]:
|
|
471
472
|
return stackings
|
472
473
|
|
473
474
|
|
474
|
-
def
|
475
|
-
tertiary_structure: Structure3D, model: int = 1
|
476
|
-
) ->
|
475
|
+
def extract_base_interactions(
|
476
|
+
tertiary_structure: Structure3D, model: int = 1
|
477
|
+
) -> BaseInteractions:
|
477
478
|
base_pairs, base_phosphate, base_ribose = find_pairs(tertiary_structure, model)
|
478
479
|
stackings = find_stackings(tertiary_structure, model)
|
479
|
-
|
480
|
+
return BaseInteractions(base_pairs, stackings, base_ribose, base_phosphate, [])
|
481
|
+
|
482
|
+
|
483
|
+
def extract_secondary_structure(
|
484
|
+
tertiary_structure: Structure3D, model: int = 1, find_gaps: bool = False
|
485
|
+
) -> BaseInteractions:
|
486
|
+
base_interactions = extract_base_interactions(tertiary_structure, model)
|
487
|
+
mapping = Mapping2D3D(
|
488
|
+
tertiary_structure,
|
489
|
+
base_interactions.basePairs,
|
490
|
+
base_interactions.stackings,
|
491
|
+
find_gaps,
|
492
|
+
)
|
480
493
|
stems, single_strands, hairpins, loops = mapping.bpseq.elements
|
481
494
|
return Structure2D(
|
482
|
-
|
483
|
-
stackings,
|
484
|
-
base_ribose,
|
485
|
-
base_phosphate,
|
486
|
-
[],
|
495
|
+
base_interactions,
|
487
496
|
str(mapping.bpseq),
|
488
497
|
mapping.dot_bracket,
|
489
498
|
mapping.extended_dot_bracket,
|
@@ -494,12 +503,12 @@ def extract_secondary_structure(
|
|
494
503
|
)
|
495
504
|
|
496
505
|
|
497
|
-
def write_json(path: str, structure2d:
|
506
|
+
def write_json(path: str, structure2d: BaseInteractions):
|
498
507
|
with open(path, "wb") as f:
|
499
508
|
f.write(orjson.dumps(structure2d))
|
500
509
|
|
501
510
|
|
502
|
-
def write_csv(path: str, structure2d:
|
511
|
+
def write_csv(path: str, structure2d: BaseInteractions):
|
503
512
|
with open(path, "w") as f:
|
504
513
|
writer = csv.writer(f)
|
505
514
|
writer.writerow(["nt1", "nt2", "type", "classification-1", "classification-2"])
|
@@ -897,12 +897,17 @@ class DotBracket:
|
|
897
897
|
|
898
898
|
|
899
899
|
@dataclass(frozen=True, order=True)
|
900
|
-
class
|
900
|
+
class BaseInteractions:
|
901
901
|
basePairs: List[BasePair]
|
902
902
|
stackings: List[Stacking]
|
903
903
|
baseRiboseInteractions: List[BaseRibose]
|
904
904
|
basePhosphateInteractions: List[BasePhosphate]
|
905
905
|
otherInteractions: List[OtherInteraction]
|
906
|
+
|
907
|
+
|
908
|
+
@dataclass(frozen=True, order=True)
|
909
|
+
class Structure2D:
|
910
|
+
baseInteractions: BaseInteractions
|
906
911
|
bpseq: str
|
907
912
|
dotBracket: str
|
908
913
|
extendedDotBracket: str
|
@@ -1,14 +1,8 @@
|
|
1
1
|
#! /usr/bin/env python
|
2
2
|
import argparse
|
3
3
|
import itertools
|
4
|
-
from typing import IO, Dict, List
|
5
|
-
|
6
|
-
import orjson
|
7
|
-
from mmcif.io.IoAdapterPy import IoAdapterPy
|
8
|
-
from mmcif.io.PdbxReader import DataContainer
|
9
4
|
|
10
5
|
from rnapolis.common import BpSeq, DotBracket
|
11
|
-
from rnapolis.util import handle_input_file
|
12
6
|
|
13
7
|
|
14
8
|
def main():
|
@@ -1,7 +1,5 @@
|
|
1
|
-
import itertools
|
2
1
|
import logging
|
3
2
|
import math
|
4
|
-
import string
|
5
3
|
from collections import defaultdict
|
6
4
|
from dataclasses import dataclass, field
|
7
5
|
from functools import cached_property, total_ordering
|
@@ -20,7 +18,6 @@ from rnapolis.common import (
|
|
20
18
|
ResidueAuth,
|
21
19
|
ResidueLabel,
|
22
20
|
Stacking,
|
23
|
-
Structure2D,
|
24
21
|
)
|
25
22
|
|
26
23
|
BASE_ATOMS = {
|
@@ -1,7 +1,6 @@
|
|
1
1
|
from collections import Counter
|
2
2
|
|
3
|
-
from rnapolis.annotator import
|
4
|
-
from rnapolis.common import BR
|
3
|
+
from rnapolis.annotator import extract_base_interactions
|
5
4
|
from rnapolis.parser import read_3d_structure
|
6
5
|
|
7
6
|
|
@@ -11,14 +10,14 @@ def test_1ehz():
|
|
11
10
|
"""
|
12
11
|
with open("tests/1ehz-assembly-1.cif") as f:
|
13
12
|
structure3d = read_3d_structure(f, 1)
|
14
|
-
|
13
|
+
base_interactions = extract_base_interactions(structure3d, 1)
|
15
14
|
|
16
15
|
interactions = [
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
16
|
+
base_interactions.basePairs,
|
17
|
+
base_interactions.stackings,
|
18
|
+
base_interactions.baseRiboseInteractions,
|
19
|
+
base_interactions.basePhosphateInteractions,
|
20
|
+
base_interactions.otherInteractions,
|
22
21
|
]
|
23
22
|
labels = ["base pairs", "stackings", "base-ribose", "base-phosphate", "other"]
|
24
23
|
for i in range(len(interactions)):
|
@@ -1,4 +1,4 @@
|
|
1
|
-
from rnapolis.annotator import
|
1
|
+
from rnapolis.annotator import extract_base_interactions
|
2
2
|
from rnapolis.common import ResidueAuth, ResidueLabel
|
3
3
|
from rnapolis.parser import read_3d_structure
|
4
4
|
from rnapolis.tertiary import Mapping2D3D
|
@@ -8,9 +8,9 @@ from rnapolis.tertiary import Mapping2D3D
|
|
8
8
|
def test_1E7K():
|
9
9
|
with open("tests/1E7K_1_C.cif") as f:
|
10
10
|
structure3d = read_3d_structure(f, 1)
|
11
|
-
|
11
|
+
base_interaction = extract_base_interactions(structure3d)
|
12
12
|
mapping = Mapping2D3D(
|
13
|
-
structure3d,
|
13
|
+
structure3d, base_interaction.basePairs, base_interaction.stackings, True
|
14
14
|
)
|
15
15
|
assert len(mapping.strands_sequences) == 2
|
16
16
|
|
@@ -26,9 +26,9 @@ def test_1DFU():
|
|
26
26
|
b2g = structure3d.find_residue(ResidueLabel("B", 2, "G"), None)
|
27
27
|
assert b2g is not None
|
28
28
|
|
29
|
-
|
29
|
+
base_interactions = extract_base_interactions(structure3d)
|
30
30
|
mapping = Mapping2D3D(
|
31
|
-
structure3d,
|
31
|
+
structure3d, base_interactions.basePairs, base_interactions.stackings, True
|
32
32
|
)
|
33
33
|
assert b2g not in mapping.base_pair_graph[b1u]
|
34
34
|
assert b1u not in mapping.base_pair_graph[b2g]
|
@@ -38,9 +38,9 @@ def test_1DFU():
|
|
38
38
|
def test_4WTI():
|
39
39
|
with open("tests/4WTI_1_T-P.cif") as f:
|
40
40
|
structure3d = read_3d_structure(f, 1)
|
41
|
-
|
41
|
+
base_interactions = extract_base_interactions(structure3d)
|
42
42
|
mapping = Mapping2D3D(
|
43
|
-
structure3d,
|
43
|
+
structure3d, base_interactions.basePairs, base_interactions.stackings, True
|
44
44
|
)
|
45
45
|
assert mapping.dot_bracket == ">strand_T\nCGG\n.((\n>strand_P\nCC\n))"
|
46
46
|
|
@@ -49,9 +49,9 @@ def test_4WTI():
|
|
49
49
|
def test_1HMH():
|
50
50
|
with open("tests/1HMH_1_E.cif") as f:
|
51
51
|
structure3d = read_3d_structure(f, 1)
|
52
|
-
|
52
|
+
base_interactions = extract_base_interactions(structure3d)
|
53
53
|
mapping = Mapping2D3D(
|
54
|
-
structure3d,
|
54
|
+
structure3d, base_interactions.basePairs, base_interactions.stackings, True
|
55
55
|
)
|
56
56
|
assert mapping.dot_bracket == ">strand_E\nUG\n.."
|
57
57
|
|
@@ -1,25 +1,21 @@
|
|
1
1
|
from collections import Counter
|
2
2
|
|
3
|
-
from hypothesis import
|
3
|
+
from hypothesis import given, settings
|
4
4
|
from hypothesis import strategies as st
|
5
5
|
|
6
6
|
from rnapolis.common import (
|
7
|
+
BaseInteractions,
|
7
8
|
BasePair,
|
8
9
|
BasePhosphate,
|
9
10
|
BaseRibose,
|
10
11
|
BpSeq,
|
11
12
|
DotBracket,
|
12
|
-
Hairpin,
|
13
13
|
Interaction,
|
14
|
-
Loop,
|
15
14
|
OtherInteraction,
|
16
15
|
Residue,
|
17
16
|
ResidueAuth,
|
18
17
|
ResidueLabel,
|
19
|
-
SingleStrand,
|
20
18
|
Stacking,
|
21
|
-
Stem,
|
22
|
-
Structure2D,
|
23
19
|
)
|
24
20
|
|
25
21
|
|
@@ -82,7 +78,7 @@ def test_rnapdbee_adapters_api_compliance_other(obj):
|
|
82
78
|
assert obj.__dict__.keys() == {"nt1", "nt2"}
|
83
79
|
|
84
80
|
|
85
|
-
@given(st.from_type(
|
81
|
+
@given(st.from_type(BaseInteractions))
|
86
82
|
@settings(max_examples=10)
|
87
83
|
def test_rnapdbee_adapters_api_compliance_structure2d(obj):
|
88
84
|
assert obj.__dict__.keys() >= {
|
@@ -1,4 +1,4 @@
|
|
1
|
-
from rnapolis.annotator import
|
1
|
+
from rnapolis.annotator import extract_base_interactions
|
2
2
|
from rnapolis.common import ResidueAuth, ResidueLabel
|
3
3
|
from rnapolis.parser import read_3d_structure
|
4
4
|
from rnapolis.tertiary import Mapping2D3D
|
@@ -8,9 +8,9 @@ from rnapolis.tertiary import Mapping2D3D
|
|
8
8
|
def test_2HY9():
|
9
9
|
with open("tests/2HY9.cif") as f:
|
10
10
|
structure3d = read_3d_structure(f, 1)
|
11
|
-
|
11
|
+
base_interactions = extract_base_interactions(structure3d)
|
12
12
|
mapping = Mapping2D3D(
|
13
|
-
structure3d,
|
13
|
+
structure3d, base_interactions.basePairs, base_interactions.stackings, True
|
14
14
|
)
|
15
15
|
|
16
16
|
# tract 1
|
@@ -61,9 +61,9 @@ def test_2HY9():
|
|
61
61
|
def test_6RS3():
|
62
62
|
with open("tests/6RS3.cif") as f:
|
63
63
|
structure3d = read_3d_structure(f, 1)
|
64
|
-
|
64
|
+
base_interactions = extract_base_interactions(structure3d)
|
65
65
|
mapping = Mapping2D3D(
|
66
|
-
structure3d,
|
66
|
+
structure3d, base_interactions.basePairs, base_interactions.stackings, True
|
67
67
|
)
|
68
68
|
|
69
69
|
g1 = structure3d.find_residue(ResidueLabel("A", 1, "DG"), None)
|
@@ -106,9 +106,9 @@ def test_6RS3():
|
|
106
106
|
def test_1JJP():
|
107
107
|
with open("tests/1JJP.cif") as f:
|
108
108
|
structure3d = read_3d_structure(f, 1)
|
109
|
-
|
109
|
+
base_interactions = extract_base_interactions(structure3d)
|
110
110
|
mapping = Mapping2D3D(
|
111
|
-
structure3d,
|
111
|
+
structure3d, base_interactions.basePairs, base_interactions.stackings, True
|
112
112
|
)
|
113
113
|
|
114
114
|
ag1 = structure3d.find_residue(ResidueLabel("A", 1, "DG"), None)
|
@@ -180,9 +180,9 @@ def test_1JJP():
|
|
180
180
|
def test_6FC9():
|
181
181
|
with open("tests/6FC9.cif") as f:
|
182
182
|
structure3d = read_3d_structure(f, 1)
|
183
|
-
|
183
|
+
base_interactions = extract_base_interactions(structure3d)
|
184
184
|
mapping = Mapping2D3D(
|
185
|
-
structure3d,
|
185
|
+
structure3d, base_interactions.basePairs, base_interactions.stackings, True
|
186
186
|
)
|
187
187
|
|
188
188
|
g1 = structure3d.find_residue(ResidueLabel("A", 1, "DG"), None)
|
@@ -256,9 +256,9 @@ def test_6FC9():
|
|
256
256
|
def test_UGG_md():
|
257
257
|
with open("tests/q-ugg-5k-salt_400-500ns_frame1065.pdb") as f:
|
258
258
|
structure3d = read_3d_structure(f, 1)
|
259
|
-
|
259
|
+
base_interactions = extract_base_interactions(structure3d)
|
260
260
|
mapping = Mapping2D3D(
|
261
|
-
structure3d,
|
261
|
+
structure3d, base_interactions.basePairs, base_interactions.stackings, True
|
262
262
|
)
|
263
263
|
|
264
264
|
u1 = structure3d.find_residue(None, ResidueAuth(" ", 1, None, "U5"))
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|