41
|
1 <tool name="Reorder SAM/BAM" id="picard_ReorderSam" version="1.106.0">
|
|
2 <!-- taken from Inserthttps://github.com/najoshi/ucd-biocore-galaxy/tree/master/tools/picard -->
|
|
3 <requirements><requirement type="package">picard</requirement></requirements>
|
|
4 <command interpreter="python">
|
|
5 picard_wrapper.py
|
|
6 --input=$inputFile
|
|
7 #if $source.indexSource == "built-in"
|
|
8 --ref="${source.ref.fields.path}"
|
|
9 #else
|
|
10 --ref-file=$refFile
|
|
11 --species-name=$source.speciesName
|
|
12 --build-name=$source.buildName
|
|
13 --trunc-names=$source.truncateSeqNames
|
|
14 #end if
|
|
15 --allow-inc-dict-concord=$allowIncDictConcord
|
|
16 --allow-contig-len-discord=$allowContigLenDiscord
|
|
17 --output-format=$outputFormat
|
|
18 --output=$outFile
|
|
19 --tmpdir "${__new_file_path__}"
|
|
20 -j "\$JAVA_JAR_PATH/ReorderSam.jar"
|
|
21 </command>
|
|
22 <inputs>
|
|
23 <param format="bam,sam" name="inputFile" type="data" label="SAM/BAM dataset to be reordered"
|
|
24 help="If empty, upload or import a SAM/BAM dataset." />
|
|
25 <conditional name="source">
|
|
26 <param name="indexSource" type="select" label="Select Reference Genome" help="This tool will re-order SAM/BAM in the same order as reference selected below.">
|
|
27 <option value="built-in">Locally cached</option>
|
|
28 <option value="history">History</option>
|
|
29 </param>
|
|
30 <when value="built-in">
|
|
31 <param name="ref" type="select" label="Select a reference genome">
|
|
32 <options from_data_table="picard_indexes" />
|
|
33 </param>
|
|
34 </when>
|
|
35 <when value="history">
|
|
36 <param name="refFile" type="data" format="fasta" metadata_name="dbkey" label="Using reference file" />
|
|
37 <param name="speciesName" type="text" value="" label="Species name" />
|
|
38 <param name="buildName" type="text" value="" label="Build name" />
|
|
39 <param name="truncateSeqNames" type="boolean" checked="False" truevalue="true" falsevalue="false" label="Truncate sequence names after first whitespace" />
|
|
40 </when>
|
|
41 </conditional>
|
|
42 <param name="allowIncDictConcord" type="boolean" checked="False" truevalue="true" falsevalue="false" label="Allow incomplete dict concordance?" help="Allows a partial overlap of the BAM contigs with the new reference sequence contigs." />
|
|
43 <param name="allowContigLenDiscord" type="boolean" checked="False" truevalue="true" falsevalue="false" label="Allow contig length discordance?" help="This is dangerous--don't check it unless you know exactly what you're doing!" />
|
|
44 <param name="outputFormat" type="boolean" checked="True" truevalue="bam" falsevalue="sam" label="Output BAM instead of SAM" help="Uncheck for SAM output" />
|
|
45 </inputs>
|
|
46 <outputs>
|
|
47 <data name="outFile" format="bam" label="${tool.name} on ${on_string}: reordered ${outputFormat}">
|
|
48 <change_format>
|
|
49 <when input="outputFormat" value="sam" format="sam" />
|
|
50 </change_format>
|
|
51 </data>
|
|
52 </outputs>
|
|
53 <tests>
|
|
54 <test>
|
|
55 <!-- Commands:
|
|
56 cp test-data/phiX.fasta .
|
|
57 samtools faidx phiX.fasta
|
|
58 java -jar CreateSequenceDictionary.jar R=phiX.fasta O=phiX.dict URI=phiX.fasta TRUNCATE_NAMES_AT_WHITESPACE=false SPECIES=phiX174
|
|
59 java -jar ReorderSam.jar VALIDATION_STRINGENCY=LENIENT I=test-data/picard_RS_input1.bam O=picard_RS_output1.bam REFERENCE=phiX.fasta ALLOW_INCOMPLETE_DICT_CONCORDANCE=false ALLOW_CONTIG_LENGTH_DISCORDANCE=false
|
|
60 -->
|
|
61 <param name="inputFile" value="picard_RS_input1.bam" />
|
|
62 <param name="indexSource" value="history" />
|
|
63 <param name="refFile" value="phiX.fasta" />
|
|
64 <param name="speciesName" value="phiX174" />
|
|
65 <param name="buildName" value="" />
|
|
66 <param name="truncateSeqNames" value="false" />
|
|
67 <param name="allowIncDictConcord" value="false" />
|
|
68 <param name="allowContigLenDiscord" value="false" />
|
|
69 <param name="outputFormat" value="True" />
|
|
70 <output name="outFile" file="picard_RS_output1.bam" ftype="bam" lines_diff="4" compare="contains" />
|
|
71 </test>
|
|
72 <test>
|
|
73 <!-- Command:
|
|
74 java -jar ReorderSam.jar VALIDATION_STRINGENCY=LENIENT I=test-data/picard_RS_input2.sam O=picard_RS_output2.sam REFERENCE=/path/to/phiX/picard_index/phiX.fa ALLOW_INCOMPLETE_DICT_CONCORDANCE=false ALLOW_CONTIG_LENGTH_DISCORDANCE=false
|
|
75 /path/to/phiX/srma_index/phiX.fa is path to phiX.fa, phiX.fa.fai, and phiX.dict
|
|
76 -->
|
|
77 <param name="inputFile" value="picard_RS_input2.sam" />
|
|
78 <param name="indexSource" value="built-in" />
|
|
79 <param name="ref" value="phiX" />
|
|
80 <param name="allowIncDictConcord" value="false" />
|
|
81 <param name="allowContigLenDiscord" value="false" />
|
|
82 <param name="outputFormat" value="False" />
|
|
83 <output name="outFile" file="picard_RS_output2.sam" ftype="sam" lines_diff="4" sort="True" />
|
|
84 </test>
|
|
85 <test>
|
|
86 <!-- Commands:
|
|
87 cp test-data/picard_RS_input4.fasta .
|
|
88 samtools faidx picard_RS_input4.fasta
|
|
89 java -jar CreateSequenceDictionary.jar R=picard_RS_input4.fasta O=picard_RS_input4.dict URI=picard_RS_input4.fasta TRUNCATE_NAMES_AT_WHITESPACE=true SPECIES=phiX174 GENOME_ASSEMBLY=phiX_buildBlah1.1
|
|
90 java -jar ReorderSam.jar VALIDATION_STRINGENCY=LENIENT I=test-data/picard_RS_input3.bam O=picard_RS_output3.sam REFERENCE=picard_RS_input4.fasta ALLOW_INCOMPLETE_DICT_CONCORDANCE=true ALLOW_CONTIG_LENGTH_DISCORDANCE=false
|
|
91 picard_RS_input3.bam can be made from picard_RS_input3.sam
|
|
92 -->
|
|
93 <param name="inputFile" value="picard_RS_input3.bam" />
|
|
94 <param name="indexSource" value="history" />
|
|
95 <param name="refFile" value="picard_RS_input4.fasta" />
|
|
96 <param name="speciesName" value="phiX174" />
|
|
97 <param name="buildName" value="phiX_buildBlah1.1" />
|
|
98 <param name="truncateSeqNames" value="true" />
|
|
99 <param name="allowIncDictConcord" value="true" />
|
|
100 <param name="allowContigLenDiscord" value="false" />
|
|
101 <param name="outputFormat" value="False" />
|
|
102 <output name="outFile" file="picard_RS_output3.sam" ftype="sam" lines_diff="12" sort="True" />
|
|
103 </test>
|
|
104 </tests>
|
|
105 <help>
|
|
106
|
|
107 .. class:: infomark
|
|
108
|
|
109 **Purpose**
|
|
110
|
|
111 Reorder SAM/BAM to match contig ordering in a particular reference file. Note that this is
|
|
112 not the same as sorting as done by the SortSam tool, which sorts by either coordinate
|
|
113 values or query name. The ordering in ReorderSam is based on exact name matching of
|
|
114 contigs/chromosomes. Reads that are mapped to a contig that is not in the new reference file are
|
|
115 not included in the output.
|
|
116
|
|
117 **Picard documentation**
|
|
118
|
|
119 This is a Galaxy wrapper for ReorderSam, a part of the external package Picard-tools_.
|
|
120
|
|
121 .. _Picard-tools: http://www.google.com/search?q=picard+samtools
|
|
122
|
|
123 ------
|
|
124
|
|
125 .. class:: infomark
|
|
126
|
|
127 **Inputs, outputs, and parameters**
|
|
128
|
|
129 For the file that needs to be reordered, either a sam file or a bam file must be supplied.
|
|
130 If a bam file is used, it must be coordinate-sorted. A reference file is also required,
|
|
131 so either a fasta file should be supplied or a built-in reference can be selected.
|
|
132
|
|
133 The output contains the same reads as the input file but the reads have been rearranged so
|
|
134 they appear in the same order as the provided reference file. The tool will output either
|
|
135 bam (the default) or sam, according to user selection. Bam is recommended since it is smaller.
|
|
136
|
|
137 The only extra parameters that can be set are flags for allowing incomplete dict concordance
|
|
138 and allowing contig length discordance. If incomplete dict concordance is allowed, only a
|
|
139 partial overlap of the bam contigs with the new reference sequence contigs is required. By
|
|
140 default it is off, requiring a corresponding contig in the new reference for each read contig.
|
|
141 If contig length discordance is allowed, contig names that are the same between a read and the
|
|
142 new reference contig are allowed even if they have different lengths. This is usually not a
|
|
143 good idea, unless you know exactly what you're doing. It's off by default.
|
|
144
|
|
145 .. class:: warningmark
|
|
146
|
|
147 **Warning on SAM/BAM quality**
|
|
148
|
|
149 Many SAM/BAM files produced externally and uploaded to Galaxy do not fully conform to SAM/BAM specifications. Galaxy deals with this by using the **LENIENT**
|
|
150 flag when it runs Picard, which allows reads to be discarded if they're empty or don't map. This appears
|
|
151 to be the only way to deal with SAM/BAM that cannot be parsed.
|
|
152
|
|
153
|
|
154 </help>
|
|
155 </tool>
|
|
156
|
|
157
|
|
158
|