comparison samtools_sort_transcriptome/samtools_sort.xml @ 0:a9b4a031a403 draft

Uploaded
author jackcurragh
date Wed, 23 Mar 2022 12:49:11 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:a9b4a031a403
1 <tool id="samtools_sort" name="Samtools sort" version="2.0.4" profile="@PROFILE@">
2 <description>order of storing aligned sequences</description>
3 <macros>
4 <import>macros.xml</import>
5 </macros>
6 <expand macro="requirements"/>
7 <expand macro="stdio"/>
8 <expand macro="version_command"/>
9 <command><![CDATA[
10 @ADDTHREADS@
11 @ADDMEMORY@
12 samtools sort
13 -@ \$addthreads
14 -m \$addmemory"M"
15 ###if str(compression):
16 ## -l '$compression'
17 ###end if
18 $prim_key_cond.prim_key_select
19 #if $prim_key_cond.prim_key_select == '-t':
20 $prim_key_cond.tag
21 $prim_key_cond.sec_key_select
22 #end if
23 $minhash
24 -O bam
25 -T "\${TMPDIR:-.}"
26 '${input1}'
27 > '${output1}'
28 ]]></command>
29 <inputs>
30 <param name="input1" type="data" format="sam,unsorted.bam,cram" label="BAM File" />
31 <conditional name="prim_key_cond">
32 <param name="prim_key_select" type="select" label="Primary sort key">
33 <option value="">coordinate</option>
34 <option value="-n" selected="True">name (-n)</option>
35 <option value="-t">tag (-t)</option>
36 </param>
37 <when value=""/>
38 <when value="-n"/>
39 <when value="-t">
40 <param name="tag" type="text" optional="false" argument="-t" label="Alignment tag"/>
41 <param name="sec_key_select" type="select" label="Secondary sort key">
42 <option value="">coordinate</option>
43 <option value="-n">name (-n)</option>
44 </param>
45 </when>
46 </conditional>
47 <param name="minhash" type="boolean" argument="-M" truevalue="-M" falsevalue="" checked="false" label="Minhash collation" help="Use minimiser for clustering unaligned/unplaced reads."/>
48 <!--<param name="compression" type="integer" argument="-l" optional="True" min="0" max="9" label="compression level" help="0 (uncompressed) to 9 (best)"/>-->
49 </inputs>
50 <outputs>
51 <data name="output1" format="bam">
52 <change_format>
53 <when input="prim_key_cond.prim_key_select" value="" format="bam" />
54 <when input="prim_key_cond.prim_key_select" value="-n" format="qname_sorted.bam" />
55 <when input="prim_key_cond.prim_key_select" value="-t" format="unsorted.bam" />
56 </change_format>
57 </data>
58 </outputs>
59 <tests>
60 <!-- tests from https://github.com/samtools/samtools/blob/9ce8c64493f7ea3fa69bc5c1ac980b1a8e3dcf1f/test/test.pl#L2464 -->
61 <!-- 1) # Pos sort -->
62 <test>
63 <param name="input1" value="test_input_1_a.bam" ftype="bam" />
64 <output name="output1" file="pos.sort.expected.bam" ftype="bam" lines_diff="4" />
65 </test>
66 <!-- test_cmd($opts, out=>"sort/pos.sort.expected.sam", cmd=>"$$opts{bin}/samtools sort${threads} $$opts{path}/dat/test_input_1_a.bam -O SAM -o -"); -->
67 <!-- 2) # Name sort -->
68 <test>
69 <param name="input1" value="test_input_1_a.bam" ftype="bam" />
70 <conditional name="prim_key_cond">
71 <param name="prim_key_select" value="-n"/>
72 </conditional>
73 <output name="output1" file="name.sort.expected.bam" ftype="qname_sorted.bam" lines_diff="4"/>
74 </test>
75 <!-- test_cmd($opts, out=>"sort/name.sort.expected.sam", cmd=>"$$opts{bin}/samtools sort${threads} -n $$opts{path}/dat/test_input_1_a.bam -O SAM -o -");-->
76 <!-- 3) # Tag sort (RG) (considers output and name sorted) -->
77 <test>
78 <param name="input1" value="test_input_1_a.bam" ftype="bam" />
79 <conditional name="prim_key_cond">
80 <param name="prim_key_select" value="-t"/>
81 <param name="tag" value="RG"/>
82 </conditional>
83 <output name="output1" file="tag.rg.sort.expected.bam" ftype="unsorted.bam" lines_diff="4"/>
84 </test>
85 <!--test_cmd($opts, out=>"sort/tag.rg.sort.expected.sam", cmd=>"$$opts{bin}/samtools sort${threads} -t RG $$opts{path}/dat/test_input_1_a.bam -O SAM -o -");-->
86 <!-- 4) # Tag sort (RG); secondary by name -->
87 <test>
88 <param name="input1" value="test_input_1_a.bam" ftype="bam" />
89 <conditional name="prim_key_cond">
90 <param name="prim_key_select" value="-t"/>
91 <param name="tag" value="RG"/>
92 <param name="sec_key_select" value="-n"/>
93 </conditional>
94 <output name="output1" file="tag.rg.n.sort.expected.bam" ftype="unsorted.bam" lines_diff="4"/>
95 </test>
96 <!--test_cmd($opts, out=>"sort/tag.rg.n.sort.expected.sam", cmd=>"$$opts{bin}/samtools sort${threads} -n -t RG $$opts{path}/dat/test_input_1_a.bam -O SAM -o -");-->
97 <!-- 5) # Tag sort (AS) -->
98 <test>
99 <param name="input1" value="test_input_1_a.bam" ftype="bam" />
100 <conditional name="prim_key_cond">
101 <param name="prim_key_select" value="-t"/>
102 <param name="tag" value="AS"/>
103 <param name="sec_key_select" value=""/>
104 </conditional>
105 <output name="output1" file="tag.as.sort.expected.bam" ftype="unsorted.bam" lines_diff="4"/>
106 </test>
107 <!--test_cmd($opts, out=>"sort/tag.as.sort.expected.sam", cmd=>"$$opts{bin}/samtools sort${threads} -t AS $$opts{path}/dat/test_input_1_d.sam -O SAM -o -");-->
108 <!-- 6) # Tag sort (FI) -->
109 <test>
110 <param name="input1" value="test_input_1_a.bam" ftype="bam" />
111 <conditional name="prim_key_cond">
112 <param name="prim_key_select" value="-t"/>
113 <param name="tag" value="FI"/>
114 </conditional>
115 <output name="output1" file="tag.fi.sort.expected.bam" ftype="unsorted.bam" lines_diff="4"/>
116 </test>
117 <!--test_cmd($opts, out=>"sort/tag.fi.sort.expected.sam", cmd=>"$$opts{bin}/samtools sort${threads} -t FI $$opts{path}/dat/test_input_1_d.sam -O SAM -o -");-->
118 <!-- 7) tests from old version -->
119 <test>
120 <param name="input1" value="1.bam" ftype="bam" />
121 <output name="output1" file="1_sort.bam" ftype="bam" sort="True" lines_diff="4"/>
122 </test>
123 <test>
124 <param name="input1" value="1.bam" ftype="bam" />
125 <conditional name="prim_key_cond">
126 <param name="prim_key_select" value="-n"/>
127 </conditional>
128 <output name="output1" file="1_sort_read_names.bam" ftype="qname_sorted.bam" lines_diff="4"/>
129 </test>
130 <!-- 8) test minhash sorting -->
131 <test>
132 <param name="input1" value="test_input_1_a.bam" ftype="bam" />
133 <param name="minhash" value="true" />
134 <output name="output1" file="minhash.expected.bam" ftype="bam" lines_diff="4" />
135 </test>
136 </tests>
137 <help>
138 **What it does**
139
140 Sort alignments by leftmost coordinates, or by read name when -n is used.
141 An appropriate @HD-SO sort order header tag will be added or an existing
142 one updated if necessary.
143
144 **Ordering Rules**
145
146 The following rules are used for ordering records.
147
148 If option -t is in use, records are first sorted by the value of the given
149 alignment tag, and then by position or name (if using -n). For example, “-t RG”
150 will make read group the primary sort key. The rules for ordering by tag are:
151
152 - Records that do not have the tag are sorted before ones that do.
153 - If the types of the tags are different, they will be sorted so that single
154 character tags (type A) come before array tags (type B), then string tags
155 (types H and Z), then numeric tags (types f and i).
156 - Numeric tags (types f and i) are compared by value. Note that comparisons of
157 floating-point values are subject to issues of rounding and precision.
158 - String tags (types H and Z) are compared based on the binary contents of the
159 tag using the C strcmp(3) function.
160 - Character tags (type A) are compared by binary character value.
161 - No attempt is made to compare tags of other types — notably type B array values will not be compared.
162
163 When the -n option is present, records are sorted by name. Names are compared so as to give a “natural” ordering — i.e. sections consisting of digits are compared numerically while all other sections are compared based on their binary representation. This means “a1” will come before “b1” and “a9” will come before “a10”. Records with the same name will be ordered according to the values of the READ1 and READ2 flags (see flags).
164
165 When the -n option is not present, reads are sorted by reference (according to the order of the @SQ header records), then by position in the reference, and then by the REVERSE flag.
166
167 This has now been removed. The previous out.prefix argument (and -f option, if any) should be changed to an appropriate combination of -T PREFIX and -o FILE. The previous -o option should be removed, as output defaults to standard output.
168
169 When the -M (minash collation) option is present, then samtools sort groups unmapped reads with similar sequence together. This can sometimes significantly reduce the file size.
170
171 </help>
172 <expand macro="citations"/>
173 </tool>