Skip to content

Commit 04cb247

Browse files
committed
Updates to pyproject.toml, also looked into issue #37 - moved logic around and removed the executable in the bin directory and moved it into the main_mcc.py file
1 parent 20d6a58 commit 04cb247

3 files changed

Lines changed: 177 additions & 185 deletions

File tree

CodeEntropy/main_mcc.py

Lines changed: 173 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,179 @@
66
from CodeEntropy import EntropyFunctions as EF
77
from CodeEntropy import MDAUniverseHelper as MDAHelper
88

9-
def main(arg_dict):
9+
import argparse
10+
from datetime import datetime
11+
12+
def main():
1013
"""
1114
Main function for calculating the entropy of a system using the multiscale cell correlation method.
12-
13-
Parameters
14-
----------
15-
arg_dict : the input arguments
1615
"""
1716

17+
try:
18+
parser = argparse.ArgumentParser(description="""
19+
CodeEntropy-POSEIDON is a tool to compute entropy using the multiscale-cell-correlation (MCC) theory and force/torque covariance methods with the ablity to compute solvent entropy.
20+
Version:
21+
0.3.1;
22+
23+
Authors:
24+
Arghya Chakravorty (arghya90),
25+
Jas Kalayan (jkalayan),
26+
Donald Chang,
27+
Sarah Fegan
28+
Ioana Papa;
29+
30+
Output:
31+
*.csv = results from different calculateion,
32+
*.pkl - Pickled reduced universe for further analysis,
33+
*.out - detailed output such as matrix and spectra""")
34+
35+
36+
parser.add_argument('-f', '--top_traj_file',
37+
required=True,
38+
dest="filePath",
39+
action='store',
40+
nargs='+',
41+
help="Path to Structure/topology file (AMBER PRMTOP, GROMACS TPR which contains topology and dihedral information) followed by Trajectory file(s) (AMBER NETCDF or GROMACS TRR) you will need to output the coordinates and forces to the same file. Required.")
42+
parser.add_argument('-l', '--selectString',
43+
action='store',
44+
dest="selectionString",
45+
type=str,
46+
default='all',
47+
help='Selection string for CodeEntropy such as protein or resid, refer to MDAnalysis.select_atoms for more information.')
48+
parser.add_argument('-b', '--begin',
49+
action="store",
50+
dest="start",
51+
help="Start analysing the trajectory from this frame index. Defaults to 0",
52+
default=0,
53+
type= int)
54+
parser.add_argument('-e', '--end',
55+
action="store",
56+
dest="end",
57+
help="Stop analysing the trajectory at this frame index. Defaults to -1 (end of trajectory file)",
58+
default=-1,
59+
type=int)
60+
parser.add_argument('-d', '--step',
61+
action="store",
62+
dest="step",
63+
help="interval between two consecutive frames to be read index. Defaults to 1",
64+
default=1,
65+
type=int)
66+
parser.add_argument("-n","--bin_width",
67+
action="store",
68+
dest="bin_width",
69+
default=30,
70+
type=int,
71+
help="Bin width in degrees for making the histogram of the dihedral angles for the conformational entropy. Default: 30")
72+
parser.add_argument('-k', '--tempra',
73+
action="store",
74+
dest="temp",
75+
help="Temperature for entropy calculation (K). Default to 298.0 K",
76+
default=298.0,
77+
type=float)
78+
parser.add_argument("-v","--verbose",
79+
action="store",
80+
dest="verbose",
81+
default=False,
82+
type=bool,
83+
help="True/False flag for noisy or quiet output. Default: False")
84+
parser.add_argument('-t', '--thread',
85+
action="store",
86+
dest="thread",
87+
help="How many multiprocess to use. Default 1 for single core execution.",
88+
default=1,
89+
type=int)
90+
parser.add_argument("-o","--out",
91+
action="store",
92+
dest ="outFile",
93+
default="outfile.out",
94+
help ="Name of the file where the output will be written. Default: outfile.out")
95+
parser.add_argument("-r","--resout",
96+
action="store",
97+
dest ="resOutFile",
98+
default="res_outfile.out",
99+
help ="Name of the file where the residue entropy output will be written. Default: res_outfile.out")
100+
parser.add_argument("-m", "--mout",
101+
action="store",
102+
dest ="moutFile",
103+
default=None,
104+
help ="Name of the file where certain matrices will be written (default: None).")
105+
106+
parser.add_argument('-c', '--cutShell',
107+
action='store',
108+
dest="cutShell",
109+
default=None,
110+
type=float,
111+
help='include cutoff shell analysis, add cutoff distance in angstrom Default None will ust the RAD Algorithm')
112+
parser.add_argument('-p', '--pureAtomNum',
113+
action='store',
114+
dest="puteAtomNum",
115+
default=1,
116+
type=int,
117+
help='Reference molecule resid for system of pure liquid. Default to 1')
118+
parser.add_argument('-x', '--excludedResnames',
119+
dest="excludedResnames",
120+
action='store',
121+
nargs='+',
122+
default=None,
123+
help='exclude a list of molecule names from nearest non-like analysis. Default: None. Multiples are gathered into list.')
124+
parser.add_argument('-w', '--water',
125+
dest = "waterResnames",
126+
action='store',
127+
default='WAT',
128+
nargs='+',
129+
help='resname for water molecules. Default: WAT. Multiples are gathered into list.')
130+
parser.add_argument('-s', '--solvent',
131+
dest="solventResnames",
132+
action='store',
133+
nargs='+',
134+
default=None,
135+
help='include resname of solvent molecules (case-sensitive) Default: None. Multiples are gathered into list.')
136+
parser.add_argument("--solContact",
137+
action="store_true",
138+
dest ="doSolContact",
139+
default=False,
140+
help ="Do solute contact calculation")
141+
142+
args = parser.parse_args()
143+
except argparse.ArgumentError:
144+
print('Command line arguments are ill-defined, please check the arguments')
145+
raise
146+
147+
148+
############## REPLACE INPUTS ##############
149+
print("printing all input")
150+
for arg in vars(args):
151+
print(' {} {}'.format(arg, getattr(args, arg) or ''))
152+
153+
startTime = datetime.now()
154+
155+
# create dictonary of inputs to be passed to the main function
156+
arg_dict = {}
157+
158+
arg_dict['outfile'] = args.outFile
159+
arg_dict['temper'] = args.temp
160+
arg_dict['selection_string'] = args.selectionString
161+
arg_dict['start'] = args.start
162+
arg_dict['end'] = args.end
163+
arg_dict['step'] = args.step
164+
arg_dict['bin_width'] = args.bin_width
165+
arg_dict['verbose'] = args.verbose
166+
arg_dict['thread'] = args.thread
167+
arg_dict['moutFile'] = args.moutFile
168+
arg_dict['resfile'] = args.resOutFile
169+
170+
arg_dict['cutShell'] = args.cutShell
171+
arg_dict['puteAtomNum'] = args.puteAtomNum
172+
arg_dict['excludedResnames'] = args.excludedResnames
173+
arg_dict['waterResnames'] = args.waterResnames
174+
arg_dict['solventResnames'] = args.solventResnames
175+
176+
# Get topology and trajectory file names and make universe
177+
tprfile = args.filePath[0]
178+
trrfile = args.filePath[1:]
179+
u = mda.Universe(tprfile, trrfile)
180+
arg_dict['universe'] = u
181+
18182
# Define MDAnalysis Universe from inputs
19183
u = arg_dict['universe']
20184

@@ -246,3 +410,7 @@ def main(arg_dict):
246410

247411

248412
# END main function
413+
414+
if __name__ == "__main__":
415+
416+
main()

bin/CodeEntropy

Lines changed: 0 additions & 172 deletions
This file was deleted.

pyproject.toml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,16 @@ dependencies = [
4141
"pathos==0.2.9"
4242
]
4343

44+
[project.urls]
45+
Source = "https://github.com/CCPBioSim/CodeEntropy"
46+
4447
[project.optional-dependencies]
4548
testing = [
4649
"pytest==8.2.2",
4750
"pytest-cov==5.0.0",
4851
"pytest-sugar==1.0.0"
4952
]
5053

51-
[project.urls]
52-
Source = "https://github.com/CCPBioSim/CodeEntropy"
53-
5454
pre-commit = [
5555
"pre-commit==3.7.1",
5656
"pylint==3.2.5"
@@ -66,8 +66,4 @@ docs = [
6666
]
6767

6868
# [project.scripts]
69-
# CodeEntropy = "main_mcc:main"
70-
71-
# [project.scripts.entry-points]
72-
73-
69+
# CodeEntropy = "main_mcc:main"

0 commit comments

Comments
 (0)