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
|
|
45 ]]></command>
|
|
46 <inputs>
|
4
|
47 <conditional name="reference_source">
|
|
48 <param name="reference_source_selector" type="select" label="Select a reference genome from your history or use a cached genome index?">
|
|
49 <option value="cached">Use a cached genome index</option>
|
|
50 <option value="history">Select a genome from the history and build the index</option>
|
|
51 </param>
|
|
52 <when value="cached">
|
|
53 <param name="ref_file" type="select" label="Using reference genome" help="Select reference genome">
|
|
54 <options from_data_table="all_fasta">
|
|
55 <filter type="sort_by" column="2"/>
|
|
56 <validator type="no_options" message="No reference genomes are available"/>
|
|
57 </options>
|
|
58 </param>
|
|
59 </when>
|
|
60 <when value="history">
|
|
61 <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"/>
|
|
62 </when>
|
|
63 </conditional>
|
2
|
64 <param argument="--amr_feature_hits" format="bed" type="data_collection" collection_type="list" label="Collection of feature hits BED files"/>
|
|
65 <param argument="--amr_deletions_file" type="data" format="bed" optional="true" label="AMR deletions file" help="Optional, leave blank to ignore"/>
|
7
|
66 <param argument="--varscan_vcf_file" type="data" format="vcf" optional="true" label="Varscan VCF file" help="Optional, leave blank to ignore"/>
|
|
67 <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
|
68 <param argument="--amr_gene_drug_file" type="data" format="tabular,tsv" label="AMR gene drugs file"/>
|
0
|
69 <param name="output_process_log" type="select" display="radio" label="Output process log file?">
|
|
70 <option value="no" selected="true">No</option>
|
|
71 <option value="yes">Yes</option>
|
|
72 </param>
|
|
73 </inputs>
|
|
74 <outputs>
|
4
|
75 <data name="process_log" format="txt" label="${tool.name} on ${on_string} (process log)">
|
0
|
76 <filter>output_process_log == 'yes'</filter>
|
|
77 </data>
|
9
|
78 <data name="errors" format="txt" label="${tool.name} on ${on_string} (errors)"/>
|
7
|
79 <collection name="mutation_regions_tsv" type="list" format="tsv" label="${tool.name} on ${on_string} (mutation regions)">
|
|
80 <filter>amr_mutation_regions_bed_file not in [None, 'None']</filter>
|
|
81 <discover_datasets pattern="(?P<designation>.+)\.(?P<ext>tsv)" directory="mutation_regions_dir"/>
|
|
82 </collection>
|
0
|
83 <collection name="amr_matrix_png" type="list" format="png">
|
7
|
84 <discover_datasets pattern="(?P<designation>.+)\.(?P<ext>png)" directory="amr_matrix_png_dir"/>
|
0
|
85 </collection>
|
|
86 </outputs>
|
|
87 <tests>
|
|
88 <test>
|
4
|
89 <param name="reference_source_selector" value="history"/>
|
|
90 <param name="ref_file" ftype="fasta" value="ref_genome.fasta"/>
|
2
|
91 <param name="amr_feature_hits">
|
0
|
92 <collection type="list">
|
11
|
93 <element name="amr_pima_md" value="amr_pima_md.bed"/>
|
0
|
94 </collection>
|
|
95 </param>
|
11
|
96 <param name="varscan_vcf_file" value="varscan.vcf" ftype="vcf"/>
|
|
97 <param name="amr_mutation_regions_bed_file" value="amr_mutation_regions.bed" ftype="bed"/>
|
2
|
98 <param name="amr_gene_drug_file" value="amr_gene_drug.tsv" ftype="tsv"/>
|
0
|
99 <output_collection name="amr_matrix_png" type="list" count="1">
|
11
|
100 <element name="amr_matrix" ftype="png">
|
0
|
101 <assert_contents>
|
11
|
102 <has_size value="28798" delta="1000"/>
|
0
|
103 </assert_contents>
|
|
104 </element>
|
|
105 </output_collection>
|
9
|
106 <output name="errors" value="errors.txt" ftype="txt"/>
|
0
|
107 </test>
|
|
108 </tests>
|
|
109 <help>
|
|
110 **What it does**
|
|
111
|
2
|
112 Accepts a collection of best AMR feature hits, an optional AMR deletions BED file, an optional AMR mutations TSV file and a AMR gene
|
|
113 drug mappings file and draws an AMR matrix.
|
0
|
114 </help>
|
|
115 <expand macro="citations"/>
|
|
116 </tool>
|
|
117
|