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