pyLoopSage 1.0.20__tar.gz → 1.0.22__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 (24) hide show
  1. {pyloopsage-1.0.20/pyLoopSage.egg-info → pyloopsage-1.0.22}/PKG-INFO +1 -1
  2. {pyloopsage-1.0.20 → pyloopsage-1.0.22}/loopsage/__init__.py +1 -1
  3. {pyloopsage-1.0.20 → pyloopsage-1.0.22}/loopsage/run.py +35 -23
  4. {pyloopsage-1.0.20 → pyloopsage-1.0.22}/loopsage/stochastic_simulation.py +1 -1
  5. {pyloopsage-1.0.20 → pyloopsage-1.0.22/pyLoopSage.egg-info}/PKG-INFO +1 -1
  6. {pyloopsage-1.0.20 → pyloopsage-1.0.22}/setup.py +1 -1
  7. {pyloopsage-1.0.20 → pyloopsage-1.0.22}/LICENSE +0 -0
  8. {pyloopsage-1.0.20 → pyloopsage-1.0.22}/README.md +0 -0
  9. {pyloopsage-1.0.20 → pyloopsage-1.0.22}/loopsage/args_definition.py +0 -0
  10. {pyloopsage-1.0.20 → pyloopsage-1.0.22}/loopsage/em.py +0 -0
  11. {pyloopsage-1.0.20 → pyloopsage-1.0.22}/loopsage/forcefields/classic_sm_ff.xml +0 -0
  12. {pyloopsage-1.0.20 → pyloopsage-1.0.22}/loopsage/initial_structures.py +0 -0
  13. {pyloopsage-1.0.20 → pyloopsage-1.0.22}/loopsage/knots.py +0 -0
  14. {pyloopsage-1.0.20 → pyloopsage-1.0.22}/loopsage/md.py +0 -0
  15. {pyloopsage-1.0.20 → pyloopsage-1.0.22}/loopsage/plots.py +0 -0
  16. {pyloopsage-1.0.20 → pyloopsage-1.0.22}/loopsage/preproc.py +0 -0
  17. {pyloopsage-1.0.20 → pyloopsage-1.0.22}/loopsage/utils.py +0 -0
  18. {pyloopsage-1.0.20 → pyloopsage-1.0.22}/loopsage/vizualization_tools.py +0 -0
  19. {pyloopsage-1.0.20 → pyloopsage-1.0.22}/pyLoopSage.egg-info/SOURCES.txt +0 -0
  20. {pyloopsage-1.0.20 → pyloopsage-1.0.22}/pyLoopSage.egg-info/dependency_links.txt +0 -0
  21. {pyloopsage-1.0.20 → pyloopsage-1.0.22}/pyLoopSage.egg-info/entry_points.txt +0 -0
  22. {pyloopsage-1.0.20 → pyloopsage-1.0.22}/pyLoopSage.egg-info/requires.txt +0 -0
  23. {pyloopsage-1.0.20 → pyloopsage-1.0.22}/pyLoopSage.egg-info/top_level.txt +0 -0
  24. {pyloopsage-1.0.20 → pyloopsage-1.0.22}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyLoopSage
3
- Version: 1.0.20
3
+ Version: 1.0.22
4
4
  Summary: An energy-based stochastic model of loop extrusion in chromatin.
5
5
  Home-page: https://github.com/SFGLab/pyLoopSage
6
6
  Author: Sebastian Korsak
@@ -1,4 +1,4 @@
1
1
  # Importing specific functions or classes from submodules
2
2
  from .run import main
3
3
 
