RNApolis 0.4.3__tar.gz → 0.4.4__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {rnapolis-0.4.3/src/RNApolis.egg-info → rnapolis-0.4.4}/PKG-INFO +1 -1
- {rnapolis-0.4.3 → rnapolis-0.4.4}/setup.py +1 -1
- {rnapolis-0.4.3 → rnapolis-0.4.4/src/RNApolis.egg-info}/PKG-INFO +1 -1
- {rnapolis-0.4.3 → rnapolis-0.4.4}/src/rnapolis/tertiary.py +43 -7
- {rnapolis-0.4.3 → rnapolis-0.4.4}/tests/test_common.py +44 -0
- {rnapolis-0.4.3 → rnapolis-0.4.4}/LICENSE +0 -0
- {rnapolis-0.4.3 → rnapolis-0.4.4}/README.md +0 -0
- {rnapolis-0.4.3 → rnapolis-0.4.4}/pyproject.toml +0 -0
- {rnapolis-0.4.3 → rnapolis-0.4.4}/setup.cfg +0 -0
- {rnapolis-0.4.3 → rnapolis-0.4.4}/src/RNApolis.egg-info/SOURCES.txt +0 -0
- {rnapolis-0.4.3 → rnapolis-0.4.4}/src/RNApolis.egg-info/dependency_links.txt +0 -0
- {rnapolis-0.4.3 → rnapolis-0.4.4}/src/RNApolis.egg-info/entry_points.txt +0 -0
- {rnapolis-0.4.3 → rnapolis-0.4.4}/src/RNApolis.egg-info/requires.txt +0 -0
- {rnapolis-0.4.3 → rnapolis-0.4.4}/src/RNApolis.egg-info/top_level.txt +0 -0
- {rnapolis-0.4.3 → rnapolis-0.4.4}/src/rnapolis/annotator.py +0 -0
- {rnapolis-0.4.3 → rnapolis-0.4.4}/src/rnapolis/clashfinder.py +0 -0
- {rnapolis-0.4.3 → rnapolis-0.4.4}/src/rnapolis/common.py +0 -0
- {rnapolis-0.4.3 → rnapolis-0.4.4}/src/rnapolis/metareader.py +0 -0
- {rnapolis-0.4.3 → rnapolis-0.4.4}/src/rnapolis/molecule_filter.py +0 -0
- {rnapolis-0.4.3 → rnapolis-0.4.4}/src/rnapolis/motif_extractor.py +0 -0
- {rnapolis-0.4.3 → rnapolis-0.4.4}/src/rnapolis/parser.py +0 -0
- {rnapolis-0.4.3 → rnapolis-0.4.4}/src/rnapolis/rfam_folder.py +0 -0
- {rnapolis-0.4.3 → rnapolis-0.4.4}/src/rnapolis/transformer.py +0 -0
- {rnapolis-0.4.3 → rnapolis-0.4.4}/src/rnapolis/util.py +0 -0
- {rnapolis-0.4.3 → rnapolis-0.4.4}/tests/test_annotator.py +0 -0
- {rnapolis-0.4.3 → rnapolis-0.4.4}/tests/test_bugfixes.py +0 -0
- {rnapolis-0.4.3 → rnapolis-0.4.4}/tests/test_metareader.py +0 -0
- {rnapolis-0.4.3 → rnapolis-0.4.4}/tests/test_parser.py +0 -0
- {rnapolis-0.4.3 → rnapolis-0.4.4}/tests/test_quadruplexes.py +0 -0
- {rnapolis-0.4.3 → rnapolis-0.4.4}/tests/test_rfam_folder.py +0 -0
- {rnapolis-0.4.3 → rnapolis-0.4.4}/tests/test_tertiary.py +0 -0
@@ -7,6 +7,7 @@ from typing import Dict, List, Optional, Set, Tuple, Union
|
|
7
7
|
|
8
8
|
import numpy
|
9
9
|
import numpy.typing
|
10
|
+
|
10
11
|
from rnapolis.common import (
|
11
12
|
BasePair,
|
12
13
|
BpSeq,
|
@@ -16,6 +17,7 @@ from rnapolis.common import (
|
|
16
17
|
Residue,
|
17
18
|
ResidueAuth,
|
18
19
|
ResidueLabel,
|
20
|
+
Saenger,
|
19
21
|
Stacking,
|
20
22
|
)
|
21
23
|
|
@@ -521,13 +523,47 @@ class Mapping2D3D:
|
|
521
523
|
|
522
524
|
@cached_property
|
523
525
|
def bpseq(self) -> BpSeq:
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
526
|
+
def pair_scoring_function(pair: BasePair3D) -> int:
|
527
|
+
if pair.saenger is not None:
|
528
|
+
if pair.saenger in (Saenger.XIX, Saenger.XX):
|
529
|
+
return 0, pair.nt1, pair.nt2
|
530
|
+
else:
|
531
|
+
return 1, pair.nt1, pair.nt2
|
532
|
+
|
533
|
+
sequence = "".join(
|
534
|
+
sorted(
|
535
|
+
[
|
536
|
+
pair.nt1_3d.one_letter_name.upper(),
|
537
|
+
pair.nt2_3d.one_letter_name.upper(),
|
538
|
+
]
|
539
|
+
)
|
540
|
+
)
|
541
|
+
if sequence in ("AU", "AT", "CG"):
|
542
|
+
return 0, pair.nt1, pair.nt2
|
543
|
+
return 1, pair.nt1, pair.nt2
|
544
|
+
|
545
|
+
canonical = [
|
546
|
+
base_pair
|
547
|
+
for base_pair in self.base_pairs
|
548
|
+
if base_pair.is_canonical and base_pair.nt1 < base_pair.nt2
|
549
|
+
]
|
550
|
+
|
551
|
+
while True:
|
552
|
+
matches = defaultdict(set)
|
553
|
+
|
554
|
+
for base_pair in canonical:
|
555
|
+
matches[base_pair.nt1_3d].add(base_pair)
|
556
|
+
matches[base_pair.nt2_3d].add(base_pair)
|
557
|
+
|
558
|
+
for pairs in matches.values():
|
559
|
+
if len(pairs) > 1:
|
560
|
+
pairs = sorted(pairs, key=pair_scoring_function)
|
561
|
+
canonical.remove(pairs[-1])
|
562
|
+
break
|
563
|
+
else:
|
564
|
+
break
|
565
|
+
|
566
|
+
return self.__generate_bpseq(canonical)
|
531
567
|
|
532
568
|
def __generate_bpseq(self, base_pairs):
|
533
569
|
result: Dict[int, List] = {}
|
@@ -1,7 +1,9 @@
|
|
1
1
|
from collections import Counter
|
2
2
|
|
3
|
+
import orjson
|
3
4
|
from hypothesis import given, settings
|
4
5
|
from hypothesis import strategies as st
|
6
|
+
|
5
7
|
from rnapolis.common import (
|
6
8
|
BaseInteractions,
|
7
9
|
BasePair,
|
@@ -10,13 +12,17 @@ from rnapolis.common import (
|
|
10
12
|
BpSeq,
|
11
13
|
DotBracket,
|
12
14
|
Interaction,
|
15
|
+
LeontisWesthof,
|
13
16
|
MultiStrandDotBracket,
|
14
17
|
OtherInteraction,
|
15
18
|
Residue,
|
16
19
|
ResidueAuth,
|
17
20
|
ResidueLabel,
|
21
|
+
Saenger,
|
18
22
|
Stacking,
|
19
23
|
)
|
24
|
+
from rnapolis.parser import read_3d_structure
|
25
|
+
from rnapolis.tertiary import Mapping2D3D
|
20
26
|
|
21
27
|
|
22
28
|
@given(st.from_type(ResidueLabel))
|
@@ -136,3 +142,41 @@ def test_multi_strand_dot_bracket():
|
|
136
142
|
assert dot_bracket.strands[1].structure == (
|
137
143
|
")))))))))))..(((...[[[[[[...)))......)))))...]]]]]][[[[[.((((((]]]]].....((((((......((((((....)))))).......))))))..))))))."
|
138
144
|
)
|
145
|
+
|
146
|
+
|
147
|
+
def test_conflicted_base_pairs():
|
148
|
+
with open("tests/1A1T_1_B-rnaview.json", "rb") as f:
|
149
|
+
data = orjson.loads(f.read())
|
150
|
+
|
151
|
+
base_pairs = []
|
152
|
+
|
153
|
+
for obj in data.get("basePairs", []):
|
154
|
+
nt1 = Residue(
|
155
|
+
None,
|
156
|
+
ResidueAuth(
|
157
|
+
obj["nt1"]["auth"]["chain"],
|
158
|
+
obj["nt1"]["auth"]["number"],
|
159
|
+
obj["nt1"]["auth"]["icode"],
|
160
|
+
obj["nt1"]["auth"]["name"],
|
161
|
+
),
|
162
|
+
)
|
163
|
+
nt2 = Residue(
|
164
|
+
None,
|
165
|
+
ResidueAuth(
|
166
|
+
obj["nt2"]["auth"]["chain"],
|
167
|
+
obj["nt2"]["auth"]["number"],
|
168
|
+
obj["nt2"]["auth"]["icode"],
|
169
|
+
obj["nt2"]["auth"]["name"],
|
170
|
+
),
|
171
|
+
)
|
172
|
+
lw = LeontisWesthof(obj["lw"])
|
173
|
+
saenger = Saenger(obj["saenger"]) if obj["saenger"] else None
|
174
|
+
base_pairs.append(BasePair(nt1, nt2, lw, saenger))
|
175
|
+
|
176
|
+
with open("tests/1A1T_1_B.cif") as f:
|
177
|
+
structure3d = read_3d_structure(f)
|
178
|
+
|
179
|
+
mapping = Mapping2D3D(structure3d, base_pairs, [], True)
|
180
|
+
assert (
|
181
|
+
mapping.dot_bracket == ">strand_B\nGGACUAGCGGAGGCUAGUCC\n((((((((....))))))))"
|
182
|
+
)
|
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
|
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
|