changeset 10:f66f23fcc83a

Modified layout
author mini
date Tue, 30 Sep 2014 11:08:39 +0200
parents 2cee4ed50058
children 137e05f24336
files libexec/callSomaticVariants.pl libexec/consolidateResults.pl libexec/filterSomaticVariants.pl strelka.xml strelka_wrapper.py
diffstat 5 files changed, 46 insertions(+), 116 deletions(-) [+]
line wrap: on
line diff
--- a/libexec/callSomaticVariants.pl	Fri Sep 26 14:33:07 2014 +0200
+++ b/libexec/callSomaticVariants.pl	Tue Sep 30 11:08:39 2014 +0200
@@ -1,7 +1,5 @@
 #!/usr/bin/env perl
-print "\n";
-print @INC;
-print "\n";
+
 =head1 LICENSE
 
 Strelka Workflow Software
@@ -38,9 +36,6 @@
 my $baseDir;
 my $libDir;
 BEGIN {
-print "\n";
-print @INC;
-print "\n";
 
     my $thisDir=(File::Spec->splitpath($0))[1];
     $baseDir=File::Spec->catdir($thisDir,File::Spec->updir());
@@ -48,12 +43,12 @@
 }
 use lib $libDir;
 use Utils;
+print "all imported call";
 
 if(getAbsPath($baseDir)) {
     errorX("Can't resolve path for strelka_workflow install directory: '$baseDir'");
 }
 my $libexecDir=File::Spec->catdir($baseDir,'libexec');
-#my $optDir=File::Spec->catdir($baseDir,'opt');
 
 
 my $scriptName=(File::Spec->splitpath($0))[2];
@@ -82,12 +77,9 @@
 #
 checkDir($baseDir);
 checkDir($libexecDir);
-#checkDir($optDir);
 
 my $strelkaBin=File::Spec->catdir($libexecDir,'strelka2');
 checkFile($strelkaBin,"strelka binary");
-#my $samtoolsBin = File::Spec->catfile($optDir,'samtools','samtools');
-#checkFile($samtoolsBin,"samtools binary");
 
 
 
--- a/libexec/consolidateResults.pl	Fri Sep 26 14:33:07 2014 +0200
+++ b/libexec/consolidateResults.pl	Tue Sep 30 11:08:39 2014 +0200
@@ -35,24 +35,18 @@
 
 my $baseDir;
 my $libDir;
-#my $optDir;
-#my $vcftDir;
 BEGIN {
     my $thisDir=(File::Spec->splitpath($0))[1];
     $baseDir=File::Spec->catdir($thisDir,File::Spec->updir());
     $libDir=File::Spec->catdir($baseDir,'lib');
-    #$optDir=File::Spec->catdir($baseDir,'opt');
-    #$vcftDir=File::Spec->catdir($optDir,'vcftools','lib','perl5','site_perl');
 }
 use lib $libDir;
 use Utils;
-#use lib $vcftDir;
 use Vcf;
 
 if(getAbsPath($baseDir)) {
     errorX("Can't resolve path for strelka_workflow install directory: '$baseDir'");
 }
-#$optDir=File::Spec->catdir($baseDir,'opt');
 
 
 my $scriptName=(File::Spec->splitpath($0))[2];
@@ -70,13 +64,6 @@
 pod2usage(2) unless(defined($configFile));
 
 #
-# check fixed paths
-#
-#my $samtoolsBin = File::Spec->catfile($optDir,'samtools','samtools');
-#checkFile($samtoolsBin,"samtools binary");
-
-
-#
 # read config and validate values
 #
 checkFile($configFile,"configuration ini");
@@ -247,17 +234,17 @@
     return unless(scalar(@bamList));
 
     my $headerFH = File::Temp->new();
-    my $getHeaderCmd = "bash -c '$samtoolsBin view -H ".$bamList[0]." > $headerFH'";
+    my $getHeaderCmd = "bash -c 'samtools view -H ".$bamList[0]." > $headerFH'";
     executeCmd($getHeaderCmd);
 
     my $allFile = File::Spec->catfile($reDir,$fileName . $itag);
-    my $cmd="$samtoolsBin merge -h $headerFH $allFile ". join(" ",@bamList);
+    my $cmd="samtools merge -h $headerFH $allFile ". join(" ",@bamList);
     executeCmd($cmd);
 
     my $allFileFinished = File::Spec->catfile($reDir,$fileName);
     checkMove($allFile,$allFileFinished);
 