4
- __version__ = "1.0.20"
4
+ __version__ = "1.0.22"
@@ -17,36 +17,48 @@ def my_config_parser(config_parser: configparser.ConfigParser) -> List[tuple[str
17
17
  args_cp.append((name, value))
18
18
  return args_cp
19
19
 
20
- def get_config() -> ListOfArgs:
21
- """This function prepares the list of arguments.
22
- At first List of args with defaults is read.
23
- Then it's overwritten by args from config file (ini file).
24
- In the end config is overwritten by argparse options."""
20
+ def get_config():
21
+ """Prepare list of arguments.
22
+ First, defaults are set.
23
+ Then, optionally config file values.
24
+ Finally, CLI arguments overwrite everything."""
25
+
26
+ print("Reading config...")
25
27
 
26
- print(f"Reading config...")
28
+ # Step 1: Setup argparse
27
29
  arg_parser = argparse.ArgumentParser()
28
-
29
30
  arg_parser.add_argument('-c', '--config_file', help="Specify config file (ini format)", metavar="FILE")
31
+
30
32
  for arg in args:
31
33
  arg_parser.add_argument(f"--{arg.name.lower()}", help=arg.help)
32
- args_ap = arg_parser.parse_args() # args from argparse
33
- config_parser = configparser.ConfigParser()
34
- config_parser.read(args_ap.config_file)
35
- args_cp = my_config_parser(config_parser)
36
- # Override defaults args with values from config file
37
- for cp_arg in args_cp:
38
- name, value = cp_arg
39
- arg = args.get_arg(name)
40
- arg.val = value
41
- # Now again override args with values from command line.
42
- for ap_arg in args_ap.__dict__:
43
- if ap_arg not in ['config_file']:
44
- name, value = ap_arg, getattr(args_ap, ap_arg)
45
- if value is not None:
46
- arg = args.get_arg(name)
47
- arg.val = value
34
+
35
+ args_ap = arg_parser.parse_args() # parse command-line arguments
36
+ args_dict = vars(args_ap)
37
+
38
+ # Step 2: If config file provided, parse it
39
+ if args_ap.config_file:
40
+ config_parser = configparser.ConfigParser()
41
+ config_parser.read(args_ap.config_file)
42
+ args_cp = my_config_parser(config_parser)
43
+
44
+ # Override default args with values from config file
45
+ for cp_arg in args_cp:
46
+ name, value = cp_arg
47
+ arg = args.get_arg(name)
48
+ arg.val = value
49
+
50
+ # Step 3: Override again with CLI arguments (if present)
51
+ for name, value in args_dict.items():
52
+ if name == "config_file":
53
+ continue
54
+ if value is not None:
55
+ arg = args.get_arg(name.upper())
56
+ arg.val = value
57
+
58
+ # Step 4: Finalize
48
59
  args.to_python()
49
60
  args.write_config_file()
61
+
50
62
  return args
51
63
 
52
64
  def main():
@@ -254,7 +254,7 @@ class StochasticSimulation:
254
254
 
255
255
  # Save simulation info
256
256
  if save:
257
- save_dir = os.path.join(self.path, 'other')
257
+ save_dir = os.path.join(self.path, 'other') + '/'
258
258
  with open(save_dir + 'info.txt', "w") as f:
259
259
  f.write(f'Number of beads {self.N_beads}.\n')
260
260
  f.write(f'Number of cohesins {self.N_lef}. Number of cohesins in second family {self.N_lef2}. Number of CTCFs {self.N_CTCF}. \n')
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyLoopSage
3
- Version: 1.0.20
3
+ Version: 1.0.22
4
4
  Summary: An energy-based stochastic model of loop extrusion in chromatin.
5
5
  Home-page: https://github.com/SFGLab/pyLoopSage
6
6
  Author: Sebastian Korsak
@@ -6,7 +6,7 @@ with open('README.md', 'r', encoding='utf-8') as f:
6
6
 
7
7
  setup(
8
8
  name='pyLoopSage', # Package name
9
- version='1.0.20', # Version of the software
9
+ version='1.0.22', # Version of the software
10
10
  description='An energy-based stochastic model of loop extrusion in chromatin.',
11
11
  long_description=long_description,
12
12
  long_description_content_type='text/markdown',
File without changes
File without changes
File without changes
File without changes
File without changes