| 
40
 | 
     1 <tool name="Replace SAM/BAM Header" id="picard_ReplaceSamHeader" version="1.106.0">
 | 
| 
 | 
     2 <!-- taken from https://github.com/najoshi/ucd-biocore-galaxy/blob/master/tools/picard/picard_ReplaceSamHeader.xml -->
 | 
| 
43
 | 
     3   <requirements><requirement type="package" version="1.106.0">picard</requirement></requirements>
 | 
| 
40
 | 
     4   <command interpreter="python">
 | 
| 
 | 
     5     picard_wrapper.py
 | 
| 
 | 
     6       --input "$inputFile"
 | 
| 
 | 
     7       -o $outFile
 | 
| 
 | 
     8       --header-file $headerFile
 | 
| 
 | 
     9       --output-format $outputFormat
 | 
| 
 | 
    10       -j "\$JAVA_JAR_PATH/ReplaceSamHeader.jar"
 | 
| 
 | 
    11       --tmpdir "${__new_file_path__}"
 | 
| 
 | 
    12   </command>
 | 
| 
 | 
    13   <inputs>
 | 
| 
 | 
    14     <param format="bam,sam" name="inputFile" type="data" label="SAM/BAM dataset to replace header in (TARGET)"
 | 
| 
 | 
    15       help="If empty, upload or import a SAM/BAM dataset." />
 | 
| 
 | 
    16     <param format="bam,sam" name="headerFile" type="data" label="SAM/BAM to reader header from (SOURCE)"
 | 
| 
 | 
    17       help="If empty, upload or import a SAM/BAM dataset." />
 | 
| 
 | 
    18     <param name="outputFormat" type="boolean" checked="True" truevalue="bam" falsevalue="sam" label="Output BAM instead of SAM" help="Uncheck for SAM output" />
 | 
| 
 | 
    19   </inputs>
 | 
| 
 | 
    20   <outputs>
 | 
| 
 | 
    21     <data name="outFile" format="bam" label="${tool.name} on ${on_string}: ${outputFormat} with replaced header">
 | 
| 
 | 
    22       <change_format>
 | 
| 
 | 
    23         <when input="outputFormat" value="sam" format="sam" />
 | 
| 
 | 
    24       </change_format>
 | 
| 
 | 
    25     </data>
 | 
| 
 | 
    26   </outputs>
 | 
| 
 | 
    27   <tests>
 | 
| 
 | 
    28     <test>
 | 
| 
 | 
    29       <!-- Command:
 | 
| 
 | 
    30 java -jar ReplaceSamHeader.jar VALIDATION_STRINGENCY=LENIENT I=test-data/picard_input_tiny_coord.bam HEADER=test-data/picard_RSH_input1.bam O=picard_RSH_output1.sam
 | 
| 
 | 
    31 picard_RSH_input1.bam can be made from picard_RSH_input1.sam
 | 
| 
 | 
    32 -->
 | 
| 
 | 
    33       <param name="inputFile" value="picard_input_tiny_coord.bam" ftype="bam" />
 | 
| 
 | 
    34       <param name="headerFile" value="picard_RSH_input1.bam" ftype="bam" />
 | 
| 
 | 
    35       <param name="outputFormat" value="False" />
 | 
| 
 | 
    36       <output name="outFile" file="picard_RSH_output1.sam" ftype="sam" />
 | 
| 
 | 
    37     </test>
 | 
| 
 | 
    38     <test>
 | 
| 
 | 
    39       <!-- Command:
 | 
| 
 | 
    40 java -jar ReplaceSamHeader.jar VALIDATION_STRINGENCY=LENIENT I=test-data/picard_input_tiny_coord.sam HEADER=test-data/picard_RSH_input1.bam O=picard_RSH_output2.sam
 | 
| 
 | 
    41 picard_RSH_input1.bam can be made from picard_RSH_input1.sam
 | 
| 
 | 
    42 -->
 | 
| 
 | 
    43       <param name="inputFile" value="picard_input_tiny_coord.sam" ftype="sam" />
 | 
| 
 | 
    44       <param name="headerFile" value="picard_RSH_input1.bam" ftype="bam" />
 | 
