changeset 21:de2f2c28c498 draft

planemo upload for repository https://github.com/bardin-lab/readtagger/tree/master/galaxy commit 0437e9e56f0af2ccfb5f119b0f290109807ed9b0-dirty
author mvdbeek
date Fri, 15 Jun 2018 11:06:43 -0400
parents 1f8609ae3941
children 6f406e783904
files igv_make_screenshots.xml test-data/rover_corrected.bam.bai
diffstat 2 files changed, 81 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/igv_make_screenshots.xml	Mon Jul 31 12:45:19 2017 -0400
+++ b/igv_make_screenshots.xml	Fri Jun 15 11:06:43 2018 -0400
@@ -1,33 +1,47 @@
-<tool id="igv_make_screenshots" name="IGV_screenshots" version="0.1.1">
+<tool id="igv_make_screenshots" name="IGV_screenshots" version="0.1.0">
+    <macros>
+        <token name="@DISPLAY_LINK@"><![CDATA[
+#set $dataset_id = str($__app__.security.encode_id($inputsection.input.dataset.id))
+#set $user_id = str($__app__.security.encode_id($__user_id__))
+#set $galaxy_url = $__app__.config.galaxy_infrastructure_url
+#set $ext = $inputsection.input.extension
+#set $element_identifier = $inputsection.input.element_identifier
+#set $display_link = "{galaxy_url}:9090/display_application/{dataset_id}/igv_{ext}/local_default/None/data/galaxy_{dataset_id}.{ext}".format(galaxy_url=galaxy_url, dataset_id=dataset_id, ext=ext, user_id=user_id)
+]]></token>
+        <token name="@PATH@"><![CDATA[#set $path="%s.%s.%s" % ($i, $inputsection.input.element_identifier, $inputsection.input.extension)]]></token>
+    </macros>
     <requirements>
         <requirement type="package" version="0.2.9">xvfbwrapper</requirement>
+        <!-- TODO: uncomment when igv in conda
         <requirement type="package" version="2.3.93">igv</requirement>
+        -->
     </requirements>
     <command detect_errors="exit_code"><![CDATA[
-        #import re
-        #if $genome_source.input_type_selector == 'history':
-            ln -s '$genome_source.genome' genome.fa &&
-        #else:
-            ln -s '$genome_source.genome.fields.path' genome.fa &&
-        #end if
-        samtools faidx genome.fa &&
-        sed -i.bak -e "s|\"genome.fa\"|\"\$PWD/genome.fa\"|g" '$igv_session' &&
-        #for $i, $inputsection in enumerate($inputfiles):
-            #set $path="%s.%s.%s" % ($i, re.sub('[^\w\-_]', '_', $inputsection.input.element_identifier), $inputsection.input.extension)
-            sed -i.bak -e "s|\"$path\"|\"\$PWD/$path\"|g" '$igv_session' &&
-            ln -fs '$inputsection.input' '$path' &&
-            #if $inputsection.input.is_of_type('bam')
-                ln -fs $inputsection.input.metadata.bam_index '$path'.bai &&
-            #end if
-        #end for
-        ln -fs $igv_session igv_session.xml &&
-        cat '$load_session' > load_session.txt &&
-        echo snapshotDirectory "\$PWD" >> load_session.txt &&
-        cat load_session.txt '$script_file' '$exit_session' > igv_script.txt &&
-        cp '$igv_session' '$igv_session_out' &&
-        python $__tool_directory__/xvfb_igv.py igv_script.txt '$igv_preferences' $width,$height &&
-        zip screenshots.zip *.png &&
-        cp screenshots.zip '$screenshots_out'
+#import re
+#if $genome_source.input_type_selector == 'history':
+    ln -s '$genome_source.genome' genome.fa &&
+#else:
+    ln -s '$genome_source.genome.fields.path' genome.fa &&
+#end if
+samtools faidx genome.fa &&
+sed -i.bak -e "s|\"genome.fa\"|\"\$PWD/genome.fa\"|g" '$igv_session' &&
+#for $i, $inputsection in enumerate($inputfiles):
+    @PATH@
+    ln -fs '$inputsection.input' '$path' &&
+    #if $inputsection.input.is_of_type('bam')
+        ln -fs $inputsection.input.metadata.bam_index '$path'.bai &&
+    #end if
+#end for
+ln -fs $igv_session igv_session.xml &&
+cat '$load_session' > load_session.txt &&
+echo snapshotDirectory "\$PWD" >> load_session.txt &&
+cat load_session.txt '$script_file' '$exit_session' > igv_script.txt &&
+cp '$igv_session_remote' '$igv_session_out'
+#if not $skip_screenshots:
+    && python $__tool_directory__/xvfb_igv.py igv_script.txt '$igv_preferences' $width,$height &&
+    zip screenshots.zip *.png &&
+    cp screenshots.zip '$screenshots_out'
+#end if
     ]]></command>
     <configfiles>
         <configfile name="igv_session">#import re
@@ -35,7 +49,7 @@
 <Session genome="genome.fa" hasGeneTrack="false" hasSequenceTrack="true" version="8">
     <Resources>
         #for $i, $inputsection in enumerate($inputfiles):
-            #set $path="%s.%s.%s" % ($i, re.sub('[^\w\-_]', '_', $inputsection.input.element_identifier), $inputsection.input.extension)
+            @PATH@
             #set $coverage_id="%s_coverage" % $path
         <Resource path="$path"/>
         #end for
@@ -43,7 +57,7 @@
     #for $i, $inputsection in enumerate($inputfiles):
         #if $inputsection.input.is_of_type('bam')
             #set $label=str($inputsection.label) if str($inputsection.label) else str($inputsection.input.element_identifier)
-            #set $path="%s.%s.%s" % ($i, re.sub('[^\w\-_]', '_', $inputsection.input.element_identifier), $inputsection.input.extension)
+            @PATH
             <Panel height="$inputsection.section_height" name="Panel${label}" width="$width">
             ## First track is the coverage
             <Track altColor="0,0,178" autoScale="true" color="175,175,175" colorScale="ContinuousColorScale;0.0;10.0;255,255,255;175,175,175" displayMode="COLLAPSED" featureVisibilityWindow="-1" fontSize="10" id="$coverage_id" name="$label Coverage" showReference="false" snpThreshold="0.2" sortable="true" visible="true">
@@ -61,7 +75,7 @@
         #for $i, $inputsection in enumerate($inputfiles):
             #if not $inputsection.input.is_of_type('bam')
                 #set $label=str($inputsection.label) if str($inputsection.label) else str($inputsection.input.element_identifier)
-                #set $path="%s.%s.%s" % ($i, re.sub('[^\w\-_]', '_', $inputsection.input.element_identifier), $inputsection.input.extension)
+                @PATH@
                 <Track altColor="0,0,178" autoScale="false" clazz="org.broad.igv.track.FeatureTrack" color="0,0,178" displayMode="COLLAPSED" featureVisibilityWindow="-1" fontSize="10" id="$path" name="$label" renderer="BASIC_FEATURE" sortable="false" visible="true" windowFunction="count"/>
              #end if
         #end for
@@ -69,6 +83,41 @@
     <PanelLayout dividerFractions="0.004995836802664446,0.12905911740216486,0.2681099084096586,0.5512073272273106,0.8409658617818485"/>
 </Session>
         ]]></configfile>