-    my $indexCmd="$samtoolsBin index $allFileFinished";
+    my $indexCmd="samtools index $allFileFinished";
     executeCmd($indexCmd);
 
     # for now don't remove all the bin realignments...
--- a/libexec/filterSomaticVariants.pl	Fri Sep 26 14:33:07 2014 +0200
+++ b/libexec/filterSomaticVariants.pl	Tue Sep 30 11:08:39 2014 +0200
@@ -34,18 +34,15 @@
 
 my $baseDir;
 my $libDir;
-#my $vcftDir;
 BEGIN {
     my $thisDir=(File::Spec->splitpath($0))[1];
     $baseDir=File::Spec->catdir($thisDir,File::Spec->updir());
     $libDir=File::Spec->catdir($baseDir,'lib');
-    #my $optDir=File::Spec->catdir($baseDir,'opt');
-    #$vcftDir=File::Spec->catdir($optDir,'vcftools','lib','perl5','site_perl');
 }
 use lib $libDir;
 use Utils;
-#use lib $vcftDir;
-#use Vcf;
+use Vcf;
+print "all imported in filter";
 
 
 my $scriptName=(File::Spec->splitpath($0))[2];
--- a/strelka.xml	Fri Sep 26 14:33:07 2014 +0200
+++ b/strelka.xml	Tue Sep 30 11:08:39 2014 +0200
@@ -1,6 +1,6 @@
-<tool id="strelka88" name="Strelka good interface but no dependencies">
-
-  <description>Strelka good interface but no dependencies</description>
+<tool id="strelka" name="Strelka">
+  <!-- Made by Gregoire Seguin-Henry for geviteam in 2014 -->
+  <description>Strelka</description>
   <requirements>
     <requirement type="set_environment">SCRIPT_PATH</requirement>
     <requirement type="package" version="0.1.18">samtools</requirement>
@@ -60,7 +60,7 @@
         <param name="binSize" type="integer" value="25000000" label="binSize" />
         <param name="minTier1Mapq" type="integer" value="20" min="0" max="40" help="between 0 and 40" label="minTier1Mapq" />
         <param name="minTier2Mapq" type="integer" value="5" min="0" max="5" help="between 0 and 5" label="minTier2Mapq" />
-        <param name="isWriteRealignedBam" type="integer" value="0" label="isWriteRealignedBam" />
+        <param name="isWriteRealignedBam" type="integer" value="0" min="0" max="1" label="isWriteRealignedBam" help="0 for no alignment else 1"/>
         <param name="ssnvPrior" type="float" value="0.000001" label="ssnvPrior" />
         <param name="sindelPrior" type="float" value="0.000001" label="sindelPrior" />
         <param name="ssnvNoise" type="float" value="0.0000005" label="ssnvNoise" />
@@ -90,25 +90,37 @@
         </conditional>
       </when>
     </conditional>  
-    <conditional name="conf_file">
-      <param name="conf_file_switch" type="select" label="output conf_file ?">
-        <option value="No" selected="true">No</option>
-        <option value="Yes">Yes</option>
-      </param>
-    </conditional>
-
-
-
+      <param name="conf_file_check" type="boolean" label="output conf file" checked="False"/>
+      <param name="output1_file_check" type="boolean" label="output passed snvs(filtred)" checked="True"/>     
+      <param name="output2_file_check" type="boolean" label="output passed indels(filtred)" checked="True"/>
+      <param name="output3_file_check" type="boolean" label="output all snvs" checked="True"/>
+      <param name="output4_file_check" type="boolean" label="output all indels" checked="True"/>
+      <param name="output5_file_check" type="boolean" label="normal realigned bam" help="only if isWriteRealignedBam option is 1" checked="False"/>
+      <param name="output6_file_check" type="boolean" label="tumor realigned bam" help="only if isWriteRealignedBam option is 1" checked="False"/>
 
   </inputs>
 
   <outputs>
