RNApolis 0.3.14__tar.gz → 0.3.16__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. {rnapolis-0.3.14/src/RNApolis.egg-info → rnapolis-0.3.16}/PKG-INFO +1 -1
  2. {rnapolis-0.3.14 → rnapolis-0.3.16}/setup.py +1 -1
  3. {rnapolis-0.3.14 → rnapolis-0.3.16/src/RNApolis.egg-info}/PKG-INFO +1 -1
  4. {rnapolis-0.3.14 → rnapolis-0.3.16}/src/rnapolis/common.py +22 -18
  5. {rnapolis-0.3.14 → rnapolis-0.3.16}/src/rnapolis/parser.py +12 -0
  6. {rnapolis-0.3.14 → rnapolis-0.3.16}/tests/test_annotator.py +7 -1
  7. {rnapolis-0.3.14 → rnapolis-0.3.16}/LICENSE +0 -0
  8. {rnapolis-0.3.14 → rnapolis-0.3.16}/README.md +0 -0
  9. {rnapolis-0.3.14 → rnapolis-0.3.16}/pyproject.toml +0 -0
  10. {rnapolis-0.3.14 → rnapolis-0.3.16}/setup.cfg +0 -0
  11. {rnapolis-0.3.14 → rnapolis-0.3.16}/src/RNApolis.egg-info/SOURCES.txt +0 -0
  12. {rnapolis-0.3.14 → rnapolis-0.3.16}/src/RNApolis.egg-info/dependency_links.txt +0 -0
  13. {rnapolis-0.3.14 → rnapolis-0.3.16}/src/RNApolis.egg-info/entry_points.txt +0 -0
  14. {rnapolis-0.3.14 → rnapolis-0.3.16}/src/RNApolis.egg-info/requires.txt +0 -0
  15. {rnapolis-0.3.14 → rnapolis-0.3.16}/src/RNApolis.egg-info/top_level.txt +0 -0
  16. {rnapolis-0.3.14 → rnapolis-0.3.16}/src/rnapolis/annotator.py +0 -0
  17. {rnapolis-0.3.14 → rnapolis-0.3.16}/src/rnapolis/clashfinder.py +0 -0
  18. {rnapolis-0.3.14 → rnapolis-0.3.16}/src/rnapolis/metareader.py +0 -0
  19. {rnapolis-0.3.14 → rnapolis-0.3.16}/src/rnapolis/molecule_filter.py +0 -0
  20. {rnapolis-0.3.14 → rnapolis-0.3.16}/src/rnapolis/motif_extractor.py +0 -0
  21. {rnapolis-0.3.14 → rnapolis-0.3.16}/src/rnapolis/rfam_folder.py +0 -0
  22. {rnapolis-0.3.14 → rnapolis-0.3.16}/src/rnapolis/tertiary.py +0 -0
  23. {rnapolis-0.3.14 → rnapolis-0.3.16}/src/rnapolis/transformer.py +0 -0
  24. {rnapolis-0.3.14 → rnapolis-0.3.16}/src/rnapolis/util.py +0 -0
  25. {rnapolis-0.3.14 → rnapolis-0.3.16}/tests/test_bugfixes.py +0 -0
  26. {rnapolis-0.3.14 → rnapolis-0.3.16}/tests/test_common.py +0 -0
  27. {rnapolis-0.3.14 → rnapolis-0.3.16}/tests/test_metareader.py +0 -0
  28. {rnapolis-0.3.14 → rnapolis-0.3.16}/tests/test_parser.py +0 -0
  29. {rnapolis-0.3.14 → rnapolis-0.3.16}/tests/test_quadruplexes.py +0 -0
  30. {rnapolis-0.3.14 → rnapolis-0.3.16}/tests/test_rfam_folder.py +0 -0
  31. {rnapolis-0.3.14 → rnapolis-0.3.16}/tests/test_tertiary.py +0 -0
@@ -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
@@ -5,7 +5,7 @@ with open("README.md") as f:
5
5
 
6
6
  setup(
7
7
  name="RNApolis",
8
- version="0.3.14",
8
+ version="0.3.16",
9
9
  packages=["rnapolis"],
10
10
  package_dir={"": "src"},
11
11
  author="Tomasz Zok",
@@ -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
@@ -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
 
@@ -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"])
@@ -1,6 +1,6 @@
1
1
  from collections import Counter
2
2
 
3
- from rnapolis.annotator import extract_base_interactions
3
+ from rnapolis.annotator import extract_base_interactions, extract_secondary_structure
4
4
  from rnapolis.parser import read_3d_structure
5
5
 
6
6
 
@@ -39,3 +39,9 @@ def test_1ehz():
39
39
  assert (
40
40
  False
41
41
  ), f"Interaction {element} occurs {count} times among {labels[i]} type: {duplicates}"
42
+
43
+
44
+ def test_8btk():
45
+ with open("tests/8btk_B7.cif") as f:
46
+ structure3d = read_3d_structure(f, 1)
47
+ assert extract_secondary_structure(structure3d, 1) is not None
File without changes
File without changes
File without changes
File without changes