RNApolis 0.4.12__tar.gz → 0.4.14__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. {rnapolis-0.4.12/src/RNApolis.egg-info → rnapolis-0.4.14}/PKG-INFO +1 -1
  2. {rnapolis-0.4.12 → rnapolis-0.4.14}/setup.py +1 -1
  3. {rnapolis-0.4.12 → rnapolis-0.4.14/src/RNApolis.egg-info}/PKG-INFO +1 -1
  4. {rnapolis-0.4.12 → rnapolis-0.4.14}/src/rnapolis/molecule_filter.py +17 -2
  5. {rnapolis-0.4.12 → rnapolis-0.4.14}/tests/test_molecule_filter.py +7 -2
  6. {rnapolis-0.4.12 → rnapolis-0.4.14}/LICENSE +0 -0
  7. {rnapolis-0.4.12 → rnapolis-0.4.14}/README.md +0 -0
  8. {rnapolis-0.4.12 → rnapolis-0.4.14}/pyproject.toml +0 -0
  9. {rnapolis-0.4.12 → rnapolis-0.4.14}/setup.cfg +0 -0
  10. {rnapolis-0.4.12 → rnapolis-0.4.14}/src/RNApolis.egg-info/SOURCES.txt +0 -0
  11. {rnapolis-0.4.12 → rnapolis-0.4.14}/src/RNApolis.egg-info/dependency_links.txt +0 -0
  12. {rnapolis-0.4.12 → rnapolis-0.4.14}/src/RNApolis.egg-info/entry_points.txt +0 -0
  13. {rnapolis-0.4.12 → rnapolis-0.4.14}/src/RNApolis.egg-info/requires.txt +0 -0
  14. {rnapolis-0.4.12 → rnapolis-0.4.14}/src/RNApolis.egg-info/top_level.txt +0 -0
  15. {rnapolis-0.4.12 → rnapolis-0.4.14}/src/rnapolis/annotator.py +0 -0
  16. {rnapolis-0.4.12 → rnapolis-0.4.14}/src/rnapolis/clashfinder.py +0 -0
  17. {rnapolis-0.4.12 → rnapolis-0.4.14}/src/rnapolis/common.py +0 -0
  18. {rnapolis-0.4.12 → rnapolis-0.4.14}/src/rnapolis/metareader.py +0 -0
  19. {rnapolis-0.4.12 → rnapolis-0.4.14}/src/rnapolis/motif_extractor.py +0 -0
  20. {rnapolis-0.4.12 → rnapolis-0.4.14}/src/rnapolis/parser.py +0 -0
  21. {rnapolis-0.4.12 → rnapolis-0.4.14}/src/rnapolis/rfam_folder.py +0 -0
  22. {rnapolis-0.4.12 → rnapolis-0.4.14}/src/rnapolis/tertiary.py +0 -0
  23. {rnapolis-0.4.12 → rnapolis-0.4.14}/src/rnapolis/transformer.py +0 -0
  24. {rnapolis-0.4.12 → rnapolis-0.4.14}/src/rnapolis/util.py +0 -0
  25. {rnapolis-0.4.12 → rnapolis-0.4.14}/tests/test_annotator.py +0 -0
  26. {rnapolis-0.4.12 → rnapolis-0.4.14}/tests/test_bugfixes.py +0 -0
  27. {rnapolis-0.4.12 → rnapolis-0.4.14}/tests/test_common.py +0 -0
  28. {rnapolis-0.4.12 → rnapolis-0.4.14}/tests/test_metareader.py +0 -0
  29. {rnapolis-0.4.12 → rnapolis-0.4.14}/tests/test_parser.py +0 -0
  30. {rnapolis-0.4.12 → rnapolis-0.4.14}/tests/test_quadruplexes.py +0 -0
  31. {rnapolis-0.4.12 → rnapolis-0.4.14}/tests/test_rfam_folder.py +0 -0
  32. {rnapolis-0.4.12 → rnapolis-0.4.14}/tests/test_tertiary.py +0 -0
  33. {rnapolis-0.4.12 → rnapolis-0.4.14}/tests/test_transformer.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: RNApolis
