RNApolis 0.3.16__tar.gz → 0.3.18__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.16/src/RNApolis.egg-info → rnapolis-0.3.18}/PKG-INFO +2 -1
  2. {rnapolis-0.3.16 → rnapolis-0.3.18}/setup.py +2 -1
  3. {rnapolis-0.3.16 → rnapolis-0.3.18/src/RNApolis.egg-info}/PKG-INFO +2 -1
  4. {rnapolis-0.3.16 → rnapolis-0.3.18}/src/RNApolis.egg-info/requires.txt +1 -0
  5. {rnapolis-0.3.16 → rnapolis-0.3.18}/src/rnapolis/annotator.py +3 -4
  6. {rnapolis-0.3.16 → rnapolis-0.3.18}/src/rnapolis/clashfinder.py +1 -2
  7. {rnapolis-0.3.16 → rnapolis-0.3.18}/src/rnapolis/common.py +0 -1
  8. {rnapolis-0.3.16 → rnapolis-0.3.18}/src/rnapolis/metareader.py +11 -1
  9. {rnapolis-0.3.16 → rnapolis-0.3.18}/src/rnapolis/molecule_filter.py +16 -4
  10. {rnapolis-0.3.16 → rnapolis-0.3.18}/src/rnapolis/parser.py +1 -2
  11. {rnapolis-0.3.16 → rnapolis-0.3.18}/src/rnapolis/rfam_folder.py +0 -1
  12. {rnapolis-0.3.16 → rnapolis-0.3.18}/src/rnapolis/tertiary.py +0 -1
  13. {rnapolis-0.3.16 → rnapolis-0.3.18}/tests/test_parser.py +7 -0
  14. {rnapolis-0.3.16 → rnapolis-0.3.18}/LICENSE +0 -0
  15. {rnapolis-0.3.16 → rnapolis-0.3.18}/README.md +0 -0
  16. {rnapolis-0.3.16 → rnapolis-0.3.18}/pyproject.toml +0 -0
  17. {rnapolis-0.3.16 → rnapolis-0.3.18}/setup.cfg +0 -0
  18. {rnapolis-0.3.16 → rnapolis-0.3.18}/src/RNApolis.egg-info/SOURCES.txt +0 -0
  19. {rnapolis-0.3.16 → rnapolis-0.3.18}/src/RNApolis.egg-info/dependency_links.txt +0 -0
  20. {rnapolis-0.3.16 → rnapolis-0.3.18}/src/RNApolis.egg-info/entry_points.txt +0 -0
  21. {rnapolis-0.3.16 → rnapolis-0.3.18}/src/RNApolis.egg-info/top_level.txt +0 -0
  22. {rnapolis-0.3.16 → rnapolis-0.3.18}/src/rnapolis/motif_extractor.py +0 -0
  23. {rnapolis-0.3.16 → rnapolis-0.3.18}/src/rnapolis/transformer.py +0 -0
  24. {rnapolis-0.3.16 → rnapolis-0.3.18}/src/rnapolis/util.py +0 -0
  25. {rnapolis-0.3.16 → rnapolis-0.3.18}/tests/test_annotator.py +0 -0
  26. {rnapolis-0.3.16 → rnapolis-0.3.18}/tests/test_bugfixes.py +0 -0
  27. {rnapolis-0.3.16 → rnapolis-0.3.18}/tests/test_common.py +0 -0
  28. {rnapolis-0.3.16 → rnapolis-0.3.18}/tests/test_metareader.py +0 -0
  29. {rnapolis-0.3.16 → rnapolis-0.3.18}/tests/test_quadruplexes.py +0 -0
  30. {rnapolis-0.3.16 → rnapolis-0.3.18}/tests/test_rfam_folder.py +0 -0
  31. {rnapolis-0.3.16 → rnapolis-0.3.18}/tests/test_tertiary.py +0 -0
@@ -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
@@ -5,7 +5,7 @@ with open("README.md") as f:
5
5
 
6
6
  setup(
7
7
  name="RNApolis",
8
- version="0.3.16",
8
+ version="0.3.18",
9
9
  packages=["rnapolis"],
10
10
  package_dir={"": "src"},
11
11
  author="Tomasz Zok",
@@ -42,6 +42,7 @@ setup(
42
42
  "numpy",
43
43
  "ordered-set",
44
44
  "orjson",
45
+ "pandas",
45
46
  "pulp",
46
47
  "requests",
47
48
  "scipy",
@@ -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
@@ -4,6 +4,7 @@ mmcif
4
4
  numpy
5
5
  ordered-set
6
6
  orjson
7
+ pandas
7
8
  pulp
8
9
  requests
9
10
  scipy
@@ -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")
@@ -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
@@ -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
@@ -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
  )
@@ -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
@@ -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"
@@ -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,
@@ -9,3 +9,10 @@ def test_nucleic_acid_only():
9
9
  with open("tests/184D.cif") as f:
10
10
  structure3d = read_3d_structure(f, 1, nucleic_acid_only=True)
11
11
  assert len(structure3d.residues) == 14
12
+
13
+
14
+ def test_1ato():
15
+ with open("tests/1ATO.pdb") as f:
16
+ structure3d = read_3d_structure(f)
17
+ sequence = "".join([residue.one_letter_name for residue in structure3d.residues])
18
+ assert sequence == "GGCACCUCCUCGCGGUGCC"
File without changes
File without changes
File without changes
File without changes