RNApolis 0.3.9__py3-none-any.whl → 0.3.11__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: RNApolis
3
- Version: 0.3.9
3
+ Version: 0.3.11
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
@@ -0,0 +1,17 @@
1
+ rnapolis/annotator.py,sha256=bcyqmUSSRyl0ejA3548K4czSElBMX3EpCKAfJ2tYjsw,21476
2
+ rnapolis/clashfinder.py,sha256=jD3s_UovygWi01NUbQNeAeRRFkARTSRraLXUV43UbAA,8514
3
+ rnapolis/common.py,sha256=owupPG9oylz4Ed4DqVYJqWIKpovLJ3EIIApgca6tuhg,27344
4
+ rnapolis/metareader.py,sha256=4qtMKRvww2sUStLeV8WVrLEt-ScydHUv4Gxx96tnf-M,1683
5
+ rnapolis/molecule_filter.py,sha256=NhjuqdCRnXgPefWZPeTq77tifmnAzamQtA0ODqPPG9k,6918
6
+ rnapolis/motif_extractor.py,sha256=duHvpi9Ulcny9K60E6VBpz5RpJZw-KdTB4_Ph0iP478,774
7
+ rnapolis/parser.py,sha256=0uNKPnKiv5uaFVFGIzP8xbGLokimBkjs1XdlV0JmKIw,12217
8
+ rnapolis/rfam_folder.py,sha256=3rgXEJR16uPFy_BOo8qkdClOAOQDVOkidnLE-yoRbeI,11112
9
+ rnapolis/tertiary.py,sha256=iWMPD9c21rjMPpEdBd7mPCQgds65IbOr4_Fy06s0NoU,18957
10
+ rnapolis/transformer.py,sha256=V9nOQvdq4-p7yUWo0vQg0CDQMpmyxz9t4TMSRVEKHnw,1817
11
+ rnapolis/util.py,sha256=IdquFO3PV1_KDqodjupzm0Rqvgy0CeSzxGHaGEHYXVU,543
12
+ RNApolis-0.3.11.dist-info/LICENSE,sha256=ZGRu12MzCgbYA-Lt8MyBlmjvPZh7xfiD5u5wBx0enq4,1066
13
+ RNApolis-0.3.11.dist-info/METADATA,sha256=J0a3wmvQoWPVFgSgvIxMkMFSBCz3KFHB8BHKFNtIdKw,54301
14
+ RNApolis-0.3.11.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
15
+ RNApolis-0.3.11.dist-info/entry_points.txt,sha256=foN2Pn5e-OzEz0fFmNoX6PnFSZFQntOlY8LbognP5F0,308
16
+ RNApolis-0.3.11.dist-info/top_level.txt,sha256=LcO18koxZcWoJ21KDRRRo_tyIbmXL5z61dPitZpy8yc,9
17
+ RNApolis-0.3.11.dist-info/RECORD,,
rnapolis/annotator.py CHANGED
@@ -486,7 +486,7 @@ def extract_secondary_structure(
486
486
  tertiary_structure: Structure3D,
487
487
  model: Optional[int] = None,
488
488
  find_gaps: bool = False,
489
- ) -> BaseInteractions:
489
+ ) -> Structure2D:
490
490
  base_interactions = extract_base_interactions(tertiary_structure, model)
