From b9d790af5593330d07c07ef102f24f0264b7f9cb Mon Sep 17 00:00:00 2001 From: Daniel Blankenberg Date: Mon, 3 Jan 2011 11:15:29 -0500 Subject: [PATCH] Add CCAT ChIP-seq peak/region caller. --- tool-data/ccat_configurations.loc.sample | 4 + tool_conf.xml.sample | 1 + tool_data_table_conf.xml.sample | 5 + tools/peak_calling/ccat_2_wrapper.py | 40 ++++++++ tools/peak_calling/ccat_2_wrapper.xml | 123 +++++++++++++++++++++++ 5 files changed, 173 insertions(+) create mode 100644 tool-data/ccat_configurations.loc.sample create mode 100644 tools/peak_calling/ccat_2_wrapper.py create mode 100644 tools/peak_calling/ccat_2_wrapper.xml diff --git a/tool-data/ccat_configurations.loc.sample b/tool-data/ccat_configurations.loc.sample new file mode 100644 index 00000000000..83c821b9307 --- /dev/null +++ b/tool-data/ccat_configurations.loc.sample @@ -0,0 +1,4 @@ +#Provide Pre-compiled CCAT peak/region caller configuration files +#UID Description path_to_config_file +#ccat_2.0_tf_config CCAT provided Transcription Factor Binding /path_to/ccat/configs/config_TF.txt +#ccat_2.0_histone_config CCAT provided Histone Modification /path_to/ccat/configs/config_histone.txt diff --git a/tool_conf.xml.sample b/tool_conf.xml.sample index 71610a27b87..7b600128d74 100644 --- a/tool_conf.xml.sample +++ b/tool_conf.xml.sample @@ -313,6 +313,7 @@
+
diff --git a/tool_data_table_conf.xml.sample b/tool_data_table_conf.xml.sample index 5fc6d376812..e23901bdbe2 100644 --- a/tool_data_table_conf.xml.sample +++ b/tool_data_table_conf.xml.sample @@ -70,4 +70,9 @@ value, dbkey, name, path + + + value, name, path + +
diff --git a/tools/peak_calling/ccat_2_wrapper.py b/tools/peak_calling/ccat_2_wrapper.py new file mode 100644 index 00000000000..3ee83709207 --- /dev/null +++ b/tools/peak_calling/ccat_2_wrapper.py @@ -0,0 +1,40 @@ +import sys, subprocess, tempfile, shutil, os.path + +CCAT_BINARY = "CCAT" + +def get_top_count( filename ): + for line in open( filename ): + if line.startswith( 'outputNum' ): + return int( line.split()[-1].strip() ) + +def stop_err( tmp_dir, exception ): + print >> sys.stderr, "Error running CCAT." + shutil.rmtree( tmp_dir ) #some error has occurred, provide info and remove possibly non-empty temp directory + raise exception + +def main(): + input_tag_file = sys.argv[1] + input_control_file = sys.argv[2] + chrom_info_file = sys.argv[3] + input_config_file = sys.argv[4] + project_name = sys.argv[5] + output_peak_file = sys.argv[6] + output_region_file = sys.argv[7] + output_top_file = sys.argv[8] + output_log_file = sys.argv[9] + + tmp_dir = tempfile.mkdtemp() + try: + proc = subprocess.Popen( args="%s %s > %s" % ( CCAT_BINARY, " ".join( map( lambda x: "'%s'" % x, [ input_tag_file, input_control_file, chrom_info_file, input_config_file, project_name ] ) ), output_log_file ), shell=True, cwd=tmp_dir ) + proc.wait() + if proc.returncode: + raise Exception( "Error code: %i" % proc.returncode ) + output_num = get_top_count( input_config_file ) + shutil.move( os.path.join( tmp_dir, "%s.significant.peak" % project_name ), output_peak_file ) + shutil.move( os.path.join( tmp_dir, "%s.significant.region" % project_name ), output_region_file ) + shutil.move( os.path.join( tmp_dir, "%s.top%i.peak" % ( project_name, output_num ) ), output_top_file ) + except Exception, e: + return stop_err( tmp_dir, e ) + os.rmdir( tmp_dir ) #clean up empty temp working directory + +if __name__ == "__main__": main() diff --git a/tools/peak_calling/ccat_2_wrapper.xml b/tools/peak_calling/ccat_2_wrapper.xml new file mode 100644 index 00000000000..d1f6ffb2c53 --- /dev/null +++ b/tools/peak_calling/ccat_2_wrapper.xml @@ -0,0 +1,123 @@ + + Control-based ChIP-seq Analysis Tool + ccat_2_wrapper.py '$input_tag_file' '$input_control_file' '$chromInfo' + #if str( $options_type[ 'options_type_selector' ] ) == 'advanced': + '$input_advanced_config_file' + #else: + '${ options_type.input_config_file.get_field( 'path' ) }' + #end if + 'CCAT in Galaxy' + '$output_peak_file' '$output_region_file' '$output_top_file' '$output_log_file' + + CCAT + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #if str( $options_type['options_type_selector' ] ) == 'advanced': +fragmentSize ${options_type[ 'fragment_size' ]} +slidingWinSize ${options_type[ 'sliding_window_size' ]} +movingStep ${options_type[ 'moving_step' ]} +isStrandSensitiveMode ${options_type[ 'is_strand_sensitive_mode' ]} +minCount ${options_type[ 'min_count' ]} +outputNum ${options_type[ 'output_num' ]} +randomSeed ${options_type[ 'random_seed' ]} +minScore ${options_type[ 'min_score' ]} +bootstrapPass ${options_type[ 'bootstrap_pass' ]} +#end if + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +**What it does** + +This tool allows ChIP-seq peak/region calling using CCAT. + +View the original CCAT documentation: http://cmb.gis.a-star.edu.sg/ChIPSeq/paperCCAT.htm. + +