commit/galaxy-central: dan: Have MACS peak caller wrapper use return code to set error state.
1 new changeset in galaxy-central: http://bitbucket.org/galaxy/galaxy-central/changeset/e8cb2707083d/ changeset: r5534:e8cb2707083d user: dan date: 2011-05-10 16:50:26 summary: Have MACS peak caller wrapper use return code to set error state. affected #: 2 files (331 bytes) --- a/tools/peak_calling/macs_wrapper.py Tue May 10 10:35:19 2011 -0400 +++ b/tools/peak_calling/macs_wrapper.py Tue May 10 10:50:26 2011 -0400 @@ -5,8 +5,6 @@ import simplejson CHUNK_SIZE = 1024 -ERROR_LINES = [ 'ERROR', 'command not found' ] #'Fatal' errors that should be passed back to stderr -WARNING_LINE_START = 'WARNING @' def gunzip_cat_glob_path( glob_path, target_filename, delete = False ): out = open( target_filename, 'wb' ) @@ -70,17 +68,16 @@ stderr_name = tempfile.NamedTemporaryFile().name # redirect stderr here, macs provides lots of info via stderr, make it into a report proc = subprocess.Popen( args=cmdline, shell=True, cwd=tmp_dir, stderr=open( stderr_name, 'wb' ) ) proc.wait() - - #Need to lightly parse stderr file to see if there is a fatal error (e.g. macs is not installed on system) - #We don't want to set tool run to error state if only warnings or info, e.g. mfold needs to be decreased, rather create empty outputs, but let user view macs log - for line in open( stderr_name ): - for err_text in ERROR_LINES: - if err_text in line: - #print error, but don't quit, allow cleanup to occur at end - print >> sys.stderr, line.rstrip( '\n\r' ) - if line.startswith( WARNING_LINE_START ): - #print warnings so they are viewable from info - print line.split( ':' )[-1].strip() + #We don't want to set tool run to error state if only warnings or info, e.g. mfold could be decreased to improve model, but let user view macs log + #Do not terminate if error code, allow dataset (e.g. log) creation and cleanup + if proc.returncode: + stderr_f = open( stderr_name ) + while True: + chunk = stderr_f.read( CHUNK_SIZE ) + if not chunk: + stderr_f.close() + break + sys.stderr.write( chunk ) #run R to create pdf from model script if os.path.exists( os.path.join( tmp_dir, "%s_model.r" % experiment_name ) ): --- a/tools/peak_calling/macs_wrapper.xml Tue May 10 10:35:19 2011 -0400 +++ b/tools/peak_calling/macs_wrapper.xml Tue May 10 10:50:26 2011 -0400 @@ -1,4 +1,4 @@ -<tool id="peakcalling_macs" name="MACS" version="1.0.0"> +<tool id="peakcalling_macs" name="MACS" version="1.0.1"><description>Model-based Analysis of ChIP-Seq</description><command interpreter="python">macs_wrapper.py $options_file $output_bed_file $output_extra_files $output_extra_files.files_path</command><requirements> Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
Bitbucket