Bisulfite reads mapperbismarksamtoolsbowtie2 '${read1}' &&
#else
ln -s '${singlePaired.input_singles}' '${read1}' &&
#end if
#else:
#set $mate1 = list()
#set $mate2 = list()
#for $mate_pair in $singlePaired.mate_list
#if $mate_pair.input_mate1.ext == "fasta":
#set read1 = re.sub('[^\w\-_.]', '_', str($mate_pair.input_mate1.element_identifier)) + '_1.fa'
#elif $mate_pair.input_mate1.ext in ["fastq.gz", "fastqsanger.gz"]:
#if $params.settingsType == "custom" and $params.pbat == "--pbat"
#set read1 = re.sub('[^\w\-_.]', '_', str($mate_pair.input_mate1.element_identifier)) + '_1.fq'
#else
#set read1 = re.sub('[^\w\-_.]', '_', str($mate_pair.input_mate1.element_identifier)) + '_1.fq.gz'
#end if
#else
#set read1 = re.sub('[^\w\-_.]', '_', str($mate_pair.input_mate1.element_identifier)) + '_1.fq'
#end if
#if $params.settingsType == "custom" and $params.pbat == "--pbat" and $mate_pair.input_mate1.ext in ["fastq.gz", "fastqsanger.gz"]:
zcat '${mate_pair.input_mate1}' > '${read1}' &&
#else
ln -s '${mate_pair.input_mate1}' '${read1}' &&
#end if
#if $mate_pair.input_mate2.ext == "fasta":
#set read2 = re.sub('[^\w\-_.]', '_', str($mate_pair.input_mate1.element_identifier)) + '_2.fa'
#elif $mate_pair.input_mate2.ext in ["fastq.gz", "fastqsanger.gz"]:
#if $params.settingsType == "custom" and $params.pbat == "--pbat"
#set read2 = re.sub('[^\w\-_.]', '_', str($mate_pair.input_mate1.element_identifier)) + '_2.fq'
#else
#set read2 = re.sub('[^\w\-_.]', '_', str($mate_pair.input_mate1.element_identifier)) + '_2.fq.gz'
#end if
#else
#set read2 = re.sub('[^\w\-_.]', '_', str($mate_pair.input_mate1.element_identifier)) + '_2.fq'
#end if
#if $params.settingsType == "custom" and $params.pbat == "--pbat" and $mate_pair.input_mate2.ext in ["fastq.gz", "fastqsanger.gz"]:
zcat '${mate_pair.input_mate2}' > '${read2}' &&
#else
ln -s '${mate_pair.input_mate2}' '${read2}' &&
#end if
$mate1.append( str($read1) )
$mate2.append( str($read2) )
#end for
#end if
python '$__tool_directory__/bismark_wrapper.py'
## Change this to accommodate the number of threads you have available.
--num-threads "\${GALAXY_SLOTS:-4}"
##
## Bismark Genome Preparation, if desired.
##
## Handle reference file.
#if $refGenomeSource.genomeSource == "built_in_fasta":
--own-file '${refGenomeSource.built_in_fasta.fields.path}'
#else if $refGenomeSource.genomeSource == "history":
--own-file '$refGenomeSource["own_file"]'
#else:
--indexes-path '${refGenomeSource.built_in_indexes.fields.path}'
#end if
##
## Input parameters
##
#if $singlePaired.sPaired == "single":
--single-paired '${read1}'
#if $singlePaired.input_singles.ext in ["fastq", "fastq.gz", "fastqillumina"]:
--phred64-quals
--fastq
#elif $singlePaired.input_singles.ext in ["fastqsanger", "fastqsanger.gz"]:
--fastq
#elif $singlePaired.input_singles.ext == "fasta":
--fasta
#end if
#else:
--mate-paired
--mate1 #echo ','.join($mate1)
--mate2 #echo ','.join($mate2)
#for $mate_pair in $singlePaired.mate_list:
#if $mate_pair.input_mate1.ext == "fastqillumina":
--phred64-quals
--fastq
#elif $mate_pair.input_mate1.ext in "fastqsanger,fastqsanger.gz":
--fastq
#elif $mate_pair.input_mate1.ext == "fasta":
--fasta
#end if
#break
#end for
-I $singlePaired.minInsert
-X $singlePaired.maxInsert
#end if
#if $sort_bam:
--sort-bam
#end if
## for now hardcode the value for the required memory per thread in --best mode
--chunkmbs 512
#if $params.settingsType == "custom":
## default 20
--seed-len $params.seed_len
## default 0
--seed-mismatches $params.seed_mismatches
## default 15
--seed-extention-attempts $params.seed_extention_attempts
## default 2
--max-reseed $params.max_reseed
## default unlimited
#if $params.qupto != 0:
--qupto $params.qupto
#end if
#if $params.skip_reads != 0:
--skip-reads $params.skip_reads
#end if
#if $params.score_min != "":
--score-min '${params.score_min}'
#end if
## if set, disable the original behaviour
$params.no_mixed
## if set, disable the original behaviour
$params.no_discordant
$params.non_directional
$params.pbat
#if $params.bismark_stdout:
--stdout '$output_stdout'
#end if
#if $params.isReportOutput:
--output-report-file '$report_file'
#end if
#else:
--output-report-file '$report_file'
#end if
##
## Output parameters.
##
--output '$output'
##$suppress_header
#if str( $singlePaired.sPaired ) == "single"
#if $output_unmapped_reads_l
--output-unmapped-reads '$output_unmapped_reads_l'
#end if
#if $output_suppressed_reads_l
--output-suppressed-reads '$output_suppressed_reads_l'
#end if
#else
#if $output_unmapped_reads_l and $output_unmapped_reads_r
--output-unmapped-reads-l '$output_unmapped_reads_l'
--output-unmapped-reads-r '$output_unmapped_reads_r'
#end if
#if $output_suppressed_reads_l and $output_suppressed_reads_l
--output-suppressed-reads-l '$output_suppressed_reads_l'
--output-suppressed-reads-r '$output_suppressed_reads_r'
#end if
#end if
]]>
((
params['settingsType'] == "default" or
( params['settingsType'] == "custom" and
params['isReportOutput'] is True )
))
((
params['settingsType'] == "custom" and
params['bismark_stdout'] is True
))
((
params['settingsType'] == "custom" and
params['suppressed_read_file'] is True
))
((
singlePaired['sPaired'] == "paired" and
params['settingsType'] == "custom" and
params['suppressed_read_file'] is True
))
((
params['settingsType'] == "custom" and
params['unmapped_read_file'] is True
))
((
singlePaired['sPaired'] == "paired" and
params['settingsType'] == "custom" and
params['unmapped_read_file'] is True
))
T conversion) or into a bisulfite treated reverse strand (G->A conversion of the forward strand).
| Each of these reads are then aligned to bisulfite treated forward strand index of a reference genome (C->T converted) and a bisulfite treated reverse strand index of the genome (G->A conversion of the forward strand, by doing this alignments will produce the same positions).
| These instances of Bowtie 2 are run in parallel. The sequence file(s) are then read in again sequence by sequence to pull out the original sequence from the genome and determine if there were any protected C's present or not.
|
| As of version 0.7.0 Bismark will only run 2 alignment threads for OT and OB in parallel, the 4 strand mode can be re-enabled by using non_directional mode.
|
| It is developed by Krueger F and Andrews SR. at the Babraham Institute. Krueger F, Andrews SR. (2011) Bismark: a flexible aligner and methylation caller for Bisulfite-Seq applications. Bioinformatics, 27, 1571-2.
.. _Bismark: http://www.bioinformatics.babraham.ac.uk/projects/bismark/
----
**Know what you are doing**
.. class:: warningmark
| There is no such thing (yet) as an automated gearshift in short read mapping. It is all like stick-shift driving in San Francisco.
| In other words = running this tool with default parameters will probably not give you meaningful results.
| A way to deal with this is to **understand** the parameters by carefully reading the `documentation`__ and experimenting. Fortunately, Galaxy makes experimenting easy.
|
.. class:: warningmark
| Make sure all your input reads are in the correct and same format. If thats not the case please adjust/convert the filetype with galaxy's build-in converters.
.. __: http://www.bioinformatics.babraham.ac.uk/projects/bismark/
----
**Input formats**
| Bismark accepts files in either Sanger FASTQ format (galaxy type *fastqsanger*), Illumina FASTQ format (galaxy type *fastqillumina*) or FASTA format (galaxy type *fasta*). Use the FASTQ Groomer to prepare your files.
----
**A Note on Built-in Reference Genomes**
| The default variant for all genomes is "Full", defined as all primary chromosomes (or scaffolds/contigs) including mitochondrial plus associated unmapped, plasmid, and other segments.
| When only one version of a genome is available in this tool, it represents the default "Full" variant. Some genomes will have more than one variant available.
| The "Canonical Male" or sometimes simply "Canonical" variant contains the primary chromosomes for a genome. For example a human "Canonical" variant contains chr1-chr22, chrX, chrY, and chrM. The "Canonical Female" variant contains the primary chromosomes excluding chrY.
----
**Outputs**
* The final output of Bismark is in SAM format by default, and has the following columns::
Column Description
-------- --------------------------------------------------------
1 QNAME seq-ID
2 FLAG this flag tries to take the strand a bisulfite read
originated from into account
(this is different from ordinary DNA alignment flags!)
3 RNAME chromosome
4 POS start position
5 MAPQ always 255
6 CIGAR extended CIGAR string
7 MRNM Mate Reference sequence NaMe ('=' if same as RNAME)
8 MPOS 1-based Mate POSition
9 ISIZE Inferred insert SIZE
10 SEQ query SEQuence on the same strand as the reference
11 QUAL Phred33 scale
12 NM-tag edit distance to the reference)
13 XX-tag base-by-base mismatches to the reference.
This does not include indels.
14 XM-tag methylation call string
15 XR-tag read conversion state for the alignment
16 XG-tag genome conversion state for the alignment
| Each read of paired-end alignments is written out in a separate line in the above format.
|
* It looks like this (scroll sideways to see the entire example)::
QNAME FLAG RNAME POS MAPQ CIAGR MRNM MPOS ISIZE SEQ QUAL OPT
HWI-EAS91_1_30788AAXX:1:1:1761:343 4 * 0 0 * * 0 0 AAAAAAANNAAAAAAAAAAAAAAAAAAAAAAAAAAACNNANNGAGTNGNNNNNNNGCTTCCCACAGNNCTGG hhhhhhh;;hhhhhhhhhhh^hOhhhhghhhfhhhgh;;h;;hhhh;h;;;;;;;hhhhhhghhhh;;Phhh
HWI-EAS91_1_30788AAXX:1:1:1578:331 4 * 0 0 * * 0 0 GTATAGANNAATAAGAAAAAAAAAAATGAAGACTTTCNNANNTCTGNANNNNNNNTCTTTTTTCAGNNGTAG hhhhhhh;;hhhhhhhhhhhhhhhhhhhhhhhhhhhh;;h;;hhhh;h;;;;;;;hhhhhhhhhhh;;hhVh
----
**Note on Bismark settings**
| All of the options have a default value. You can change any of them. If any Bismark function is missing please contact the tool author or your Galaxy admin.
----
**Bismark settings**
* **If Paired-End Reads**
* **Minimum insert size for valid paired-end alignments**
| The minimum insert size for valid paired-end alignments. E.g. if -I 60 is specified and a paired-end alignment consists of two 20-bp alignments in the appropriate orientation with a 20-bp gap between them, that alignment is considered valid (as long as -X is also satisfied). A 19-bp gap would not be valid in that case. Default: 0.
|
| Alignment option *-I/--minins *
* **Maximum insert size for valid paired-end alignments**
| The maximum insert size for valid paired-end alignments. E.g. if -X 100 is specified and a paired-end alignment consists of two 20-bp alignments in the proper orientation with a 60-bp gap between them, that alignment is considered valid (as long as -I is also satisfied). A 61-bp gap would not be valid in that case. Default: 500.
|
| Alignment option *-X/--maxins *
* **Number of mismatches to be allowed in a seed alignment during multiseed alignment**
| Sets the number of mismatches to allowed in a seed alignment during multiseed alignment. Can be set to 0 or 1. Setting this higher makes alignment slower (often much slower) but increases sensitivity. Default: 0. This option is only available for Bowtie 2 (for Bowtie 1 see -n).
|
| Bowtie 2 Specific option *-N *
* **Length of the seed substrings to align during multiseed alignment**
| Sets the length of the seed substrings to align during multiseed alignment. Smaller values make alignment slower but more senstive. Default: the --sensitive preset of Bowtie 2 is used by default, which sets -L to 20. This option is only available for Bowtie 2 (for Bowtie 1 see -l).
|
| Bowtie 2 Specific option *-L *
* **How many consecutive seed extension attempts can fail before Bowtie 2 moves on**
| Up to consecutive seed extension attempts can "fail" before Bowtie 2 moves on, using the alignments found so far. A seed extension "fails" if it does not yield a new best or a new second-best alignment. Default: 15.
|
| Bowtie 2 Effort option *-D *
* **Maximum number of times Bowtie 2 will re-seed reads with repetitive seeds**
| is the maximum number of times Bowtie 2 will "re-seed" reads with repetitive seeds. When "re-seeding," Bowtie 2 simply chooses a new set of reads (same length, same number of mismatches allowed) at different offsets and searches for more alignments. A read is considered to have repetitive seeds if the total number of seed hits divided by the number of seeds that aligned at least once is greater than 300. Default: 2.
|
| Bowtie 2 Effort option *-R *
* **Only aligns the first N reads or read pairs from the input**
| Only aligns the first reads or read pairs from the input. Default: no limit.
|
| Input option *-u/--upto *
* **Skip (i.e. do not align) the first N reads or read pairs from the input**
| Input option *-s/--skip*
* **Disable looking for discordant alignments if it cannot find any concordant alignments**
| Normally, Bowtie 2 looks for discordant alignments if it cannot find any concordant alignments. A discordant alignment is an alignment where both mates align uniquely, but that does not satisfy the paired-end constraints (--fr/--rf/--ff, -I, -X). This option disables that behavior and it is on by default.
|
| Bowtie 2 Paired-End option *--no-discordant*
* **Disable Bowtie 2's behaviour to try to find alignments for the individual mates**
| This option disables Bowtie 2's behavior to try to find alignments for the individual mates if it cannot find a concordant or discordant alignment for a pair. This option is invariable and on by default.
|
| Bowtie 2 Paired-End option *--no-mixed*
* **Write ambiguous reads to an extra output file**
| Write all reads which produce more than one valid alignment with the same number of lowest mismatches or other reads that fail to align uniquely to a file in the output directory. Written reads will appear as they did in the input, without any of the translation of quality values that may have taken place within Bowtie or Bismark. Paired-end reads will be written to two parallel files with _1 and _2 inserted in theit filenames, i.e. _ambiguous_reads_1.txt and _ambiguous_reads_2.txt. These reads are not written to the file specified with --un.
|
| Output option *--ambiguous*
* **Write all reads that could not be aligned to a file**
| Write all reads that could not be aligned to a file in the output directory. Written reads will appear as they did in the input, without any translation of quality values that may have taken place within Bowtie or Bismark. Paired-end reads will be written to two parallel files with _1 and _2 inserted in their filenames, i.e. _unmapped_reads_1.txt and unmapped_reads_2.txt. Reads with more than one valid alignment with the same number of lowest mismatches (ambiguous mapping) are also written to _unmapped_reads.txt unless the option --ambiguous is specified as well.
|
| Output option *-un/--unmapped*
* **Offer all report files concatenated in one file**
| Prints out a Bismark mapping report
]]>
10.1093/bioinformatics/btr167