diff samtools_mpileup.xml @ 11:111f83918fe6 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/samtools/samtools_mpileup commit 0f75269223c0821c6c82acf98fde947d0f816f2b"
author iuc
date Tue, 28 Sep 2021 16:15:20 +0000
parents 8da515fbc1bf
children 329deb17a9f7
line wrap: on
line diff
--- a/samtools_mpileup.xml	Tue Sep 21 09:33:51 2021 +0000
+++ b/samtools_mpileup.xml	Tue Sep 28 16:15:20 2021 +0000
@@ -1,4 +1,4 @@
-<tool id="samtools_mpileup" name="samtools mpileup" version="2.1.4">
+<tool id="samtools_mpileup" name="Samtools mpileup" version="2.1.5" profile="@PROFILE@">
     <description>multi-way pileup of variants</description>
     <macros>
         <import>macros.xml</import>
@@ -7,36 +7,25 @@
     <expand macro="stdio" />
     <expand macro="version_command" />
     <command><![CDATA[
-    
-    #set $input_bams = $reference_source.input_bam
+
+    #set $input_bams = $input
     @PREPARE_IDX_MULTIPLE@
-
-    #if $reference_source.reference_source_selector == "history":
-        #set ref_fa = 'ref.fa'
-        ln -s '${reference_source.ref_file}' 'ref.fa' &&
-        samtools faidx ref.fa &&
-    #else:
-        #set ref_fa = str( $reference_source.ref_file.fields.path )
-    #end if
+    @PREPARE_FASTA_IDX@
 
     samtools mpileup
-        -f '$ref_fa'
+        -f '$reffa'
     #for $i in range(len( $input_bams )):
         '${i}'
     #end for
 
     #if str( $advanced_options.advanced_options_selector ) == "advanced":
         #if str( $advanced_options.filter_by_flags.filter_flags ) == "filter":
-            #if $advanced_options.filter_by_flags.require_flags:
-                #set $filter = $advanced_options.filter_by_flags.require_flags
-                @FLAGS@
-                --rf $flags
-            #end if
-            #if $advanced_options.filter_by_flags.exclude_flags:
-                #set $filter = $advanced_options.filter_by_flags.exclude_flags
-                @FLAGS@
-                --ff $flags
-            #end if
+            #set $filter = $advanced_options.filter_by_flags.require_flags
+            @FLAGS@
+            --rf $flags
+            #set $filter = $advanced_options.filter_by_flags.exclude_flags
+            @FLAGS@
+            --ff $flags
         #end if
         #if str($advanced_options.limit_by_region.limit_by_regions) == "limit":
             #if str( $advanced_options.limit_by_region.region_paste ) != "None":
@@ -46,7 +35,7 @@
                 -l '$advanced_options.limit_by_region.bed_regions'
             #end if
         #end if
-    
+
         #if str( $advanced_options.exclude_read_group.exclude_read_groups ) == "paste":
             -G '$excluded_read_groups'
         #elif str( $advanced_options.exclude_read_group.exclude_read_groups ) == "history"
@@ -67,31 +56,17 @@
         ${output_options_cond.output_mapping_quality}
         ${output_options_cond.output_read_names}
         ${output_options_cond.output_all_pos}
+        #if $output_options_cond.output_tags:
+            --output-extra '$output_options_cond.output_tags'
+        #end if
     #end if
     --output '$output_file_pu'
     ]]></command>
     <inputs>
-        <conditional name="reference_source">
-            <param name="reference_source_selector" type="select" label="Choose the source for the reference genome">
-                <option value="cached">Use a built-in genome</option>
-                <option value="history">Use a genome from the history</option>
-            </param>
-            <when value="cached">
-                <param name="input_bam" type="data" format="bam" multiple="True" min="1" label="BAM file(s)">
-                    <validator type="unspecified_build" />
-                    <validator message="Sequences are not currently available for the specified build." metadata_column="1" metadata_name="dbkey" table_name="fasta_indexes" type="dataset_metadata_in_data_table" />
-                </param>
-                <param name="ref_file" type="select" label="Using reference genome">
-                    <options from_data_table="fasta_indexes" />
-                </param>
-            </when>
-            <when value="history">
-                <param name="input_bam" type="data" format="bam" multiple="True" min="1" label="BAM file(s)">
-                    <validator check="bam_index" message="Metadata missing, click the pencil icon in the history item and use the auto-detect feature to correct this issue." type="metadata" />
-                </param>
-                <param name="ref_file" type="data" format="fasta" label="Using reference genome" />
-            </when>
-        </conditional>
+        <param name="input" type="data" format="bam" multiple="true" min="1" label="BAM file(s)">
+            <validator check="bam_index" message="Metadata missing, click the pencil icon in the history item and use the auto-detect feature to correct this issue." type="metadata" />
+        </param>
+        <expand macro="mandatory_reference" argument="-f"/>
         <conditional name="advanced_options">
             <param name="advanced_options_selector" type="select" label="Set advanced options">
                 <option selected="True" value="default">Basic</option>