491
491
  mapping = Mapping2D3D(
492
492
  tertiary_structure,
rnapolis/common.py CHANGED
@@ -1,6 +1,7 @@
1
1
  import itertools
2
2
  import logging
3
3
  import os
4
+ import re
4
5
  import string
5
6
  from collections import defaultdict
6
7
  from collections.abc import Sequence
@@ -896,6 +897,37 @@ class DotBracket:
896
897
  return f"{self.sequence}\n{self.structure}"
897
898
 
898
899
 
900
+ @dataclass
901
+ class MultiStrandDotBracket(DotBracket):
902
+ strands: List[Strand]
903
+
904
+ @staticmethod
905
+ def from_string(input: str):
906
+ strands = []
907
+ first = 1
908
+
909
+ for match in re.finditer(
910
+ r"((>.*?\n)?([ACGUNacgun]+)\n([.()\[\]{}<>A-Za-z]+))", input
911
+ ):
912
+ sequence = match.group(3)
913
+ structure = match.group(4)
914
+ assert len(sequence) == len(structure)
915
+ last = first + len(sequence) - 1
916
+ strands.append(Strand(first, last, sequence, structure))
917
+ first = last + 1
918
+
919
+ return MultiStrandDotBracket(
920
+ "".join(strand.sequence for strand in strands),
921
+ "".join(strand.structure for strand in strands),
922
+ strands,
923
+ )
924
+
925
+ @staticmethod
926
+ def from_file(path: str):
927
+ with open(path) as f:
928
+ return MultiStrandDotBracket.from_string(f.read())
929
+
930
+
899
931
  @dataclass(frozen=True, order=True)
900
932
  class BaseInteractions:
901
933
  basePairs: List[BasePair]
rnapolis/parser.py CHANGED
@@ -12,8 +12,15 @@ def read_3d_structure(
12
12
  atoms, modified, sequence = (
13
13
  parse_cif(cif_or_pdb) if is_cif(cif_or_pdb) else parse_pdb(cif_or_pdb)
14
14
  )
15
- if model is not None:
16
- atoms = list(filter(lambda atom: atom.model == model, atoms))
15
+ available_models = {atom.model: None for atom in atoms}
16
+ atoms_by_model = {
17
+ model: list(filter(lambda atom: atom.model == model, atoms))
18
+ for model in available_models
19
+ }
20
+ if model is not None and model in available_models:
21
+ atoms = atoms_by_model[model]
22
+ else:
23
+ atoms = atoms_by_model[list(available_models.keys())[0]]
17
24
  return group_atoms(atoms, modified, sequence, nucleic_acid_only)
18
25
 
19
26
 
@@ -1,17 +0,0 @@
1
- rnapolis/annotator.py,sha256=8AwrCKy_5CKU3HsRgqj5U2aQrAXiysoAnqjsDdvCAEA,21481
2
- rnapolis/clashfinder.py,sha256=jD3s_UovygWi01NUbQNeAeRRFkARTSRraLXUV43UbAA,8514
3
- rnapolis/common.py,sha256=DPmRpNkMaxuIai3vfLzSlP6IN0zpj6kmT3LoRjnJUWE,26440
4
- rnapolis/metareader.py,sha256=4qtMKRvww2sUStLeV8WVrLEt-ScydHUv4Gxx96tnf-M,1683
5
- rnapolis/molecule_filter.py,sha256=NhjuqdCRnXgPefWZPeTq77tifmnAzamQtA0ODqPPG9k,6918
6
- rnapolis/motif_extractor.py,sha256=duHvpi9Ulcny9K60E6VBpz5RpJZw-KdTB4_Ph0iP478,774
7
- rnapolis/parser.py,sha256=D2PwAFurTjZDP8WBV2AOxFHPLAFE8U1G_vC_5Y7BE4U,11948
8
- rnapolis/rfam_folder.py,sha256=3rgXEJR16uPFy_BOo8qkdClOAOQDVOkidnLE-yoRbeI,11112
9
- rnapolis/tertiary.py,sha256=iWMPD9c21rjMPpEdBd7mPCQgds65IbOr4_Fy06s0NoU,18957
10
- rnapolis/transformer.py,sha256=V9nOQvdq4-p7yUWo0vQg0CDQMpmyxz9t4TMSRVEKHnw,1817
11
- rnapolis/util.py,sha256=IdquFO3PV1_KDqodjupzm0Rqvgy0CeSzxGHaGEHYXVU,543
12
- RNApolis-0.3.9.dist-info/LICENSE,sha256=ZGRu12MzCgbYA-Lt8MyBlmjvPZh7xfiD5u5wBx0enq4,1066
13
- RNApolis-0.3.9.dist-info/METADATA,sha256=E-6_MxMx9qQZK18G7EzHgwuxwYhchfkVXusFdBpG6nY,54300
14
- RNApolis-0.3.9.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
15
- RNApolis-0.3.9.dist-info/entry_points.txt,sha256=foN2Pn5e-OzEz0fFmNoX6PnFSZFQntOlY8LbognP5F0,308
16
- RNApolis-0.3.9.dist-info/top_level.txt,sha256=LcO18koxZcWoJ21KDRRRo_tyIbmXL5z61dPitZpy8yc,9
17
- RNApolis-0.3.9.dist-info/RECORD,,