comparison igv_make_screenshots.xml @ 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
comparison
equal deleted inserted replaced
20:1f8609ae3941 21:de2f2c28c498
1 <tool id="igv_make_screenshots" name="IGV_screenshots" version="0.1.1"> 1 <tool id="igv_make_screenshots" name="IGV_screenshots" version="0.1.0">
2 <macros>
3 <token name="@DISPLAY_LINK@"><![CDATA[
4 #set $dataset_id = str($__app__.security.encode_id($inputsection.input.dataset.id))
5 #set $user_id = str($__app__.security.encode_id($__user_id__))
6 #set $galaxy_url = $__app__.config.galaxy_infrastructure_url
7 #set $ext = $inputsection.input.extension
8 #set $element_identifier = $inputsection.input.element_identifier
9 #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)
10 ]]></token>
11 <token name="@PATH@"><![CDATA[#set $path="%s.%s.%s" % ($i, $inputsection.input.element_identifier, $inputsection.input.extension)]]></token>
12 </macros>
2 <requirements> 13 <requirements>
3 <requirement type="package" version="0.2.9">xvfbwrapper</requirement> 14 <requirement type="package" version="0.2.9">xvfbwrapper</requirement>
15 <!-- TODO: uncomment when igv in conda
4 <requirement type="package" version="2.3.93">igv</requirement> 16 <requirement type="package" version="2.3.93">igv</requirement>
17 -->
5 </requirements> 18 </requirements>
6 <command detect_errors="exit_code"><![CDATA[ 19 <command detect_errors="exit_code"><![CDATA[
7 #import re 20 #import re
8 #if $genome_source.input_type_selector == 'history': 21 #if $genome_source.input_type_selector == 'history':
9 ln -s '$genome_source.genome' genome.fa && 22 ln -s '$genome_source.genome' genome.fa &&
10 #else: 23 #else:
11 ln -s '$genome_source.genome.fields.path' genome.fa && 24 ln -s '$genome_source.genome.fields.path' genome.fa &&
12 #end if 25 #end if
13 samtools faidx genome.fa && 26 samtools faidx genome.fa &&
14 sed -i.bak -e "s|\"genome.fa\"|\"\$PWD/genome.fa\"|g" '$igv_session' && 27 sed -i.bak -e "s|\"genome.fa\"|\"\$PWD/genome.fa\"|g" '$igv_session' &&
15 #for $i, $inputsection in enumerate($inputfiles): 28 #for $i, $inputsection in enumerate($inputfiles):
16 #set $path="%s.%s.%s" % ($i, re.sub('[^\w\-_]', '_', $inputsection.input.element_identifier), $inputsection.input.extension) 29 @PATH@
17 sed -i.bak -e "s|\"$path\"|\"\$PWD/$path\"|g" '$igv_session' && 30 ln -fs '$inputsection.input' '$path' &&
18 ln -fs '$inputsection.input' '$path' && 31 #if $inputsection.input.is_of_type('bam')
19 #if $inputsection.input.is_of_type('bam') 32 ln -fs $inputsection.input.metadata.bam_index '$path'.bai &&
20 ln -fs $inputsection.input.metadata.bam_index '$path'.bai && 33 #end if
21 #end if 34 #end for
22 #end for 35 ln -fs $igv_session igv_session.xml &&
23 ln -fs $igv_session igv_session.xml && 36 cat '$load_session' > load_session.txt &&
24 cat '$load_session' > load_session.txt && 37 echo snapshotDirectory "\$PWD" >> load_session.txt &&
25 echo snapshotDirectory "\$PWD" >> load_session.txt && 38 cat load_session.txt '$script_file' '$exit_session' > igv_script.txt &&
26 cat load_session.txt '$script_file' '$exit_session' > igv_script.txt && 39 cp '$igv_session_remote' '$igv_session_out'
27 cp '$igv_session' '$igv_session_out' && 40 #if not $skip_screenshots:
28 python $__tool_directory__/xvfb_igv.py igv_script.txt '$igv_preferences' $width,$height && 41 && python $__tool_directory__/xvfb_igv.py igv_script.txt '$igv_preferences' $width,$height &&
29 zip screenshots.zip *.png && 42 zip screenshots.zip *.png &&
30 cp screenshots.zip '$screenshots_out' 43 cp screenshots.zip '$screenshots_out'
44 #end if
31 ]]></command> 45 ]]></command>
32 <configfiles> 46 <configfiles>
33 <configfile name="igv_session">#import re 47 <configfile name="igv_session">#import re
34 <![CDATA[<?xml version="1.0" encoding="UTF-8" standalone="no"?> 48 <![CDATA[<?xml version="1.0" encoding="UTF-8" standalone="no"?>
35 <Session genome="genome.fa" hasGeneTrack="false" hasSequenceTrack="true" version="8"> 49 <Session genome="genome.fa" hasGeneTrack="false" hasSequenceTrack="true" version="8">
36 <Resources> 50 <Resources>
37 #for $i, $inputsection in enumerate($inputfiles): 51 #for $i, $inputsection in enumerate($inputfiles):
38 #set $path="%s.%s.%s" % ($i, re.sub('[^\w\-_]', '_', $inputsection.input.element_identifier), $inputsection.input.extension) 52 @PATH@
39 #set $coverage_id="%s_coverage" % $path 53 #set $coverage_id="%s_coverage" % $path
40 <Resource path="$path"/> 54 <Resource path="$path"/>
41 #end for 55 #end for
42 </Resources> 56 </Resources>
43 #for $i, $inputsection in enumerate($inputfiles): 57 #for $i, $inputsection in enumerate($inputfiles):
44 #if $inputsection.input.is_of_type('bam') 58 #if $inputsection.input.is_of_type('bam')
45 #set $label=str($inputsection.label) if str($inputsection.label) else str($inputsection.input.element_identifier) 59 #set $label=str($inputsection.label) if str($inputsection.label) else str($inputsection.input.element_identifier)
46 #set $path="%s.%s.%s" % ($i, re.sub('[^\w\-_]', '_', $inputsection.input.element_identifier), $inputsection.input.extension) 60 @PATH
47 <Panel height="$inputsection.section_height" name="Panel${label}" width="$width"> 61 <Panel height="$inputsection.section_height" name="Panel${label}" width="$width">
48 ## First track is the coverage 62 ## First track is the coverage
49 <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"> 63 <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">
50 <DataRange baseline="0.0" drawBaseline="true" flipAxis="false" maximum="10.0" minimum="0.0" type="LINEAR"/> 64 <DataRange baseline="0.0" drawBaseline="true" flipAxis="false" maximum="10.0" minimum="0.0" type="LINEAR"/>
51 </Track> 65 </Track>
59 <Panel height="186" name="FeaturePanel" width="$width"> 73 <Panel height="186" name="FeaturePanel" width="$width">
60 <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"/> 74 <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"/>
61 #for $i, $inputsection in enumerate($inputfiles): 75 #for $i, $inputsection in enumerate($inputfiles):
62 #if not $inputsection.input.is_of_type('bam') 76 #if not $inputsection.input.is_of_type('bam')
63 #set $label=str($inputsection.label) if str($inputsection.label) else str($inputsection.input.element_identifier) 77 #set $label=str($inputsection.label) if str($inputsection.label) else str($inputsection.input.element_identifier)
64 #set $path="%s.%s.%s" % ($i, re.sub('[^\w\-_]', '_', $inputsection.input.element_identifier), $inputsection.input.extension) 78 @PATH@
65 <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"/> 79 <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"/>
80 #end if
81 #end for
82 </Panel>
83 <PanelLayout dividerFractions="0.004995836802664446,0.12905911740216486,0.2681099084096586,0.5512073272273106,0.8409658617818485"/>
84 </Session>
85 ]]></configfile>
86 <configfile name="igv_session_remote">#import re
87 <![CDATA[<?xml version="1.0" encoding="UTF-8" standalone="no"?>
88 <Session genome="dm6" hasGeneTrack="true" hasSequenceTrack="true" version="8">
89 <Resources>#for $i, $inputsection in enumerate($inputfiles):@DISPLAY_LINK@<Resource path="$display_link"/>#end for
90 </Resources>
91 #for $i, $inputsection in enumerate($inputfiles):
92 #if $inputsection.input.is_of_type('bam')
93 #set $label=str($inputsection.label) if str($inputsection.label) else str($inputsection.input.element_identifier)
94 @DISPLAY_LINK@
95 #set $coverage_id="%s_coverage" % $display_link
96 <Panel height="$inputsection.section_height" name="Panel${label}" width="$width">
97 ## First track is the coverage
98 <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">
99 <DataRange baseline="0.0" drawBaseline="true" flipAxis="false" maximum="10.0" minimum="0.0" type="LINEAR"/>
100 </Track>
101 ## Second track is the actual BAM alignment file
102 <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">
103 <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"/>
104 </Track>
105 </Panel>
106 #end if
107 #end for
108 <Panel height="186" name="FeaturePanel" width="$width">
109 <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"/>
110 #for $i, $inputsection in enumerate($inputfiles):
111 #if not $inputsection.input.is_of_type('bam')
112 #set $label=str($inputsection.label) if str($inputsection.label) else str($inputsection.input.element_identifier)
113 @PATH@
114 <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"/>
66 #end if 115 #end if
67 #end for 116 #end for
68 </Panel> 117 </Panel>
69 <PanelLayout dividerFractions="0.004995836802664446,0.12905911740216486,0.2681099084096586,0.5512073272273106,0.8409658617818485"/> 118 <PanelLayout dividerFractions="0.004995836802664446,0.12905911740216486,0.2681099084096586,0.5512073272273106,0.8409658617818485"/>
70 </Session> 119 </Session>
75 <configfile name="exit_session"> 124 <configfile name="exit_session">
76 exit 125 exit
77 </configfile> 126 </configfile>
78 <configfile name="igv_preferences"> 127 <configfile name="igv_preferences">
79 SAM.SHOW_SOFT_CLIPPED=$show_softclippped 128 SAM.SHOW_SOFT_CLIPPED=$show_softclippped
80 SAM.FILTER_SECONDARY_ALIGNMENTS=$filter_secondary
81 </configfile> 129 </configfile>
82 </configfiles> 130 </configfiles>
83 <inputs> 131 <inputs>
84 <conditional name="genome_source"> 132 <conditional name="genome_source">
85 <param name="input_type_selector" type="select" label="Choose the genome source"> 133 <param name="input_type_selector" type="select" label="Choose the genome source">
103 <sanitizer invalid_char=""> 151 <sanitizer invalid_char="">
104 <valid initial="string.letters,string.digits"><add value="_" /> </valid> 152 <valid initial="string.letters,string.digits"><add value="_" /> </valid>
105 </sanitizer> 153 </sanitizer>
106 </param> 154 </param>
107 </repeat> 155 </repeat>
156 <param name="skip_screenshots" type="boolean" label="Skip taking screenshots? Only produces session files."/>
108 <param name="show_softclippped" type="boolean" label="Show softclipped bases?" truevalue="true" falsevalue="false" checked="true"/> 157 <param name="show_softclippped" type="boolean" label="Show softclipped bases?" truevalue="true" falsevalue="false" checked="true"/>
109 <param name="filter_secondary" type="boolean" label="Filter out secondary reads" truevalue="true" falsevalue="false" checked="true"/>
110 <param name="script_file" type="data" format="txt" label="Select a IGV script with regions for which to take screenshots"/> 158 <param name="script_file" type="data" format="txt" label="Select a IGV script with regions for which to take screenshots"/>
111 <param name="width" label="Select the screenshot width" type="integer" min="800" value="1920"/> 159 <param name="width" label="Select the screenshot width" type="integer" min="800" value="1920"/>
112 <param name="height" label="Select the screenshot height" type="integer" min="640" value="1080"/> 160 <param name="height" label="Select the screenshot height" type="integer" min="640" value="1080"/>
113 </inputs> 161 </inputs>
114 <outputs> 162 <outputs>
115 <data name="igv_session_out" format="xml"/> 163 <data name="igv_session_out" format="xml"/>
116 <data name="screenshots_out" format="zip"/> 164 <data name="screenshots_out" format="zip">
165 <filter>skip_screenshots == False</filter>
166 </data>
117 </outputs> 167 </outputs>
118 <tests> 168 <tests>
119 <test> 169 <test>
120 <param name="genome_source|input_type_selector" value="history"/> 170 <param name="genome_source|input_type_selector" value="history"/>
121 <param name="genome_source|genome" value="rover_reference.fa"/> 171 <param name="genome_source|genome" value="rover_reference.fa"/>