RNApolis 0.3.14__py3-none-any.whl → 0.3.16__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: RNApolis
3
- Version: 0.3.14
3
+ Version: 0.3.16
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
@@ -1,17 +1,17 @@
1
1
  rnapolis/annotator.py,sha256=XnjFBeu3P_2UMdkD4Ao7m7K6JfeqYa-13xRzghrLvt8,22086
2
2
  rnapolis/clashfinder.py,sha256=jD3s_UovygWi01NUbQNeAeRRFkARTSRraLXUV43UbAA,8514
3
- rnapolis/common.py,sha256=mgn9psuBcgJVGPRxsxilVedPygqfwFz9wn5Z0vTU6SY,30107
3
+ rnapolis/common.py,sha256=tbmKV64nLClmzNN0HyKnvWA0-5aSyf4x8CGpBjpIJ4M,30290
4
4
  rnapolis/metareader.py,sha256=4qtMKRvww2sUStLeV8WVrLEt-ScydHUv4Gxx96tnf-M,1683
5
5
  rnapolis/molecule_filter.py,sha256=NhjuqdCRnXgPefWZPeTq77tifmnAzamQtA0ODqPPG9k,6918
6
6
  rnapolis/motif_extractor.py,sha256=duHvpi9Ulcny9K60E6VBpz5RpJZw-KdTB4_Ph0iP478,774
7
- rnapolis/parser.py,sha256=Cmjt7p8UkiSNhSQDjc6I7BRqtuIIHs23Fp-Glb8Zikw,12216
7
+ rnapolis/parser.py,sha256=6xEeQghil0eXIzi0bNUkebknfqIxx9EfOfT9q33eN4A,12666
8
8
  rnapolis/rfam_folder.py,sha256=3rgXEJR16uPFy_BOo8qkdClOAOQDVOkidnLE-yoRbeI,11112
9
9
  rnapolis/tertiary.py,sha256=VuATTN2SD7lBL9iUgT-doDwuEYsLodgV2u-SwQsyQcU,19658
10
10
  rnapolis/transformer.py,sha256=V9nOQvdq4-p7yUWo0vQg0CDQMpmyxz9t4TMSRVEKHnw,1817
11
11
  rnapolis/util.py,sha256=IdquFO3PV1_KDqodjupzm0Rqvgy0CeSzxGHaGEHYXVU,543
12
- RNApolis-0.3.14.dist-info/LICENSE,sha256=ZGRu12MzCgbYA-Lt8MyBlmjvPZh7xfiD5u5wBx0enq4,1066
13
- RNApolis-0.3.14.dist-info/METADATA,sha256=Yrp600ac6KI9zfglV3wf4bY9-dOHO32YgWwwKzYzo94,54301
14
- RNApolis-0.3.14.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
15
- RNApolis-0.3.14.dist-info/entry_points.txt,sha256=foN2Pn5e-OzEz0fFmNoX6PnFSZFQntOlY8LbognP5F0,308
16
- RNApolis-0.3.14.dist-info/top_level.txt,sha256=LcO18koxZcWoJ21KDRRRo_tyIbmXL5z61dPitZpy8yc,9
17
- RNApolis-0.3.14.dist-info/RECORD,,
12
+ RNApolis-0.3.16.dist-info/LICENSE,sha256=ZGRu12MzCgbYA-Lt8MyBlmjvPZh7xfiD5u5wBx0enq4,1066
13
+ RNApolis-0.3.16.dist-info/METADATA,sha256=k4D9WCUq94R1lGhWmYJqTjfh9ww8RPRjxg_IOHiPEcg,54301
14
+ RNApolis-0.3.16.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
15
+ RNApolis-0.3.16.dist-info/entry_points.txt,sha256=foN2Pn5e-OzEz0fFmNoX6PnFSZFQntOlY8LbognP5F0,308
16
+ RNApolis-0.3.16.dist-info/top_level.txt,sha256=LcO18koxZcWoJ21KDRRRo_tyIbmXL5z61dPitZpy8yc,9
17
+ RNApolis-0.3.16.dist-info/RECORD,,
rnapolis/common.py CHANGED
@@ -900,33 +900,37 @@ class BpSeq:
900
900
  else:
901
901
  stack.pop()
902
902
 
903
- # permute order of every component
904
- permutations = [
905
- list(itertools.permutations(component)) for component in components
906
- ]
907
- solutions = set()
903
+ # find unique orders for each component
904
+ unique = []
905
+ for component in components:
906
+ unique.append(set())
908
907
 
909
- for permutation in itertools.product(*permutations):
910
- orders = [0 for _ in range(len(regions))]
908
+ for permutation in itertools.permutations(component):
909
+ orders = {region: 0 for region in component}
911
910
 
912
- for component in permutation:
913
- for i in range(1, len(component)):
914
- region_i = component[i]
915
- available = [True for _ in range(len(graph))]
911
+ for i in range(1, len(permutation)):
912
+ available = [True for _ in range(len(component))]
916
913
 
917
914
  for j in range(i):
918
- region_j = component[j]
919
-
920
- if region_j in graph[region_i]:
921
- available[orders[region_j]] = False
915
+ if permutation[j] in graph[permutation[i]]:
916
+ available[orders[permutation[j]]] = False
922
917
 
923
918
  order = next(
924
- filter(lambda i: available[i] is True, range(len(available)))
919
+ filter(lambda k: available[k] is True, range(len(available)))
925
920
  )
926
- orders[region_i] = order
921
+ orders[permutation[i]] = order
922
+
923
+ unique[-1].add(frozenset(orders.items()))
924
+
925
+ # generate all possible dot-brackets
926
+ solutions = set()
927
+ for assignment in itertools.product(*unique):
928
+ orders = {region: 0 for region in range(len(regions))}
927
929
 
928
- solutions.add(self.__make_dot_bracket(regions, orders))
930
+ for order in assignment:
931
+ orders.update(order)
929
932
 
933
+ solutions.add(self.__make_dot_bracket(regions, orders))
930
934
  return list(solutions)
931
935
 
932
936
 
rnapolis/parser.py CHANGED
@@ -1,3 +1,4 @@
1
+ import logging
1
2
  from typing import IO, Dict, List, Optional, Tuple, Union
2
3
 
3
4
  from mmcif.io.IoAdapterPy import IoAdapterPy
@@ -5,6 +6,9 @@ from mmcif.io.IoAdapterPy import IoAdapterPy
5
6
  from rnapolis.common import ResidueAuth, ResidueLabel
6
7
  from rnapolis.tertiary import BASE_ATOMS, Atom, Residue3D, Structure3D
7
8
 
9
+ logging.basicConfig(level=logging.INFO)
10
+ logger = logging.getLogger(__name__)
11
+
8
12
 
9
13
  def read_3d_structure(
10
14
  cif_or_pdb: IO[str], model: Optional[int] = None, nucleic_acid_only: bool = False
@@ -104,6 +108,14 @@ def parse_cif(
104
108
  auth_residue_name,
105
109
  )
106
110
 
111
+ if label is None and auth is None:
112
+ # this should not happen in a valid mmCIF file
113
+ # skipping the line
114
+ logger.debug(
115
+ f"Cannot parse an atom line without chain name, residue number, and residue name: {row}"
116
+ )
117
+ continue
118
+
107
119
  model = int(row_dict.get("pdbx_PDB_model_num", "1"))
108
120
  atom_name = row_dict["label_atom_id"]
109
121
  x = float(row_dict["Cartn_x"])