@@ -109,7 +84,7 @@
                             <expand  macro="flag_options" />
                         </param>
                         <param name="exclude_flags" argument="--ff/--excl-flags" type="select" multiple="True" display="checkboxes" label="Exclude">
-                            <expand  macro="flag_options" />
+                            <expand  macro="flag_options" s4="true" s256="true" s512="true" s1024="true"/>
                         </param>
                     </when>
                     <when value="nofilter" />
@@ -171,19 +146,20 @@
                     <option value="-a">all (including those with zero depth)</option>
                     <option value="-aa">absolutely all (including unused reference sequences)</option>
                 </param>
+                <param name="output_tags" type="text" argument="--output-extra" label="Add tags to output" help="Output extra read fields and read tag values, e.g., NM and XS (must be comma seperated, e.g., NM,XS)" />
             </when>
         </conditional>
     </inputs>
     <outputs>
-        <data name="output_file_pu" format="pileup" label="${tool.name} on ${on_string} pileup"/>
+        <data name="output_file_pu" format="pileup" label="${tool.name} on ${on_string}"/>
     </outputs>
     <tests>
         <!-- samtools test https://github.com/samtools/samtools/blob/4651d25f2b14cd68ffb0915a74b0c1b529b8cfa1/test/test.pl#L757 -->
         <test>
-            <conditional name="reference_source">
-                <param name="reference_source_selector" value="history" />
-                <param name="ref_file" ftype="fasta" value="mpileup.ref.fa" />
-                <param name="input_bam" ftype="bam" value="mpileup.1.bam,mpileup.2.bam,mpileup.3.bam" />
+            <param name="input" ftype="bam" value="mpileup.1.bam,mpileup.2.bam,mpileup.3.bam" />
+            <conditional name="addref_cond">
+                <param name="addref_select" value="history" />
+                <param name="ref" ftype="fasta" value="mpileup.ref.fa" />
             </conditional>
             <conditional name="advanced_options">
                 <param name="advanced_options_selector" value="advanced" />
@@ -196,10 +172,10 @@
         </test>
 <!-- test_cmd($opts,out=>'dat/mpileup.out.1',err=>'dat/mpileup.err.1',cmd=>"$$opts{bin}/samtools mpileup -b $$opts{tmp}/mpileup.bam.list -f $$opts{tmp}/mpileup.ref.fa.gz -r17:100-150");-->
         <test>
-            <conditional name="reference_source">
-                <param name="reference_source_selector" value="history" />
-                <param name="ref_file" ftype="fasta" value="mpileup.ref.fa" />
-                <param name="input_bam" ftype="bam" value="mpileup.1.bam" />
+            <param name="input" ftype="bam" value="mpileup.1.bam" />
+            <conditional name="addref_cond">
+                <param name="addref_select" value="history" />
+                <param name="ref" ftype="fasta" value="mpileup.ref.fa" />
             </conditional>
             <conditional name="advanced_options">
                 <param name="advanced_options_selector" value="advanced" />
@@ -219,10 +195,10 @@
     -->
         <!-- original test from galaxy tool-->
         <test>
-            <conditional name="reference_source">
-                <param name="reference_source_selector" value="history" />
-                <param name="ref_file" ftype="fasta" value="phiX.fasta" />
-                <param name="input_bam" ftype="bam" value="samtools_mpileup_in_1.bam" />
+            <param name="input" ftype="bam" value="samtools_mpileup_in_1.bam" />
+            <conditional name="addref_cond">
+                <param name="addref_select" value="history" />
+                <param name="ref" ftype="fasta" value="phiX.fasta" />
             </conditional>
             <conditional name="output_options_cond">
                 <param name="output_options_selector" value="advanced" />
@@ -235,9 +211,11 @@
             <output name="output_file_pu" file="samtools_mpileup_out_1.pileup" ftype="pileup" />
         </test>
         <test>
-            <param name="reference_source_selector" value="history" />
-            <param name="ref_file" ftype="fasta" value="phiX.fasta" />
-            <param name="input_bam" ftype="bam" value="phiX.bam" />
+            <param name="input" ftype="bam" value="phiX.bam" />
+            <conditional name="addref_cond">
+                <param name="addref_select" value="history" />
+                <param name="ref" ftype="fasta" value="phiX.fasta" />
+            </conditional>
             <conditional name="output_options_cond">
                 <param name="output_options_selector" value="default" />
             </conditional>
