RNApolis 0.3.16__py3-none-any.whl → 0.3.18__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.16
3
+ Version: 0.3.18
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
@@ -21,6 +21,7 @@ Requires-Dist: mmcif
21
21
  Requires-Dist: numpy
22
22
  Requires-Dist: ordered-set
23
23
  Requires-Dist: orjson
24
+ Requires-Dist: pandas
24
25
  Requires-Dist: pulp
25
26
  Requires-Dist: requests
26
27
  Requires-Dist: scipy
@@ -0,0 +1,17 @@
1
+ rnapolis/annotator.py,sha256=7U3f0gchKdIGc6FwJx0UAc_95HJI5SgECj-b7-1yBhc,22086
2
+ rnapolis/clashfinder.py,sha256=i95kp0o6OWNqmJDBr-PbsZd7RY2iJtBDr7QqolJSuAQ,8513
3
+ rnapolis/common.py,sha256=PUYF01P2vevhyImhZjGYE0jJlsxWHX6GQmsxI4W7S-E,30255
4
+ rnapolis/metareader.py,sha256=I1-cXc2YNBPwa3zihAnMTjEsAo79tEKzSmWu5yvN1Pk,2071
5
+ rnapolis/molecule_filter.py,sha256=hB6-nXgjmw7FAsQ3bj0cZ2FvuW2I1PXunEfcdwEUB1o,7389
6
+ rnapolis/motif_extractor.py,sha256=duHvpi9Ulcny9K60E6VBpz5RpJZw-KdTB4_Ph0iP478,774
7
+ rnapolis/parser.py,sha256=rQuzaRqsNTdHCS8_dKW5uT_nSi0xLnixF5xfy8puo_s,12665
8
+ rnapolis/rfam_folder.py,sha256=SjiiyML_T1__saruFwSMJEoQ7Y55GIU8ktS8ZUn5-fw,11111
9
+ rnapolis/tertiary.py,sha256=wy8n7gfLHj_lIAydGgIwn_RMvBYiJzkSxXU_eff3ym0,19657
10
+ rnapolis/transformer.py,sha256=V9nOQvdq4-p7yUWo0vQg0CDQMpmyxz9t4TMSRVEKHnw,1817
11
+ rnapolis/util.py,sha256=IdquFO3PV1_KDqodjupzm0Rqvgy0CeSzxGHaGEHYXVU,543
12
+ RNApolis-0.3.18.dist-info/LICENSE,sha256=ZGRu12MzCgbYA-Lt8MyBlmjvPZh7xfiD5u5wBx0enq4,1066
13
+ RNApolis-0.3.18.dist-info/METADATA,sha256=OkVdmxEbvCPPkUD1R49oZv5j89ng8-tds1yQeZYzORk,54323
14
+ RNApolis-0.3.18.dist-info/WHEEL,sha256=HiCZjzuy6Dw0hdX5R3LCFPDmFS4BWl8H-8W39XfmgX4,91
15
+ RNApolis-0.3.18.dist-info/entry_points.txt,sha256=foN2Pn5e-OzEz0fFmNoX6PnFSZFQntOlY8LbognP5F0,308
16
+ RNApolis-0.3.18.dist-info/top_level.txt,sha256=LcO18koxZcWoJ21KDRRRo_tyIbmXL5z61dPitZpy8yc,9
17
+ RNApolis-0.3.18.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.43.0)
2
+ Generator: setuptools (72.2.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
rnapolis/annotator.py CHANGED
@@ -10,8 +10,6 @@ from typing import Dict, List, Optional, Set, Tuple
10
10
  import numpy
11
11
  import numpy.typing
12
12
  from ordered_set import OrderedSet
13
- from scipy.spatial import KDTree
14
-
15
13
  from rnapolis.common import (
16
14
  BR,
17
15
  BaseInteractions,
@@ -43,6 +41,7 @@ from rnapolis.tertiary import (
43
41
  torsion_angle,
44
42
  )
45
43
  from rnapolis.util import handle_input_file
44
+ from scipy.spatial import KDTree
46
45
 
47
46
  HYDROGEN_BOND_MAX_DISTANCE = 4.0
48
47
  HYDROGEN_BOND_ANGLE_RANGE = (50.0, 130.0) # 90 degrees is ideal, so allow +- 40 degrees
@@ -149,7 +148,7 @@ def detect_bph_br_classification(
149
148
 
150
149
 
151
150
  def merge_and_clean_bph_br(
152
- pairs: List[Tuple[Residue3D, Residue3D, int]]
151
+ pairs: List[Tuple[Residue3D, Residue3D, int]],
153
152
  ) -> Dict[Tuple[Residue3D, Residue3D], OrderedSet[int]]:
154
153
  bph_br_map: Dict[Tuple[Residue3D, Residue3D], OrderedSet[int]] = defaultdict(
155
154
  OrderedSet
@@ -588,7 +587,7 @@ def main():
588
587
  "-a",
589
588
  "--all-dot-brackets",
590
589
  action="store_true",
591
- help=")optional) print all dot-brackets, not only optimal one (exclusive with -e/--extended)",
590
+ help="(optional) print all dot-brackets, not only optimal one (exclusive with -e/--extended)",
592
591
  )
593
592
  parser.add_argument("-b", "--bpseq", help="(optional) path to output BPSEQ file")
594
593
  parser.add_argument("-c", "--csv", help="(optional) path to output CSV file")
rnapolis/clashfinder.py CHANGED
@@ -8,11 +8,10 @@ from functools import cached_property
8
8
  from typing import List, Optional
9
9
 
10
10
  import numpy as np
11
- from scipy.spatial import KDTree
12
-
13
11
  from rnapolis.metareader import read_metadata
14
12
  from rnapolis.parser import read_3d_structure
15
13
  from rnapolis.tertiary import Atom, Residue3D
14
+ from scipy.spatial import KDTree
16
15
 
17
16
  CARBON_RADIUS = 0.6
18
17
  NITROGEN_RADIUS = 0.54
rnapolis/common.py CHANGED
@@ -8,7 +8,6 @@ from collections.abc import Sequence
8
8
  from dataclasses import dataclass
9
9
  from enum import Enum
10
10
  from functools import cache, cached_property, total_ordering
11
- from itertools import permutations
12
11
  from typing import Dict, List, Optional, Tuple
13
12
 
14
13
  import graphviz
rnapolis/metareader.py CHANGED
@@ -3,9 +3,9 @@ import argparse
3
3
  from typing import IO, Dict, List
4
4
 
5
5
  import orjson
6
+ import pandas as pd
6
7
  from mmcif.io.IoAdapterPy import IoAdapterPy
7
8
  from mmcif.io.PdbxReader import DataContainer
8
-
9
9
  from rnapolis.util import handle_input_file
10
10
 
11
11
 
@@ -46,6 +46,10 @@ def main():
46
46
  help="read the mmCIF file and list categories available inside",
47
47
  action="store_true",
48
48
  )
49
+ parser.add_argument(
50
+ "--csv-directory",
51
+ help="directory where to output CSV per each category",
52
+ )
49
53
  args = parser.parse_args()
50
54
 
51
55
  file = handle_input_file(args.path)
@@ -57,6 +61,12 @@ def main():
57
61
  result = read_metadata(file, args.category)
58
62
  print(orjson.dumps(result).decode("utf-8"))
59
63
 
64
+ if args.csv_directory:
65
+ for category in result:
66
+ with open(f"{args.csv_directory}/{category}.csv", "w") as f:
67
+ df = pd.DataFrame(result[category])
68
+ df.to_csv(f, index=False)
69
+
60
70
 
61
71
  if __name__ == "__main__":
62
72
  main()
@@ -5,7 +5,6 @@ from typing import List, Set, Tuple
5
5
 
6
6
  from mmcif.io.IoAdapterPy import IoAdapterPy
7
7
  from mmcif.io.PdbxReader import DataCategory, DataContainer
8
-
9
8
  from rnapolis.util import handle_input_file
10
9
 
11
10
  # Source: https://mmcif.wwpdb.org/dictionaries/mmcif_pdbx_v50.dic/Items/_entity_poly.type.html
@@ -158,11 +157,17 @@ def main():
158
157
  parser = argparse.ArgumentParser()
159
158
  parser.add_argument(
160
159
  "--type",
161
- help="a type of molecule to select (default: polyribonucleotide)",
160
+ help="a type of molecule to select, you can provide this argument multiple times (default: polyribonucleotide)",
162
161
  action="append",
163
162
  default=["polyribonucleotide"],
164
163
  choices=ENTITY_POLY_TYPES,
165
164
  )
165
+ parser.add_argument(
166
+ "--chain",
167
+ help="a chain ID (label_asym_id) to select, you can provide this argument multiple times (if provided, it overrides the --type argument)",
168
+ action="append",
169
+ default=[],
170
+ )
166
171
  parser.add_argument("path", help="path to a PDBx/mmCIF file")
167
172
  args = parser.parse_args()
168
173
 
@@ -171,8 +176,15 @@ def main():
171
176
  data = adapter.readFile(file.name)
172
177
  output = DataContainer("rnapolis")
173
178
 
174
- entity_ids = select_ids(data, "entity_poly", "type", "entity_id", set(args.type))
175
- asym_ids = select_ids(data, "struct_asym", "entity_id", "id", entity_ids)
179
+ if args.chain:
180
+ entity_ids = select_ids(data, "struct_asym", "id", "entity_id", set(args.chain))
181
+ asym_ids = set(args.chain)
182
+ else:
183
+ entity_ids = select_ids(
184
+ data, "entity_poly", "type", "entity_id", set(args.type)
185
+ )
186
+ asym_ids = select_ids(data, "struct_asym", "entity_id", "id", entity_ids)
187
+
176
188
  auth_asym_ids = select_ids(
177
189
  data, "atom_site", "label_asym_id", "auth_asym_id", asym_ids
178
190
  )
rnapolis/parser.py CHANGED
@@ -2,7 +2,6 @@ import logging
2
2
  from typing import IO, Dict, List, Optional, Tuple, Union
3
3
 
4
4
  from mmcif.io.IoAdapterPy import IoAdapterPy
5
-
6
5
  from rnapolis.common import ResidueAuth, ResidueLabel
7
6
  from rnapolis.tertiary import BASE_ATOMS, Atom, Residue3D, Structure3D
8
7
 
@@ -212,7 +211,7 @@ def parse_pdb(
212
211
  if alternate_location != " ":
213
212
  continue
214
213
  atom_name = line[12:16].strip()
215
- residue_name = line[18:20].strip()
214
+ residue_name = line[17:20].strip()
216
215
  chain_identifier = line[21]
217
216
  residue_number = int(line[22:26].strip())
218
217
  insertion_code = line[26] if line[26] != " " else None
rnapolis/rfam_folder.py CHANGED
@@ -14,7 +14,6 @@ from typing import List
14
14
  import appdirs
15
15
  import requests
16
16
  import RNA
17
-
18
17
  from rnapolis.common import BpSeq, DotBracket
19
18
 
20
19
  COMBINED_CM = "https://ftp.ebi.ac.uk/pub/databases/Rfam/CURRENT/Rfam.cm.gz"
rnapolis/tertiary.py CHANGED
@@ -7,7 +7,6 @@ from typing import Dict, List, Optional, Set, Tuple, Union
7
7
 
8
8
  import numpy
9
9
  import numpy.typing
10
-
11
10
  from rnapolis.common import (
12
11
  BasePair,
13
12
  BpSeq,
@@ -1,17 +0,0 @@
1
- rnapolis/annotator.py,sha256=XnjFBeu3P_2UMdkD4Ao7m7K6JfeqYa-13xRzghrLvt8,22086
2
- rnapolis/clashfinder.py,sha256=jD3s_UovygWi01NUbQNeAeRRFkARTSRraLXUV43UbAA,8514
3
- rnapolis/common.py,sha256=tbmKV64nLClmzNN0HyKnvWA0-5aSyf4x8CGpBjpIJ4M,30290
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=6xEeQghil0eXIzi0bNUkebknfqIxx9EfOfT9q33eN4A,12666
8
- rnapolis/rfam_folder.py,sha256=3rgXEJR16uPFy_BOo8qkdClOAOQDVOkidnLE-yoRbeI,11112
9
- rnapolis/tertiary.py,sha256=VuATTN2SD7lBL9iUgT-doDwuEYsLodgV2u-SwQsyQcU,19658
10
- rnapolis/transformer.py,sha256=V9nOQvdq4-p7yUWo0vQg0CDQMpmyxz9t4TMSRVEKHnw,1817
11
- rnapolis/util.py,sha256=IdquFO3PV1_KDqodjupzm0Rqvgy0CeSzxGHaGEHYXVU,543
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,,