+        <configfile name="igv_session_remote">#import re
+<![CDATA[<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<Session genome="dm6" hasGeneTrack="true" hasSequenceTrack="true" version="8">
+    <Resources>#for $i, $inputsection in enumerate($inputfiles):@DISPLAY_LINK@<Resource path="$display_link"/>#end for
+    </Resources>
+    #for $i, $inputsection in enumerate($inputfiles):
+        #if $inputsection.input.is_of_type('bam')
+            #set $label=str($inputsection.label) if str($inputsection.label) else str($inputsection.input.element_identifier)
+            @DISPLAY_LINK@
+            #set $coverage_id="%s_coverage" % $display_link
+            <Panel height="$inputsection.section_height" name="Panel${label}" width="$width">
+            ## First track is the coverage
+            <Track altColor="0,0,178" autoScale="true" color="175,175,175" colorScale="ContinuousColorScale;0.0;10.0;255,255,255;175,175,175" displayMode="COLLAPSED" featureVisibilityWindow="-1" fontSize="10" id="$coverage_id" name="$label Coverage" showReference="false" snpThreshold="0.2" sortable="true" visible="true">
+                <DataRange baseline="0.0" drawBaseline="true" flipAxis="false" maximum="10.0" minimum="0.0" type="LINEAR"/>
+            </Track>
+            ## Second track is the actual BAM alignment file
+            <Track altColor="0,0,178" autoScale="false" color="0,0,178" displayMode="EXPANDED" featureVisibilityWindow="-1" fontSize="10" id="$display_link" name="$label" sortable="true" visible="true">
+                <RenderOptions colorByTag="$inputsection.color_by_tag" colorOption="TAG" flagUnmappedPairs="false" groupByOption="NONE" groupByTag="BR" linkByTag="READNAME" linkedReads="false" maxInsertSize="1000" minInsertSize="50" quickConsensusMode="false" shadeBasesOption="QUALITY" shadeCenters="true" showAllBases="false" sortByTag="" viewPairs="false"/>
+            </Track>
+            </Panel>
+        #end if
+    #end for
+    <Panel height="186" name="FeaturePanel" width="$width">
+        <Track altColor="0,0,178" autoScale="false" color="0,0,178" displayMode="COLLAPSED" featureVisibilityWindow="-1" fontSize="10" id="Reference sequence" name="Reference sequence" sortable="false" visible="true"/>
+        #for $i, $inputsection in enumerate($inputfiles):
+            #if not $inputsection.input.is_of_type('bam')
+                #set $label=str($inputsection.label) if str($inputsection.label) else str($inputsection.input.element_identifier)
+                @PATH@
+                <Track altColor="0,0,178" autoScale="false" clazz="org.broad.igv.track.FeatureTrack" color="0,0,178" displayMode="COLLAPSED" featureVisibilityWindow="-1" fontSize="10" id="$display_link" name="$label" renderer="BASIC_FEATURE" sortable="false" visible="true" windowFunction="count"/>
+             #end if
+        #end for
+    </Panel>
+    <PanelLayout dividerFractions="0.004995836802664446,0.12905911740216486,0.2681099084096586,0.5512073272273106,0.8409658617818485"/>
+</Session>
+        ]]></configfile>
         <configfile name="load_session">
 load igv_session.xml
         </configfile>
