COBY 0.1.2__py3-none-any.whl
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.
- COBY/__init__.py +6 -0
- COBY/__main__.py +251 -0
- COBY/general_functions/__init__.py +7 -0
- COBY/general_functions/center_coords.py +8 -0
- COBY/general_functions/flatten.py +9 -0
- COBY/help.py +0 -0
- COBY/main_class/COBY_class.py +903 -0
- COBY/main_class/__init__.py +5 -0
- COBY/main_class/command_preprocessors/__init__.py +16 -0
- COBY/main_class/command_preprocessors/memb_preprocessor.py +880 -0
- COBY/main_class/command_preprocessors/prot_preprocessor.py +204 -0
- COBY/main_class/command_preprocessors/solv_preprocessor.py +410 -0
- COBY/main_class/definition_preprocessors/__init__.py +22 -0
- COBY/main_class/definition_preprocessors/ion_defs_preprocessor.py +51 -0
- COBY/main_class/definition_preprocessors/lipid_defs_preprocessor.py +29 -0
- COBY/main_class/definition_preprocessors/lipid_scaffolds_preprocessor.py +115 -0
- COBY/main_class/definition_preprocessors/molecule_beads_checker.py +37 -0
- COBY/main_class/definition_preprocessors/molecule_defs_checker.py +293 -0
- COBY/main_class/definition_preprocessors/solvent_defs_preprocessor.py +29 -0
- COBY/main_class/general_tools/__init__.py +34 -0
- COBY/main_class/general_tools/backupper.py +27 -0
- COBY/main_class/general_tools/coord_checker.py +34 -0
- COBY/main_class/general_tools/fix_points.py +55 -0
- COBY/main_class/general_tools/get_geoms_list.py +30 -0
- COBY/main_class/general_tools/get_number_from_string.py +9 -0
- COBY/main_class/general_tools/is_number.py +21 -0
- COBY/main_class/general_tools/log_file_writer.py +13 -0
- COBY/main_class/general_tools/n_list_mixer.py +11 -0
- COBY/main_class/general_tools/pickler.py +19 -0
- COBY/main_class/general_tools/print_term.py +40 -0
- COBY/main_class/general_tools/rotate_point.py +38 -0
- COBY/main_class/general_tools/rotation_matrix_from_vectors.py +28 -0
- COBY/main_class/lipid_calculator/__init__.py +14 -0
- COBY/main_class/lipid_calculator/lipid_calculator.py +314 -0
- COBY/main_class/lipid_calculator/lipid_optimizer.py +110 -0
- COBY/main_class/lipid_inserter/__init__.py +12 -0
- COBY/main_class/lipid_inserter/lipid_inserter.py +53 -0
- COBY/main_class/planar_grid_maker_and_optimizer/.__init__.py.swp +0 -0
- COBY/main_class/planar_grid_maker_and_optimizer/__init__.py +18 -0
- COBY/main_class/planar_grid_maker_and_optimizer/make_rect_grid_3D_matrix_based.py +256 -0
- COBY/main_class/planar_grid_maker_and_optimizer/make_rect_grid_lines_based.py +264 -0
- COBY/main_class/planar_grid_maker_and_optimizer/planar_grid_maker.py +243 -0
- COBY/main_class/planar_grid_maker_and_optimizer/plane_grid_point_optimizer.py +308 -0
- COBY/main_class/polygon_makers/__init__.py +14 -0
- COBY/main_class/polygon_makers/holed_subleaflet_bbox_maker.py +343 -0
- COBY/main_class/polygon_makers/subleaflet_poly_maker.py +114 -0
- COBY/main_class/protein_inserter/__init__.py +12 -0
- COBY/main_class/protein_inserter/prot_placer.py +115 -0
- COBY/main_class/solvater/__init__.py +18 -0
- COBY/main_class/solvater/get_lipid_volume.py +20 -0
- COBY/main_class/solvater/get_protein_volume.py +16 -0
- COBY/main_class/solvater/get_solute_volume.py +20 -0
- COBY/main_class/solvater/solvater.py +831 -0
- COBY/main_class/special_preprocessors/__init__.py +12 -0
- COBY/main_class/special_preprocessors/stacked_membranes_preprocessor.py +272 -0
- COBY/main_class/structure_file_handlers/__init__.py +21 -0
- COBY/main_class/structure_file_handlers/gro_atom_writer.py +21 -0
- COBY/main_class/structure_file_handlers/gro_reader.py +44 -0
- COBY/main_class/structure_file_handlers/molecule_importer.py +304 -0
- COBY/main_class/structure_file_handlers/pdb_atom_writer.py +38 -0
- COBY/main_class/structure_file_handlers/pdb_reader.py +28 -0
- COBY/main_class/structure_file_handlers/system_file_writer.py +192 -0
- COBY/main_class/topology_handlers/__init__.py +16 -0
- COBY/main_class/topology_handlers/itp_read_initiater.py +32 -0
- COBY/main_class/topology_handlers/itp_reader.py +107 -0
- COBY/main_class/topology_handlers/moleculetype_class.py +197 -0
- COBY/main_class/topology_handlers/topol_file_writer.py +38 -0
- COBY/molecule_definitions/CHOL_v1.py +12 -0
- COBY/molecule_definitions/__init__.py +37 -0
- COBY/molecule_definitions/ion_defs_M3_release_parameters.py +28 -0
- COBY/molecule_definitions/lipid_defs_example.py +33 -0
- COBY/molecule_definitions/lipid_scaffolds_M3_release_parameters.py +234 -0
- COBY/molecule_definitions/prot_defs_M3_release_parameters.py +58 -0
- COBY/molecule_definitions/solvent_defs_M3_release_parameters.py +96 -0
- COBY/structure_classes/.MOLECULE_class.py.swp +0 -0
- COBY/structure_classes/ATOM_class.py +30 -0
- COBY/structure_classes/LIPID_class.py +9 -0
- COBY/structure_classes/MOLECULE_class.py +262 -0
- COBY/structure_classes/PROTEIN_class.py +5 -0
- COBY/structure_classes/RESIDUE_class.py +75 -0
- COBY/structure_classes/SOLVENT_class.py +27 -0
- COBY/structure_classes/__init__.py +12 -0
- COBY/version.py +50 -0
- coby-0.1.2.dist-info/METADATA +65 -0
- coby-0.1.2.dist-info/RECORD +87 -0
- coby-0.1.2.dist-info/WHEEL +4 -0
- coby-0.1.2.dist-info/licenses/LICENSE +202 -0
COBY/__init__.py
ADDED
COBY/__main__.py
ADDED
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
'''
|
|
2
|
+
If you want to run this program from the command line,
|
|
3
|
+
then the command must involve the -m flag before the program.
|
|
4
|
+
ex:
|
|
5
|
+
python -m CPPM_calculator #Note that '.py' must not be included
|
|
6
|
+
Flags should follow the above.
|
|
7
|
+
ex:
|
|
8
|
+
python -m CPPM_calculator -N normfile.txt
|
|
9
|
+
'''
|
|
10
|
+
import argparse
|
|
11
|
+
import sys
|
|
12
|
+
import ast
|
|
13
|
+
|
|
14
|
+
### Imports the package part
|
|
15
|
+
from COBY.__init__ import COBY
|
|
16
|
+
|
|
17
|
+
#####################################################################
|
|
18
|
+
########################## HERE BE PARSING ##########################
|
|
19
|
+
#####################################################################
|
|
20
|
+
|
|
21
|
+
if __name__ == "__main__":
|
|
22
|
+
### Custom Action classes to check if arguments have been given.
|
|
23
|
+
given_arguments = set()
|
|
24
|
+
|
|
25
|
+
class IsStored_ActionStore(argparse.Action):
|
|
26
|
+
def __call__(self, parser, namespace, values, option_string=None):
|
|
27
|
+
given_arguments.add(self.dest)
|
|
28
|
+
setattr(namespace, self.dest + '_set', True)
|
|
29
|
+
setattr(namespace, self.dest, values)
|
|
30
|
+
|
|
31
|
+
class IsStored_ActionAppend(argparse.Action):
|
|
32
|
+
def __call__(self, parser, namespace, values, option_string=None):
|
|
33
|
+
given_arguments.add(self.dest)
|
|
34
|
+
setattr(namespace, self.dest + '_set', True)
|
|
35
|
+
items = getattr(namespace, self.dest, None)
|
|
36
|
+
items = argparse._copy_items(items)
|
|
37
|
+
items.append(values)
|
|
38
|
+
setattr(namespace, self.dest, items)
|
|
39
|
+
|
|
40
|
+
class IsStored_ActionExtend(argparse.Action):
|
|
41
|
+
def __call__(self, parser, namespace, values, option_string=None):
|
|
42
|
+
given_arguments.add(self.dest)
|
|
43
|
+
setattr(namespace, self.dest + '_set', True)
|
|
44
|
+
items = getattr(namespace, self.dest, None)
|
|
45
|
+
items = argparse._copy_items(items)
|
|
46
|
+
items.extend(values)
|
|
47
|
+
setattr(namespace, self.dest, items)
|
|
48
|
+
|
|
49
|
+
### Does not work
|
|
50
|
+
# class IsStored_ActionCount(argparse.Action):
|
|
51
|
+
# def __call__(self, parser, namespace, values, option_string=None):
|
|
52
|
+
# given_arguments.add(self.dest)
|
|
53
|
+
# setattr(namespace, self.dest + '_set', True)
|
|
54
|
+
# items = getattr(namespace, self.dest, None)
|
|
55
|
+
# items = argparse._copy_items(items)
|
|
56
|
+
# items += 1
|
|
57
|
+
# setattr(namespace, self.dest, items)
|
|
58
|
+
|
|
59
|
+
parser = argparse.ArgumentParser(
|
|
60
|
+
formatter_class=argparse.RawTextHelpFormatter,
|
|
61
|
+
add_help = False,
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
parser.add_argument("--help", "-h", dest = "help", action=IsStored_ActionStore)
|
|
65
|
+
|
|
66
|
+
#######################
|
|
67
|
+
### SYSTEM CREATION ###
|
|
68
|
+
#######################
|
|
69
|
+
### Leaflet commands
|
|
70
|
+
parser.add_argument("--membrane", "-membrane", "-memb", dest = "membrane_cmds", action=IsStored_ActionAppend, type=str, default = [], nargs="+")
|
|
71
|
+
|
|
72
|
+
### Protein commands
|
|
73
|
+
parser.add_argument("--protein", "-protein", "-prot", dest = "protein_cmds", action=IsStored_ActionAppend, type=str, default = [], nargs="+")
|
|
74
|
+
|
|
75
|
+
### Solvent commands
|
|
76
|
+
parser.add_argument("--solvation", "-solvation", "-solv", dest = "solvation_cmds", action=IsStored_ActionAppend, type=str, default = [], nargs="+")
|
|
77
|
+
|
|
78
|
+
### Solvent commands
|
|
79
|
+
parser.add_argument("--flooding", "-flooding", "-flood", dest = "flooding_cmds", action=IsStored_ActionAppend, type=str, default = [], nargs="+")
|
|
80
|
+
|
|
81
|
+
###############################
|
|
82
|
+
### SPECIAL SYSTEM CREATION ###
|
|
83
|
+
###############################
|
|
84
|
+
### Stacked membrane commands
|
|
85
|
+
parser.add_argument("--stacked_membranes", "-stack_memb", "-stacked_membranes", dest = "stacked_membranes_cmds", action=IsStored_ActionAppend, type=str, default = [], nargs="+")
|
|
86
|
+
|
|
87
|
+
############
|
|
88
|
+
### MISC ###
|
|
89
|
+
############
|
|
90
|
+
### Topology commands
|
|
91
|
+
parser.add_argument("--itp_input", "-itp_input", "-itp_in", dest = "itp_input_cmds", action=IsStored_ActionAppend, type=str, default = [], nargs="+")
|
|
92
|
+
|
|
93
|
+
### Molecule structure import commands
|
|
94
|
+
parser.add_argument("--molecule_import", "-molecule_import", dest = "molecule_import_cmds", action=IsStored_ActionAppend, type=str, default = [], nargs="+")
|
|
95
|
+
|
|
96
|
+
### Molecule definition import commands
|
|
97
|
+
parser.add_argument("--molecule_definition", "-molecule_definition", dest = "molecule_definition_cmds", action=IsStored_ActionAppend, type=str, default = [], nargs="+")
|
|
98
|
+
|
|
99
|
+
### Plotting command. Developer feature to test different algorithms.
|
|
100
|
+
parser.add_argument("--plot_grid", "-plot_grid", "-plot", dest = "plot_grid_cmd", action=IsStored_ActionStore)
|
|
101
|
+
|
|
102
|
+
### Pickle commands
|
|
103
|
+
parser.add_argument("--pickle", "-pickle", dest = "pickle_cmd", action=IsStored_ActionStore)
|
|
104
|
+
|
|
105
|
+
### Whether to backup files if they would be overwritten
|
|
106
|
+
parser.add_argument("--backup", "-backup", dest = "backup_cmd", action=IsStored_ActionStore)
|
|
107
|
+
|
|
108
|
+
### Random seed
|
|
109
|
+
parser.add_argument("--randseed", "-randseed", "-rand", dest = "randseed_cmd", action=IsStored_ActionStore)
|
|
110
|
+
|
|
111
|
+
### System parameters
|
|
112
|
+
parser.add_argument("--sys_params", "-sys_params", "-sysp", dest = "sys_params", action=IsStored_ActionStore)
|
|
113
|
+
parser.add_argument("--prot_params", "-prot_params", "-pp", dest = "prot_params", action=IsStored_ActionStore)
|
|
114
|
+
parser.add_argument("--lipid_params", "-lipid_params", "-lp", dest = "lipid_params", action=IsStored_ActionStore)
|
|
115
|
+
parser.add_argument("--solv_params", "-solv_params", "-sp", dest = "solv_params", action=IsStored_ActionStore)
|
|
116
|
+
|
|
117
|
+
### System name
|
|
118
|
+
parser.add_argument("--system_name", "-system_name", "-sn", dest = "system_name", action=IsStored_ActionStore)
|
|
119
|
+
|
|
120
|
+
#########################
|
|
121
|
+
### BOX SIZE AND TYPE ###
|
|
122
|
+
#########################
|
|
123
|
+
### pbc box size [nm]
|
|
124
|
+
parser.add_argument("--box", "-box", dest = "pbc_box", action=IsStored_ActionExtend, type=str, default = [], nargs="+")
|
|
125
|
+
parser.add_argument("--pbc", "-pbc", dest = "pbc_box", action=IsStored_ActionExtend, type=str, default = [], nargs="+")
|
|
126
|
+
|
|
127
|
+
### x/y/z size of box [nm]
|
|
128
|
+
parser.add_argument("--x", "-x", dest = "pbcx", type=str, action=IsStored_ActionStore)
|
|
129
|
+
parser.add_argument("--y", "-y", dest = "pbcy", type=str, action=IsStored_ActionStore)
|
|
130
|
+
parser.add_argument("--z", "-z", dest = "pbcz", type=str, action=IsStored_ActionStore)
|
|
131
|
+
|
|
132
|
+
### pbc box type
|
|
133
|
+
parser.add_argument("--box_type", "-box_type", dest = "pbc_box_type", type=str, action=IsStored_ActionStore)
|
|
134
|
+
parser.add_argument("--pbc_type", "-pbc_type", dest = "pbc_box_type", type=str, action=IsStored_ActionStore)
|
|
135
|
+
|
|
136
|
+
### Manual unit cell designation
|
|
137
|
+
parser.add_argument("--pdb_unitcell", "-pdb_unitcell", dest = "pdb_unitcell", action=IsStored_ActionExtend, type=str, default = [], nargs="+")
|
|
138
|
+
parser.add_argument("--gro_unitcell", "-gro_unitcell", dest = "gro_unitcell", action=IsStored_ActionExtend, type=str, default = [], nargs="+")
|
|
139
|
+
|
|
140
|
+
####################
|
|
141
|
+
### OUTPUT FILES ###
|
|
142
|
+
####################
|
|
143
|
+
### Output pdb/gro/top/log file
|
|
144
|
+
parser.add_argument("--out_all", "-out_all", "-o_all", dest = "out_all_file_name", action=IsStored_ActionStore)
|
|
145
|
+
|
|
146
|
+
### Output pdb/gro file
|
|
147
|
+
parser.add_argument("--out_sys", "-out_sys", "-o_sys", dest = "out_sys_file_name", action=IsStored_ActionStore)
|
|
148
|
+
### Output pdb file
|
|
149
|
+
parser.add_argument("--out_pdb", "-out_pdb", "-o_pdb", dest = "out_pdb_file_name", action=IsStored_ActionStore)
|
|
150
|
+
### Output gro file
|
|
151
|
+
parser.add_argument("--out_gro", "-out_gro", "-o_gro", dest = "out_gro_file_name", action=IsStored_ActionStore)
|
|
152
|
+
|
|
153
|
+
### Output topology file
|
|
154
|
+
parser.add_argument("--out_top", "-out_top", "-t", dest = "out_top_file_name", action=IsStored_ActionStore)
|
|
155
|
+
|
|
156
|
+
### Log file
|
|
157
|
+
parser.add_argument("--out_log", "-out_log", "-log", dest = "out_log_file_name", action=IsStored_ActionStore)
|
|
158
|
+
|
|
159
|
+
################
|
|
160
|
+
### PRINTING ###
|
|
161
|
+
################
|
|
162
|
+
### Prints
|
|
163
|
+
parser.add_argument("--print_quiet", "-quiet", dest = "quiet", action=IsStored_ActionStore)
|
|
164
|
+
parser.add_argument("--print_debug", "-debug", dest = "debug", action=IsStored_ActionStore)
|
|
165
|
+
parser.add_argument("--print_extra", "-extra", dest = "extra", action=IsStored_ActionStore)
|
|
166
|
+
parser.add_argument("--print_warnings", "-warn", dest = "warnings", action=IsStored_ActionStore)
|
|
167
|
+
parser.add_argument("--verbose", "-verbose", "-v", dest = "verbose", action=IsStored_ActionStore)
|
|
168
|
+
|
|
169
|
+
### ### Parser for handling '-f' when importing module to Jupyter
|
|
170
|
+
# parser.add_argument("-fff", "-f", dest = "debug_flag_for_ipython")
|
|
171
|
+
### unknown variable includes the weird -f flag that jupyter puts in so no need for added argument.
|
|
172
|
+
### Argument still needed otherwise jupyter will throw the following error:
|
|
173
|
+
### "ipykernel_launcher.py: error: ambiguous option: -f could match -flood, -flooding"
|
|
174
|
+
|
|
175
|
+
args, unknown = parser.parse_known_args()
|
|
176
|
+
|
|
177
|
+
##############################
|
|
178
|
+
### HELP FOR THOSE IN NEED ###
|
|
179
|
+
##############################
|
|
180
|
+
|
|
181
|
+
if __name__ == "__main__":
|
|
182
|
+
if "help" in given_arguments or len(given_arguments) == 0:
|
|
183
|
+
parser.print_help()
|
|
184
|
+
sys.exit()
|
|
185
|
+
|
|
186
|
+
parser_kwargs = {}
|
|
187
|
+
|
|
188
|
+
parse_membrane_cmds = [" ".join(i) for i in args.membrane_cmds]
|
|
189
|
+
parse_protein_cmds = [" ".join(i) for i in args.protein_cmds]
|
|
190
|
+
parse_solvation_cmds = [" ".join(i) for i in args.solvation_cmds]
|
|
191
|
+
parse_flooding_cmds = [" ".join(i) for i in args.flooding_cmds]
|
|
192
|
+
parse_stacked_membranes_cmds = [" ".join(i) for i in args.stacked_membranes_cmds]
|
|
193
|
+
parse_itp_input_cmds = [" ".join(i) for i in args.itp_input_cmds]
|
|
194
|
+
parse_molecule_import_cmds = [" ".join(i) for i in args.molecule_import_cmds]
|
|
195
|
+
parse_molecule_definition_cmds = [" ".join(i) for i in args.molecule_definition_cmds]
|
|
196
|
+
|
|
197
|
+
for COBY_cmd, parse, arg_name in [
|
|
198
|
+
("membrane", parse_membrane_cmds, "membrane_cmds"),
|
|
199
|
+
("protein", parse_protein_cmds, "protein_cmds"),
|
|
200
|
+
("solvation", parse_solvation_cmds, "solvation_cmds"),
|
|
201
|
+
("flooding", parse_flooding_cmds, "flooding_cmds"),
|
|
202
|
+
("stacked_membranes", parse_stacked_membranes_cmds, "stacked_membranes_cmds"),
|
|
203
|
+
("itp_input", parse_itp_input_cmds, "itp_input_cmds"),
|
|
204
|
+
("molecule_import", parse_molecule_import_cmds, "molecule_import_cmds"),
|
|
205
|
+
("molecule_definition", parse_molecule_definition_cmds, "molecule_definition_cmds"),
|
|
206
|
+
|
|
207
|
+
("plot_grid", args.plot_grid_cmd, "plot_grid_cmd"),
|
|
208
|
+
("pickle", args.pickle_cmd, "pickle_cmd"),
|
|
209
|
+
("backup", args.backup_cmd, "backup_cmd"),
|
|
210
|
+
("randseed", args.randseed_cmd, "randseed_cmd"),
|
|
211
|
+
|
|
212
|
+
("sys_params", args.sys_params, "sys_params"),
|
|
213
|
+
("prot_params", args.prot_params, "prot_params"),
|
|
214
|
+
("lipid_params", args.lipid_params, "lipid_params"),
|
|
215
|
+
("solv_params", args.solv_params, "solv_params"),
|
|
216
|
+
|
|
217
|
+
("box", args.pbc_box, "pbc_box"),
|
|
218
|
+
("x", args.pbcx, "pbcx"),
|
|
219
|
+
("y", args.pbcy, "pbcy"),
|
|
220
|
+
("z", args.pbcz, "pbcz"),
|
|
221
|
+
("box_type", args.pbc_box_type, "pbc_box_type"),
|
|
222
|
+
("pdb_unitcell", args.pdb_unitcell, "pdb_unitcell"),
|
|
223
|
+
("gro_unitcell", args.gro_unitcell, "gro_unitcell"),
|
|
224
|
+
|
|
225
|
+
("out_all", args.out_all_file_name, "out_all_file_name"),
|
|
226
|
+
("out_sys", args.out_sys_file_name, "out_sys_file_name"),
|
|
227
|
+
("out_pdb", args.out_pdb_file_name, "out_pdb_file_name"),
|
|
228
|
+
("out_gro", args.out_gro_file_name, "out_gro_file_name"),
|
|
229
|
+
("out_top", args.out_top_file_name, "out_top_file_name"),
|
|
230
|
+
("out_log", args.out_log_file_name, "out_log_file_name"),
|
|
231
|
+
|
|
232
|
+
("sn", args.system_name, "system_name"),
|
|
233
|
+
|
|
234
|
+
("quiet", args.quiet, "quiet"),
|
|
235
|
+
("debug", args.debug, "debug"),
|
|
236
|
+
("extra", args.extra, "extra"),
|
|
237
|
+
("warn", args.warnings, "warnings"),
|
|
238
|
+
("verbose", args.verbose, "verbose"),
|
|
239
|
+
]:
|
|
240
|
+
if arg_name in given_arguments:
|
|
241
|
+
parser_kwargs[COBY_cmd] = parse
|
|
242
|
+
|
|
243
|
+
if parser_kwargs:
|
|
244
|
+
COBY(
|
|
245
|
+
run = True,
|
|
246
|
+
terminal_run_kwargs = parser_kwargs,
|
|
247
|
+
)
|
|
248
|
+
|
|
249
|
+
#####################################################################
|
|
250
|
+
########################## YOU HAVE PARSED ##########################
|
|
251
|
+
#####################################################################
|
COBY/help.py
ADDED
|
File without changes
|