Mercurial > repos > wolma > mimodd
view reheader.xml @ 24:3accdbe6503b draft default tip
Deleted selected files
author | wolma |
---|---|
date | Thu, 21 Jul 2016 03:56:19 -0400 |
parents | 5db0545b9004 |
children |
line wrap: on
line source
<tool id="reheader" name="Reheader BAM file" version="0.1.7.3"> <description>From a BAM file generate a new file with the original header (if any) replaced or modified by that found in a second SAM file</description> <expand macro="requirements" /> <version_command>python3 -m MiModD version -q</version_command> <command> #if ($str($rg.treat_rg) != "ignore" and $str($rg.rginfo.source) == "from_form") or $str($co.treat_co) != "ignore": python3 -m MiModD header #if $str($rg.treat_rg) != "ignore" and $str($rg.rginfo.source) == "from_form": #for $rginfo in $rg.rginfo.rg #if $str($rginfo.source_id): --rg-id "${rginfo.source_id}" #end if #if $str($rginfo.rg_sm): --rg-sm "${rginfo.rg_sm}" #end if #if $str($rginfo.rg_cn): --rg-cn "${rginfo.rg_cn}" #else: --rg-cn "" #end if #if $str($rginfo.rg_ds): --rg-ds "${rginfo.rg_ds}" #else: --rg-ds "" #end if #if $str($rginfo.rg_date): --rg-dt "${rginfo.rg_date}" #else: --rg-dt "" #end if #if $str($rginfo.rg_lb): --rg-lb "${rginfo.rg_lb}" #else: --rg-lb "" #end if #if $str($rginfo.rg_pl): --rg-pl "${rginfo.rg_pl}" #else: --rg-pl "" #end if #if $str($rginfo.rg_pi): --rg-pi "${rginfo.rg_pi}" #else: --rg-pi "" #end if #if $str($rginfo.rg_pu): --rg-pu "${rginfo.rg_pu}" #else: --rg-pu "" #end if #end for #end if #if $str($co.treat_co) != "ignore": --co #for $comment in $co.coinfo #if $str($comment.line): "${comment.line}" #end if #end for #end if | #end if python3 -m MiModD reheader "$inputfile" --sq ignore --rg ${rg.treat_rg} #if $str($rg.treat_rg) != "ignore": #if $str($rg.rginfo.source) == "from_file": "${rg.rginfo.data}" #else: - #end if #for $rgmapping in $rg.rginfo.rg #if $str($rgmapping.source_id) and $str($rgmapping.rg_id): "$str($rgmapping.source_id)" : "$str($rgmapping.rg_id)" #end if #end for #end if --co ${co.treat_co} #if $str($co.treat_co) != "ignore": - #end if #set $restr = "" #for $rename in $rg_renaming #set $restr = $restr + ($str($rename.from) and $str($rename.to) and '"' + $str($rename.from) + '" : "' + $str($rename.to) + '" ') #end for #if $restr --rgm $restr #end if #set $restr = "" #for $rename in $sq_renaming #set $restr = $restr + ($str($rename.from) and $str($rename.to) and '"' + $str($rename.from) + '" : "' + $str($rename.to) + '" ') #end for #if $restr --sqm $restr #end if -o "$output" </command> <macros> <import>toolshed_macros.xml</import> <macro name="getreadgroupinfo"> <conditional name="rginfo"> <param help="" label="source of new read-group information" name="source" type="select"> <option value="from_file">existing SAM file</option> <option value="from_form">input form</option> </param> <when value="from_file"> <param format="sam" help="use the read group information found in this file" label="read-group template file in SAM format" name="data" type="data" /> <repeat default="0" help="read-group information found in the input file, by default, gets updated / replaced with information from template file read-groups with matching IDs. Alternatively, you may specify explicit read-group mappings below." min="0" name="rg" title="custom read-group mapping"> <param label="modify input file information for read-group ID (will create the read-group if it does not exist)" name="source_id" type="text" /> <param label="with template file information for read-group ID" name="rg_id" type="text" /> </repeat> </when> <when value="from_form"> <repeat default="1" min="1" name="rg" title="new read-group info"> <param help="required field" label="read-group ID (will create the read-group if it does not exist)" name="source_id" type="text" /> <param name="rg_id" type="hidden" value="" /> <param help="required field" label="sample name" name="rg_sm" type="text" /> <param label="description" name="rg_ds" type="text" /> <param label="date (YY-MM-DD format) the run was produced" name="rg_date" type="text" /> <param label="name of sequencing center" name="rg_cn" type="text" /> <param label="read-group library" name="rg_lb" type="text" /> <param label="platform/technology used to produce the reads" name="rg_pl" type="text" /> <param label="predicted median insert size" name="rg_pi" type="text" /> <param label="platform unit; unique identifier" name="rg_pu" type="text" /> </repeat> </when> </conditional> </macro> </macros> <inputs> <param format="bam" help="the file to reheader." label="input file in BAM format" name="inputfile" type="data" /> <conditional name="rg"> <param help="Replace mode will ignore ALL existing read group information in the input file and use ONLY template information, Update mode will COPY existing input file information and UPDATE it with template information; choose No, ... to leave read-group information alone." label="modify read-group information ?" name="treat_rg" type="select"> <option value="ignore">No, do not change read-groups.</option> <option value="update">Yes, update existing information</option> <option value="replace">Yes, replace existing information</option> </param> <when value="update"> <expand macro="getreadgroupinfo" /> </when> <when value="replace"> <expand macro="getreadgroupinfo" /> </when> </conditional> <conditional name="co"> <param help="" label="modify comments in the input file ?" name="treat_co" type="select"> <option value="ignore">No, do not change comments.</option> <option value="update">Yes, append new comments to existing ones</option> <option value="replace">Yes, replace all existing comments</option> </param> <when value="update"> <repeat default="0" min="0" name="coinfo" title="comment line"> <param name="line" size="80" type="text" /> </repeat> </when> <when value="replace"> <repeat default="0" min="0" name="coinfo" title="comment line"> <param name="line" size="80" type="text" /> </repeat> </when> </conditional> <repeat default="0" help="Warning: changing read-group IDs may increase job runtime substantially." min="0" name="rg_renaming" title="rename read-group"> <param help="as it appears in the current input file header" label="old name" name="from" size="30" type="text" /> <param label="new name" name="to" size="30" type="text" /> </repeat> <repeat default="0" help="Warning: changing sequence names may increase job runtime substantially." min="0" name="sq_renaming" title="rename sequence"> <param help="as it appears in the current input file header" label="old name" name="from" size="30" type="text" /> <param label="new name" name="to" size="30" type="text" /> </repeat> </inputs> <outputs> <data format="bam" label="(Re)headered bam file from MiModd ${tool.name} on ${on_string}" name="output"> </data> </outputs> <help> .. class:: infomark **What it does** The tool generates a copy of the BAM input file with a modified header (i.e., metadata). It can update or replace read-group information (i.e., information about the samples in the file), add or replace comment lines, and rename reference sequences declared in the header. The tool ensures that the resulting BAM file is valid and can be further processed by other MiModD tools and standard software like samtools. It aborts with an error message if a valid BAM file cannot be generated with the user-specified settings. The template information used to modify or replace the input file metadata is provided through forms or, in the case of read-group information, can be taken from an existing SAM file as can be generated, for example, with the *NGS Run Annotation* tool. </help> </tool>