molutils 0.6.0__tar.gz → 0.6.1__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.
Files changed (26) hide show
  1. {molutils-0.6.0 → molutils-0.6.1}/PKG-INFO +2 -2
  2. {molutils-0.6.0 → molutils-0.6.1}/molutils/_core/count.py +24 -15
  3. {molutils-0.6.0 → molutils-0.6.1}/molutils/_core/extract.py +8 -10
  4. {molutils-0.6.0 → molutils-0.6.1}/molutils/_core/list_.py +2 -2
  5. {molutils-0.6.0 → molutils-0.6.1}/molutils/_core/remove.py +2 -2
  6. {molutils-0.6.0 → molutils-0.6.1}/molutils/_ui/app_main.py +7 -9
  7. {molutils-0.6.0 → molutils-0.6.1}/molutils/_ui/fy_help.fyh +13 -2
  8. {molutils-0.6.0 → molutils-0.6.1}/molutils/_ui/fy_rules.fyr +3 -0
  9. molutils-0.6.1/molutils/_version.py +1 -0
  10. {molutils-0.6.0 → molutils-0.6.1}/molutils.egg-info/PKG-INFO +2 -2
  11. {molutils-0.6.0 → molutils-0.6.1}/molutils.egg-info/requires.txt +1 -1
  12. {molutils-0.6.0 → molutils-0.6.1}/setup.py +1 -1
  13. molutils-0.6.0/molutils/_version.py +0 -1
  14. {molutils-0.6.0 → molutils-0.6.1}/LICENSE.md +0 -0
  15. {molutils-0.6.0 → molutils-0.6.1}/README.md +0 -0
  16. {molutils-0.6.0 → molutils-0.6.1}/molutils/__init__.py +0 -0
  17. {molutils-0.6.0 → molutils-0.6.1}/molutils/__main__.py +0 -0
  18. {molutils-0.6.0 → molutils-0.6.1}/molutils/_core/__init__.py +0 -0
  19. {molutils-0.6.0 → molutils-0.6.1}/molutils/_ui/__init__.py +0 -0
  20. {molutils-0.6.0 → molutils-0.6.1}/molutils/_ui/app_subcommand.py +0 -0
  21. {molutils-0.6.0 → molutils-0.6.1}/molutils.egg-info/SOURCES.txt +0 -0
  22. {molutils-0.6.0 → molutils-0.6.1}/molutils.egg-info/dependency_links.txt +0 -0
  23. {molutils-0.6.0 → molutils-0.6.1}/molutils.egg-info/entry_points.txt +0 -0
  24. {molutils-0.6.0 → molutils-0.6.1}/molutils.egg-info/top_level.txt +0 -0
  25. {molutils-0.6.0 → molutils-0.6.1}/pyproject.toml +0 -0
  26. {molutils-0.6.0 → molutils-0.6.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: molutils
3
- Version: 0.6.0
3
+ Version: 0.6.1
4
4
  Summary: Collection of tools for preprocessing or summarizing details from biomolecular structure files.
5
5
  Home-page: https://github.com/diegobarmor/molutils
6
6
  Author: DiegoBarMor
@@ -13,7 +13,7 @@ Requires-Python: >=3.10
13
13
  Description-Content-Type: text/markdown
14
14
  License-File: LICENSE.md
15
15
  Requires-Dist: molsimple==0.1.2
16
- Requires-Dist: freyacli==0.4.5
16
+ Requires-Dist: freyacli==0.5.0
17
17
  Dynamic: author
18
18
  Dynamic: author-email
19
19
  Dynamic: classifier
@@ -1,5 +1,3 @@
1
- from pathlib import Path
2
-
3
1
  import molsimple as ms
4
2
  import freyacli as fy
5
3
  import molutils as mu
@@ -10,39 +8,44 @@ class Count(mu.AppSubcommand):
10
8
  def run(self):
11
9
  command = self.main.subcommands.pop(0)
12
10
 
13
- if command == "models" : return self.app_count_models()
14
- if command == "chains" : return self.app_count_chains()
15
- if command == "residues": return self.app_count_residues()
16
- if command == "frames" : return self.app_count_frames()
17
- if command == "altlocs" : return self.app_count_altlocs()
11
+ if command == "models" : return self.app_count_models()
12
+ if command == "chains" : return self.app_count_chains()
13
+ if command == "residues" : return self.app_count_residues()
14
+ if command == "particles": return self.app_count_particles()
15
+ if command == "frames" : return self.app_count_frames()
16
+ if command == "altlocs" : return self.app_count_altlocs()
18
17
 
19
18
  raise ValueError(f"Unknown command: {command}")
20
19
 
21
20
 
22
21
  # --------------------------------------------------------------------------
23
22
  def app_count_models(self):
24
- path_in = self.main.get_arg_path("path_in", assertion = fy.PathAssertion.FILE_IN)
23
+ path_in = self.main.arg_path("path_in", assertion = fy.PathAssertion.FILE_IN)
25
24
  print(mu.Count.models(ms.System.read_pdb(path_in)))
26
25
 
27
26
 
28
27
  # --------------------------------------------------------------------------
29
28
  def app_count_chains(self):
30
- path_in = self.main.get_arg_path("path_in", assertion = fy.PathAssertion.FILE_IN)
29
+ path_in = self.main.arg_path("path_in", assertion = fy.PathAssertion.FILE_IN)
31
30
  print(mu.Count.chains(ms.System.read_pdb(path_in)))
32
31
 
33
32
 
34
33
  # --------------------------------------------------------------------------
35
34
  def app_count_residues(self):
36
- path_in = self.main.get_arg_path("path_in", assertion = fy.PathAssertion.FILE_IN)
35
+ path_in = self.main.arg_path("path_in", assertion = fy.PathAssertion.FILE_IN)
37
36
  print(mu.Count.residues(ms.System.read_pdb(path_in)))
38
37
 
39
38
 
39
+ # --------------------------------------------------------------------------
40
+ def app_count_particles(self):
41
+ path_in = self.main.arg_path("path_in", assertion = fy.PathAssertion.FILE_IN)
42
+ print(mu.Count.particles(ms.System.read_pdb(path_in)))
43
+
44
+
40
45
  # --------------------------------------------------------------------------
41
46
  def app_count_frames(self):
42
- path_struct = self.main.get_arg_path("path_struct", assertion = fy.PathAssertion.FILE_IN)
43
- path_traj = self.main.get_arg_path("path_traj",
44
- assertion = fy.PathAssertion.FILE_IN, allow_none = True
45
- )
47
+ path_struct = self.main.arg_path("path_struct", assertion = fy.PathAssertion.FILE_IN)
48
+ path_traj = self.main.arg_path("path_traj", assertion = fy.PathAssertion.FILE_IN)
46
49
 
47
50
  import MDAnalysis as mda
48
51
  args_traj = [str(path_traj)] if path_traj is not None else []
@@ -55,7 +58,7 @@ class Count(mu.AppSubcommand):
55
58
 
56
59
  # --------------------------------------------------------------------------
57
60
  def app_count_altlocs(self):
58
- path_in = self.main.get_arg_path("path_in", assertion = fy.PathAssertion.FILE_IN)
61
+ path_in = self.main.arg_path("path_in", assertion = fy.PathAssertion.FILE_IN)
59
62
  print(mu.Count.altlocs(ms.System.read_pdb(path_in)))
60
63
 
61
64
 
@@ -77,6 +80,12 @@ class Count(mu.AppSubcommand):
77
80
  return len(mu.List.residues(system, do_sort = False))
78
81
 
79
82
 
83
+ # --------------------------------------------------------------------------
84
+ @classmethod
85
+ def particles(cls, system: ms.System) -> int:
86
+ return len(system.particles)
87
+
88
+
80
89
  # --------------------------------------------------------------------------
81
90
  @classmethod
82
91
  def frames(cls, universe) -> tuple[int, int]:
@@ -21,7 +21,7 @@ class Extract(mu.AppSubcommand):
21
21
  # --------------------------------------------------------------------------
22
22
  def app_extract_models(self):
23
23
  path_in, folder_out = self._io_filein_dirout()
24
- first_only = self.main.get_arg_bool("first_only")
24
+ first_only = self.main.arg_toggle("first_only")
25
25
 
26
26
  for i, model in enumerate(ms.System.read_pdb(path_in).models):
27
27
  path_out = folder_out / f"{path_in.stem}.m{i:03}.pdb"
@@ -32,7 +32,7 @@ class Extract(mu.AppSubcommand):
32
32
  # --------------------------------------------------------------------------
33
33
  def app_extract_chains(self):
34
34
  path_in, folder_out = self._io_filein_dirout()
35
- first_only = self.main.get_arg_bool("first_only")
35
+ first_only = self.main.arg_toggle("first_only")
36
36
 
37
37
  system = ms.System.read_pdb(path_in)
38
38
  chain_ids = mu.List.chains(system, do_sort = False)
@@ -46,7 +46,7 @@ class Extract(mu.AppSubcommand):
46
46
  # --------------------------------------------------------------------------
47
47
  def app_extract_residue(self):
48
48
  path_in, folder_out = self._io_filein_dirout()
49
- residue_dotstr = self.main.get_arg_str("residue")
49
+ residue_dotstr = self.main.arg_str("residue")
50
50
 
51
51
  pdb = ms.System.read_pdb(path_in)
52
52
  chres = ms.ChainResid.from_dotstr(residue_dotstr)
@@ -57,11 +57,9 @@ class Extract(mu.AppSubcommand):
57
57
  # --------------------------------------------------------------------------
58
58
  def app_extract_frames(self):
59
59
  path_struct, folder_out = self._io_filein_dirout(key_in = "path_struct")
60
- path_traj = self.main.get_arg_path("path_traj",
61
- assertion = fy.PathAssertion.FILE_IN, allow_none = True
62
- )
63
- frames = self.main.get_arg_int("frames", is_list = True)
64
- unpack = self.main.get_arg_bool("unpack")
60
+ path_traj = self.main.arg_path("path_traj", assertion = fy.PathAssertion.FILE_IN)
61
+ frames = self.main.arg_int_list("frames")
62
+ unpack = self.main.arg_toggle("unpack")
65
63
  mu.Extract.frames(path_struct, path_traj, folder_out, frames, unpack)
66
64
 
67
65
 
@@ -101,8 +99,8 @@ class Extract(mu.AppSubcommand):
101
99
 
102
100
  # --------------------------------------------------------------------------
103
101
  def _io_filein_dirout(self, key_in = "path_in") -> tuple[Path, Path]:
104
- path_in = self.main.get_arg_path(key_in, assertion = fy.PathAssertion.FILE_IN)
105
- folder_out = self.main.get_arg_path("folder_out",
102
+ path_in = self.main.arg_path(key_in, assertion = fy.PathAssertion.FILE_IN)
103
+ folder_out = self.main.arg_path("folder_out",
106
104
  default = path_in.parent, assertion = fy.PathAssertion.DIR_OUT
107
105
  )
108
106
  return path_in, folder_out
@@ -18,13 +18,13 @@ class List(mu.AppSubcommand):
18
18
 
19
19
  # --------------------------------------------------------------------------
20
20
  def app_list_chains(self):
21
- path_in = self.main.get_arg_path("path_in", assertion = fy.PathAssertion.FILE_IN)
21
+ path_in = self.main.arg_path("path_in", assertion = fy.PathAssertion.FILE_IN)
22
22
  print(*mu.List.chains(ms.System.read_pdb(path_in), do_sort = True))
23
23
 
24
24
 
25
25
  # --------------------------------------------------------------------------
26
26
  def app_list_residues(self):
27
- path_in = self.main.get_arg_path("path_in", assertion = fy.PathAssertion.FILE_IN)
27
+ path_in = self.main.arg_path("path_in", assertion = fy.PathAssertion.FILE_IN)
28
28
  print(*mu.List.residues(ms.System.read_pdb(path_in), do_sort = True))
29
29
 
30
30
 
@@ -17,8 +17,8 @@ class Remove(mu.AppSubcommand):
17
17
 
18
18
  # --------------------------------------------------------------------------
19
19
  def app_remove_altlocs(self):
20
- path_in = self.main.get_arg_path("path_in", assertion = fy.PathAssertion.FILE_IN)
21
- path_out = self.main.get_arg_path("path_out", assertion = fy.PathAssertion.FILE_OUT)
20
+ path_in = self.main.arg_path("path_in", assertion = fy.PathAssertion.FILE_IN)
21
+ path_out = self.main.arg_path("path_out", assertion = fy.PathAssertion.FILE_OUT)
22
22
  mu.Remove.altlocs(path_in).save(path_out)
23
23
 
24
24
 
@@ -34,17 +34,15 @@ class AppMain(fy.App):
34
34
 
35
35
  # --------------------------------------------------------------------------
36
36
  def _run_select(self):
37
- query = self.get_arg_str("query")
38
- path_in = self.get_arg_path("path_in", assertion = fy.PathAssertion.FILE_IN)
39
- path_out = self.get_arg_path("path_out", assertion = fy.PathAssertion.FILE_OUT)
40
- paths_traj = self.get_arg_path("paths_traj", assertion = fy.PathAssertion.FILE_OUT,
41
- allow_none = True, is_list = True
42
- )
37
+ query = self.arg_str("query")
38
+ path_in = self.arg_path("path_in", assertion = fy.PathAssertion.FILE_IN)
39
+ path_out = self.arg_path("path_out", assertion = fy.PathAssertion.FILE_OUT)
40
+ paths_traj = self.arg_path_list("paths_traj", assertion = fy.PathAssertion.FILE_OUT)
43
41
 
44
42
  import MDAnalysis as mda
45
43
  mda.Universe(path_in).select_atoms(query).write(path_out)
46
44
 
47
- if paths_traj == [None]: return
45
+ if not paths_traj: return
48
46
 
49
47
  path_traj_in, path_traj_out = paths_traj
50
48
  u = mda.Universe(path_in, path_traj_in)
@@ -53,8 +51,8 @@ class AppMain(fy.App):
53
51
 
54
52
  # --------------------------------------------------------------------------
55
53
  def _run_merge(self):
56
- paths_in = self.get_arg_path("paths_in", assertion = fy.PathAssertion.FILE_IN, is_list = True)
57
- path_out = self.get_arg_path("path_out", assertion = fy.PathAssertion.FILE_OUT)
54
+ paths_in = self.arg_path_list("paths_in", assertion = fy.PathAssertion.FILE_IN)
55
+ path_out = self.arg_path("path_out", assertion = fy.PathAssertion.FILE_OUT)
58
56
  pgroups = (ms.System.read_pdb(path_in).particles for path_in in paths_in)
59
57
  ms.ParticleGroup((p for pgroup in pgroups for p in pgroup)).save(path_out)
60
58
 
@@ -20,10 +20,17 @@
20
20
  !@
21
21
  @chains
22
22
  !fyh:_ Counts the number of chains in a PDB file.
23
+ Considers only the first model of the molecular system.
23
24
  !fyh:path_in Path of a PDB file.
24
25
  !@
25
26
  @residues
26
27
  !fyh:_ Counts the number of residues in a PDB file in the format "chainid.resid".
28
+ Considers only the first model of the molecular system.
29
+ !fyh:path_in Path of a PDB file.
30
+ !@
31
+ @particles
32
+ !fyh:_ Counts the number of particles in a PDB file in the format "chainid.resid".
33
+ Considers only the first model of the molecular system.
27
34
  !fyh:path_in Path of a PDB file.
28
35
  !@
29
36
  @frames
@@ -45,12 +52,12 @@
45
52
  @extract
46
53
  !fyh:_ Extract specific sections of data from biomolecular structures.
47
54
  @models
48
- !fyh:_ Extracts the models in a PDB file into separate files.
55
+ !fyh:_ Extract the models in a PDB file into separate files.
49
56
  !use:_io_filein_dirout
50
57
  !fyh:first_only Use this flag for extracting only the first model of the structure and disregard the rest.
51
58
  !@
52
59
  @chains
53
- !fyh:_ Extracts the chains in a PDB file into separate files.
60
+ !fyh:_ Extract the chains in a PDB file into separate files.
54
61
  !use:_io_filein_dirout
55
62
  !fyh:first_only Use this flag for extracting only the first chain of the structure and disregard the rest.
56
63
  !@
@@ -75,6 +82,10 @@
75
82
  !@
76
83
  !@
77
84
 
85
+ @remove
86
+ !fyh:_ Remove undesired data from a PDB file.
87
+ !@
88
+
78
89
  @select
79
90
  !fyh:_ Select specific atoms with a custom query (MDAnalysis format) and save them into a file. Requires MDAnalysis.
80
91
  !fyh:query Query for selecting the atoms of interest. Must follow MDAnalysis format
@@ -17,6 +17,9 @@
17
17
  @residues
18
18
  path_in[]1.PATH
19
19
  !@
20
+ @particles
21
+ path_in[]1.PATH
22
+ !@
20
23
  @frames
21
24
  path_struct[]1.PATH
22
25
  ~path_traj[]1.PATH
@@ -0,0 +1 @@
1
+ __version__ = "0.6.1"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: molutils
3
- Version: 0.6.0
3
+ Version: 0.6.1
4
4
  Summary: Collection of tools for preprocessing or summarizing details from biomolecular structure files.
5
5
  Home-page: https://github.com/diegobarmor/molutils
6
6
  Author: DiegoBarMor
@@ -13,7 +13,7 @@ Requires-Python: >=3.10
13
13
  Description-Content-Type: text/markdown
14
14
  License-File: LICENSE.md
15
15
  Requires-Dist: molsimple==0.1.2
16
- Requires-Dist: freyacli==0.4.5
16
+ Requires-Dist: freyacli==0.5.0
17
17
  Dynamic: author
18
18
  Dynamic: author-email
19
19
  Dynamic: classifier
@@ -1,2 +1,2 @@
1
1
  molsimple==0.1.2
2
- freyacli==0.4.5
2
+ freyacli==0.5.0
@@ -23,7 +23,7 @@ setup(
23
23
  },
24
24
  install_requires=[
25
25
  "molsimple==0.1.2",
26
- "freyacli==0.4.5",
26
+ "freyacli==0.5.0",
27
27
  ],
28
28
  entry_points={
29
29
  "console_scripts": [
@@ -1 +0,0 @@
1
- __version__ = "0.6.0"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes