Mercurial > repos > devteam > bwa_0_7_10
diff bwa.xml @ 0:5e72d136a39e draft
Uploaded
author | devteam |
---|---|
date | Mon, 29 Sep 2014 16:22:24 -0400 |
parents | |
children | 6bfb657c8fe1 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bwa.xml Mon Sep 29 16:22:24 2014 -0400 @@ -0,0 +1,500 @@ +<?xml version="1.0"?> +<tool id="bwa_aln_0_7_10" name="BWA" version="bwa-0.7.10-r837-dirty_galaxy_0.1"> + <requirements> + <requirement type="package" version="0.7.10.039ea20639">bwa</requirement> + <requirement type="package" version="1.1">samtools</requirement> + </requirements> + <description>- map short reads (< 100 bp) against referece genome</description> + <command> + + #set $reference_fasta_filename = "localref.fa" + + #if str( $reference_source.reference_source_selector ) == "history": + + ln -s "${reference_source.ref_file}" "${reference_fasta_filename}" && + + ## The following shell commands decide with of the BWA indexing algorithms (IS or BWTSW) will be run + ## depending ob the size of the input FASTA dataset + + ( + size=`stat -c %s "${reference_fasta_filename}" 2>/dev/null`; ## Linux + if [ $? -eq 0 ]; + then + if [ \$size -lt 2000000000 ]; + then + bwa index -a is "${reference_fasta_filename}"; + else + bwa index -a bwtsw "${reference_fasta_filename}"; + fi; + fi; + + eval \$(stat -s "${reference_fasta_filename}"); ## OSX + if [ $? -eq 0 ]; + then + if [ \$st_size -lt 2000000000 ]; + then + bwa index -a is "${reference_fasta_filename}"; + echo "Generating BWA index with is algorithm"; + else + bwa index -a bwtsw "${reference_fasta_filename}"; + echo "Generating BWA index with bwtsw algorithm"; + fi; + fi; + ) && + + #else: + #set $reference_fasta_filename = str( $reference_source.ref_file.fields.path ) + #end if + + ## Begin bwa command line + +####### Fastq paired + + #if str( $input_type.input_type_selector ) == "paired": + + bwa aln + -t "\${GALAXY_SLOTS:-1}" + + @command_options@ + + "${reference_fasta_filename}" + "${input_type.fastq_input1}" + > first.sai && + + bwa aln + -t "\${GALAXY_SLOTS:-1}" + + @command_options@ + + "${reference_fasta_filename}" + "${input_type.fastq_input2}" + > second.sai && + + bwa sampe + + #if str( $input_type.adv_pe_options.adv_pe_options_selector) == "True": + + -a ${$input_type.adv_pe_options.a} + -o ${$input_type.adv_pe_options.o} + -n ${$input_type.adv_pe_options.n} + -N ${$input_type.adv_pe_options.N} + + #end if + + @read_group_options@ + + "${reference_fasta_filename}" first.sai second.sai "${input_type.fastq_input1}" "${input_type.fastq_input2}" + +####### Fastq single + + #elif str( $input_type.input_type_selector ) == "single": + + bwa aln + -t "\${GALAXY_SLOTS:-1}" + + @command_options@ + + "${reference_fasta_filename}" + "${input_type.fastq_input1}" + > first.sai && + + bwa samse + + #if str( $input_type.adv_se_options.adv_se_options_selector) == "True": + + -n ${$input_type.adv_se_options.n} + + #end if + + @read_group_options@ + + "${reference_fasta_filename}" first.sai "${input_type.fastq_input1}" + +####### BAM paired + + #elif str( $input_type.input_type_selector ) == "paired_bam": + + bwa aln + -t "\${GALAXY_SLOTS:-1}" + -b + -1 + + @command_options@ + + "${reference_fasta_filename}" + "${input_type.bam_input}" + > first.sai && + + bwa aln + -t "\${GALAXY_SLOTS:-1}" + -b + -2 + @command_options@ + "${reference_fasta_filename}" + "${input_type.bam_input}" + > second.sai && + + bwa sampe + + #if str( $input_type.adv_bam_pe_options.adv_pe_options_selector) == "True": + + -a ${$input_type.adv_bam_pe_options.a} + -o ${$input_type.adv_bam_pe_options.o} + -n ${$input_type.adv_bam_pe_options.n} + -N ${$input_type.adv_bam_pe_options.N} + + #end if + + @read_group_options@ + + "${reference_fasta_filename}" first.sai second.sai "${input_type.bam_input}" "${input_type.bam_input}" + +####### Fastq single ------------ to do next + + #elif str( $input_type.input_type_selector ) == "single_bam": + + bwa aln + -t "\${GALAXY_SLOTS:-1}" + -b + -0 + + @command_options@ + + "${reference_fasta_filename}" + "${input_type.bam_input}" + > first.sai && + + bwa samse + + #if str( $input_type.adv_bam_se_options.adv_se_options_selector) == "True": + + -n ${$input_type.adv_bam_se_options.n} + + #end if + + @read_group_options@ + + "${reference_fasta_filename}" first.sai "${input_type.bam_input}" + + #end if + + | samtools view -Sb - > $bam_output + + </command> + + <macros> + <token name="@command_options@"> + #if str( $analysis_type.analysis_type_selector ) == "illumina": + + ## do nothing -> just align with default parameters + + #elif str( $analysis_type.analysis_type_selector ) == "full": + + -n ${analysis_type.n} + -o ${analysis_type.o} + -e ${analysis_type.e} + -i ${analysis_type.i} + -d ${analysis_type.d} + -l ${analysis_type.l} + -k ${analysis_type.k} + -m ${analysis_type.m} + -M ${analysis_type.M} + -O ${analysis_type.O} + -E ${analysis_type.E} + -R ${analysis_type.R} + -q ${analysis_type.q} + + #if str( $analysis_type.B ): + -B ${analysis_type.B} + #end if + + #if str( $analysis_type.L ): + -B ${analysis_type.L} + #end if + + #elif str( $analysis_type.analysis_type_selector ) == "cline": + ${analysis_type.cline} + #end if + </token> + <token name="@read_group_options@"> + + #if str( $rg.rg_selector ) == "True": + + -r "@RG\tID:$rg.ID\tSM:$rg.SM" + + #end if + </token> + + <xml name="advanced_pe_options"> + <param name="adv_pe_options_selector" type="boolean" truevalue="set" falsevalue="do_not_set" label="Set advanced paired end options?" help="Provides additional controls"/> + <when value="set"> + <param name="a" type="integer" value="500" label="Maximum insert size for a read pair to be considered being mapped properly." help="sampe -a; This option is only used when there are not enough good alignment to infer the distribution of insert sizes; default=500"/> + <param name="o" type="integer" value="100000" label="Maximum occurrences of a read for pairing. A read with more occurrences will be treated as a single-end read." help="sampe -o; Reducing this parameter helps faster pairing; default=100000"/> + <param name="n" type="integer" value="3" label="Maximum number of alignments to output in the XA tag for reads paired properly." help="sampe -n; If a read has more than this many hits, the XA tag will not be written; default=3"/> + <param name="N" type="integer" value="10" label="Maximum number of alignments to output in the XA tag for disconcordant read pairs (excluding singletons)." help="sampe -N; If a read has more than this many hits, the XA tag will not be written; default=10"/> + <param name="c" type="float" value="0.00005" label="Prior of chimeric rate (lower bound)" help="sampe -c"/> + </when> + <when value="do_not_set"> + <!-- do nothing --> + </when> + </xml> + <xml name="advances_se_options"> + <param name="adv_se_options_selector" type="boolean" truevalue="set" falsevalue="do_not_set" label="Set advanced single end options?" help="Provides additional controls"/> + <when value="set"> + <param name="n" type="integer" value="3" label="Maximum number of alignments to output in the XA tag." help="-n; If a read has more than this many hits, the XA tag will not be written; default=3"/> + </when> + <when value="do_not_set"> + <!-- do nothing --> + </when> + </xml> + </macros> + + <inputs> + + <conditional name="reference_source"> + <param name="reference_source_selector" type="select" label="Load reference genome from"> + <option value="cached">Local cache</option> + <option value="history">History</option> + </param> + <when value="cached"> + <param name="ref_file" type="select" label="Using reference genome" help="Select genome from the list"> + <options from_data_table="bwa_mem_indexes"> + <filter type="sort_by" column="2" /> + <validator type="no_options" message="No indexes are available" /> + </options> + <validator type="no_options" message="A built-in reference genome is not available for the build associated with the selected input file"/> + </param> + </when> + <when value="history"> + <param name="ref_file" type="data" format="fasta" label="Use the folloing dataset as the reference sequence" help="You can upload a FASTA sequence to the history and use it as reference" /> + </when> + </conditional> + <conditional name="input_type"> + <param name="input_type_selector" type="select" label="Select input type" help="Select between fastq and bam datasets and between paired and single end data"> + <option value="paired">Paired fastq</option> + <option value="single">Single fastq</option> + <option value="paired_bam">Paired BAM</option> + <option value="single_bam">Single BAM</option> + </param> + <when value="paired"> + <param name="fastq_input1" type="data" format="fastqsanger" label="Select first set of reads" help="Specify dataset with forward reads"/> + <param name="fastq_input2" type="data" format="fastqsanger" label="Select second set of reads" help="Specify dataset with reverse reads"/> + <conditional name="adv_pe_options"> + + <expand macro="advanced_pe_options" /> + + </conditional> + </when> + <when value="single"> + <param name="fastq_input1" type="data" format="fastqsanger" label="Select fastq dataset" help="Specify dataset with single reads"/> + <conditional name="adv_se_options"> + + <expand macro="advances_se_options" /> + + </conditional> + </when> + + <!-- the difference between single and paired bams is in the <command> tag portion and realated to -0, -1, and -2 options --> + + <when value="paired_bam"> + <param name="bam_input" type="data" format="bam" label="Select BAM dataset" help="Specify BAM dataset with paired reads"/> + <conditional name="adv_bam_pe_options"> + + <expand macro="advanced_pe_options" /> + + </conditional> + </when> + <when value="single_bam"> + <param name="bam_input" type="data" format="bam" label="Select BAM dataset" help="Specify BAM dataset with single reads"/> + <conditional name="adv_bam_se_options"> + + <expand macro="advances_se_options" /> + + </conditional> + </when> + + </conditional> + + <conditional name="rg"> + <param name="rg_selector" type="boolean" truevalue="set" falsevalue="do_not_set" label="Specify readgroup information?" help="Specifying readgroup information can greatly simplify your downstream analyses by allowing combining multiple datasets. See help below for more details"/> + <when value="set"> + <param name="ID" type="text" value="readgroup1" size="20" label="Specify readgroup ID" help="This value must be unique among multiple samples in your experiment"> + <sanitizer invalid_char=""> + <valid initial="string.printable"/> + </sanitizer> + </param> + <param name="SM" type="text" value="blood" size="20" label="Specify readgroup sample name (SM)" help="This value should be descriptive"> + <sanitizer invalid_char=""> + <valid initial="string.printable"/> + </sanitizer> + </param> + </when> + <when value="do_not_set"> + <!-- do nothing --> + </when> + </conditional> + + <conditional name="analysis_type"> + <param name="analysis_type_selector" type="select" label="Select analysis mode"> + <option value="illumina">1.Simple Illumina mode</option> + <option value="full">2.Full list of options</option> + <option value="cline">3.Input parameters on the command line</option> + </param> + <when value="illumina"> + <!-- do nothing --> + </when> + <when value="full"> + <param name="n" type="text" value="0.04" label="maximum edit distance if the value is integer, or the fraction of missing alignments given 2% uniform base error rate if float. In the latter case, the maximum edit distance is automatically chosen for different read lengths." help="aln -n; default=0.04"/> + <param name="o" type="integer" value="1" label="maximum number or gap openings" help="aln -o; default=1"/> + <param name="e" type="integer" value="-1" label="maximum number of gap extensions" help="aln -e; -1 disables long gaps and invokes k-difference mode; default=-1"/> + <param name="i" type="integer" value="5" label="do not put an indel within this many bp towards the ends" help="aln -i; default=5"/> + <param name="d" type="integer" value="10" label="maximum occurrences for extending a long deletion" help="aln -d; default=10"/> + <param name="l" type="integer" value="32" label="seed length" help="aln -l; default=32"/> + <param name="k" type="integer" value="2" label="maximum differences in the seed" help="aln -k; default=2"/> + <param name="m" type="integer" value="2000000" label="maximum entries in the queue" help="aln -m; default=2000000"/> + <param name="M" type="integer" value="3" label="mismatch penalty" help="aln -M; default=3"/> + <param name="O" type="integer" value="11" label="gap open penalty" help="aln -O; default=11"/> + <param name="E" type="integer" value="4" label="gap extension penalty" help="aln -E; default=4"/> + <param name="R" type="integer" value="30" label="stop searching when there are more than this value of equally best hits" help="aln -R; default=30"/> + <param name="q" type="integer" value="0" label="quality threshold for read trimming down to 35bp" help="aln -q; default=0"/> + <param name="B" type="integer" optional="True" label="length of barcode" help="aln -B; optional parameter"/> + <param name="L" type="float" optional="True" label="log-scaled gap penalty for long deletions" help="aln -L; optional parameter"/> + </when> + + <when value="cline"> + <param name="cline" size="60" type="text" value="-n 0.04 -R 10" label="Type command line options here" help="All paremeters that DO NOT involve filenames can be typed here."> + <sanitizer> + <valid initial="string.printable"> + <remove value="'"/> + </valid> + </sanitizer> + </param> + </when> + </conditional> + </inputs> + + <outputs> + <data format="bam" name="bam_output" label="${tool.name} on ${on_string} (mapped reads in BAM format)"/> + </outputs> + + <tests> + <test> + <param name="reference_source_selector" value="history" /> + <param name="ref_file" ftype="fasta" value="bwa-mem-mt-genome.fa"/> + <param name="input_type_selector" value="paired"/> + <param name="fastq_input1" ftype="fastqsanger" value="bwa-mem-fastq1.fq"/> + <param name="fastq_input2" ftype="fastqsanger" value="bwa-mem-fastq2.fq"/> + <param name="analysis_type_selector" value="illumina"/> + <output name="bam_output" ftype="bam" file="bwa-aln-test1.bam" lines_diff="2" /> + </test> + <test> + <param name="reference_source_selector" value="history" /> + <param name="ref_file" ftype="fasta" value="bwa-mem-mt-genome.fa"/> + <param name="input_type_selector" value="paired_bam"/> + <param name="bam_input" ftype="bam" value="bwa-aln-bam-input.bam"/> + <param name="analysis_type_selector" value="illumina"/> + <output name="bam_output" ftype="bam" file="bwa-aln-test2.bam" lines_diff="2" /> + </test> + </tests> + <stdio> + <exit_code range="1:" /> + </stdio> + <help> + +**What is does** + +BWA is a software package for mapping low-divergent sequences against a large reference genome, such as the human genome. The bwa-aln algorithm is designed for Illumina sequence reads up to 100bp. For longer reads use BWA-MEM algorithm distributed as separate Galaxy tool. + +This Galaxy tool wraps bwa-aln, bwa-samse and -sampe modules of bwa read mapping tool: + + - bwa aln - actual mapper placing reads onto the reference sequence + - bwa samse - post-processor converting suffix array coordinates into genome coordinates in SAM format for single reads + - bam sampe - post-processor for paired reads + +Galaxy implementation takes fastq or BAM (unaligned BAM) datasets as input and produces output in BAM (not SAM; in reality SAM produced by the bwa is converted to BAM on the fly by samtools view command) format, which can be further processed using various BAM utilities exiting in Galaxy (BAMTools, SAMTools, Picard). + +----- + +**Galaxy-specific option** + +Galaxy allows three levels of control over bwa-mem options provided by **Select analysis mode** menu option. These are: + + 1. *Simple Illumina mode*: The simplest possible bwa mem application in which it alignes single or paired-end data to reference using default parameters. It is equivalent to the following command: bwa mem <reference index> <fastq dataset1> [fastq dataset2] + 2. *Full list of options*: Allows access to all options through Galaxy interface. + 3. *Input parameters on the command line*: Similar to the choice above but for those who does not like clicking. Here options can be directly typed into a text box. + +------ + +**bwa-aln options** + +Each Galaxy parameter widget corresponds to command line flags listed below:: + + -n NUM max #diff (int) or missing prob under 0.02 err rate (float) [0.04] + -o INT maximum number or fraction of gap opens [1] + -e INT maximum number of gap extensions, -1 for disabling long gaps [-1] + -i INT do not put an indel within INT bp towards the ends [5] + -d INT maximum occurrences for extending a long deletion [10] + -l INT seed length [32] + -k INT maximum differences in the seed [2] + -m INT maximum entries in the queue [2000000] + -M INT mismatch penalty [3] + -O INT gap open penalty [11] + -E INT gap extension penalty [4] + -R INT stop searching when there are >INT equally best hits [30] + -q INT quality threshold for read trimming down to 35bp [0] + -B INT length of barcode + -L log-scaled gap penalty for long deletions + -N non-iterative mode: search for all n-difference hits (slooow) + -I the input is in the Illumina 1.3+ FASTQ-like format + -b the input read file is in the BAM format + -0 use single-end reads only (effective with -b) + -1 use the 1st read in a pair (effective with -b) + -2 use the 2nd read in a pair (effective with -b) + +**bwa-samse options**:: + + -a INT maximum insert size [500] + -o INT maximum occurrences for one end [100000] + -n INT maximum hits to output for paired reads [3] + -N INT maximum hits to output for discordant pairs [10] + -c FLOAT prior of chimeric rate (lower bound) [1.0e-05] + -r STR read group header line [null] + +**bwa-sampe options**:: + + -n INT maximum hits to output for paired reads [3] + -r STR read group header line [null] + +------ + +.. class:: warningmark + +**An important note on Read Groups** + +One of the recommended best practices in NGS analysis is adding read group information to BAM files. You can do thid directly in BWA interface using the +**Specify readgroup information?** widget. If you are not familiar with readgroups you shold know that this is effectively a way to tag reads with an additional ID. +This allows you to combine BAM files from, for example, multiple BWA runs into a single dataset. This significantly simplifies downstream processing as +instead of dealing with multiple datasets you only have to handle only one. This is possible because the readgroup information allows you to identify +data from different experiments even if they are combined in one file. Many downstream analysis tools such as varinat callers (e.g., FreeBayes or Naive Varinat Caller +present in Galaxy) are aware of readgtroups and will automatically generate calls for each individual sample even if they are combined within a single file. + +----- + +.. class:: infomark + +**More info** + +To obtain more information about BWA and ask questions use these resources: + + 1. https://biostar.usegalaxy.org/ + 2. https://www.biostars.org/ + 3. https://github.com/lh3/bwa + 4. http://bio-bwa.sourceforge.net/ + + + </help> + <citations> + <citation type="doi">10.1093/bioinformatics/btp324</citation> + <citation type="doi">10.1093/bioinformatics/btp698</citation> + </citations> +</tool>