-    <data format="vcf" name="output1_vcf" label="${tool.name} on ${on_string}(passed.somatic.snvs.vcf)" from_work_dir="StrelkaAnalysis/results/passed.somatic.snvs.vcf"/>
-    <data format="vcf" name="output2_vcf" label="${tool.name} on ${on_string}(passed.somatic.indels.vcf)" from_work_dir="StrelkaAnalysis/results/passed.somatic.indels.vcf"/>
-    <data format="vcf" name="output3_vcf" label="${tool.name} on ${on_string}(all.somatic.snvs.vcf)" from_work_dir="StrelkaAnalysis/results/all.somatic.snvs.vcf"/>
-    <data format="vcf" name="output4_vcf" label="${tool.name} on ${on_string}(all.somatic.indels.vcf)" from_work_dir="StrelkaAnalysis/results/all.somatic.indels.vcf"/>
+    <data format="vcf" name="output1_vcf" label="${tool.name} on ${on_string}(passed.somatic.snvs.vcf)" from_work_dir="StrelkaAnalysis/results/passed.somatic.snvs.vcf">
+      <filter>output1_file_check == True</filter>
+    </data>
+    <data format="vcf" name="output2_vcf" label="${tool.name} on ${on_string}(passed.somatic.indels.vcf)" from_work_dir="StrelkaAnalysis/results/passed.somatic.indels.vcf">
+      <filter>output2_file_check == True</filter>
+    </data>
+    <data format="vcf" name="output3_vcf" label="${tool.name} on ${on_string}(all.somatic.snvs.vcf)" from_work_dir="StrelkaAnalysis/results/all.somatic.snvs.vcf">
+      <filter>output3_file_check == True</filter>
+    </data>
+    <data format="vcf" name="output4_vcf" label="${tool.name} on ${on_string}(all.somatic.indels.vcf)" from_work_dir="StrelkaAnalysis/results/all.somatic.indels.vcf">
+      <filter>output4_file_check == True</filter>
+    </data>
     <data name="conf_file.ini" label="conf_file.ini" from_work_dir="StrelkaAnalysis/tmp/config.ini">
-      <filter>conf_file.conf_file_switch == "Yes"</filter>
+      <filter>conf_file_check == True</filter>
+    </data>
+    <data format="bam" name="output5_bam" label="${tool.name} on ${on_string}(normal.realigned.bam)" from_work_dir="StrelkaAnalysis/realigned/normal.realigned.bam">
+      <filter>output5_file_check == True</filter>
+    </data>
+    <data format="bam" name="output6_bam" label="${tool.name} on ${on_string}(tumor.realigned.bam)" from_work_dir="StrelkaAnalysis/realigned/tumor.realigned.bam">
+      <filter>output6_file_check == True</filter>
     </data>
   </outputs>
 
--- a/strelka_wrapper.py	Fri Sep 26 14:33:07 2014 +0200
+++ b/strelka_wrapper.py	Tue Sep 30 11:08:39 2014 +0200
@@ -1,5 +1,8 @@
 #!/usr/bin/env python
