77
88class MultibindDriver (object ):
99
10+ """Class to quickly run multibind over a range of pH values"""
11+
1012 def __init__ (self , multibind ):
13+ """
14+ Parameters
15+ ----------
16+ multibind : Multibind
17+ A multibind object with its states and graph attributed defined.
18+
19+ """
1120 if not type (multibind .states ) is None and not type (multibind .graph ) is None :
1221 self .multibind = multibind
1322 else :
1423 raise ValueError (
1524 "Multibind driver must be passed a Multibind object that has states and a graph file loaded." )
1625
1726 def create_tensor (self , pH_array ):
27+ """Create a tensor containing state free energies across a pH range.
28+
29+ Parameters
30+ ----------
31+ pH_array : iterable
32+ An iterable containing the pH values to calculate binding free energies for.
33+
34+ Returns
35+ -------
36+ None
37+
38+ """
1839 num_states = self .multibind .states .name .shape [0 ]
1940 self .tensor = np .zeros ((num_states , num_states , len (pH_array )))
2041
@@ -28,8 +49,14 @@ def create_tensor(self, pH_array):
2849class Multibind (object ):
2950
3051 def __init__ (self , states_filename = None , graph_filename = None ):
31- # If states are specified in a CSV, may as well fill them in
32- # here. The same goes for the graph information
52+ """
53+ Parameters
54+ ----------
55+ states_filename : str (optional)
56+ Path the CSV containing the states of the graph.
57+ graph_filename : str (optional)
58+ Path to the CSV containing the graph data for the network.
59+ """
3360 if states_filename :
3461 self .read_states (states_filename )
3562 else :
@@ -44,10 +71,20 @@ def __init__(self, states_filename=None, graph_filename=None):
4471 self .concentrations = {}
4572
4673 def build_cycle (self , pH = 5 ):
47- """Constructs the cycle used for calculation"""
74+ """Constructs the cycle used for calculation
75+
76+ Parameters
77+ ----------
78+ pH : float | int
79+ The pH to calculate binding free energies over.
80+
81+ Returns
82+ -------
83+ None
84+ """
4885
4986 # Determine if we have enough information to continue,
50- # ie states information and graph information
87+ # i.e. states information and graph information
5188 if type (self .states ) is None or type (self .graph ) is None :
5289 msg = "Need to specify both the state and graph \
5390 information. Try using `read_states` and `read_graph`."
@@ -169,6 +206,16 @@ def jacobian(g_t):
169206
170207 def MLE_dist (self , N_steps = int (1e6 ), nt = 1 ):
171208 """Run Monte-Carlo steps to assess quality of MLE results.
209+
210+ Parameters
211+ ----------
212+ N_steps : int
213+ The number of Monte-Carlo steps to perform.
214+
215+ Returns
216+ -------
217+ ndarray with the distribution of free energy values for the states.
218+
172219 """
173220
174221 def potential (g_t ):
@@ -236,14 +283,17 @@ def effective_energy_difference(self, macrostate_class, state1, state2):
236283 """Calculate the effective binding energy between two states.
237284
238285 Parameters
239- ==========
240- macrostate_class : name of macrostate class (i.e. number of protons)
241- state1 : first, 'starting' state
242- state2 : second, 'destination' state
286+ ----------
287+ macrostate_class : str
288+ Name of macrostate class (i.e. number of protons)
289+ state1 : str
290+ first, 'starting' state
291+ state2 : str
292+ second, 'destination' state
243293
244294 Returns
245- =======
246- float : binding free energy in kT
295+ -------
296+ float : macroscopic free energy difference in kT
247297 """
248298
249299 macrostate_class = str (macrostate_class )
@@ -264,26 +314,31 @@ def _parse(self, filename, comment=None):
264314 raise e (f"Could not parse file { filename } " )
265315
266316 def read_states (self , filename , comment = None ):
267- """Read in state information from a state CSV file
317+ """Read in state information from a state CSV file.
268318
269319 Parameters
270- ==========
271- filename : string with the file path
320+ ----------
321+ filename : str
322+ Path to the state CSV file.
323+
324+ Returns
325+ -------
326+ None
272327 """
273328 self .states = self ._parse (filename , comment = comment )
274329 self .states ['name' ] = self .states ['name' ].astype ('str' )
275330
276331 def read_graph (self , filename , comment = None ):
277- """Read in the graph information from a graph CSV file
332+ """Read in the graph information from a graph CSV file.
278333
279334 Parameters
280- ==========
281- filename : string with the file path
335+ ----------
336+ filename : str
337+ File path of the graph CSV
282338
283339 Returns
284- =======
285- DataFrame with graph information (accessible using `graph`
286- attribute)
340+ -------
341+ None
287342 """
288343 self .graph = self ._parse (filename , comment = comment )
289344 self .graph ['state1' ] = self .graph ['state1' ].astype ('str' )
0 commit comments