@@ -53,6 +53,12 @@ def _single_residue(self, adir, process=False):
53
53
result = None
54
54
return result
55
55
56
+ def _single_result (self , adir ):
57
+ result = self ._single_residue (adir )
58
+ residue = adir .split ('/' )[- 1 ]
59
+ self .residues [residue ] = result
60
+
61
+
56
62
def reprocess (self , nproc = 1 ):
57
63
"""Rerun processing and clustering on :class:`Gibbs` data.
58
64
@@ -77,7 +83,7 @@ def reprocess(self, nproc=1):
77
83
except KeyboardInterrupt :
78
84
pass
79
85
80
- def collect_results (self ):
86
+ def collect_results (self , nproc = 1 ):
81
87
"""Collect names of results for each residue in the `basicrta-{cutoff}`
82
88
directory in a dictionary stored in :attr:`ProcessProtein.results`.
83
89
"""
@@ -87,13 +93,19 @@ def collect_results(self):
87
93
sorted_inds = (np .array ([int (adir .split ('/' )[- 1 ][1 :]) for adir in dirs ])
88
94
.argsort ())
89
95
dirs = dirs [sorted_inds ]
90
- try :
91
- for adir in tqdm (dirs , desc = 'collecting results' ):
92
- result = self ._single_residue (adir )
93
- residue = adir .split ('/' )[- 1 ]
94
- self .residues [residue ] = result
95
- except KeyboardInterrupt :
96
- pass
96
+ with (Pool (nproc , initializer = tqdm .set_lock ,
97
+ initargs = (Lock (),)) as p ):
98
+ try :
99
+ for _ in tqdm (p .istarmap (self ._single_result , dirs ),
100
+ total = len (dirs ), position = 0 ,
101
+ desc = 'overall progress' ):
102
+ pass
103
+ #for adir in tqdm(dirs, desc='collecting results'):
104
+ # result = self._single_residue(adir)
105
+ # residue = adir.split('/')[-1]
106
+ # self.residues[residue] = result
107
+ except KeyboardInterrupt :
108
+ pass
97
109
98
110
def get_taus (self ):
99
111
r"""Get :math:`\tau` and 95\% confidence interval bounds for the slowest
0 commit comments