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