3
- Version: 0.4.12
3
+ Version: 0.4.14
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.4.12",
8
+ version="0.4.14",
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.4.12
3
+ Version: 0.4.14
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 @@ ENTITY_POLY_TYPES = [
21
21
  ]
22
22
 
23
23
  CATEGORIES_WITH_ENTITY_ID = [
24
+ ("entity", "id"),
24
25
  ("atom_site", "label_entity_id"),
25
26
  ("entity_keywords", "entity_id"),
26
27
  ("entity_name_com", "entity_id"),
@@ -155,7 +156,9 @@ def select_category_by_id(
155
156
 
156
157
 
157
158
  def filter_by_poly_types(
158
- file_content: str, entity_poly_types: Iterable[str] = ["polyribonucleotide"]
159
+ file_content: str,
160
+ entity_poly_types: Iterable[str] = ["polyribonucleotide"],
161
+ retain_categories: Iterable[str] = [],
159
162
  ) -> str:
160
163
  adapter = IoAdapterPy()
161
164
 
@@ -186,13 +189,20 @@ def filter_by_poly_types(
186
189
  obj = DataCategory(category, attributes, rows)
187
190
  output.append(obj)
188
191
 
192
+ for category in retain_categories:
193
+ obj = data[0].getObj(category)
194
+ if obj:
195
+ output.append(obj)
196
+
189
197
  with tempfile.NamedTemporaryFile("rt+") as tmp:
190
198
  adapter.writeFile(tmp.name, [output])
191
199
  tmp.seek(0)
192
200
  return tmp.read()
193
201
 
194
202
 
195
- def filter_by_chains(file_content: str, chains: Iterable[str]) -> str:
203
+ def filter_by_chains(
204
+ file_content: str, chains: Iterable[str], retain_categories: Iterable[str] = []
205
+ ) -> str:
196
206
  """
197
207
  Filter a PDBx/mmCIF file by chain IDs. The function returns a new PDBx/mmCIF file.
198
208
 
@@ -227,6 +237,11 @@ def filter_by_chains(file_content: str, chains: Iterable[str]) -> str:
227
237
  obj = DataCategory(category, attributes, rows)
228
238
  output.append(obj)
229
239
 
240
+ for category in retain_categories:
241
+ obj = data[0].getObj(category)
242
+ if obj:
243
+ output.append(obj)
244
+
230
245
  with tempfile.NamedTemporaryFile("rt+") as tmp:
231
246
  adapter.writeFile(tmp.name, [output])
232
247
  tmp.seek(0)
@@ -1,3 +1,4 @@
1
+ import re
1
2
  import tempfile
2
3
 
3
4
  from rnapolis.molecule_filter import filter_by_chains, filter_by_poly_types
@@ -8,7 +9,9 @@ def test_filter_by_poly_types():
8
9
  with open("tests/1a9n.cif") as f:
9
10
  content = f.read()
10
11
 
11
- filtered = filter_by_poly_types(content, ["polyribonucleotide"])
12
+ filtered = filter_by_poly_types(content, ["polyribonucleotide"], ["chem_comp"])
13
+ assert re.search(r"^_entity\.id", filtered, re.MULTILINE) is not None
14
+ assert re.search(r"^_chem_comp\.id", filtered, re.MULTILINE) is not None
12
15
 
13
16
  with tempfile.NamedTemporaryFile("rt+") as f:
14
17
  f.write(filtered)
@@ -23,7 +26,9 @@ def test_filter_by_chains():
23
26
  with open("tests/1a9n.cif") as f:
24
27
  content = f.read()
25
28
 
26
- filtered = filter_by_chains(content, ["A", "C"])
29
+ filtered = filter_by_chains(content, ["A", "C"], ["chem_comp"])
30
+ assert re.search(r"^_entity\.id", filtered, re.MULTILINE) is not None
31
+ assert re.search(r"^_chem_comp\.id", filtered, re.MULTILINE) is not None
27
32
 
28
33
  with tempfile.NamedTemporaryFile("rt+") as f:
29
34
  f.write(filtered)
File without changes
File without changes
File without changes
File without changes