<commit_before><tool id="slamdunk" name="Slamdunk" version="0.3.3">
	<requirements>
		<requirement type="package" version="0.3.3">slamdunk</requirement>
	</requirements>
	<command detect_errors="exit_code"><![CDATA[
        slamdunk all -r '$Genome' -b '$Reference' -o ./out
        #if $multimapper.advanced == "advanced"
        	-n $multimapper.multimappers
        	$multimapper.multimap
        	#if $multimapper.filterbed.filterbed
            	-fb $multimapper.filterbed.bedtofilter
            #end if
        #end if
        #if $quantseq.advanced == "advanced"
        	-5 $quantseq.trim5
        	-a $quantseq.maxpolyA
        #end if
        #if $advanced.advanced == "advanced"
        	$advanced.endtoend
        	-mq $advanced.minMQ
        	-mi $advanced.minID
        	-nm $advanced.maxNM
        	-mc $advanced.minCov
        	-mv $advanced.minVar
        	-mbq $advanced.minBaseQual
        #end if
        -rl $readLength
        -c $covThresh
        '$Reads'
    ]]></command>
	<inputs>
		<param type="data" name="Genome" format="fasta" />
		<param type="data" name="Reference" format="bed" />
		<param type="data" name="Reads" format="fastqsanger" />
		<conditional name="multimapper">
			<param name="advanced" type="select" label="Multimapper recovery">
				<option value="simple" selected="true">Discard multimappers.
				</option>
				<option value="advanced">Recover multimappers.</option>
			</param>
			<when value="simple">
			</when>
			<when value="advanced">
				<conditional name="filterbed">
					<param name="filterbed" type="boolean"
						label="Use separate 3' UTR bed to filter multimappers." />
					<when value="true">
						<param name="bedtofilter" label="Bed to filter" type="data"
							format="bed" />
					</when>
					<when value="false">
					</when>
				</conditional>
				<param name="multimappers" type="integer"
					label="Maximum number of alignments to report per read" value="1"
					min="1"
					help="The maximum number of alignments is used to track multimapping read alignments. The more are allowed, the more sensitive the multimapper filtering will be, but also the longer the runtime will be. 100 was used in previous publications." />
				<param name="multimap" type="boolean"
					label="Use reference bed file to resolve multimappers." truevalue="--multimap"
					falsevalue=""
					help="Enable multimapper recovery, requires -n to be set to a value > 1 to have impact." />
			</when>
		</conditional>
		<conditional name="quantseq">
			<param name="advanced" type="select" label="Quantseq">
				<option value="simple" selected="true">I am using a QuantSeq kit.
				</option>
				<option value="advanced">I need custom trimming.</option>
			</param>
			<when value="simple">
			</when>
			<when value="advanced">
				<param name="trim5" type="integer"
					label="Number of bp to remove from the 5' end of all reads" value="12"
					min="0"
					help="For Lexogen's Quantseq kit and previous SLAMSeq papers a clipping of 12 bp from the 5' end is recommended." />
				<param name="maxpolyA" type="integer"
					label="Maximum number of As at the 3' end of a read" value="4" min="0"
					help="The maximum number of allowed As at the 3' end of a read. All A-stretches that exceed this threshold are clipped because they are likely part of the poly-A tail." />
			</when>
		</conditional>
		<conditional name="advanced">
			<param name="advanced" type="select" label="Advanced settings.">
				<option value="simple" selected="true">I will run with default
					recommended settings.
				</option>
				<option value="advanced">I need custom settings.</option>
			</param>
			<when value="simple">
			</when>
			<when value="advanced">
				<param name="endtoend" type="boolean"
					label="Enable end-to-end alignments for mapping." truevalue="--endtoend"
					falsevalue=""
					help="Enable end-to-end alignments for mapping in slamdunk with --endtoend" />
				<param name="minMQ" type="integer" label="Minimum mapping quality"
					value="2" min="0"
					help="Minimum mapping quality to consider alignments (default: 2)." />
				<param name="minMQ" type="integer" label="Minimum mapping quality"
					value="2" min="0"
					help="Minimum mapping quality to consider alignments (default: 2)." />
				<param name="minID" type="float" label="Minimum alignment identity"
					value="0.95" min="0"
					help="Minimum alignment-identity to consider alignments (default: 0.95)." />
				<param name="maxNM" type="integer" label="Maximum number of mismatches"
					value="-1"
					help="Maximum number of mismatches to consider alignments. Negative numbers deactivate filter (default: -1)." />
				<param name="minCov" type="integer" label="Minimum coverage to call variant"
					value="10" min="0" help="Minimum coverage to call variant (default: 10)." />
				<param name="minVar" type="float"
					label="Minimum variant fraction to call variant" value="0.8" min="0"
					help="Minimum variant fraction to call variant (default: 0.8)." />
				<param name="minBaseQual" type="integer" label="Minimum base quality"
					value="27" min="0"
					help="Minimum base quality for T>C conversions (default: 27)." />
			</when>
		</conditional>
		<param name="covThresh" type="integer" label="T>C conversion threshold"
			value="1" min="1"
			help="Number of T>C conversions required to count a read as a T>C read (default: 1)." />
		<param name="readLength" type="integer" label="Read length"
			value="50" min="50" help="Maximum read length (before trimming)." />
	</inputs>
	<outputs>
		<data name="outputBam" format="bam" from_work_dir="./out/filter/*.bam" />
		<data name="outputTsv" format="tabular" from_work_dir="./out/count/*_tcount.tsv" />
	</outputs>
	<tests>
		<test>
			<param name="Genome" value="ref.fa" />
			<param name="Reference" value="actb.bed" />
			<param name="Reads" value="reads.fq" />
			<param name="readLength" value="100" />
			<param name="advanced.minBaseQual" value="27" />
			<param name="quantseq.trim5" value="0" />
			<output name="outputTsv" file="reads_slamdunk_mapped_filtered_tcount.tsv" lines_diff="1" />
		</test>
	</tests>
	<help><![CDATA[
SLAMseq
=======

SLAMseq is a novel sequencing protocol that directly uncovers 4-thiouridine incorporation events in RNA by high-throughput sequencing. When combined with metabolic labeling protocols, SLAM-seq allows to study the intracellular RNA dynamics, from transcription, RNA processing to RNA stability.

Original publication: `Herzog et al., Nature Methods, 2017; doi:10.1038/nmeth.4435 <https://www.nature.com/nmeth/journal/vaop/ncurrent/full/nmeth.4435.html>`_

Slamdunk
========

To analyze a given SLAMSeq dataset with *slamdunk* using the default parameters which worked well on datasets during development,
call the *all* dunk using the recommended minimum set of default parameters:

.. code:: bash

    slamdunk all -r <reference fasta> -b <bed file> -o <output directory> -5 12 -n 100
                 -t <threads> -m -rl <maximum read length> --skip-sam files [files ...]
                 
The input data you need and parameters you need to set yourself are the following:
                 
=========  ==========================================================================================================================================================
Parameter  Description
=========  ==========================================================================================================================================================
**-r**     The reference fasta file.
**-b**     BED-file containing coordinates for 3' UTRs.
**-o**     The output directory where all output files of this dunk will be placed.
**-t**     The number of threads to use for this dunk. NextGenMap runs multi-threaded, so it is recommended to use more threads than available samples (default: 1).
**files**  Samplesheet or a list of all sample BAM/FASTA(gz)/FASTQ(gz) files (wildcard \* accepted).
=========  ==========================================================================================================================================================

This will run the entire *slamdunk* analysis with the most relevant output files being:

* Folder *count*: Tab-separated *tcount* files containing the SLAMSeq statistics per UTR
* Folder *filter*: BAM-files with the final mapped reads for visualization and further processing

------------------------------------------------------

If you want to have a very quick sanity check whether your desired conversion rates have been achieved, use this *alleyoop* command
to plot the UTR conversion rates in your sample:

.. code:: bash

   alleyoop utrrates -o <output directory> -r <reference fasta> -t <threads>
                     -b <bed file> -l <maximum read length> bam [bam ...]
                

=========  =====================================================================================================================================================================
Parameter  Description
=========  =====================================================================================================================================================================
**-o**     The output directory where the plots will be placed.
**-r**     The reference fasta file.
**-t**     The number of threads to use. All tools run single-threaded, so it is recommended to use as many threads as available samples.
**-b**     BED-file containing coordinates for 3' UTRs.
**-l**     Maximum read length in all samples.
**bam**    BAM file(s) containing the final filtered reads from the *filter* folder (wildcard \* accepted).
=========  =====================================================================================================================================================================

This will produce a plot like the following example where you can clearly see that individual conversions for a given starting base are balanced and unbiased,
except for the T->C conversions in this SLAMSeq sample with longer labelling times.

    ]]></help>
	<citations>
		<citation type="bibtex">
			@misc{renameTODO,
			author = {LastTODO,
			FirstTODO},
			year = {TODO},
			title = {TODO},
			url =
			{http://t-neumann.github.io/slamdunk},
			}
		</citation>
	</citations>
</tool><commit_msg>use conditional in tests<commit_after><tool id="slamdunk" name="Slamdunk" version="0.3.3">
	<requirements>
		<requirement type="package" version="0.3.3">slamdunk</requirement>
	</requirements>
	<command detect_errors="exit_code"><![CDATA[
        slamdunk all -r '$Genome' -b '$Reference' -o ./out
        #if $multimapper.advanced == "advanced"
        	-n $multimapper.multimappers
        	$multimapper.multimap
        	#if $multimapper.filterbed.filterbed
            	-fb $multimapper.filterbed.bedtofilter
            #end if
        #end if
        #if $quantseq.advanced == "advanced"
        	-5 $quantseq.trim5
        	-a $quantseq.maxpolyA
        #end if
        #if $advanced.advanced == "advanced"
        	$advanced.endtoend
        	-mq $advanced.minMQ
        	-mi $advanced.minID
        	-nm $advanced.maxNM
        	-mc $advanced.minCov
        	-mv $advanced.minVar
        	-mbq $advanced.minBaseQual
        #end if
        -rl $readLength
        -c $covThresh
        '$Reads'
    ]]></command>
	<inputs>
		<param type="data" name="Genome" format="fasta" />
		<param type="data" name="Reference" format="bed" />
		<param type="data" name="Reads" format="fastqsanger" />
		<conditional name="multimapper">
			<param name="advanced" type="select" label="Multimapper recovery">
				<option value="simple" selected="true">Discard multimappers.
				</option>
				<option value="advanced">Recover multimappers.</option>
			</param>
			<when value="simple">
			</when>
			<when value="advanced">
				<conditional name="filterbed">
					<param name="filterbed" type="boolean"
						label="Use separate 3' UTR bed to filter multimappers." />
					<when value="true">
						<param name="bedtofilter" label="Bed to filter" type="data"
							format="bed" />
					</when>
					<when value="false">
					</when>
				</conditional>
				<param name="multimappers" type="integer"
					label="Maximum number of alignments to report per read" value="1"
					min="1"
					help="The maximum number of alignments is used to track multimapping read alignments. The more are allowed, the more sensitive the multimapper filtering will be, but also the longer the runtime will be. 100 was used in previous publications." />
				<param name="multimap" type="boolean"
					label="Use reference bed file to resolve multimappers." truevalue="--multimap"
					falsevalue=""
					help="Enable multimapper recovery, requires -n to be set to a value > 1 to have impact." />
			</when>
		</conditional>
		<conditional name="quantseq">
			<param name="advanced" type="select" label="Quantseq">
				<option value="simple" selected="true">I am using a QuantSeq kit.
				</option>
				<option value="advanced">I need custom trimming.</option>
			</param>
			<when value="simple">
			</when>
			<when value="advanced">
				<param name="trim5" type="integer"
					label="Number of bp to remove from the 5' end of all reads" value="12"
					min="0"
					help="For Lexogen's Quantseq kit and previous SLAMSeq papers a clipping of 12 bp from the 5' end is recommended." />
				<param name="maxpolyA" type="integer"
					label="Maximum number of As at the 3' end of a read" value="4" min="0"
					help="The maximum number of allowed As at the 3' end of a read. All A-stretches that exceed this threshold are clipped because they are likely part of the poly-A tail." />
			</when>
		</conditional>
		<conditional name="advanced">
			<param name="advanced" type="select" label="Advanced settings.">
				<option value="simple" selected="true">I will run with default recommended settings.
				</option>
				<option value="advanced">I need custom settings.</option>
			</param>
			<when value="simple">
			</when>
			<when value="advanced">
				<param name="endtoend" type="boolean"
					label="Enable end-to-end alignments for mapping." truevalue="--endtoend"
					falsevalue=""
					help="Enable end-to-end alignments for mapping in slamdunk with --endtoend" />
				<param name="minMQ" type="integer" label="Minimum mapping quality"
					value="2" min="0"
					help="Minimum mapping quality to consider alignments (default: 2)." />
				<param name="minMQ" type="integer" label="Minimum mapping quality"
					value="2" min="0"
					help="Minimum mapping quality to consider alignments (default: 2)." />
				<param name="minID" type="float" label="Minimum alignment identity"
					value="0.95" min="0"
					help="Minimum alignment-identity to consider alignments (default: 0.95)." />
				<param name="maxNM" type="integer" label="Maximum number of mismatches"
					value="-1"
					help="Maximum number of mismatches to consider alignments. Negative numbers deactivate filter (default: -1)." />
				<param name="minCov" type="integer" label="Minimum coverage to call variant"
					value="10" min="0" help="Minimum coverage to call variant (default: 10)." />
				<param name="minVar" type="float"
					label="Minimum variant fraction to call variant" value="0.8" min="0"
					help="Minimum variant fraction to call variant (default: 0.8)." />
				<param name="minBaseQual" type="integer" label="Minimum base quality"
					value="27" min="0"
					help="Minimum base quality for T>C conversions (default: 27)." />
			</when>
		</conditional>
		<param name="covThresh" type="integer" label="T>C conversion threshold"
			value="1" min="1"
			help="Number of T>C conversions required to count a read as a T>C read (default: 1)." />
		<param name="readLength" type="integer" label="Read length"
			value="50" min="50" help="Maximum read length (before trimming)." />
	</inputs>
	<outputs>
		<data name="outputBam" format="bam" from_work_dir="./out/filter/*.bam" />
		<data name="outputTsv" format="tabular" from_work_dir="./out/count/*_tcount.tsv" />
	</outputs>
	<tests>
		<test>
			<param name="Genome" value="ref.fa" />
			<param name="Reference" value="actb.bed" />
			<param name="Reads" value="reads.fq" />
			<param name="readLength" value="100" />
			<conditional name="multimapper">
				<param name="advanced" value="advanced" />
				<param name="minBaseQual" value="27" />
				<param name="trim5" value="0" />
			</conditional>
			<output name="outputTsv" file="reads_slamdunk_mapped_filtered_tcount.tsv" lines_diff="1" />
		</test>
	</tests>
	<help><![CDATA[
SLAMseq
=======

SLAMseq is a novel sequencing protocol that directly uncovers 4-thiouridine incorporation events in RNA by high-throughput sequencing. When combined with metabolic labeling protocols, SLAM-seq allows to study the intracellular RNA dynamics, from transcription, RNA processing to RNA stability.

Original publication: `<NAME> al., Nature Methods, 2017; doi:10.1038/nmeth.4435 <https://www.nature.com/nmeth/journal/vaop/ncurrent/full/nmeth.4435.html>`_

Slamdunk
========

To analyze a given SLAMSeq dataset with *slamdunk* using the default parameters which worked well on datasets during development,
call the *all* dunk using the recommended minimum set of default parameters:

.. code:: bash

    slamdunk all -r <reference fasta> -b <bed file> -o <output directory> -5 12 -n 100
                 -t <threads> -m -rl <maximum read length> --skip-sam files [files ...]
                 
The input data you need and parameters you need to set yourself are the following:
                 
=========  ==========================================================================================================================================================
Parameter  Description
=========  ==========================================================================================================================================================
**-r**     The reference fasta file.
**-b**     BED-file containing coordinates for 3' UTRs.
**-o**     The output directory where all output files of this dunk will be placed.
**-t**     The number of threads to use for this dunk. NextGenMap runs multi-threaded, so it is recommended to use more threads than available samples (default: 1).
**files**  Samplesheet or a list of all sample BAM/FASTA(gz)/FASTQ(gz) files (wildcard \* accepted).
=========  ==========================================================================================================================================================

This will run the entire *slamdunk* analysis with the most relevant output files being:

* Folder *count*: Tab-separated *tcount* files containing the SLAMSeq statistics per UTR
* Folder *filter*: BAM-files with the final mapped reads for visualization and further processing

------------------------------------------------------

If you want to have a very quick sanity check whether your desired conversion rates have been achieved, use this *alleyoop* command
to plot the UTR conversion rates in your sample:

.. code:: bash

   alleyoop utrrates -o <output directory> -r <reference fasta> -t <threads>
                     -b <bed file> -l <maximum read length> bam [bam ...]
                

=========  =====================================================================================================================================================================
Parameter  Description
=========  =====================================================================================================================================================================
**-o**     The output directory where the plots will be placed.
**-r**     The reference fasta file.
**-t**     The number of threads to use. All tools run single-threaded, so it is recommended to use as many threads as available samples.
**-b**     BED-file containing coordinates for 3' UTRs.
**-l**     Maximum read length in all samples.
**bam**    BAM file(s) containing the final filtered reads from the *filter* folder (wildcard \* accepted).
=========  =====================================================================================================================================================================

This will produce a plot like the following example where you can clearly see that individual conversions for a given starting base are balanced and unbiased,
except for the T->C conversions in this SLAMSeq sample with longer labelling times.

    ]]></help>
	<citations>
		<citation type="bibtex">
			@misc{renameTODO,
			author = {LastTODO,
			FirstTODO},
			year = {TODO},
			title = {TODO},
			url =
			{http://t-neumann.github.io/slamdunk},
			}
		</citation>
	</citations>
</tool>

{'fraction_non_alphanumeric': 0.2174332738066509, 'fraction_numerical': 0.009652975529707033, 'mean_word_length': 3.825337680484397, 'pattern_counts': {'":': 0, '<': 217, '<?xml version=': 0, '>': 229, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '896737', 'n_tokens_mistral': 6628, 'n_tokens_neox': 5492, 'n_words': 1931}