molutils 0.1.0__tar.gz → 0.2.0__tar.gz
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.
- {molutils-0.1.0 → molutils-0.2.0}/PKG-INFO +6 -3
- molutils-0.2.0/README.md +2 -0
- {molutils-0.1.0 → molutils-0.2.0}/molutils/__init__.py +3 -0
- {molutils-0.1.0 → molutils-0.2.0}/molutils/_core/extract.py +17 -1
- molutils-0.2.0/molutils/_core/list_.py +16 -0
- molutils-0.2.0/molutils/_parsers/parser_pdb.py +47 -0
- molutils-0.2.0/molutils/_ui/__init__.py +0 -0
- molutils-0.2.0/molutils/_ui/app.py +123 -0
- molutils-0.2.0/molutils/_ui/fy_help.fyh +45 -0
- molutils-0.2.0/molutils/_ui/fy_rules.fyr +29 -0
- molutils-0.2.0/molutils/_version.py +1 -0
- {molutils-0.1.0 → molutils-0.2.0}/molutils.egg-info/PKG-INFO +6 -3
- {molutils-0.1.0 → molutils-0.2.0}/molutils.egg-info/SOURCES.txt +3 -0
- molutils-0.2.0/molutils.egg-info/requires.txt +1 -0
- {molutils-0.1.0 → molutils-0.2.0}/setup.py +2 -2
- molutils-0.1.0/README.md +0 -1
- molutils-0.1.0/molutils/_ui/app.py +0 -76
- molutils-0.1.0/molutils/_ui/fy_help.fyh +0 -20
- molutils-0.1.0/molutils/_ui/fy_rules.fyr +0 -12
- molutils-0.1.0/molutils/_version.py +0 -1
- molutils-0.1.0/molutils.egg-info/requires.txt +0 -1
- {molutils-0.1.0 → molutils-0.2.0}/LICENSE.md +0 -0
- {molutils-0.1.0 → molutils-0.2.0}/molutils/__main__.py +0 -0
- {molutils-0.1.0 → molutils-0.2.0}/molutils/_core/__init__.py +0 -0
- {molutils-0.1.0 → molutils-0.2.0}/molutils/_core/count.py +0 -0
- {molutils-0.1.0/molutils/_ui → molutils-0.2.0/molutils/_parsers}/__init__.py +0 -0
- {molutils-0.1.0 → molutils-0.2.0}/molutils.egg-info/dependency_links.txt +0 -0
- {molutils-0.1.0 → molutils-0.2.0}/molutils.egg-info/entry_points.txt +0 -0
- {molutils-0.1.0 → molutils-0.2.0}/molutils.egg-info/top_level.txt +0 -0
- {molutils-0.1.0 → molutils-0.2.0}/pyproject.toml +0 -0
- {molutils-0.1.0 → molutils-0.2.0}/setup.cfg +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: molutils
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Collection of tools for preprocessing or summarizing details from biomolecular structure files.
|
|
4
5
|
Home-page: https://github.com/diegobarmor/molutils
|
|
5
6
|
Author: DiegoBarMor
|
|
6
7
|
Author-email: diegobarmor42@gmail.com
|
|
@@ -11,7 +12,7 @@ Classifier: Operating System :: OS Independent
|
|
|
11
12
|
Requires-Python: >=3.10
|
|
12
13
|
Description-Content-Type: text/markdown
|
|
13
14
|
License-File: LICENSE.md
|
|
14
|
-
Requires-Dist: freyacli==0.
|
|
15
|
+
Requires-Dist: freyacli==0.3.1
|
|
15
16
|
Dynamic: author
|
|
16
17
|
Dynamic: author-email
|
|
17
18
|
Dynamic: classifier
|
|
@@ -23,5 +24,7 @@ Dynamic: license
|
|
|
23
24
|
Dynamic: license-file
|
|
24
25
|
Dynamic: requires-dist
|
|
25
26
|
Dynamic: requires-python
|
|
27
|
+
Dynamic: summary
|
|
26
28
|
|
|
27
|
-
#
|
|
29
|
+
# MolUtils
|
|
30
|
+
MolUtils is a collection of tools for preprocessing or summarizing details from biomolecular structure files.
|
molutils-0.2.0/README.md
ADDED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
from
|
|
1
|
+
from collections import defaultdict
|
|
2
|
+
|
|
3
|
+
import molutils as mu
|
|
2
4
|
|
|
3
5
|
# //////////////////////////////////////////////////////////////////////////////
|
|
4
6
|
class Extract:
|
|
@@ -25,4 +27,18 @@ class Extract:
|
|
|
25
27
|
data = data[idx:]
|
|
26
28
|
|
|
27
29
|
|
|
30
|
+
# --------------------------------------------------------------------------
|
|
31
|
+
@classmethod
|
|
32
|
+
def split_chains(cls, data: str) -> dict[str, str]:
|
|
33
|
+
pdb = mu.ParserPDB(data)
|
|
34
|
+
chains = defaultdict(list)
|
|
35
|
+
for line in pdb.iter_atoms():
|
|
36
|
+
chain_id = mu.ParserPDB.get_chainid(line)
|
|
37
|
+
chains[chain_id].append(line)
|
|
38
|
+
return {
|
|
39
|
+
chain_id: mu.ParserPDB.join_lines(lines)
|
|
40
|
+
for chain_id, lines in chains.items()
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
28
44
|
# //////////////////////////////////////////////////////////////////////////////
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
|
|
3
|
+
import molutils as mu
|
|
4
|
+
|
|
5
|
+
# //////////////////////////////////////////////////////////////////////////////
|
|
6
|
+
class List:
|
|
7
|
+
# --------------------------------------------------------------------------
|
|
8
|
+
@classmethod
|
|
9
|
+
def chains(cls, path_pdb: Path, first_only: bool = False) -> list[str]:
|
|
10
|
+
pdb = mu.ParserPDB.from_file(path_pdb)
|
|
11
|
+
gen_chain_ids = (mu.ParserPDB.get_chainid(line) for line in pdb.iter_atoms())
|
|
12
|
+
if first_only: return mu.ParserPDB.safe_next(gen_chain_ids)
|
|
13
|
+
return sorted(set(gen_chain_ids))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
# //////////////////////////////////////////////////////////////////////////////
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
|
|
3
|
+
# //////////////////////////////////////////////////////////////////////////////
|
|
4
|
+
class ParserPDB:
|
|
5
|
+
LENGTH_RECORD = 80
|
|
6
|
+
IDX_CHAIN_ID = 21
|
|
7
|
+
|
|
8
|
+
# --------------------------------------------------------------------------
|
|
9
|
+
def __init__(self, data_pdb: str):
|
|
10
|
+
self.data = data_pdb.splitlines()
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
# --------------------------------------------------------------------------
|
|
14
|
+
@classmethod
|
|
15
|
+
def from_file(cls, path_pdb: Path):
|
|
16
|
+
return cls(path_pdb.read_text())
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
# --------------------------------------------------------------------------
|
|
20
|
+
@classmethod
|
|
21
|
+
def join_lines(cls, lines: list[str]) -> str:
|
|
22
|
+
return '\n'.join(lines) + "\nEND"
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# --------------------------------------------------------------------------
|
|
26
|
+
def iter_atoms(self):
|
|
27
|
+
return (
|
|
28
|
+
line for line in self.data
|
|
29
|
+
if line.startswith("ATOM") or line.startswith("HETATM")
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# --------------------------------------------------------------------------
|
|
34
|
+
@classmethod
|
|
35
|
+
def safe_next(cls, gen):
|
|
36
|
+
try: return next(gen)
|
|
37
|
+
except StopIteration: raise ValueError(f"No ATOM records found in PDB file")
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
# --------------------------------------------------------------------------
|
|
41
|
+
@classmethod
|
|
42
|
+
def get_chainid(cls, line: str) -> str:
|
|
43
|
+
try: return line[cls.IDX_CHAIN_ID]
|
|
44
|
+
except IndexError: raise ValueError(f"Unexpected format of ATOM records in PDB file")
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
# //////////////////////////////////////////////////////////////////////////////
|
|
File without changes
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
|
|
3
|
+
import molutils as mu
|
|
4
|
+
|
|
5
|
+
import freyacli as fy
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# //////////////////////////////////////////////////////////////////////////////
|
|
9
|
+
class App(fy.App):
|
|
10
|
+
_APP_NAME = "molutils"
|
|
11
|
+
_VERSION = mu.__version__
|
|
12
|
+
|
|
13
|
+
# --------------------------------------------------------------------------
|
|
14
|
+
def __init__(self, argv: list[str]):
|
|
15
|
+
dir_ui = Path(__file__).parent
|
|
16
|
+
super().__init__(
|
|
17
|
+
args = argv,
|
|
18
|
+
path_fyr = dir_ui / "fy_rules.fyr",
|
|
19
|
+
path_fyh = dir_ui / "fy_help.fyh",
|
|
20
|
+
)
|
|
21
|
+
self.subcommands = self.get_path_to_root()
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
# --------------------------------------------------------------------------
|
|
25
|
+
def run(self):
|
|
26
|
+
command = self.subcommands.pop(0)
|
|
27
|
+
if command == "list" : return self._run_list()
|
|
28
|
+
if command == "count" : return self._run_count()
|
|
29
|
+
if command == "extract": return self._run_extract()
|
|
30
|
+
if command == "select" : return self._run_select()
|
|
31
|
+
raise ValueError(f"Unknown command: {command}")
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
# --------------------------------------------------------------------------
|
|
35
|
+
def _run_list(self):
|
|
36
|
+
def list_chains():
|
|
37
|
+
path_in = self.get_arg_path("path_in")
|
|
38
|
+
first_only = self.get_arg_bool("first_only")
|
|
39
|
+
self.assert_file_in(path_in)
|
|
40
|
+
print(*mu.List.chains(path_in, first_only))
|
|
41
|
+
|
|
42
|
+
command = self.subcommands.pop(0)
|
|
43
|
+
|
|
44
|
+
if command == "chains": return list_chains()
|
|
45
|
+
|
|
46
|
+
raise ValueError(f"Unknown command: {command}")
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
# --------------------------------------------------------------------------
|
|
50
|
+
def _run_count(self):
|
|
51
|
+
def count_models():
|
|
52
|
+
path_in = self.get_arg_path("path_in")
|
|
53
|
+
self.assert_file_in(path_in)
|
|
54
|
+
print(mu.Count.models(path_in))
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
command = self.subcommands.pop(0)
|
|
58
|
+
|
|
59
|
+
if command == "models": return count_models()
|
|
60
|
+
|
|
61
|
+
raise ValueError(f"Unknown command: {command}")
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
# --------------------------------------------------------------------------
|
|
65
|
+
def _run_extract(self):
|
|
66
|
+
def extract_models():
|
|
67
|
+
path_in = self.get_arg_path("path_in")
|
|
68
|
+
self.assert_file_in(path_in)
|
|
69
|
+
|
|
70
|
+
folder_out = self.get_arg_path("folder_out", default = path_in.parent)
|
|
71
|
+
self.assert_dir_out(folder_out)
|
|
72
|
+
|
|
73
|
+
data_pdb = path_in.read_text()
|
|
74
|
+
|
|
75
|
+
if self.get_arg_bool("first_only"):
|
|
76
|
+
_, model = mu.Extract.next_model(data_pdb)
|
|
77
|
+
path_out = folder_out / f"{path_in.stem}.m0.pdb"
|
|
78
|
+
path_out.write_text(model)
|
|
79
|
+
return
|
|
80
|
+
|
|
81
|
+
for i, model in enumerate(mu.Extract.iter_models(data_pdb)):
|
|
82
|
+
path_out = folder_out / f"{path_in.stem}.m{i:03}.pdb"
|
|
83
|
+
path_out.write_text(model)
|
|
84
|
+
|
|
85
|
+
def extract_chains():
|
|
86
|
+
path_in = self.get_arg_path("path_in")
|
|
87
|
+
self.assert_file_in(path_in)
|
|
88
|
+
|
|
89
|
+
folder_out = self.get_arg_path("folder_out", default = path_in.parent)
|
|
90
|
+
self.assert_dir_out(folder_out)
|
|
91
|
+
|
|
92
|
+
data_pdb = path_in.read_text()
|
|
93
|
+
|
|
94
|
+
chains = mu.Extract.split_chains(data_pdb)
|
|
95
|
+
|
|
96
|
+
chain_ids = mu.List.chains(path_in, first_only = True) \
|
|
97
|
+
if self.get_arg_bool("first_only") else chains.keys()
|
|
98
|
+
|
|
99
|
+
for chain_id in chain_ids:
|
|
100
|
+
path_out = folder_out / f"{path_in.stem}.{chain_id}.pdb"
|
|
101
|
+
path_out.write_text(chains[chain_id])
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
command = self.subcommands.pop(0)
|
|
105
|
+
|
|
106
|
+
if command == "models": return extract_models()
|
|
107
|
+
if command == "chains": return extract_chains()
|
|
108
|
+
|
|
109
|
+
raise ValueError(f"Unknown command: {command}")
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
# --------------------------------------------------------------------------
|
|
113
|
+
def _run_select(self):
|
|
114
|
+
query = self.get_arg_str("query")
|
|
115
|
+
path_in = self.get_arg_path("path_in")
|
|
116
|
+
path_out = self.get_arg_path("path_out")
|
|
117
|
+
self.assert_file_in(path_in)
|
|
118
|
+
|
|
119
|
+
import MDAnalysis as mda
|
|
120
|
+
mda.Universe(path_in).select_atoms(query).write(path_out)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
# //////////////////////////////////////////////////////////////////////////////
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
!fyh:_ molutils is a collection of tools for preprocessing or summarizing details from biomolecular structure files.
|
|
2
|
+
|
|
3
|
+
@list
|
|
4
|
+
!fyh:_ Lists the unique values for different aspects of biomolecular structures.
|
|
5
|
+
@chains
|
|
6
|
+
!fyh:_ Lists the chains in a PDB file.
|
|
7
|
+
!fyh:path_in Path of a PDB file.
|
|
8
|
+
!fyh:first_only Use this flag for displaying only the first chain of the structure.
|
|
9
|
+
!@
|
|
10
|
+
!@
|
|
11
|
+
|
|
12
|
+
@count
|
|
13
|
+
!fyh:_ Provides counts for different aspects of biomolecular structures.
|
|
14
|
+
@models
|
|
15
|
+
!fyh:_ Counts the number of models in a PDB file.
|
|
16
|
+
!fyh:path_in Path of a PDB file.
|
|
17
|
+
!@
|
|
18
|
+
!@
|
|
19
|
+
|
|
20
|
+
@extract
|
|
21
|
+
!fyh:_ Extract specific sections of data from biomolecular structures.
|
|
22
|
+
@models
|
|
23
|
+
!fyh:_ Extracts the models in a PDB file into separate files.
|
|
24
|
+
!use:_extract
|
|
25
|
+
!fyh:first_only Use this flag for extracting only the first model of the structure and disregard the rest.
|
|
26
|
+
!@
|
|
27
|
+
@chains
|
|
28
|
+
!fyh:_ Extracts the chains in a PDB file into separate files.
|
|
29
|
+
!use:_extract
|
|
30
|
+
!fyh:first_only Use this flag for extracting only the first chain of the structure and disregard the rest.
|
|
31
|
+
!@
|
|
32
|
+
!@
|
|
33
|
+
|
|
34
|
+
@select
|
|
35
|
+
!fyh:_ Select specific atoms with a custom query (MDAnalysis format) and save them into a file. Requires MDAnalysis.
|
|
36
|
+
!fyh:query Query for selecting the atoms of interest. Must follow MDAnalysis format
|
|
37
|
+
!fyh:path_in Path of the structure file whose atoms will be selected. Can be anything supported by MDanalysis.
|
|
38
|
+
!fyh:path_out Path for the output selected atoms. Can be anything supported by MDanalysis.
|
|
39
|
+
!@
|
|
40
|
+
|
|
41
|
+
!def _extract
|
|
42
|
+
!fyh:path_in Path of a PDB file.
|
|
43
|
+
!fyh:folder_out Path of the directory where to place the unpacked structures.
|
|
44
|
+
If not provided, the parent directory of the input PDB file will be used.
|
|
45
|
+
!fed
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
@list
|
|
2
|
+
@chains
|
|
3
|
+
path_in[]1.PATH
|
|
4
|
+
~first_only[f,first-only]
|
|
5
|
+
!@
|
|
6
|
+
!@
|
|
7
|
+
|
|
8
|
+
@count
|
|
9
|
+
@models
|
|
10
|
+
path_in[]1.PATH
|
|
11
|
+
!@
|
|
12
|
+
!@
|
|
13
|
+
|
|
14
|
+
@extract
|
|
15
|
+
@models !use:_extract !@
|
|
16
|
+
@chains !use:_extract !@
|
|
17
|
+
!@
|
|
18
|
+
|
|
19
|
+
@select
|
|
20
|
+
query[]1.STR
|
|
21
|
+
path_in[]1.PATH
|
|
22
|
+
path_out[]1.PATH
|
|
23
|
+
!@
|
|
24
|
+
|
|
25
|
+
!def _extract
|
|
26
|
+
path_in[]1.PATH
|
|
27
|
+
~folder_out[]1.PATH
|
|
28
|
+
~first_only[f,first-only]
|
|
29
|
+
!fed
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.2.0"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: molutils
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Collection of tools for preprocessing or summarizing details from biomolecular structure files.
|
|
4
5
|
Home-page: https://github.com/diegobarmor/molutils
|
|
5
6
|
Author: DiegoBarMor
|
|
6
7
|
Author-email: diegobarmor42@gmail.com
|
|
@@ -11,7 +12,7 @@ Classifier: Operating System :: OS Independent
|
|
|
11
12
|
Requires-Python: >=3.10
|
|
12
13
|
Description-Content-Type: text/markdown
|
|
13
14
|
License-File: LICENSE.md
|
|
14
|
-
Requires-Dist: freyacli==0.
|
|
15
|
+
Requires-Dist: freyacli==0.3.1
|
|
15
16
|
Dynamic: author
|
|
16
17
|
Dynamic: author-email
|
|
17
18
|
Dynamic: classifier
|
|
@@ -23,5 +24,7 @@ Dynamic: license
|
|
|
23
24
|
Dynamic: license-file
|
|
24
25
|
Dynamic: requires-dist
|
|
25
26
|
Dynamic: requires-python
|
|
27
|
+
Dynamic: summary
|
|
26
28
|
|
|
27
|
-
#
|
|
29
|
+
# MolUtils
|
|
30
|
+
MolUtils is a collection of tools for preprocessing or summarizing details from biomolecular structure files.
|
|
@@ -14,6 +14,9 @@ molutils.egg-info/top_level.txt
|
|
|
14
14
|
molutils/_core/__init__.py
|
|
15
15
|
molutils/_core/count.py
|
|
16
16
|
molutils/_core/extract.py
|
|
17
|
+
molutils/_core/list_.py
|
|
18
|
+
molutils/_parsers/__init__.py
|
|
19
|
+
molutils/_parsers/parser_pdb.py
|
|
17
20
|
molutils/_ui/__init__.py
|
|
18
21
|
molutils/_ui/app.py
|
|
19
22
|
molutils/_ui/fy_help.fyh
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
freyacli==0.3.1
|
|
@@ -7,7 +7,7 @@ exec(Path("molutils/_version.py").read_text())
|
|
|
7
7
|
setup(
|
|
8
8
|
name="molutils",
|
|
9
9
|
version=__version__,
|
|
10
|
-
description="",
|
|
10
|
+
description="Collection of tools for preprocessing or summarizing details from biomolecular structure files.",
|
|
11
11
|
keywords="",
|
|
12
12
|
long_description=open("README.md").read(),
|
|
13
13
|
long_description_content_type="text/markdown",
|
|
@@ -21,7 +21,7 @@ setup(
|
|
|
21
21
|
"_ui/fy_rules.fyr", "_ui/fy_help.fyh",
|
|
22
22
|
],
|
|
23
23
|
},
|
|
24
|
-
install_requires=["freyacli==0.
|
|
24
|
+
install_requires=["freyacli==0.3.1"],
|
|
25
25
|
entry_points={
|
|
26
26
|
"console_scripts": [
|
|
27
27
|
"molutils=molutils.__main__:main",
|
molutils-0.1.0/README.md
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# molutils
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
from pathlib import Path
|
|
2
|
-
|
|
3
|
-
import molutils as mu
|
|
4
|
-
|
|
5
|
-
import freyacli as fy
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
# //////////////////////////////////////////////////////////////////////////////
|
|
9
|
-
class App(fy.App):
|
|
10
|
-
_APP_NAME = "molutils"
|
|
11
|
-
_VERSION = mu.__version__
|
|
12
|
-
|
|
13
|
-
# --------------------------------------------------------------------------
|
|
14
|
-
def __init__(self, argv: list[str]):
|
|
15
|
-
dir_ui = Path(__file__).parent
|
|
16
|
-
super().__init__(
|
|
17
|
-
args = argv,
|
|
18
|
-
path_fyr = dir_ui / "fy_rules.fyr",
|
|
19
|
-
path_fyh = dir_ui / "fy_help.fyh",
|
|
20
|
-
)
|
|
21
|
-
self.subcommands = self.get_path_to_root()
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
# --------------------------------------------------------------------------
|
|
25
|
-
def run(self):
|
|
26
|
-
command = self.subcommands.pop(0)
|
|
27
|
-
if command == "count": return self._run_count()
|
|
28
|
-
if command == "extract": return self._run_extract()
|
|
29
|
-
raise ValueError(f"Unknown command: {command}")
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
# --------------------------------------------------------------------------
|
|
33
|
-
def _run_count(self):
|
|
34
|
-
def count_models():
|
|
35
|
-
path_pdb = self.get_arg_path("path_pdb")
|
|
36
|
-
self.assert_file_in(path_pdb)
|
|
37
|
-
print(mu.Count.models(path_pdb))
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
command = self.subcommands.pop(0)
|
|
41
|
-
|
|
42
|
-
if command == "models": return count_models()
|
|
43
|
-
|
|
44
|
-
raise ValueError(f"Unknown command: {command}")
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
# --------------------------------------------------------------------------
|
|
48
|
-
def _run_extract(self):
|
|
49
|
-
def extract_models():
|
|
50
|
-
path_pdb = self.get_arg_path("path_pdb")
|
|
51
|
-
self.assert_file_in(path_pdb)
|
|
52
|
-
|
|
53
|
-
folder_out = self.get_arg_path("folder_out", default = path_pdb.parent)
|
|
54
|
-
self.assert_dir_out(folder_out)
|
|
55
|
-
|
|
56
|
-
data_pdb = path_pdb.read_text()
|
|
57
|
-
|
|
58
|
-
if self.get_arg_bool("first_only"):
|
|
59
|
-
_, model = mu.Extract.next_model(data_pdb)
|
|
60
|
-
path_out = folder_out / f"{path_pdb.stem}.m0.pdb"
|
|
61
|
-
path_out.write_text(model)
|
|
62
|
-
return
|
|
63
|
-
|
|
64
|
-
for i, model in enumerate(mu.Extract.iter_models(data_pdb)):
|
|
65
|
-
path_out = folder_out / f"{path_pdb.stem}.m{i:03}.pdb"
|
|
66
|
-
path_out.write_text(model)
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
command = self.subcommands.pop(0)
|
|
70
|
-
|
|
71
|
-
if command == "models": return extract_models()
|
|
72
|
-
|
|
73
|
-
raise ValueError(f"Unknown command: {command}")
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
# //////////////////////////////////////////////////////////////////////////////
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
!fyh:_ molutils is a collection of tools for preprocessing or summarizing details from biomolecular structure files.
|
|
2
|
-
|
|
3
|
-
@count
|
|
4
|
-
!fyh:_ Provides counts for different aspects of biomolecular structures.
|
|
5
|
-
@models
|
|
6
|
-
!fyh:_ Counts the number of models in a PDB file.
|
|
7
|
-
!fyh:path_pdb Path of a PDB file.
|
|
8
|
-
!@
|
|
9
|
-
!@
|
|
10
|
-
|
|
11
|
-
@extract
|
|
12
|
-
!fyh:_ Extract specific sections of data from biomolecular structures.
|
|
13
|
-
@models
|
|
14
|
-
!fyh:_ Extracts the models in a PDB file into separate files.
|
|
15
|
-
!fyh:path_pdb Path of a PDB file.
|
|
16
|
-
!fyh:folder_out Path of the directory where to place the unpacked models.
|
|
17
|
-
If not provided, the parent directory of the input PDB file will be used.
|
|
18
|
-
!fyh:first_only Use this flag for extracting only the first model of the structure and disregard the rest.
|
|
19
|
-
!@
|
|
20
|
-
!@
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.1.0"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
freyacli==0.2.0
|
|
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
|