-#Dan Blankenberg
+#Gregoire Seguin-Henry (Engineer IT)
+#Amine Sbitti (Data Scientist)
+#Ludovic Marie-Sainte (Project Manager)
+#For Geviteam 2014
 
 """
 A wrapper script for running the GenomeAnalysisTK.jar commands.
@@ -10,14 +13,7 @@
 from binascii import unhexlify
 from string import Template
 from galaxy import eggs
-#import pkg_resources; pkg_resources.require( "bx-python" )
 
-#GALAXY_EXT_TO_GATK_EXT = { 'gatk_interval':'intervals', 'bam_index':'bam.bai', 'gatk_dbsnp':'dbSNP', 'picard_interval_list':'interval_list' } #items not listed here will use the galaxy extension as-is
-#GALAXY_EXT_TO_GATK_FILE_TYPE = GALAXY_EXT_TO_GATK_EXT #for now, these are the same, but could be different if needed
-#DEFAULT_GATK_PREFIX = "gatk_file"
-#CHUNK_SIZE = 2**20 #1mb
-#
-#
 def cleanup_before_exit( tmp_dir ):
     if tmp_dir and os.path.exists( tmp_dir ):
         shutil.rmtree( tmp_dir )
@@ -62,9 +58,8 @@
             my_Popen( command, "fasta_index_stderr", tmp_dir, "Error during indexation of fasta file :" + fasta_filename)
 
 def __main__():
-    #Parse Command Line  OPTPARSE DEPRECIATED USE ARGPARSE INSTEAD
-    #MKTEMP DEPRECIATED USE MKDTlizations#EMP INSTEAD
-    #manage parsing
+
+    #Manage options
     parser = argparse.ArgumentParser()                                             
     parser.add_argument( '-t', '--tumorBam', help='path to tumor bam file', required = False )
     parser.add_argument( '-n', '--normalBam', help='path to tumor bam file', required = False )   
@@ -98,10 +93,10 @@
     job_dir=os.getcwd()
     analysis_dir=job_dir + "/StrelkaAnalysis"
     config_script=root_dir + "/configureStrelkaWorkflow.pl"
-    tmp_dir = "tmp"  #tempfile.mkdtemp( prefix='tmp-strelkaAnalysis-' )
+    tmp_dir = tempfile.mkdtemp( prefix='tmp-strelkaAnalysis-' )
     config_ini = "%s/config.ini" % (tmp_dir)
 
-    print("root_dir: " + root_dir + "\njob_dir :" + job_dir + "\nanalysis_dir :" + analysis_dir + "\nconfig_script :" + config_script + "\ntmp_dir :" + tmp_dir + "\nconfig_ini :" +  config_ini)
+    #print("root_dir: " + root_dir + "\njob_dir :" + job_dir + "\nanalysis_dir :" + analysis_dir + "\nconfig_script :" + config_script + "\ntmp_dir :" + tmp_dir + "\nconfig_ini :" +  config_ini)
 
 
     #verifying eveything's ok
@@ -113,7 +108,6 @@
     
 
     # creating index if needed
-    os.environ['PATH']= root_dir + "/opt/samtools:" + os.environ['PATH']
     bam_filenames = [ args.tumorBam, args.normalBam ]
     index_bam_files( bam_filenames, tmp_dir )
     fasta_files = [ args.refFile ]
@@ -129,7 +123,7 @@
     	if not os.path.exists(args.configFile):
 	     print( "The path to your configuration File seems to be wrong, use another one or custom option", file=sys.stderr)
     	cmdbash="cp %s %s" % (args.configFile, config_ini)
-        my_Popen(cmdbash, "copy_default_file_err", tmp_dir, "Error during the copy of default config file, maybe it was removed")
+        my_Popen(cmdbash, "copy_default_file_err", tmp_dir, "Error during the copy of the selected config file")
 
 
 
@@ -148,55 +142,3 @@
     my_Popen( cmd, "workflow_stderr", tmp_dir, "Error during workflow execution !")   
     print("**** completed workflow execution")
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-#bam_filenames = []
-#    if options.datasets:
-#        for ( dataset_arg, filename, galaxy_ext, prefix ) in options.datasets:
-#            gatk_filename = filename_from_galaxy( filename, galaxy_ext, target_dir = tmp_dir, prefix = prefix )#return the link to the dataset that has been created in the function
-#            if dataset_arg:
-#                cmd = '%s %s "%s"' % ( cmd, gatk_filetype_argument_substitution( dataset_arg, galaxy_ext ), gatk_filename )
-#            if galaxy_ext == "bam":
-#                bam_filenames.append( gatk_filename )
-#    #set up stdout and stderr output options
-#    stdout = open_file_from_option( options.stdout, mode = 'wb' )
-#    stderr = open_file_from_option( options.stderr, mode = 'wb' )
-#    #if no stderr file is specified, we'll use our own
-#    if stderr is None:
-#        stderr = tempfile.NamedTemporaryFile( prefix="strelka-stderr-", dir=tmp_dir )
-#    
-#    proc = subprocess.Popen( args=cmd, stdout=stdout, stderr=stderr, shell=True, cwd=tmp_dir )
-#    return_code = proc.wait()
-#    
-#    if return_code:
-#        stderr_target = sys.stderr
-#    else:
-#        stderr_target = sys.stdout
-#    stderr.flush()
-#    stderr.seek(0)
-#    while True:
-#        chunk = stderr.read( CHUNK_SIZE )
-#        if chunk:
-#            stderr_target.write( chunk )
-#        else:
-#            break
-#    stderr.close()
-#    #generate html reports
-#    if options.html_report_from_directory:
-#        for ( html_filename, html_dir ) in options.html_report_from_directory:
-#            html_report_from_directory( open( html_filename, 'wb' ), html_dir )
-#    
-#    cleanup_before_exit( tmp_dir )
-
-if __name__=="__main__": __main__()