| 
 | 
    45       <param name="outputFormat" value="False" />
 | 
| 
 | 
    46       <output name="outFile" file="picard_RSH_output2.sam" ftype="sam" />
 | 
| 
 | 
    47     </test>
 | 
| 
 | 
    48     <test>
 | 
| 
 | 
    49       <!-- Command:
 | 
| 
 | 
    50 java -jar ReplaceSamHeader.jar VALIDATION_STRINGENCY=LENIENT I=test-data/picard_input_tiny_coord.sam HEADER=test-data/picard_RSH_input1.sam O=picard_RSH_output2.bam
 | 
| 
 | 
    51 -->
 | 
| 
 | 
    52       <param name="inputFile" value="picard_input_tiny_coord.sam" ftype="sam" />
 | 
| 
 | 
    53       <param name="headerFile" value="picard_RSH_input1.sam" ftype="sam" />
 | 
| 
 | 
    54       <param name="outputFormat" value="True" />
 | 
| 
 | 
    55       <output name="outFile" file="picard_RSH_output2.bam" ftype="bam" />
 | 
| 
 | 
    56     </test>
 | 
| 
 | 
    57   </tests>
 | 
| 
 | 
    58   <help>
 | 
| 
 | 
    59 
 | 
| 
 | 
    60 
 | 
| 
 | 
    61 .. class:: infomark
 | 
| 
 | 
    62 
 | 
| 
 | 
    63 **Purpose**
 | 
| 
 | 
    64 
 | 
| 
 | 
    65 Replace Sam Header with the header from another sam file. The tool does not do any
 | 
| 
 | 
    66 significant validation, so it's up to the user to make sure that the elements in
 | 
| 
 | 
    67 the header are relevant and that the new header has all the required things.
 | 
| 
 | 
    68 
 | 
| 
 | 
    69 Replace the SAMFileHeader in a SAM file with the given header. Validation is
 | 
| 
 | 
    70 minimal. It is up to the user to ensure that all the elements referred to in the
 | 
| 
 | 
    71 SAMRecords are present in the new header. Sort order of the two input files must
 | 
| 
 | 
    72 be the same.
 | 
| 
 | 
    73 
 | 
| 
 | 
    74 **Picard documentation**
 | 
| 
 | 
    75 
 | 
| 
 | 
    76 This is a Galaxy wrapper for ReplaceSamHeader, a part of the external package Picard-tools_.
 | 
| 
 | 
    77 
 | 
| 
 | 
    78  .. _Picard-tools: http://www.google.com/search?q=picard+samtools
 | 
| 
 | 
    79 
 | 
| 
 | 
    80 ------
 | 
| 
 | 
    81 
 | 
| 
 | 
    82 .. class:: infomark
 | 
| 
 | 
    83 
 | 
| 
 | 
    84 **Inputs and outputs**
 | 
| 
 | 
    85 
 | 
| 
 | 
    86 Either a sam file or a bam file is required as the file whose header will be replaced.
 | 
| 
 | 
    87 The header file is also required and can also be either sam or bam (it does not have
 | 
| 
 | 
    88 to be the same type as the other file). In both cases, if a bam file is used, it must
 | 
| 
 | 
    89 be coordinate-sorted. Galaxy currently coordinate-sorts all bam files.
 | 
| 
 | 
    90 
 | 
| 
 | 
    91 The tool will output either bam (the default) or sam. Bam is recommended since it is smaller.
 | 
| 
 | 
    92 
 | 
| 
 | 
    93 .. class:: warningmark
 | 
| 
 | 
    94 
 | 
| 
 | 
    95 **Warning on SAM/BAM quality**
 | 
| 
 | 
    96 
 | 
| 
 | 
    97 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**
 | 
| 
 | 
    98 flag when it runs Picard, which allows reads to be discarded if they're empty or don't map. This appears
 | 
| 
 | 
    99 to be the only way to deal with SAM/BAM that cannot be parsed.
 | 
| 
 | 
   100 
 | 
| 
 | 
   101 
 | 
| 
 | 
   102 
 | 
| 
 | 
   103   </help>
 | 
| 
 | 
   104 </tool>
 |