Skip to content

Commit

Permalink
last iteration will keep all meme output and write it to a final resu…
Browse files Browse the repository at this point in the history
…lts file for evaluation
  • Loading branch information
weiju committed Jul 1, 2014
1 parent 1b759e4 commit 1071a2d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
17 changes: 9 additions & 8 deletions cmonkey/cmonkey_run.py
Expand Up @@ -679,14 +679,15 @@ def run_iterations(self, row_scoring, col_scoring):
self.write_stats(iteration_result)
self.update_iteration(iteration)

if 'dump_results' in self['debug']:
# write complete result into a cmresults.tsv
conn = self.__dbconn()
path = os.path.join(self['output_dir'], 'cmresults-postproc.tsv.bz2')
with bz2.BZ2File(path, 'w') as outfile:
debug.write_iteration(conn, outfile,
self['num_iterations'] + 1,
self['num_clusters'], self['output_dir'])
# default behaviour:
# always write complete result into a cmresults.tsv for R/cmonkey
# compatibility
conn = self.__dbconn()
path = os.path.join(self['output_dir'], 'cmresults-postproc.tsv.bz2')
with bz2.BZ2File(path, 'w') as outfile:
debug.write_iteration(conn, outfile,
self['num_iterations'] + 1,
self['num_clusters'], self['output_dir'])


self.write_finish_info()
Expand Down
5 changes: 3 additions & 2 deletions cmonkey/meme.py
Expand Up @@ -119,7 +119,8 @@ def background_file():

# run mast
meme_outfile = None
if 'keep_memeout' in params.debug:
is_last_iteration = params.iteration > params.num_iterations
if 'keep_memeout' in params.debug or is_last_iteration:
meme_outfile = os.path.join(params.outdir,
'meme-out-%04d-%04d' % (params.iteration, params.cluster))
with open(meme_outfile, 'w') as outfile:
Expand Down Expand Up @@ -158,7 +159,7 @@ def background_file():
except:
logging.warn("could not remove tmp file: '%s'", seqfile)
try:
if 'keep_memeout' not in params.debug:
if 'keep_memeout' not in params.debug and not is_last_iteration:
os.remove(meme_outfile)
except:
logging.warn("could not remove tmp file: '%s'", meme_outfile)
Expand Down

0 comments on commit 1071a2d

Please sign in to comment.