@@ -77,7 +126,6 @@
         </configfile>
         <configfile name="igv_preferences">
 SAM.SHOW_SOFT_CLIPPED=$show_softclippped
-SAM.FILTER_SECONDARY_ALIGNMENTS=$filter_secondary
         </configfile>
     </configfiles>
     <inputs>
@@ -105,15 +153,17 @@
                 </sanitizer>
             </param>
         </repeat>
+        <param name="skip_screenshots" type="boolean" label="Skip taking screenshots? Only produces session files."/>
         <param name="show_softclippped" type="boolean" label="Show softclipped bases?" truevalue="true" falsevalue="false" checked="true"/>
-        <param name="filter_secondary" type="boolean" label="Filter out secondary reads" truevalue="true" falsevalue="false" checked="true"/>
         <param name="script_file" type="data" format="txt" label="Select a IGV script with regions for which to take screenshots"/>
         <param name="width" label="Select the screenshot width" type="integer" min="800" value="1920"/>
         <param name="height" label="Select the screenshot height" type="integer" min="640" value="1080"/>
     </inputs>
     <outputs>
         <data name="igv_session_out" format="xml"/>
-        <data name="screenshots_out" format="zip"/>
+        <data name="screenshots_out" format="zip">
+            <filter>skip_screenshots == False</filter>
+        </data>
     </outputs>
     <tests>
         <test>
Binary file test-data/rover_corrected.bam.bai has changed