RNApolis 0.1.5__py3-none-any.whl → 0.2.0__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.1.5
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
@@ -0,0 +1,15 @@
1
+ rnapolis/annotator.py,sha256=XtEJrog8c3zZ-pLlGBytJExGahPstGd-nbPLKQLa58A,21228
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/motif_extractor.py,sha256=duHvpi9Ulcny9K60E6VBpz5RpJZw-KdTB4_Ph0iP478,774
6
+ rnapolis/parser.py,sha256=Z3Zd_IuRyOP45x5BStgu7UgoyHthhw55fT3udHUhAE4,11905
7
+ rnapolis/tertiary.py,sha256=iWMPD9c21rjMPpEdBd7mPCQgds65IbOr4_Fy06s0NoU,18957
8
+ rnapolis/transformer.py,sha256=V9nOQvdq4-p7yUWo0vQg0CDQMpmyxz9t4TMSRVEKHnw,1817
9
+ rnapolis/util.py,sha256=IdquFO3PV1_KDqodjupzm0Rqvgy0CeSzxGHaGEHYXVU,543
10
+ RNApolis-0.2.0.dist-info/LICENSE,sha256=ZGRu12MzCgbYA-Lt8MyBlmjvPZh7xfiD5u5wBx0enq4,1066
11
+ RNApolis-0.2.0.dist-info/METADATA,sha256=-ApE3-kETFzu512tLPAQa7MJjY7tuT-qyHLkPMBhI7A,1148
12
+ RNApolis-0.2.0.dist-info/WHEEL,sha256=Xo9-1PvkuimrydujYJAjF7pCkriuXBpUPEjma1nZyJ0,92
13
+ RNApolis-0.2.0.dist-info/entry_points.txt,sha256=113HwzaWSIoCvcPxkg_j2TIbnezP4_7akpTNr5n3Zjg,220
14
+ RNApolis-0.2.0.dist-info/top_level.txt,sha256=LcO18koxZcWoJ21KDRRRo_tyIbmXL5z61dPitZpy8yc,9
15
+ RNApolis-0.2.0.dist-info/RECORD,,
rnapolis/annotator.py CHANGED
@@ -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 IO, Dict, List, Optional, Set, Tuple
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 extract_secondary_structure(
475
- tertiary_structure: Structure3D, model: int = 1, find_gaps: bool = False
476
- ) -> Structure2D:
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
- mapping = Mapping2D3D(tertiary_structure, base_pairs, stackings, find_gaps)
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
- base_pairs,
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: 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: 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"])
rnapolis/common.py CHANGED
@@ -897,12 +897,17 @@ class DotBracket:
897
897
 
898
898
 
899
899
  @dataclass(frozen=True, order=True)
900
- class Structure2D:
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():
rnapolis/tertiary.py CHANGED
@@ -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,15 +0,0 @@
1
- rnapolis/annotator.py,sha256=_J-ydWfoGgkzwxRoQRGPTxs45rkd823y2zyEiBhYK7E,20921
2
- rnapolis/clashfinder.py,sha256=jD3s_UovygWi01NUbQNeAeRRFkARTSRraLXUV43UbAA,8514
3
- rnapolis/common.py,sha256=7oDhrlE-_hgzR6YOacL1rnanmMRg90idY-7BCBPZslQ,26339
4
- rnapolis/metareader.py,sha256=4qtMKRvww2sUStLeV8WVrLEt-ScydHUv4Gxx96tnf-M,1683
5
- rnapolis/motif_extractor.py,sha256=VJV1jUPschb_YZTwIatoqF3JQ_jc8uygQZGBao8k9wo,958
6
- rnapolis/parser.py,sha256=Z3Zd_IuRyOP45x5BStgu7UgoyHthhw55fT3udHUhAE4,11905
7
- rnapolis/tertiary.py,sha256=PuW2TZJuXzrDvYpR4fnFzsvyOvZlRv2b97N9sUPH1vQ,19005
8
- rnapolis/transformer.py,sha256=V9nOQvdq4-p7yUWo0vQg0CDQMpmyxz9t4TMSRVEKHnw,1817
9
- rnapolis/util.py,sha256=IdquFO3PV1_KDqodjupzm0Rqvgy0CeSzxGHaGEHYXVU,543
10
- RNApolis-0.1.5.dist-info/LICENSE,sha256=ZGRu12MzCgbYA-Lt8MyBlmjvPZh7xfiD5u5wBx0enq4,1066
11
- RNApolis-0.1.5.dist-info/METADATA,sha256=9u0fjRcuuEcM0dB65JdtKyC-9uRtnWw8WDbjOMamIJs,1124
12
- RNApolis-0.1.5.dist-info/WHEEL,sha256=Xo9-1PvkuimrydujYJAjF7pCkriuXBpUPEjma1nZyJ0,92
13
- RNApolis-0.1.5.dist-info/entry_points.txt,sha256=113HwzaWSIoCvcPxkg_j2TIbnezP4_7akpTNr5n3Zjg,220
14
- RNApolis-0.1.5.dist-info/top_level.txt,sha256=LcO18koxZcWoJ21KDRRRo_tyIbmXL5z61dPitZpy8yc,9
15
- RNApolis-0.1.5.dist-info/RECORD,,