0
|
1 <tool id="draw_amr_matrix" name="PIMA: draw AMR matrix" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
|
|
2 <description>of genes and drugs</description>
|
|
3 <macros>
|
|
4 <import>macros.xml</import>
|
|
5 </macros>
|
|
6 <expand macro="requirements"/>
|
|
7 <command detect_errors="exit_code"><![CDATA[
|
|
8 #import re
|
|
9
|
2
|
10 mkdir amr_feature_hits_dir &&
|
7
|
11 mkdir mutation_regions_dir &&
|
|
12 mkdir amr_matrix_png_dir &&
|
0
|
13
|
4
|
14 #if $reference_source.reference_source_selector == 'history':
|
|
15 ln -f -s '$reference_source.ref_file' reference.fa &&
|
|
16 #else:
|
|
17 ln -f -s '$reference_source.ref_file.fields.path' reference.fa &&
|
|
18 #end if
|
|
19
|
2
|
20 #for $i in $amr_feature_hits:
|
0
|
21 #set file_name = $i.file_name
|
|
22 #set identifier = re.sub('[^\s\w\-\\.]', '_', str($i.element_identifier))
|
2
|
23 ln -s '$file_name' 'amr_feature_hits_dir/$identifier' &&
|
0
|
24 #end for
|
|
25
|
|
26 python '$__tool_directory__/draw_amr_matrix.py'
|
4
|
27 --amr_feature_hits_dir 'amr_feature_hits_dir'
|
|
28 #if str($amr_deletions_file) != 'None':
|
|
29 --amr_deletions_file '$amr_deletions_file'
|
|
30 #end if
|
7
|
31 #if str($varscan_vcf_file) != 'None':
|
|
32 --varscan_vcf_file '$varscan_vcf_file'
|
4
|
33 #end if
|
7
|
34 #if str($amr_mutation_regions_bed_file) != 'None':
|
|
35 --amr_mutation_regions_bed_file '$amr_mutation_regions_bed_file'
|
|
36 --mutation_regions_dir 'mutation_regions_dir'
|
4
|
37 #end if
|
2
|
38 --amr_gene_drug_file '$amr_gene_drug_file'
|
4
|
39 --reference_genome reference.fa
|
7
|
40 --amr_matrix_png_dir 'amr_matrix_png_dir'
|
9
|
41 --errors '$errors'
|
0
|
42 #if str($output_process_log) == 'yes':
|
|
43 && mv 'process_log' '$process_log'
|
|
44 #end if
|
13
|
45 --in_test_mode '$in_test_mode'
|
0
|
46 ]]></command>
|
|
47 <inputs>
|
4
|
48 <conditional name="reference_source">
|
|
49 <param name="reference_source_selector" type="select" label="Select a reference genome from your history or use a cached genome index?">
|
|
50 <option value="cached">Use a cached genome index</option>
|
|
51 <option value="history">Select a genome from the history and build the index</option>
|
|
52 </param>
|
|
53 <when value="cached">
|
|
54 <param name="ref_file" type="select" label="Using reference genome" help="Select reference genome">
|
|
55 <options from_data_table="all_fasta">
|
|
56 <filter type="sort_by" column="2"/>
|
|
57 <validator type="no_options" message="No reference genomes are available"/>
|
|
58 </options>
|
|
59 </param>
|
|
60 </when>
|
|
61 <when value="history">
|
|
62 <param name="ref_file" type="data" format="fasta,fastq" label="Select the reference sequence" help="You can upload a FASTA file and use it as reference"/>
|
|
63 </when>
|
|
64 </conditional>
|
2
|
65 <param argument="--amr_feature_hits" format="bed" type="data_collection" collection_type="list" label="Collection of feature hits BED files"/>
|
|
66 <param argument="--amr_deletions_file" type="data" format="bed" optional="true" label="AMR deletions file" help="Optional, leave blank to ignore"/>
|
7
|
67 <param argument="--varscan_vcf_file" type="data" format="vcf" optional="true" label="Varscan VCF file" help="Optional, leave blank to ignore"/>
|
|
68 <param argument="--amr_mutation_regions_bed_file" type="data" format="bed" optional="true" label="AMR mutation regions BED file" help="Optional, leave blank to ignore"/>
|
2
|
69 <param argument="--amr_gene_drug_file" type="data" format="tabular,tsv" label="AMR gene drugs file"/>
|
0
|
70 <param name="output_process_log" type="select" display="radio" label="Output process log file?">
|
|
71 <option value="no" selected="true">No</option>
|
|
72 <option value="yes">Yes</option>
|
|
73 </param>
|
13
|
74 <param name="in_test_mode" type="hidden" value="false"/>
|
0
|
75 </inputs>
|
|
76 <outputs>
|
4
|
77 <data name="process_log" format="txt" label="${tool.name} on ${on_string} (process log)">
|
0
|
78 <filter>output_process_log == 'yes'</filter>
|
|
79 </data>
|
9
|
80 <data name="errors" format="txt" label="${tool.name} on ${on_string} (errors)"/>
|
7
|
81 <collection name="mutation_regions_tsv" type="list" format="tsv" label="${tool.name} on ${on_string} (mutation regions)">
|
|
82 <filter>amr_mutation_regions_bed_file not in [None, 'None']</filter>
|
|
83 <discover_datasets pattern="(?P<designation>.+)\.(?P<ext>tsv)" directory="mutation_regions_dir"/>
|
|
84 </collection>
|
0
|
85 <collection name="amr_matrix_png" type="list" format="png">
|
7
|
86 <discover_datasets pattern="(?P<designation>.+)\.(?P<ext>png)" directory="amr_matrix_png_dir"/>
|
0
|
87 </collection>
|
|
88 </outputs>
|
|
89 <tests>
|
|
90 <test>
|
4
|
91 <param name="reference_source_selector" value="history"/>
|
|
92 <param name="ref_file" ftype="fasta" value="ref_genome.fasta"/>
|
2
|
93 <param name="amr_feature_hits">
|
0
|
94 <collection type="list">
|
11
|
95 <element name="amr_pima_md" value="amr_pima_md.bed"/>
|
0
|
96 </collection>
|
|
97 </param>
|
11
|
98 <param name="varscan_vcf_file" value="varscan.vcf" ftype="vcf"/>
|
|
99 <param name="amr_mutation_regions_bed_file" value="amr_mutation_regions.bed" ftype="bed"/>
|
2
|
100 <param name="amr_gene_drug_file" value="amr_gene_drug.tsv" ftype="tsv"/>
|
13
|
101 <param name="in_test_mode" value="true"/>
|
0
|
102 <output_collection name="amr_matrix_png" type="list" count="1">
|
11
|
103 <element name="amr_matrix" ftype="png">
|
0
|
104 <assert_contents>
|
11
|
105 <has_size value="28798" delta="1000"/>
|
0
|
106 </assert_contents>
|
|
107 </element>
|
|
108 </output_collection>
|
9
|
109 <output name="errors" value="errors.txt" ftype="txt"/>
|
0
|
110 </test>
|
|
111 </tests>
|
|
112 <help>
|
|
113 **What it does**
|
|
114
|
2
|
115 Accepts a collection of best AMR feature hits, an optional AMR deletions BED file, an optional AMR mutations TSV file and a AMR gene
|
|
116 drug mappings file and draws an AMR matrix.
|
0
|
117 </help>
|
|
118 <expand macro="citations"/>
|
|
119 </tool>
|
|
120
|