annotate draw_amr_matrix.xml @ 13:b1a7e04e6371 draft

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