@@ -248,11 +226,13 @@
             <output name="output_file_pu" file="samtools_mpileup_out_2.pileup" ftype="pileup" />
         </test>
         <test>
-            <param name="reference_source_selector" value="history" />
-            <param name="ref_file" ftype="fasta" value="phiX.fasta" />
-            <param name="input_bam" ftype="bam" value="samtools_mpileup_in_1.bam" />
+            <param name="input" ftype="bam" value="samtools_mpileup_in_1.bam" />
+            <conditional name="addref_cond">
+                <param name="addref_select" value="history" />
+                <param name="ref" ftype="fasta" value="phiX.fasta" />
+            </conditional>
             <conditional name="output_options_cond">
-                <param name="output_options_cond" value="advanced" />
+                <param name="output_options_selector" value="advanced" />
                 <param name="base_position_on_reads" value="true" />
                 <param name="output_mapping_quality" value="true" />
             </conditional>
@@ -262,6 +242,18 @@
             </conditional>
             <output name="output_file_pu" file="samtools_mpileup_out_3.pileup" ftype="pileup" />
         </test>
+        <test>
+            <param name="input" ftype="bam" value="mpileup.1.bam" />
+            <conditional name="addref_cond">
+                <param name="addref_select" value="history" />
+                <param name="ref" ftype="fasta" value="mpileup.ref.fa" />
+            </conditional>
+            <conditional name="output_options_cond">
+                <param name="output_options_selector" value="advanced" />
+                <param name="output_tags" value="NM,AM" />
+            </conditional>
+            <output name="output_file_pu" file="mpileup.out.4" ftype="pileup" />
+        </test>
     </tests>
     <help><![CDATA[
 **What it does**
@@ -272,7 +264,7 @@
 
 In the pileup format (without -u or -g), each line represents a genomic position, consisting of chromosome name, 1-based coordinate, reference base, the number of reads covering the site, read bases, base qualities and alignment mapping qualities. Information on match, mismatch, indel, strand, mapping quality and start and end of a read are all encoded at the read base column. At this column, a dot stands for a match to the reference base on the forward strand, a comma for a match on the reverse strand, a '>' or '<' for a reference skip, 'ACGTN' for a mismatch on the forward strand and 'acgtn' for a mismatch on the reverse strand. A pattern '\\+[0-9]+[ACGTNacgtn]+' indicates there is an insertion between this reference position and the next reference position. The length of the insertion is given by the integer in the pattern, followed by the inserted sequence. Similarly, a pattern '-[0-9]+[ACGTNacgtn]+' represents a deletion from the reference. The deleted bases will be presented as '*' in the following lines. Also at the read base column, a symbol '^' marks the start of a read. The ASCII of the character following '^' minus 33 gives the mapping quality. A symbol '$' marks the end of a read segment.
 
-Note that there are two orthogonal ways to specify locations in the input file; via -r region and -l file. The former uses (and requires) an index to do random access while the latter streams through the file contents filtering out the specified regions, requiring no index. The two may be used in conjunction. For example a BED file containing locations of genes in chromosome 20 could be specified using -r 20 -l chr20.bed, meaning that the index is used to find chromosome 20 and then it is filtered for the regions listed in the bed file. 
+Note that there are two orthogonal ways to specify locations in the input file; via -r region and -l file. The former uses (and requires) an index to do random access while the latter streams through the file contents filtering out the specified regions, requiring no index. The two may be used in conjunction. For example a BED file containing locations of genes in chromosome 20 could be specified using -r 20 -l chr20.bed, meaning that the index is used to find chromosome 20 and then it is filtered for the regions listed in the bed file.
 
 **BAQ (Base Alignment Quality)**
 
@@ -280,7 +272,7 @@
 
 BAQ is turned on when a reference file is supplied using the -f option. To disable it, use the -B option.
 
-It is possible to store pre-calculated BAQ values in a SAM BQ:Z tag. Samtools mpileup will use the precalculated values if it finds them. The -E option can be used to make it ignore the contents of the BQ:Z tag and force it to recalculate the BAQ scores by making a new alignment. 
+It is possible to store pre-calculated BAQ values in a SAM BQ:Z tag. Samtools mpileup will use the precalculated values if it finds them. The -E option can be used to make it ignore the contents of the BQ:Z tag and force it to recalculate the BAQ scores by making a new alignment.
     ]]></help>
     <expand macro="citations" />
 </tool>