0
|
1 <tool id="ideas_preprocessor" name="IDEAS preprocessor" version="1.0.0">
|
|
2 <description></description>
|
|
3 <requirements>
|
|
4 <requirement type="package" version="2.5.4">deeptools</requirement>
|
|
5 <requirement type="package" version="1.10.4">r-data.table</requirement>
|
|
6 <requirement type="package" version="1.4.4">r-optparse</requirement>
|
|
7 <requirement type="package" version="1.6">samtools</requirement>
|
|
8 <requirement type="package" version="357">ucsc-bigwigaverageoverbed</requirement>
|
|
9 </requirements>
|
|
10 <command detect_errors="exit_code"><![CDATA[
|
|
11 #set tmp_dir = "tmp"
|
|
12 #set prep_input_config = "prep_input_config.txt"
|
|
13 #set prep_output_config = "prep_output_config.txt"
|
|
14 #set specify_genomic_window = $specify_genomic_window_cond.specify_genomic_window
|
2
|
15 mkdir $tmp_dir &&
|
|
16 mkdir $output.files_path &&
|
|
17 #if str($specify_genomic_window) == "yes":
|
|
18 ##############################################
|
|
19 ## Using a genomic window bed file, so categorize
|
|
20 ## the window positions by chromosome to enable
|
|
21 ## the IDEAS -inv option.
|
|
22 ##############################################
|
|
23 #set windows_positions_by_chroms_config = "windows_positions_by_chroms_config.txt"
|
|
24 cp '$gen_windows_positions_by_chroms_config' $windows_positions_by_chroms_config &&
|
|
25 #end if
|
0
|
26 ##############################################
|
|
27 ## Create the config file and prepare the data
|
|
28 ##############################################
|
|
29 cp '$gen_prep_input_config' $prep_input_config &&
|
|
30 sort $prep_input_config -o $prep_input_config &&
|
|
31 Rscript '$__tool_directory__/ideas_preprocessor.R'
|
|
32 --prep_input_config '$prep_input_config'
|
|
33 #if str($specify_genomic_window) == "yes":
|
2
|
34 --prep_output_config '$prep_output_config'
|
|
35 --windows_positions_by_chroms_config '$windows_positions_by_chroms_config'
|
|
36 #end if
|
|
37 #if str($specify_genomic_window) == "yes":
|
0
|
38 --bed_input '$specify_genomic_window_cond.bed_input'
|
|
39 #else:
|
|
40 --chrom_len_file '$chromInfo'
|
|
41 --window_size $specify_genomic_window_cond.window_size
|
|
42 #set restrict_chromosomes = $specify_genomic_window_cond.restrict_chromosomes_cond.restrict_chromosomes
|
|
43 #if str($restrict_chromosomes) == "yes":
|
|
44 #set chroms = []
|
|
45 #set chrom_repeat = $specify_genomic_window_cond.restrict_chromosomes_cond.chrom_repeat
|
|
46 #for $i in $chrom_repeat.chrom
|
|
47 $chroms.append($i)
|
|
48 #end for
|
|
49 --restrict_to_chroms ",".join(chroms)
|
|
50 #end if
|
|
51 #end if
|
|
52 --reads_per_bp $reads_per_bp
|
2
|
53 #if str($exclude_input) not in ["None", ""]:
|
0
|
54 --exclude_input '$exclude_input'
|
|
55 #end if
|
|
56 --output '$output'
|
|
57 --output_files_path '$output.files_path'
|
|
58 &> ideas_preprocessor_log.txt;
|
|
59 if [[ $? -ne 0 ]]; then
|
|
60 cp ideas_preprocessor_log.txt '$output';
|
|
61 exit 1;
|
|
62 fi
|
|
63 ]]></command>
|
|
64 <configfiles>
|
|
65 <configfile name="gen_prep_input_config"><![CDATA[#if str($cell_type_epigenetic_factor_cond.cell_type_epigenetic_factor) == "extract":
|
|
66 #set input_name_positions = $cell_type_epigenetic_factor_cond.input_name_positions
|
|
67 #for $i in $cell_type_epigenetic_factor_cond.input:
|
|
68 #set file_name_with_ext = $i.name
|
|
69 #if str($file_name_with_ext).find("http") >= 0 or str($file_name_with_ext).find("ftp") >= 0:
|
|
70 #set file_name_with_ext = $file_name_with_ext.split('/')[-1]
|
|
71 #end if
|
|
72 #assert str($file_name_with_ext).find("-") >= 0, "The selected input '%s' is invalid because it does not include the '-' character which is required when setting cell type and epigenetic factor names by extracting them from the input file names." % $file_name_with_ext
|
|
73 #set file_name = $file_name_with_ext.split(".")[0]
|
|
74 #if str($input_name_positions) == "cell_first":
|
|
75 #set cell_type_name = $file_name.split("-")[0]
|
|
76 #set epigenetic_factor_name = $file_name.split("-")[1]
|
|
77 #else:
|
|
78 #set cell_type_name = $file_name.split("-")[1]
|
|
79 #set epigenetic_factor_name = $file_name.split("-")[0]
|
|
80 #end if
|
2
|
81 ${cell_type_name} ${epigenetic_factor_name} ${i} ${file_name} ${i.ext}
|
0
|
82 #end for
|
|
83 #else:
|
|
84 #for $input_items in $cell_type_epigenetic_factor_cond.input_repeat:
|
2
|
85 ${input_items.cell_type_name} ${input_items.epigenetic_factor_name} ${input_items.input} ${file_name} ${input_items.input.ext}
|
0
|
86 #end for
|
|
87 #end if]]></configfile>
|
|
88 <configfile name="gen_windows_positions_by_chroms_config"><![CDATA[#if str($specify_genomic_window_cond.specify_genomic_window) == "yes":
|
|
89 #import collections
|
|
90 #set window_positions_by_chroms_odict = $collections.OrderedDict()
|
|
91 #for count, line in enumerate(open($specify_genomic_window_cond.bed_input.file_name, 'r')):
|
|
92 #set $line = $line.strip()
|
|
93 #if not $line or $line.startswith('#'):
|
|
94 #continue
|
|
95 #end if
|
|
96 #set items = $line.split('\t')
|
|
97 #if $items[0] in $window_positions_by_chroms_odict:
|
|
98 #set tup = $window_positions_by_chroms_odict[$items[0]]
|
|
99 #set $tup[1] += 1
|
|
100 #set $window_positions_by_chroms_odict[$items[0]] = $tup
|
|
101 #else:
|
|
102 #set $window_positions_by_chroms_odict[$items[0]] = [$count, $count+1]
|
|
103 #end if
|
|
104 #end for
|
|
105 #for $chrom, $tup in $window_positions_by_chroms_odict.items():
|
|
106 ${chrom} ${tup[0]} ${tup[1]}
|
|
107 #end for
|
|
108 #end if]]></configfile>
|
|
109 </configfiles>
|
|
110 <inputs>
|
|
111 <conditional name="cell_type_epigenetic_factor_cond">
|
|
112 <param name="cell_type_epigenetic_factor" type="select" label="Set cell type and epigenetic factor names by">
|
|
113 <option value="extract" selected="true">extracting them from the selected input file names</option>
|
|
114 <option value="manual">manually setting them for each selected input</option>
|
|
115 </param>
|
|
116 <when value="extract">
|
|
117 <param name="input" type="data" format="bigwig,bam" multiple="True" label="BAM or BigWig files">
|
|
118 <validator type="empty_field"/>
|
|
119 <validator type="unspecified_build"/>
|
|
120 </param>
|
|
121 <param name="input_name_positions" type="select" display="radio" label="Selected input file name pattern is" help="A '-' character must separate cell type and epigenetic factor names within the selected input file names">
|
|
122 <option value="cell_first" selected="true">Cell type name - Epigenetic factor name</option>
|
|
123 <option value="cell_last">Epigenetic factor name - Cell type name</option>
|
|
124 </param>
|
|
125 </when>
|
|
126 <when value="manual">
|
|
127 <repeat name="input_repeat" title="Cell type, Epigenetic factor and Input" min="1">
|
|
128 <param name="cell_type_name" type="text" value="" label="Cell type name">
|
|
129 <validator type="empty_field"/>
|
|
130 </param>
|
|
131 <param name="epigenetic_factor_name" type="text" value="" label="Epigenetic factor name">
|
|
132 <validator type="empty_field"/>
|
|
133 </param>
|
|
134 <param name="input" type="data" format="bigwig,bam" label="BAM or BigWig file">
|
|
135 <validator type="empty_field"/>
|
|
136 <validator type="unspecified_build"/>
|
|
137 </param>
|
|
138 </repeat>
|
|
139 </when>
|
|
140 </conditional>
|
|
141 <conditional name="specify_genomic_window_cond">
|
|
142 <param name="specify_genomic_window" type="select" label="Select Bed file that defines genomic windows on which to process the data">
|
|
143 <option value="no" selected="true">No</option>
|
|
144 <option value="yes">Yes</option>
|
|
145 </param>
|
|
146 <when value="no">
|
|
147 <param name="window_size" type="integer" value="200" label="Window size in base pairs"/>
|
|
148 <conditional name="restrict_chromosomes_cond">
|
|
149 <param name="restrict_chromosomes" type="select" label="Restrict processing to specified chromosomes">
|
|
150 <option value="no" selected="true">No</option>
|
|
151 <option value="yes">Yes</option>
|
|
152 </param>
|
|
153 <when value="no"/>
|
|
154 <when value="yes">
|
|
155 <repeat name="chrom_repeat" title="Chromosomes" min="1">
|
|
156 <param name="chrom" type="text" value="" label="Chromosome" help="One chromosome (e.g., chr1, chr2, chrX) per text field"/>
|
|
157 </repeat>
|
|
158 </when>
|
|
159 </conditional>
|
|
160 </when>
|
|
161 <when value="yes">
|
|
162 <param name="bed_input" type="data" format="bed" label="Bed file specifying the genomic windows"/>
|
|
163 </when>
|
|
164 </conditional>
|
|
165 <param argument="--bychr" type="boolean" truevalue="true" falsevalue="" checked="False" label="Output chromosomes in separate files"/>
|
|
166 <param name="reads_per_bp" type="select" display="radio" label="Calculate the signal in each genomic window using">
|
|
167 <option value="6" selected="true">mean</option>
|
|
168 <option value="8">max</option>
|
|
169 </param>
|
|
170 <param name="exclude_input" type="data" format="bed" optional="True" multiple="True" label="Select file(s) containing regions to exclude"/>
|
|
171 <param argument="--standardize_datasets" type="boolean" truevalue="true" falsevalue="" checked="False" label="Standardize all datasets"/>
|
|
172 </inputs>
|
|
173 <outputs>
|
|
174 <data name="output" format="html"/>
|
|
175 </outputs>
|
|
176 <tests>
|
|
177 <test>
|
|
178 </test>
|
|
179 </tests>
|
|
180 <help>
|
|
181 **What it does**
|
|
182
|
|
183 -----
|
|
184
|
|
185 **Required options**
|
|
186
|
|
187 </help>
|
|
188 <citations>
|
|
189 <citation type="doi">10.1093/nar/gkw278</citation>
|
|
190 </citations>
|
|
191 </tool>
|