@@ -217,6 +217,11 @@ def create_plts(resultsdir, wrapped_prog, Ks, bestk):
217217 plt_files = [os .path .join (resultsdir , "K" ) + str (i ) + "_rep" +
218218 file_to_plot + "_f"
219219 for i in plt_list ]
220+ elif wrapped_prog == "maverick" :
221+ plt_files = [os .path .join (os .path .join (resultsdir , "K" + str (i )),
222+ "outputQmatrix_ind_K" + str (i ) + ".csv" )
223+ for i in plt_list ]
224+
220225 else :
221226 plt_files = [os .path .join (resultsdir , "fS_run_K." ) + str (i ) + ".meanQ"
222227 for i in plt_list ]
@@ -225,7 +230,7 @@ def create_plts(resultsdir, wrapped_prog, Ks, bestk):
225230 indfile = arg .indfile )
226231
227232
228- def maverick_merger (outdir , k_list , tests ):
233+ def maverick_merger (outdir , k_list , no_tests ):
229234 """
230235 Grabs the split outputs from MavericK and merges them in a single directory.
231236 """
@@ -261,6 +266,7 @@ def _ti_test(outdir, log_evidence_ti):
261266 "that the best value of 'K' is: {}\n " .format (bestk ))
262267 bestk_file .write (output_text )
263268 bestk_file .close ()
269+ return [bestk ]
264270
265271 for filename in files_list :
266272 header = True
@@ -275,8 +281,9 @@ def _ti_test(outdir, log_evidence_ti):
275281
276282 outfile .close ()
277283
278- if tests is False :
279- _ti_test (outdir , log_evidence_ti )
284+ if no_tests is False :
285+ bestk = _ti_test (outdir , log_evidence_ti )
286+ return bestk
280287
281288
282289def argument_parser (args ):
@@ -477,15 +484,18 @@ def main():
477484 structure_threader (Ks , replicates , threads , wrapped_prog )
478485
479486 if wrapped_prog == "maverick" :
480- maverick_merger (arg .outpath , Ks , arg .notests )
487+ bestk = maverick_merger (arg .outpath , Ks , arg .notests )
488+ arg .notests = True
481489
482490 if arg .notests is False :
483491 bestk = structure_harvester (arg .outpath , wrapped_prog )
484492
485- if arg .noplot is False :
486- if arg .bestk is not None :
487- bestk = arg .bestk
488- create_plts (arg .outpath , wrapped_prog , Ks , bestk )
493+ if arg .noplot is False :
494+ if arg .bestk is not None :
495+ bestk = arg .bestk
496+ else :
497+ bestk = None
498+ create_plts (arg .outpath , wrapped_prog , Ks , bestk )
489499
490500
491501if __name__ == "__main__" :
0 commit comments