text:
<tool id="multiqc" name="MultiQC" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="20.01">
    <description>aggregate results from bioinformatics analyses into a single report</description>

    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="bio_tools"/>
    <expand macro='requirements' />
    <version_command>multiqc --version</version_command>
    <command detect_errors="aggressive">
<![CDATA[
#import re
#import os

die() { echo "$@" 1>&2 ; exit 1; } &&

mkdir multiqc_WDir &&

#set $configfile="F"

#for $i, $repeat in enumerate( $results )
    #set software_dir = os.path.join('multiqc_WDir', str($repeat.software_cond.software) + '_' + str($i))
    mkdir $software_dir &&
    #if str($repeat.software_cond.software) == "bamtools"
        #set $pattern = "Stats for BAM file(s)"
        @LN_FILES@
    #elif str($repeat.software_cond.software) == "bcftools"
        #set $pattern = "This file was produced by bcftools stats"
        @LN_FILES@
    #elif str($repeat.software_cond.software) == "bismark"
        @BISMARK_INPUT@
    #elif str($repeat.software_cond.software) == "bowtie2"
        #set $pattern = "% overall alignment rate"
        @LN_FILES@
    #elif str($repeat.software_cond.software) == "busco"
        ## Searches for files "short_summary_[samplename].txt"
        #for $file in $repeat.software_cond.input
            @ESCAPE_IDENTIFIER@
            #set file_path = os.path.join($software_dir, 'short_summary_' + str($identifier))
            ln -s '$file' '$file_path' &&
        #end for
    #elif str($repeat.software_cond.software) == "cutadapt"
        #set $pattern = "This is cutadapt"
        #for $file in $repeat.software_cond.input
            @ESCAPE_IDENTIFIER@
            #set file_path = os.path.join($software_dir, str($identifier) + '.txt')
            ln -s '$file' '$file_path' &&
            ## replace header for old cutadapt release
            sed -i.old 's/You are running/This is/' '$file_path' &&
            grep -q "$pattern" '$file_path' || die "'$pattern' or 'You are running cutadapt' not found in the file" &&
        #end for
    #elif str($repeat.software_cond.software) == "deeptools"
      @DEEPTOOLS_INPUT@
    #elif str($repeat.software_cond.software) == "fastp"
        #set $pattern = "report_title"
        #for $file in $repeat.software_cond.input
            @ESCAPE_IDENTIFIER@
            #set file_path = os.path.join($software_dir, str($identifier) + 'fastp.json')
            ln -s '$file' '$file_path' &&
            grep -q "$pattern" '$file_path' || die "'$pattern' or 'report_title' not found in the file" &&
        #end for
    #elif str($repeat.software_cond.software) == "fastqc"
        @FASTQC_INPUT@
    #elif str($repeat.software_cond.software) == "featureCounts"
        #for $file in $repeat.software_cond.input
            @ESCAPE_IDENTIFIER@
            #set file_prefix = os.path.join($software_dir, str($identifier))
            if grep -qw Status '$file'; then
                ln -s '$file' '${file_prefix}.summary';
            else
                echo -e 'Status\t${identifier}' > '${file_prefix}.summary';
                cat '$file' >> '${file_prefix}.summary';
            fi &&
        #end for
    #elif str($repeat.software_cond.software) == "flexbar"
        #set $pattern = "flexible barcode and adapter removal"
        @LN_FILES@
    #elif str($repeat.software_cond.software) == "gatk"
        #for $j, $repeat2 in enumerate( $repeat.software_cond.output )
            #if str($repeat2.type) == "varianteval"
                #set $pattern = "#:GATKTable:TiTvVariantEvaluator"
                @LN_2_FILES@
            #elif str($repeat2.type) == "base_recalibrator"
                #set $pattern = "#:GATKTable:Arguments:Recalibration"
                @LN_2_FILES@
            #end if
        #end for
    #elif str($repeat.software_cond.software) == "hicup"
        #for $file in $repeat.software_cond.input
            @ESCAPE_IDENTIFIER@
            #set file_path = os.path.join($software_dir, 'HiCUP_summary_report_' + str($identifier))
            ln -s '${file}' '$file_path' &&
        #end for
    #elif str($repeat.software_cond.software) == "hisat2"
        #set $pattern = "HISAT2 summary stats:"
        @LN_FILES@
    #elif str($repeat.software_cond.software) == "hicexplorer"
        #set $pattern = "Min rest. site distance"
        @LN_FILES@
    #elif str($repeat.software_cond.software) == "htseq"
        #set $pattern = "__too_low_aQual"
        @LN_FILES@
    #elif str($repeat.software_cond.software) == "kallisto"
        #set $pattern = "finding pseudoalignments for the reads"
        @LN_FILES@
    #elif str($repeat.software_cond.software) == "macs2"
        #set $pattern = "# This file is generated by MACS"
        #for $file in $repeat.software_cond.input
            @ESCAPE_IDENTIFIER@
            #set file_path = os.path.join($software_dir, str($identifier) + '_peaks.xls')
            grep -q "$pattern" $file || die "'$pattern' not found in the file" &&
            ln -s '$file' '$file_path' &&
        #end for
    #elif str($repeat.software_cond.software) == "picard"
        @PICCARD_INPUT@
    #elif str($repeat.software_cond.software) == "prokka"
        #set $pattern = "contigs:"
        @LN_FILES@
    #elif str($repeat.software_cond.software) == "pycoqc"
        #set $pattern = "\"pycoqc\":"
        @LN_FILES@
    #elif str($repeat.software_cond.software) == "qualimap"
        @QUALIMAP_INPUT@
    #elif str($repeat.software_cond.software) == "quast"
        #for $k, $file in enumerate($repeat.software_cond.input)
            #set file_dir = os.path.join($software_dir, 'file_' + str($k))
            #set file_path = os.path.join($file_dir, 'report.tsv')
            mkdir '$file_dir' &&
            ln -s '$file' '$file_path' &&
        #end for
    #elif str($repeat.software_cond.software) == "rsem"
        #for $file in $repeat.software_cond.input
            @ESCAPE_IDENTIFIER@
            #set file_path = os.path.join($software_dir, str($identifier) + '.cnt')
            ln -s '$file' '$file_path' &&
        #end for
    #elif str($repeat.software_cond.software) == "rseqc"
        @RSEQ_INPUT@
    #elif str($repeat.software_cond.software) == "salmon"
        @SALMON_INPUT@
    #elif str($repeat.software_cond.software) == "samblaster"
        #set $pattern = "samblaster: Version"
        @LN_FILES@
    #elif str($repeat.software_cond.software) == "samtools"
        @SAMTOOLS_INPUT@
    #elif str($repeat.software_cond.software) == "slamdunk"
        #set $pattern = "# slamdunk"
        @LN_FILES@
    #elif str($repeat.software_cond.software) == "snpeff"
        #set $pattern = "SnpEff_version"
        @LN_FILES@
    #elif str($repeat.software_cond.software) == "sortmerna"
        #set $pattern = "Minimal SW score based on E-value"
        @LN_FILES@
    #else if str($repeat.software_cond.software) == "star":
        @STAR_INPUT@
    #elif str($repeat.software_cond.software) == "tophat"
        #for $file in $repeat.software_cond.input
            @ESCAPE_IDENTIFIER@
            #set file_path = os.path.join($software_dir, str($identifier) + 'align_summary.txt')
            ln -s '$file' '$file_path' &&
        #end for
    #elif str($repeat.software_cond.software) == "trimmomatic"
        #set $pattern = "Trimmomatic"
        @LN_FILES@
    #elif str($repeat.software_cond.software) == "vcftools"
        @VCFTOOLS_INPUT@
    #else if str($repeat.software_cond.software) == "custom_content":
        #set $configfile = "T"
        #for $j, $file in enumerate( $repeat.software_cond.input )
            #set file_path = os.path.join($software_dir, 'file_' + str($i) + '_' + str($j))
            ln -s '$file' '$file_path' &&
            more $file &&
        #end for
    #end if
#end for

multiqc multiqc_WDir
--filename 'report'

#if str($title)
    --title '$title'
#end if
#if str($comment)
    --comment '$comment'
#end if

$flat
$export

#if $configfile == "T"
    --config '$multiqc_config'
#end if
    ]]></command>
    <configfiles>
        <configfile name="multiqc_config">
<![CDATA[
custom_data:
#for $i, $repeat in enumerate( $results )
    #if str($repeat.software_cond.software) == "custom_content"
    section_$i:
        file_format: 'tsv'
        section_name: '$repeat.software_cond.section_name'
        title: '$repeat.software_cond.title'
        description: '$repeat.software_cond.description'
        plot_type: '$repeat.software_cond.plot_type'
        pconfig:
            id: 'section_${i}_${repeat.software_cond.plot_type}'
            ylab: '$repeat.software_cond.ylab'
            xlab: '$repeat.software_cond.xlab'
    #end if
#end for
sp:
#for $i, $repeat in enumerate( $results )
    #if str($repeat.software_cond.software) == "custom_content"
    section_$i:
        fn: 'file_${i}_*'
    #end if
#end for
        ]]></configfile>
    </configfiles>
    <inputs>
        <repeat name="results" title="Results" min="1">
            <conditional name="software_cond">
                <param name="software" type="select" label="Which tool was used generate logs?" help="Software name">
                    <!--<option value="adapterRemoval">Adapter Removal</option>-->
                    <!--<option value="afterqc">AfterQC</option>-->
                    <option value="bamtools">Bamtools</option>
                    <!--<option value="bbmap">BBMap</option>-->
                    <option value="bcftools">Bcftools</option>
                    <!--<option value="bcl2fastq">bcl2fastq</option>-->
                    <!--<option value="biobambam2">biobambam2</option>-->
                    <!--<option value="biobloomtools">BioBloom Tools</option>-->
                    <option value="bismark">Bismark</option>
                    <!--<option value="bowtie1">Bowtie 1</option>-->
                    <option value="bowtie2">Bowtie 2</option>
                    <option value="busco">BUSCO</option>
                    <!--<option value="clusterflow">Cluster Flow</option>-->
                    <option value="cutadapt">Cutadapt/Trim Galore!</option>
                    <!--<option value="clipandmerge">ClipAndMerge</option>-->
                    <!--<option value="conpair">Conpair</option>-->
                    <!--<option value="dedup">DeDup</option>-->
                    <option value="deeptools">deepTools</option>
                    <!--<option value="disambiguate">Disambiguate</option>-->
                    <!--<option value="fastq_screen">FastQ Screen</option>-->
                    <option value="fastp">fastp</option>
                    <option value="fastqc">FastQC</option>
                    <option value="featureCounts">featureCounts</option>
                    <!--<option value="fgbio">fgbio</option>-->
                    <option value="flexbar">Flexbar</option>
                    <option value="gatk">GATK</option>
                    <!--<option value="goleft_indexcov">goleft indexcov</option>-->
                    <option value="hicexplorer">HiCExplorer</option>
                    <!--<option value="hicup">HiCUP</option>-->
                    <option value="hisat2">HISAT2</option>
                    <!--<option value="homer">HOMER</option>-->
                    <option value="htseq">HTSeq</option>
                    <!--<option value="interop">InterOp</option>-->
                    <!--<option value="jellyfish">Jellyfish</option>-->
                    <option value="kallisto">Kallisto</option>
                    <!--<option value="leehom">leeHom</option>-->
                    <option value="macs2">MACS2</option>
                    <!--<option value="methylQA">methylQA</option>-->
                    <!--<option value="mosdepth">mostdepth</option>-->
                    <!--<option value="mtnucratio">mtnucratio</option>-->
                    <!--<option value="peddy">Peddy</option>-->
                    <option value="picard">Picard</option>
                    <!--<option value="preseq">Preseq</option>-->
                    <option value="prokka">Prokka</option>
                    <option value="pycoqc">PycoQC</option>
                    <!--<option value="qorts">QoRTs</option>-->
                    <option value="qualimap">Qualimap (BamQC or RNASeq output)</option>
                    <option value="quast">QUAST</option>
                    <!--<option value="rna_seqc">RNA-SeQC</option>-->
                    <!--<option value="rsem">RSEM (rsem-calculate-regex output)</option>-->
                    <option value="rseqc">RSeQC</option>
                    <!--<option value="salmon">Salmon</option>-->
                    <option value="samblaster">Samblaster</option>
                    <option value="samtools">Samtools</option>
                    <!--<option value="sargasso">Sargasso</option>-->
                    <!--<option value="seqyclean">SeqyClean</option>-->
                    <!--<option value="sexdeterrmine">SexDetErrmine</option>-->
                    <!--<option value="skewer">Skewer</option>-->
                    <option value="slamdunk">Slamdunk</option>
                    <option value="snpeff">SnpEff</option>
                    <option value="sortmerna">SortMeRNA</option>
                    <option value="star">STAR</option>
                    <!--<option value="supernova">Supernova</option>-->
                    <!--<option value="theta2">THeTA2</option>-->
                    <option value="tophat">TopHat2</option>
                    <option value="trimmomatic">Trimmomatic</option>
                    <option value="vcftools">VCFTools</option>
                    <!--<option value="verifybamid">VerifyBAMID</option>-->
                    <!--Custom-->
                    <option value="custom_content">Custom Content</option>
                </param>
                <when value="bamtools">
                    <param name="input" type="data" format="txt" multiple="true" label="Output of BAMtools" help="It should contain 'Stats for BAM file(s)'"/>
                </when>
                <when value="bcftools">
                    <param name="input" type="data" format="txt" multiple="true" label="Output of BAMtools" help="It should contain 'This file was produced by bcftools stats'"/>
                </when>
                <when value="bismark">
                    <repeat name="output" title="Bismark output" min="1">
                        <param name="type" type="select" label="Type of Bismark output?">
                            <option value="align">Alignment file</option>
                            <option value="dedup">Deduplication file</option>
                            <option value="meth_extract">Methylation file</option>
                            <option value="m_bias">m_bias file</option>
                            <option value="bam2nuc">bam2nuc file</option>
                        </param>
                        <param name="input" type="data" format="txt" multiple="true" label="Bismark output"/>
                    </repeat>
                </when>
                <when value="bowtie2">
                    <param name="input" type="data" format="txt" multiple="true" label="Output of Bowtie 2" help="It should contain 'reads; of these:'"/>
                </when>
                <when value="busco">
                    <param name="input" type="data" format="txt" multiple="true" label="Output of BUSCO"/>
                </when>
                <when value="cutadapt">
                    <param name="input" type="data" format="txt,tabular,tsv,csv" multiple="true" label="Output of Cutadapt" help="It should contain 'This is cutadapt' or 'You are running cutadapt'"/>
                </when>
                <when value="deeptools">
                    <repeat name="output" title="deepTools output" min="1">
                        <param name="type" type="select" label="deepTool used to generate the output?">
                            <option value="bamPEFragmentSize">bamPEFragmentSize</option>
                            <option value="estimateReadFiltering">estimateReadFiltering</option>
                            <option value="plotCoverageStdout">plotCoverageStdout</option>
                            <option value="plotCoverageOutRawCounts">plotCoverageOutRawCounts</option>
                            <option value="plotEnrichment">plotEnrichment</option>
                            <option value="plotFingerprintOutRawCounts">plotFingerprintOutRawCounts</option>
                            <option value="plotFingerprintOutQualityMetrics">plotFingerprintOutQualityMetrics</option>
                        </param>
                        <param name="input" type="data" format="txt" multiple="true" label="Bismark output"/>
                    </repeat>
                </when>
                <when value="fastp">
                    <param name="input" type="data" format="json" multiple="true" label="Output of fastp" help="It should be the json report from fastp containing 'report_title'"/>
                </when>
                <when value="fastqc">
                    <repeat name="output" title="FastQC output" min="1">
                        <param name="type" type="select" label="Type of FastQC output?">
                            <option value="data">Raw data</option>
                            <option value="theoretical_gc">Theorectical GC</option>
                        </param>
                        <param name="input" type="data" format="txt" multiple="true" label="FastQC output">
                            <validator type="expression" message="MultiQC does not accept the HTML report generated by FastQC, only the Raw Data">value is not None and value.extension != "html"</validator>
                        </param>
                    </repeat>
                </when>
                <when value="featureCounts">
                    <param name="input" type="data" format="txt,tabular,tsv,csv" multiple="true" label="Output of FeatureCounts"/>
                </when>
                <when value="flexbar">
                    <param name="input" type="data" format="txt,tabular,tsv,csv" multiple="true" label="Output of Flexbar" help="It should contain 'Flexbar - flexible barcode and adapter removal'"/>
                </when>
                <when value="gatk">
                    <repeat name="output" title="GATK output" min="1">
                        <param name="type" type="select" label="Type of GATK output?">
                            <option value="varianteval">Variant eval file</option>
                            <option value="base_recalibrator">Base recalibrator file</option>
                        </param>
                        <param name="input" type="data" format="txt" multiple="true" label="GATK output"/>
                    </repeat>
                </when>
                <when value="hicexplorer">
                    <param name="input" type="data" format="txt,tabular" multiple="true" label="Output of HiCExplorer" help="It should contain 'Min rest. site distance'"/>
                </when>
                <when value="hisat2">
                    <param name="input" type="data" format="txt,tabular" multiple="true" label="Output of HISAT2" help="It should contain 'HISAT2 summary stats:'"/>
                </when>
                <when value="htseq">
                    <param name="input" type="data" format="txt,tabular" multiple="true" label="Output of HTSeq" help="It should contain '__too_low_aQual'"/>
                </when>
                <when value="kallisto">
                    <param name="input" type="data" format="txt,tabular,tsv,csv" multiple="true" label="Output of Kallisto" help="It should contain '[quant] finding pseudoalignments for the reads'"/>
                </when>
                <when value="macs2">
                    <param name="input" type="data" format="txt,tabular,tsv" multiple="true" label="Output of MACS2" help="It should be a tabular file containing '# This file is generated by MACS'"/>
                </when>
                <when value="picard">
                    <repeat name="output" title="Picard output" min="1">
                        <param name="type" type="select" label="Type of Picard output?">
                            <option value="alignment_metrics">Alignment metrics</option>
                            <option value="basedistributionbycycle">Base distribution by cycle</option>
                            <option value="gcbias">GC bias</option>
                            <option value="hsmetrics">HS Metrics</option>
                            <option value="insertsize">Insert size</option>
                            <option value="markdups">Markdups</option>
                            <option value="oxogmetrics">Oxog metrics</option>
                            <option value="pcr_metrics">PCR metrics</option>
                            <option value="rnaseqmetrics">RNA Seq metrics</option>
                            <option value="rrbs_metrics">RRBS metrics</option>
                            <option value="wgs_metrics">WGS metrics</option>
                        </param>
                        <param name="input" type="data" format="txt" multiple="true" label="Picard output"/>
                    </repeat>
                </when>
                <when value="prokka">
                    <param name="input" type="data" format="txt" multiple="true" label="Output of Prokka" help="It should contain 'contigs:'"/>
                </when>
                <when value="pycoqc">
                    <param name="input" type="data" format="txt,json" multiple="true" label="Output of PycoQC"/>
                </when>
                <when value="qualimap">
                    <param name="input" type="data" format="txt,tabular,tsv" multiple="true" label="Output of Qualimap BamQC" help="First result input should be genome_coverage (default from tool output). Run the Flatten Collection tool to keep all output in one report" />
                </when>
                <when value="quast">
                    <param name="input" type="data" format="tabular,tsv" multiple="true" label="Output of Quast"/>
                </when>
                <when value="rseqc">
                    <repeat name="output" title="RSeQC output" min="1">
                        <conditional name="type">
                            <param name="type" type="select" label="Type of RSeQC output?">
                                <option value="bam_stat">bam_stat</option>
                                <option value="gene_body_coverage">gene_body_coverage</option>
                                <option value="infer_experiment">infer_experiment</option>
                                <option value="inner_distance">inner_distance</option>
                                <option value="junction_annotation">junction_annotation</option>
                                <option value="junction_saturation">junction_saturation</option>
                                <option value="read_distribution">read_distribution</option>
                                <option value="read_duplication_pos">read_duplication_pos</option>
                                <option value="read_gc">read_gc</option>
                            </param>
                            <when value="bam_stat">
                                <param name="input" type="data" format="txt,tabular" multiple="true" label="RSeQC bam_stat output" help="It should contain 'Proper-paired reads map to different chrom:'"/>
                            </when>
                            <when value="gene_body_coverage">
                                <param name="input" type="data" format="txt" multiple="true" label="RSeQC gene_body_coverage output"/>
                            </when>
                            <when value="infer_experiment">
                                <param name="input" type="data" format="txt" multiple="true" label="RSeQC infer_experiment output" help="It should contain 'Fraction of reads explained by'"/>
                            </when>
                            <when value="inner_distance">
                                <param name="input" type="data" format="txt,xls,tabular" multiple="true" label="RSeQC inner_distance output"/>
                            </when>
                            <when value="junction_annotation">
                                <param name="input" type="data" format="txt,xls,tabular" multiple="true" label="RSeQC junction_annotation output" help="It should contain 'Partial Novel Splicing Junctions:'"/>
                            </when>
                            <when value="junction_saturation">
                                <param name="input" type="data" format="txt" multiple="true" label="RSeQC junction_saturation output"/>
                            </when>
                            <when value="read_distribution">
                                <param name="input" type="data" format="txt,xls,tabular" multiple="true" label="RSeQC read_distribution output" help="It should contain 'Group               Total_bases         Tag_count           Tags/Kb'"/>
                            </when>
                            <when value="read_duplication_pos">
                                <param name="input" type="data" format="csv,xls,tabular" multiple="true" label="RSeQC read_duplication_pos output"/>
                            </when>
                            <when value="read_gc">
                                <param name="input" type="data" format="csv,xls,tabular" multiple="true" label="RSeQC read_gc output"/>
                            </when>
                        </conditional>
                    </repeat>
                </when>
                <when value="samblaster">
                    <param name="input" type="data" format="txt,tabular,tsv,csv" multiple="true" label="Output of Samblaster" help="It should contain 'samblaster: Version'"/>
                </when>
                <when value="samtools">
                    <repeat name="output" title="Samtools output" min="1">
                        <conditional name="type">
                            <param name="type" type="select" label="Type of Samtools output?">
                                <option value="stats">stats</option>
                                <option value="flagstat">flagstat</option>
                                <option value="idxstats">idxstats</option>
                                <option value="rmdup">rmdup</option>
                            </param>
                            <when value="stats">
                                <param name="input" type="data" format="txt" multiple="true" label="Samtools stats output" help="It should contain 'This file was produced by samtools stats'"/>
                            </when>
                            <when value="flagstat">
                                <param name="input" type="data" format="txt" multiple="true" label="Samtools flagstat output" help="It should contain 'in total (QC-passed reads + QC-failed reads)'"/>
                            </when>
                            <when value="idxstats">
                                <param name="input" type="data" format="txt" multiple="true" label="Samtools idxstats output"/>
                            </when>
                            <when value="rmdup">
                                <param name="input" type="data" format="txt" multiple="true" label="Samtools rmdup output" help="It should contain '[bam_rmdup'"/>
                            </when>
                        </conditional>
                    </repeat>
                </when>
                <when value="slamdunk">
                    <param name="input" type="data" format="txt,tabular" multiple="true" label="Output of Slamdunk Alleyoop" help="It should contain '# slamdunk'"/>
                </when>
                <when value="snpeff">
                    <param name="input" type="data" format="csv" multiple="true" label="Output of SnpEff"/>
                </when>
                <when value="sortmerna">
                    <param name="input" type="data" format="txt" multiple="true" label="Log file of SortMeRNA" help="It should contain 'Minimal SW score based on E-value'"/>
                </when>
                <when value="star">
                    <repeat name="output" title="STAR output" min="1">
                        <conditional name="type">
                            <param name="type" type="select" label="Type of STAR output?">
                                <option value="log">Log</option>
                                <option value="genecounts">Gene counts</option>
                            </param>
                            <when value="log">
                                <param name="input" type="data" format="txt" multiple="true" label="STAR log output"/>
                            </when>
                            <when value="genecounts">
                                <param name="input" type="data" format="tabular,tsv" multiple="true" label="STAR gene count output"/>
                            </when>
                        </conditional>
                    </repeat>
                </when>
                <when value="tophat">
                    <param name="input" type="data" format="txt,tabular,tsv,csv" multiple="true" label="Output of TopHat2"/>
                </when>
                <when value="trimmomatic">
                    <param name="input" type="data" format="txt,tabular,tsv,csv" multiple="true" label="Output of Trimmomatic" help="It should contain 'TTrimmomatic'"/>
                </when>
                <when value="vcftools">
                    <repeat name="output" title="VCFTools output" min="1">
                        <conditional name="type">
                            <param name="type" type="select" label="Type of VCFTools output?">
                                <option value="relatedness2">relatedness2</option>
                                <option value="tstv_by_count">tstv_by_count</option>
                                <option value="tstv_by_qual">tstv_by_qual</option>
                                <option value="tstv_summary">tstv_summary</option>
                            </param>
                            <when value="relatedness2">
                                <param name="input" type="data" format="txt" multiple="true" label="VCFTools relatedness2 output"/>
                            </when>
                            <when value="tstv_by_count">
                                <param name="input" type="data" format="tabular,tsv" multiple="true" label="VCFTools TsTV count output"/>
                            </when>
                            <when value="tstv_by_qual">
                                <param name="input" type="data" format="tabular" multiple="true" label="VCFTools TsTV qual output"/>
                            </when>
                            <when value="tstv_summary">
                                <param name="input" type="data" format="txt" multiple="true" label="VCFTools TsTV summary output"/>
                            </when>
                        </conditional>
                    </repeat>
                </when>
                <when value="custom_content">
                    <param argument="plot_type" label="The plot type to visualise the data with" type="select">
                        <option value="linegraph">linegraph</option>
                        <option value="bargraph">bargraph</option>
                        <option value="scatter">scatter</option>
                        <option value="generalstats">generalstats</option>
                        <option value="table">table</option>
                    </param>
                    <param argument="section_name" label="Section name" type="text" help="Nice name used for the report section header" />
                    <param argument="title" label="Title" type="text" help="Plot title" />
                    <param argument="description" label="Description" type="text" help="Introductory text to be printed under the section header" />
                    <param argument="xlab" label="X axis label" type="text" />
                    <param argument="ylab" label="Y axis label" type="text" />
                    <param name="input" type="data" format="tabular,tsv" multiple="true" label="Data files"/>
                </when>
            </conditional>
        </repeat>
        <param name="title" type="text" value="" optional="true" label="Report title" help="It is printed as page header">
            <sanitizer invalid_char="">
                <valid initial="string.letters,string.digits">
                    <add value="," />
                    <add value=":" />
                    <add value="-" />
                    <add value="_" />
                    <add value=" " />
                    <add value="." />
                </valid>
            </sanitizer>
            <validator type="regex">[0-9a-zA-Z,: _.-]+</validator>
        </param>
        <param name="comment" type="text" value="" optional="true" label="Custom comment" help="It will be printed at the top of the report">
            <sanitizer invalid_char="">
                <valid initial="string.letters,string.digits">
                    <add value="," />
                    <add value=":" />
                    <add value="-" />
                    <add value="_" />
                    <add value=" " />
                    <add value="." />
                </valid>
            </sanitizer>
            <validator type="regex">[0-9a-zA-Z,: _.-]+</validator>
        </param>
        <param argument="--flat" type="boolean" truevalue="--flat" falsevalue="" checked="false" label="Use only flat plots (non-interactive images)" help="To consume less disk space and resources to display. Used by default when there are 100 or more samples."/>
        <param argument="--export" type="boolean" truevalue="--export" falsevalue="" checked="false" label="Output the multiQC plots raw data?" help="This will output a file for each plot containing the raw data used to generate the plot"/>
        <param name="saveLog" type="boolean" truevalue="true" falsevalue="false" checked="false" label="Output the multiQC log file?" help="This is mostly useful for debugging purposes"/>
    </inputs>
    <outputs>
        <data name="html_report" format="html" from_work_dir="report.html" label="${tool.name} on ${on_string}: Webpage" />
        <data name="log" format="txt" from_work_dir="report_data/multiqc.log" label="${tool.name} on ${on_string}: Log">
            <filter>saveLog</filter>
        </data>
        <collection name="stats" type="list" label="${tool.name} on ${on_string}: Stats">
            <discover_datasets pattern="multiqc_(?P<designation>.+)\.txt" format="tabular" directory="report_data" />
        </collection>
        <collection name="plots" type="list" label="${tool.name} on ${on_string}: Plots">
            <discover_datasets pattern="mqc_(?P<designation>.+)\.txt" format="tabular" directory="report_data" />
            <filter>export</filter>
        </collection>
    </outputs>
    <tests>
        <!--Test 01-->
        <test expect_num_outputs="4">
            <repeat name="results">
                <conditional name="software_cond">
                    <param name="software" value="cutadapt" />
                    <param name="input" value="cutadapt.txt" />
                </conditional>
            </repeat>
            <repeat name="results">
                <conditional name="software_cond">
                    <param name="software" value="fastp" />
                    <param name="input" value="fastp1.json.txt,fastp2.json.txt" />
                </conditional>
            </repeat>
            <repeat name="results">
                <conditional name="software_cond">
                    <param name="software" value="fastqc" />
                    <repeat name="output">
                        <param name="type" value="data"/>
                        <param name="input" value="fastqc_1.txt,fastqc_2.txt"/>
                    </repeat>
                </conditional>
            </repeat>
            <repeat name="results">
                <conditional name="software_cond">
                    <param name="software" value="flexbar" />
                    <param name="input" value="flexbar.txt" />
                </conditional>
            </repeat>
            <repeat name="results">
                <conditional name="software_cond">
                    <param name="software" value="slamdunk" />
                    <param name="input" value="slamdunk_summary.txt,slamdunk_reads1_overallrates.csv,slamdunk_reads2_overallrates.csv" />
                </conditional>
            </repeat>
            <repeat name="results">
                <conditional name="software_cond">
                    <param name="software" value="sortmerna" />
                    <param name="input" value="sortmerna.txt" />
                </conditional>
            </repeat>
            <repeat name="results">
                <conditional name="software_cond">
                    <param name="software" value="trimmomatic" />
                    <param name="input" value="trimmomatic.txt" />
                </conditional>
            </repeat>
            <param name="title" value="Title of the report"/>
            <param name="comment" value="Commment for the report"/>
            <param name="flat" value="true"/>
            <param name="export" value="true"/>
            <param name="saveLog" value="true"/>
            <output name="html_report">
                <assert_contents>
                    <has_text text="Title of the report" />
                    <has_text text="Commment for the report" />
                    <has_text text="cutadapt_trimmed_sequences_plot" />
                    <has_text text="An ultra-fast all-in-one FASTQ preprocessor" />
                    <has_text text="fastqc_seq_heatmap_key_t" />
                    <has_text text="flexbar_plot" />
                    <has_text text="a tool to analyze SLAMSeq data" />
                    <has_text text="sortmerna-detailed-plot" />
                    <has_text text="trimmomatic_plot" />
                </assert_contents>
            </output>
            <output name="log">
                <assert_contents>
                    <has_text_matching expression="\[INFO   \]  MultiQC complete$"/>
                </assert_contents>
            </output>
            <output_collection name="stats" type="list" count="10">
                <expand macro="element_assert" name="cutadapt" columns="9" lines="2" text="dataset_33"/>
                <expand macro="element_assert" name="fastp" columns="2" lines="3" text="R1_fq"/>
                <expand macro="element_assert" name="fastqc" columns="22" lines="3" text="poulet5_1"/>
                <expand macro="element_assert" name="flexbar" columns="11" lines="2" text="result_right"/>
                <expand macro="element_assert" name="general_stats" columns="20" lines="11" text="bwa-mem-fastq1_fq"/>
                <expand macro="element_assert" name="slamdunk_readrates_plus" columns="13" lines="3" text="slamdunk_reads1_overallrates_csv"/>
                <expand macro="element_assert" name="slamdunk_readrates_minus" columns="13" lines="3" text="slamdunk_reads1_overallrates_csv"/>
                <expand macro="element_assert" name="sortmerna" columns="22" lines="2" text="25839_merged"/>
                <expand macro="element_assert" name="sources" columns="4" lines="7" text="Module"/>
                <expand macro="element_assert" name="trimmomatic" columns="6" lines="2" text="C2"/>
            </output_collection>
            <output_collection name="plots" type="list" count="29"/>
        </test>
        <!--Test 02-->
        <test expect_num_outputs="2">
            <repeat name="results">
                <conditional name="software_cond">
                    <param name="software" value="bismark" />
                    <repeat name="output">
                        <param name="type" value="align"/>
                        <param name="input" value="bismark.txt"/>
                    </repeat>
                </conditional>
            </repeat>
            <repeat name="results">
                <conditional name="software_cond">
                    <param name="software" value="bowtie2" />
                    <param name="input" value="bowtie2_1.txt,bowtie2_2.txt" />
                </conditional>
            </repeat>
            <repeat name="results">
                <conditional name="software_cond">
                    <param name="software" value="hisat2" />
                    <param name="input" value="hisat2_1.txt,hisat2_2.txt" />
                </conditional>
            </repeat>
            <repeat name="results">
                <conditional name="software_cond">
                    <param name="software" value="hicexplorer" />
                    <param name="input" value="hicexplorer1.log,hicexplorer1.log,hicexplorer2.log" />
                </conditional>
            </repeat>
            <repeat name="results">
                <conditional name="software_cond">
                    <param name="software" value="kallisto" />
                    <param name="input" value="kallisto_1.txt,kallisto_2.txt" />
                </conditional>
            </repeat>
            <repeat name="results">
                <conditional name="software_cond">
                    <param name="software" value="macs2" />
                    <param name="input" value="macs_1.txt,macs_2.txt" />
                </conditional>
            </repeat>
            <repeat name="results">
                <conditional name="software_cond">
                    <param name="software" value="star" />
                    <repeat name="output">
                        <conditional name="type">
                            <param name="type" value="log"/>
                            <param name="input" value="star_log.txt" />
                        </conditional>
                    </repeat>
                    <repeat name="output">
                        <conditional name="type">
                            <param name="type" value="genecounts"/>
                            <param name="input" value="star_counts.txt" />
                        </conditional>
                    </repeat>
                </conditional>
            </repeat>
            <repeat name="results">
                <conditional name="software_cond">
                    <param name="software" value="tophat" />
                    <param name="input" value="tophat.txt" />
                </conditional>
            </repeat>
            <param name="saveLog" value="false"/>
            <output name="html_report">
                <assert_contents>
                    <has_text text="bismark-alignment" />
                    <has_text text="bowtie2_se_plot" />
                    <has_text text="hisat2_se_plot" />
                    <has_text text="kallisto_alignment" />
                    <has_text text="MACS2" />
                    <has_text text="star_alignment_plot" />
                    <has_text text="tophat_alignment" />
                    <has_text text="hicexplorer" />
                    <has_text text="hicexplorer1_log_1" />
                </assert_contents>
            </output>
            <output_collection name="stats" type="list" count="11">
                <expand macro="element_assert" name="bismark_alignment" columns="21" lines="2" text="bismark_txt_SE_report"/>
                <expand macro="element_assert" name="bowtie2" columns="7" lines="3" text="bowtie2_1_txt"/>
                <expand macro="element_assert" name="cutadapt" columns="9" lines="5" text="HS002-PE-R00059_BD0U5YACXX.RHM067_CAGATC_L002_R2"/>
                <expand macro="element_assert" name="general_stats" columns="22"  lines="19" text="treat2"/>
                <expand macro="element_assert" name="hicexplorer" columns="41" lines="4" text="hicexplorer_3_hicexplorer2_log_small_test_rf"/>
                <expand macro="element_assert" name="hisat2" columns="6" lines="3" text="hisat2_2_txt"/>
                <expand macro="element_assert" name="kallisto" columns="6" lines="3" text="HS002-PE-R00059_BD0U5YACXX.RHM067_CAGATC_L002_R1_val_1"/>
                <expand macro="element_assert" name="macs" columns="12" lines="3" text="treat2"/>
                <expand macro="element_assert" name="sources" columns="4" lines="18" text="Cutadapt"/>
                <expand macro="element_assert" name="star" columns="27" lines="2" text="star_log_txt"/>
                <expand macro="element_assert" name="tophat.txt" columns="9" lines="2" text="tophat_txtalign"/>
            </output_collection>
        </test>
        <!--Test 03-->
        <test expect_num_outputs="2">
            <repeat name="results">
                <conditional name="software_cond">
                    <param name="software" value="bamtools" />
                    <param name="input" value="bamtools.txt" />
                </conditional>
            </repeat>
            <repeat name="results">
                <conditional name="software_cond">
                    <param name="software" value="bcftools" />
                    <param name="input" value="bcftools.txt" />
                </conditional>
            </repeat>
            <repeat name="results">
                <conditional name="software_cond">
                    <param name="software" value="busco" />
                    <param name="input" value="busco.txt" />
                </conditional>
            </repeat>
            <repeat name="results">
                <conditional name="software_cond">
                    <param name="software" value="deeptools" />
                    <repeat name="output">
                        <param name="type" value="bamPEFragmentSize"/>
                        <param name="input" value="deeptools_bamPEFragmentSize.txt"/>
                    </repeat>
                    <repeat name="output">
                        <param name="type" value="estimateReadFiltering"/>
                        <param name="input" value="deeptools_estimateReadFiltering.txt"/>
                    </repeat>
                    <repeat name="output">
                        <param name="type" value="plotCoverageStdout"/>
                        <param name="input" value="deeptools_plotCoverageStdout.txt"/>
                    </repeat>
                    <repeat name="output">
                        <param name="type" value="plotCoverageOutRawCounts"/>
                        <param name="input" value="deeptools_plotCoverageOutRawCounts.txt"/>
                    </repeat>
                    <repeat name="output">
                        <param name="type" value="plotEnrichment"/>
                        <param name="input" value="deeptools_plotEnrichment.txt"/>
                    </repeat>
                    <repeat name="output">
                        <param name="type" value="plotFingerprintOutRawCounts"/>
                        <param name="input" value="deeptools_plotFingerprintOutRawCounts.txt"/>
                    </repeat>
                </conditional>
            </repeat>
            <repeat name="results">
                <conditional name="software_cond">
                    <param name="software" value="featureCounts" />
                    <param name="input" value="featureCounts.txt" />
                </conditional>
            </repeat>
            <repeat name="results">
                <conditional name="software_cond">
                    <param name="software" value="gatk" />
                    <repeat name="output">
                        <param name="type" value="base_recalibrator"/>
                        <param name="input" value="gatk_BaseRecalibrator.txt"/>
                    </repeat>
                    <repeat name="output">
                        <param name="type" value="varianteval"/>
                        <param name="input" value="gatk_varianteval.txt"/>
                    </repeat>
                </conditional>
            </repeat>
            <repeat name="results">
                <conditional name="software_cond">
                    <param name="software" value="htseq" />
                    <param name="input" value="htseq.txt" />
                </conditional>
            </repeat>
            <repeat name="results">
                <conditional name="software_cond">
                    <param name="software" value="picard" />
                    <repeat name="output">
                        <param name="type" value="gcbias"/>
                        <param name="input" value="picard_collectGcBias.txt"/>
                    </repeat>
                    <repeat name="output">
                        <param name="type" value="insertsize"/>
                        <param name="input" value="picard_CollectInsertSizeMetrics.txt"/>
                    </repeat>
                    <repeat name="output">
                        <param name="type" value="markdups"/>
                        <param name="input" value="picard_MarkDuplicates.txt"/>
                    </repeat>
                    <repeat name="output">
                        <param name="type" value="basedistributionbycycle"/>
                        <param name="input" value="picard_CollectBaseDistributionByCycle.txt"/>
                    </repeat>
                    <repeat name="output">
                        <param name="type" value="rnaseqmetrics"/>
                        <param name="input" value="picard_CollectRnaSeqMetrics.txt"/>
                    </repeat>
                    <repeat name="output">
                        <param name="type" value="alignment_metrics"/>
                        <param name="input" value="picard_CollectAlignmentSummaryMetrics.txt"/>
                    </repeat>
                </conditional>
            </repeat>
            <repeat name="results">
                <conditional name="software_cond">
                    <param name="software" value="prokka" />
                    <param name="input" value="prokka_1.txt,prokka_2.txt" />
                </conditional>
            </repeat>
            <repeat name="results">
                <conditional name="software_cond">
                    <param name="software" value="qualimap" />
                    <param name="input" value="genome_results.txt" />
                </conditional>
            </repeat>
            <repeat name="results">
                <conditional name="software_cond">
                    <param name="software" value="quast" />
                    <param name="input" value="quast.tsv" />
                </conditional>
            </repeat>
            <repeat name="results">
                <conditional name="software_cond">
                    <param name="software" value="rseqc" />
                    <repeat name="output">
                        <conditional name="type">
                            <param name="type" value="read_gc"/>
                            <param name="input" value="rseqc.txt"/>
                        </conditional>
                    </repeat>
                </conditional>
            </repeat>
            <repeat name="results">
                <conditional name="software_cond">
                    <param name="software" value="samblaster" />
                    <param name="input" value="samblaster.txt" />
                </conditional>
            </repeat>
            <repeat name="results">
                <conditional name="software_cond">
                    <param name="software" value="samtools" />
                    <repeat name="output">
                        <conditional name="type">
                            <param name="type" value="stats"/>
                            <param name="input" value="samtools_stats.txt"/>
                        </conditional>
                    </repeat>
                    <repeat name="output">
                        <conditional name="type">
                            <param name="type" value="flagstat"/>
                            <param name="input" value="samtools_flagstat.txt"/>
                        </conditional>
                    </repeat>
                    <repeat name="output">
                        <conditional name="type">
                            <param name="type" value="idxstats"/>
                            <param name="input" value="samtools_idxstats.txt"/>
                        </conditional>
                    </repeat>
                </conditional>
            </repeat>
            <repeat name="results">
                <conditional name="software_cond">
                    <param name="software" value="snpeff" />
                    <param name="input" value="snpeff.csv" ftype="csv" />
                </conditional>
            </repeat>
            <repeat name="results">
                <conditional name="software_cond">
                    <param name="software" value="vcftools" />
                    <repeat name="output">
                        <conditional name="type">
                            <param name="type" value="tstv_by_qual"/>
                            <param name="input" value="vcftools.txt"/>
                        </conditional>
                    </repeat>
                    <param name="input" value="vcftools.txt" />
                </conditional>
            </repeat>
            <output name="html_report">
                <assert_contents>
                    <has_text text="bamtools-stats" />
                    <has_text text="bcftools_stats_indel-lengths" />
                    <has_text text="busco-lineage-fungi_odb9" />
                    <has_text text="deeptools" />
                    <has_text text="featureCounts_assignment_plot" />
                    <has_text text="gatk_varianteval_variant_plot" />
                    <has_text text="htseq_assignment_plot" />
                    <has_text text="picard_alignment_readlength" />
                    <has_text text="picard-rna-assignment" />
                    <has_text text="picard-markduplicates" />
                    <has_text text="picard-insertsize" />
                    <has_text text="picard-gcbias" />
                    <has_text text="prokka_plot" />
                    <has_text text="qualimap" />
                    <has_text text="samblaster_duplicates" />
                    <has_text text="quast-stats" />
                    <has_text text="samtools-flagstat-dp" />
                    <has_text text="snpeff" />
                </assert_contents>
            </output>
            <output_collection name="stats" type="list" count="21">
                <expand macro="element_assert" name="bamtools_stats" columns="20" lines="2" text="bamtools_txt"/>
                <expand macro="element_assert" name="bcftools_stats" columns="28" lines="2" text="Test1"/>
                <expand macro="element_assert" name="busco" columns="8" lines="2" text="busco_txt"/>
                <expand macro="element_assert" name="featureCounts" columns="14" lines="7" text="5: TopHat on data 1, data 14, and data 13"/>
                <expand macro="element_assert" name="gatk_varianteval" columns="12" lines="2" text="gatk_varianteval_txt"/>
                <expand macro="element_assert" name="general_stats" columns="44" lines="23" text="x_bam"/>
                <expand macro="element_assert" name="htseq" columns="9" lines="2" text="htseq_txt"/>
                <expand macro="element_assert" name="picard_AlignmentSummaryMetrics" columns="26" lines="2" text="D11_H4K16ac_Rep1_R1_fastq_gz"/>
                <expand macro="element_assert" name="picard_RnaSeqMetrics" columns="27" lines="2" text="picard_CollectRnaSeqMetrics_bam"/>
                <expand macro="element_assert" name="picard_baseContent" columns="11" lines="2" text="D11_H4K16ac_Rep1_R1_fastq_gz"/>
                <expand macro="element_assert" name="picard_dups" columns="10" lines="2" text="dataset_114"/>
                <expand macro="element_assert" name="picard_insertSize" columns="23" lines="2" text="dataset_197_FR"/>
                <expand macro="element_assert" name="prokka" columns="11" lines="3" text="Sample2"/>
                <expand macro="element_assert" name="qualimap_bamqc_genome_results" columns="12" lines="2" text="x_bam"/>
                <expand macro="element_assert" name="quast" columns="50" lines="2" text="14892_1#15"/>
                <expand macro="element_assert" name="samblaster" columns="5" lines="2" text="virtual-normal"/>
                <expand macro="element_assert" name="samtools_flagstat" columns="34" lines="2" text="samtools_flagstat_txt">
                    <has_text text="samtools_flagstat" />
                    <has_text text="mapped_passed" />
                    <has_text text="20689039" />
                </expand>
                <expand macro="element_assert" name="samtools_idxstats" columns="68" lines="2" text="samtools_idxstats_txt_idxstat"/>
                <expand macro="element_assert" name="samtools_stats" columns="40" lines="2" text="samtools_stats_txt"/>
                <expand macro="element_assert" name="snpeff" columns="169" lines="2" text="snpeff_csv"/>
                <expand macro="element_assert" name="sources" columns="4" lines="33" text="Bamtools"/>
            </output_collection>
        </test>
        <!--Test 04-->
        <test expect_num_outputs="2">
            <repeat name="results">
                <conditional name="software_cond">
                    <param name="software" value="custom_content" />
                    <param name="cc_select" value="manual" />
                    <param name="plot_type" value="linegraph" />
                    <param name="section_name" value="BPC" />
                    <param name="description" value="Sum of intensity (Y) of the most intense peaks at each retention time(X)" />
                    <param name="xlab" value="Retention Time" />
                    <param name="ylab" value="Base Peak Intensity" />
                    <param name="input" value="cc_ko15.bpc.tab,cc_wt15.bpc.tab" />
                </conditional>
            </repeat>
            <output name="html_report" ftype="html">
                <assert_contents>
                    <has_size value="1110578" delta="500" />
                </assert_contents>
            </output>
	        <output_collection name="stats" type="list" count="1"/>
        </test>
        <!--Test 05-->
        <test expect_num_outputs="3">
            <repeat name="results">
                <conditional name="software_cond">
                    <param name="software" value="fastqc" />
                    <repeat name="output">
                        <param name="type" value="data"/>
                        <param name="input" value="fastqc_1.txt,fastqc_2.txt"/>
                    </repeat>
                </conditional>
            </repeat>
            <param name="title" value="Title of the report"/>
            <param name="comment" value="Commment for the report"/>
            <param name="flat" value="true"/>
            <param name="export" value="true"/>
            <output name="html_report">
                <assert_contents>
                    <has_text text="Title of the report" />
                    <has_text text="Commment for the report" />
                    <has_text text="fastqc_seq_heatmap_key_t" />
                </assert_contents>
            </output>
	        <output_collection name="stats" type="list" count="3">
                <expand macro="element_assert" name="fastqc" columns="22" lines="3" text="poulet5_2"/>
                <expand macro="element_assert" name="general_stats" columns="6" lines="3" text="poulet5_2"/>
                <expand macro="element_assert" name="sources" columns="4" lines="3" text="FastQC"/>
            </output_collection>
            <output_collection name="plots" type="list" count="7">
                <element name="fastqc_per_base_sequence_quality_plot_1" file="mqc_fastqc_per_base_sequence_quality_plot_1.txt" compare="sim_size" delta="10"/>
            </output_collection>
        </test>
        <!--Test 06-->
        <test expect_num_outputs="2">
            <repeat name="results">
                <conditional name="software_cond">
                    <param name="software" value="pycoqc" />
                    <param name="input" value="pycoqc.json"/>
                </conditional>
            </repeat>
            <param name="title" value="Title of the report"/>
            <param name="comment" value="Commment for the report"/>
            <!-- <param name="flat" value="true"/> -->
            <output name="html_report">
                <assert_contents>
                    <has_text text="Title of the report" />
                    <has_text text="Commment for the report" />
                    <has_text text="General Statistics" />
                    <has_text text="pycoqc_count_plot" />
                    <has_text text="pycoqc_read_len_plot" />
                    <has_text text="pycoqc_read_qual_plot" />
                </assert_contents>
            </output>
	    <output_collection name="stats" type="list" count="2"/>
        </test>
    </tests>
    <help><![CDATA[
**What it does**

`MultiQC <http://multiqc.info/>`_ aggregates results from bioinformatics analyses across many samples into a single report. It takes results of multiple analyses and creates a report that can be viewed as a single beautiful web-page. It's a general use tool, perfect for summarizing the output from numerous bioinformatics tools.

**Inputs**

MultiQC takes software output summaries/logs and creates a single report from them. You need to tell the tool which software was used to generate the report. This is done using the **Software name** dropdown. At present only the Galaxy tools found in the ToolShed produce logs that can used with MultiQC

----

The first integration of this tool was made by
`@cmonjeau <https://github.com/cmonjeau>`_ and `@yvanlebras <https://github.com/yvanlebras>`_.
It is now maintained by the `Intergalactic Utilities Commission <https://galaxyproject.org/iuc>`_.
    ]]></help>
    <citations>
        <citation type="doi">10.1093/bioinformatics/btw354</citation>
    </citations>
</tool>


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Newtonsoft.Json;

namespace Geocoding.MapQuest
{
	public class ReverseGeocodeRequest : BaseRequest
	{
		public ReverseGeocodeRequest(string key, double latitude, double longitude)
			: this(key, new Location(latitude, longitude))
		{

		}

		public ReverseGeocodeRequest(string key, Location loc)
			: this(key, new LocationRequest(loc))
		{
		}

		public ReverseGeocodeRequest(string key, LocationRequest loc)
			: base(key)
		{
			Location = loc;
		}

		[JsonIgnore]
		LocationRequest loc;
		/// <summary>
		/// Latitude and longitude for the request
		/// </summary>
		[JsonProperty("location")]
		public virtual LocationRequest Location
		{
			get { return loc; }
			set
			{
				if (value == null)
					throw new ArgumentNullException("Location");

				loc = value;
			}
		}

		[JsonIgnore]
		public override string RequestAction
		{
			get { return "reverse"; }
		}
	}
}

redpajama_set_name: RedPajamaGithub


text:
import yaml
import numpy as np
from tqdm import tqdm
import argparse
import torch
from torch.autograd import Variable
import torch.optim as optim
import torch.nn as nn

import data, utils
from language import get_language_pairs
from visdom_helper import visdom_helper
from model import VanillaSequenceToSequence

print('********<loading train module>********')

def LTZeroInt(s):
    if int(s) > 0:
        return int(s)
    else:
        raise argparse.ArgumentTypeError('{} need to be larger than 1 and an integer.'.format(s))

_pr = argparse.ArgumentParser(description='Sequence-To-Sequence Model in PyTorch')

_pr.add_argument('-d', '--debug', dest='DEBUG', default=True, type=bool, help='debug mode prints more info')
_pr.add_argument('--input-lang', dest='INPUT_LANG', default='eng', help='code name for the input language ')
_pr.add_argument('--output-lang', dest='OUTPUT_LANG', default='cmn', help='code name for the output language ')
_pr.add_argument('--max-data-len', dest='MAX_DATA_LEN', default=10, type=int,
                 help='maximum length for input output pairs (words)')
_pr.add_argument('--dash-id', dest='DASH_ID', type=str, default='seq-to-seq-experiment',
                 help='maximum length for input output pairs')
_pr.add_argument('--batch-size', dest='BATCH_SIZE', type=int, default=10, help='maximum length for input output pairs')
_pr.add_argument('--learning-rate', dest='LEARNING_RATE', type=float, default=1e-3,
                 help='maximum length for input output pairs')
_pr.add_argument('--n-epoch', dest='N_EPOCH', type=int, default=5, help='number of epochs to train')
_pr.add_argument('-e', '--eval-interval', dest='EVAL_INTERVAL', type=LTZeroInt, default=10,
                 help='evaluate model on validation set')
_pr.add_argument('--teacher-forcing-r', dest='TEACHER_FORCING_R', type=float, default=0.5,
                 help='Float for the teacher-forcing ratio')
_pr.add_argument('-s', '--save-interval', dest='SAVE_INTERVAL', type=LTZeroInt, default=100,
                 help='evaluate model on validation set')
_pr.add_argument('--n-layers', dest='N_LAYERS', type=int, default=1,
                 help='maximum length for input output pairs')
_pr.add_argument('--bi-directional', dest='BI_DIRECTIONAL', type=bool, default=False,
                 help='whether use bi-directional module for the model')

class Session():
    def __init__(self, args):
        self.name = 'seq-2-seq-translator'
        self.args = args
        self.meta = lambda: None
        self.meta.epoch = 0

        # create logging and dashboard
        self.ledger = utils.Ledger(debug=self.args.DEBUG)
        self.dash = visdom_helper.Dashboard(args.DASH_ID)

        if self.args.DEBUG:
            self.ledger.pp(vars(args))

        # load data
        source_data = list(data.read_language(self.args.INPUT_LANG, self.args.OUTPUT_LANG, data.normalize_strings))
        self.ledger.green('sentence pairs in file: {}'.format(len(source_data)))
        self.pairs = list(filter(data.trim_by_length(self.args.MAX_DATA_LEN), source_data))
        self.ledger.green('Number of sentence pairs after filtering: {}'.format(len(self.pairs)))

        self.input_lang, self.output_lang = \
            get_language_pairs(self.args.INPUT_LANG, args.OUTPUT_LANG, self.pairs)
        self.input_lang.summarize()
        self.output_lang.summarize()

        self.word_index_pairs = [[self.input_lang.sentence_to_indexes(p[0]),
                                  self.output_lang.sentence_to_indexes(p[1])]
                                 for p in self.pairs]

        # Now build the model
        self.model = VanillaSequenceToSequence(
            self.input_lang, self.output_lang, 200, n_layers=self.args.N_LAYERS,
            bidirectional=self.args.BI_DIRECTIONAL)
        self.ledger.log('Sequence to sequence model graph:\n', self.model)

    def train(self, debug=False):
        # setting up Training
        optimizer = optim.Adam(self.model.parameters(), lr=self.args.LEARNING_RATE)
        criterion = nn.CrossEntropyLoss()

        # train
        self.meta.losses = []
        # print(self.word_index_pairs)
        for i, (inputs, target) in enumerate(tqdm(data.get_batch(self.word_index_pairs, self.args.BATCH_SIZE))):
            hidden = self.model.init_hidden(len(inputs))
            optimizer.zero_grad()

            input_vec = Variable(torch.LongTensor(inputs), requires_grad=False)
            target_vec = Variable(torch.LongTensor(target), requires_grad=False)
            _, target_seq_length = target_vec.size()

            # set the training flag
            self.model.train()
            # NOTE: we don't need to output longer than the target, because there is no way to calculate the entropy. This is however a very crude way of doing it, and in the future a better loss metric would be needed. self.args.MAX_OUTPUT_LEN
            output, hidden, output_embeded = self.model(input_vec, hidden, target_vec, self.args.TEACHER_FORCING_R,
                                                        target_seq_length - 1)

            b_size, seq_len, n_words = output_embeded.size()
            # TODO: instead of clipping output_embedded, should pad target longer with <NULL>. (different from t_padded!).
            # NOTE: need to cut target_vec to same length as seq_len
            target_without_SOS = target_vec[:, 1:(seq_len + 1)].contiguous().view(-1)
            # self.ledger.debug(output_embeded.size(), target_without_SOS.size())
            loss = criterion(output_embeded.view(-1, n_words), target_without_SOS)

            # target_vec.t()[1:].t().view(-1))

            # for output_softmax, t in zip(output_softmaxes, target_padded):
            #     loss += criterion(output_softmax, t)

            self.meta.losses.append(loss.data.numpy()[0])
            if i % self.args.EVAL_INTERVAL == 0:
                self.dash.plot('loss', 'line', X=np.arange(0, len(self.meta.losses)), Y=np.array(self.meta.losses))
            if i % self.args.SAVE_INTERVAL == 0:
                # TODO: add data file
                self.model.save()

            loss.backward()
            optimizer.step()

            # execute only once under debug mode.
            if debug:
                return
        self.meta.epoch += 1

    def checkpoint_location(self):
        return self.checkpoint_folder + '/' + self.name + '_batch_' + str(self.meta.epoch)

    def __enter__(self):
        try:
            self.meta = utils.Struct(**self.model.load(self.checkpoint_location()))
            if not self.args or self.args.LOAD_PARAMES_FROM_CHECKPOINT:
                self.args = dict(self.args.items() +i)
        except Exception as e:
            self.ledger.debug("Exception: ", e)

    def __exit__(self, exc_type, exc_val, exc_tb):
        self.model.save(self.checkpoint_location(),
                        {
                            "args": args.
                            "meta": {
                                'losses': self.meta.losses,
                                'epoch': self.meta.epoch
                            }
                        })
        pass

    def evaluate(self, input_sentence):

        normalized = data.normalize_strings(input_sentence)
        input_ind = [self.input_lang.sentence_to_indexes(normalized)]
        input_vec = Variable(torch.LongTensor(input_ind), requires_grad=False)
        hidden = self.model.init_hidden(1)
        self.model.eval()
        translated, _, _ = self.model.forward(input_vec, hidden, max_output_length=1000)
        first_in_batch = 0
        output_sentence = self.output_lang.indexes_to_sentence(translated[first_in_batch].data.numpy())

        return output_sentence

if __name__ == "__main__":
    args = _pr.parse_args()
    sess = Session(args)
    for i in range(args.N_EPOCH):
        sess.train()


text:
// The MIT License (MIT)

// Copyright (c) 2013 lailongwei<lailongwei@126.com>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

#ifndef __LLBC_CORE_OBJECT_POOL_THREAD_OBJECT_POOL_MANAGER_H__
#define __LLBC_CORE_OBJECT_POOL_THREAD_OBJECT_POOL_MANAGER_H__

#include "llbc/common/Common.h"

#include "llbc/core/objectpool/ObjectPool.h"

__LLBC_NS_BEGIN

/**
 * The global object pool define.
 */
LLBC_EXPORT LLBC_SafetyObjectPool &__LLBC_GlobalObjectPool();
#define LLBC_GlobalObjectPool (LLBC_NS __LLBC_GlobalObjectPool())

/**
 * \brief The thread object pool manager class encapsulation.
 */
class LLBC_EXPORT LLBC_ThreadObjectPoolManager
{
public:
    /**
     * Create the entry thread(Call LLBC_Startup()/LLBC_Cleanup() methods' thread) object-pools.
     * Call by LLBC framework, do not try to call it.
     * @return int - return 0 if success, otherwise return -1.
     */
    static int CreateEntryThreadObjectPools();

    /**
     * Destroy entry thread(Call LLBC_Startup()/LLBC_Cleanup() methods' thread) object-pools.
     * Call by LLBC framework, do not try to call it.
     * @return int - return 0 if success, otherwise return -1.
     */
    static int DestroyEntryThreadObjectPools();

public:
    /**
     * Get entry thread(Call LLBC_Startup()/LLBC_Cleanup() methods' thread) thread safety object-pool.
     * @return LLBC_SafetyObjectPool * - safety object-pool pointer.
     * Note:
     *      If you use entry thread to get object-pool object, you must call this method to fetch
     *      the entry thread object-pool.
     */
    static LLBC_SafetyObjectPool *GetEntryThreadSafetyObjectPool();

    /**
     * Get entry thread(Call LLBC_Startup()/LLBC_Cleanup() methods' thread) thread unsafety object-pool.
     * @return LLBC_UnsafetyObjectPool * - unsafety object-pool pointer.
     * Note:
     *      If you use entry thread to get object-pool object, you must call this method to fetch
     *      the entry thread object-pool.
     */
    static LLBC_UnsafetyObjectPool *GetEntryThreadUnsafetyObjectPool();

public:
    /**
     * Get current thread safety object pool, thread must be LLBC style thread.
     * @return LLBC_SafetyObjectPool * - safety object-pool pointer.
     */
    static LLBC_SafetyObjectPool *GetCurThreadSafetyObjectPool();

    /**
     * Get current thread unsafety object pool, thread must be LLBC style thread.
     * @return LLBC_UnsafetyObjectPool * - unsafety object-pool pointer.
     */
    static LLBC_UnsafetyObjectPool *GetCurThreadUnsafetyObjectPool();
};

/**
 * Object pool converience method, get object from safety object-pool.
 * @return OjectType * - the object pointer.
 */
template <typename ObjectType>
ObjectType *LLBC_GetObjectFromSafetyPool();

/**
 * Object pool converience method, release object to safety object-pool.
 * @param[in] obj - the will release object pointer.
 */
template <typename ObjectType>
void LLBC_ReleaseObjectToSafetyPool(ObjectType *obj);

/**
 * Object pool converience method, get object from unsafety object-pool.
 * @return ObjectType * - the object pointer.
 */
template <typename ObjectType>
ObjectType *LLBC_GetObjectFromUnsafetyPool();

/**
 * Object pool converience method, release object to unsafety object-pool.
 * @param[in] obj - the will release object pointer.
 */
template <typename ObjectType>
void LLBC_ReleaseObjectToUnsafetyPool(ObjectType *obj);

/**
 * Object pool converience method, get guarded object from safety object-pool.
 * @return LLBC_ObjectGuard<ObjectType> - the guarded object.
 */
template <typename ObjectType>
LLBC_ObjectGuard<ObjectType> LLBC_GetGuardedObjectFromSafetyPool();

/**
 * Object pool converience method, get guarded object from unsafety object-pool.
 * @return LLBC_ObjectGuard<ObjectType> - the guarded object.
 */
template <typename ObjectType>
LLBC_ObjectGuard<ObjectType> LLBC_GetGuardedObjectFromUnsafetyPool();

/**
 * Object pool converience method, get referencable object from object pool(unsafety object-pool).
 * @param[in] autoRelease - the auto-release flag, default is false.
 * @return ReferencableObjectType * - the referencable object pointer.
 */
template <typename ReferencableObjectType>
ReferencableObjectType *LLBC_GetReferencableObjectFromPool(bool autoRelease = false);

__LLBC_NS_END

#include "llbc/core/objectpool/ObjectPoolManagerInl.h"

#endif // !__LLBC_CORE_OBJECT_POOL_THREAD_OBJECT_POOL_MANAGER_H__


text:
package org.ng200.openolympus.controller.auth;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.http.HttpStatus;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.authentication.AuthenticationFailureHandler;
import org.springframework.stereotype.Component;

@Component
public class OpenOlympusAuthenticationFailureHandler implements
		AuthenticationFailureHandler {

	public OpenOlympusAuthenticationFailureHandler() {
	}

	@Override
	public void onAuthenticationFailure(HttpServletRequest request,
			HttpServletResponse response, AuthenticationException exception)
					throws IOException, ServletException {
		response.setContentType("application/json");
		response.setStatus(HttpStatus.OK.value());
		AuthenticationResponder.writeLoginStatusJson(response.getWriter(),
				"failed", null);
	}
}


text:
{% extends 'contact_manager/base.html' %}
    {% load staticfiles %}

    {% block head %}

        {{ block.super }}

    {% endblock head %}

    {% block header %}

        {{ block.super }}

    {% endblock header %}

    {% block content %}

 {{ viewed_event.name }} {{ viewed_event.date.year }}

 {{ event_month }} {{ viewed_event.date.day }}, {{ viewed_event.date.year }}

Add Event Contact

Contacts:

                    {% for contact in event_contacts %}

{{ contact.first_name }} {{ contact.last_name }}

                    {% empty %}

No contacts added yet.

                    {% endfor %}

    {% endblock %}


text:
title: UCP architecture
description: Learn about the architecture of Docker Universal Control Plane.
keywords: ucp, architecture
---

Universal Control Plane is a containerized application that runs on
[Docker Enterprise Edition](/ee/index.md) and extends its functionality
to make it easier to deploy, configure, and monitor your applications at scale.

UCP also secures Docker with role-based access control so that only authorized
users can make changes and deploy applications to your Docker cluster.

![](images/architecture-1.svg)

Once Universal Control Plane (UCP) instance is deployed, developers and IT
operations no longer interact with Docker Engine directly, but interact with
UCP instead. Since UCP exposes the standard Docker API, this is all done
transparently, so that you can use the tools you already know and love, like
the Docker CLI client and Docker Compose.

## Under the hood

Docker UCP leverages the clustering and orchestration functionality provided
by Docker.

![](images/architecture-2.svg)

A swarm is a collection of nodes that are in the same Docker cluster.
[Nodes](/engine/swarm/key-concepts.md) in a Docker swarm operate in one of two
modes: Manager or Worker. If nodes are not already running in a swarm when
installing UCP, nodes will be configured to run in swarm mode.

When you deploy UCP, it starts running a globally scheduled service called
`ucp-agent`. This service monitors the node where it's running and starts
and stops UCP services, based on whether the node is a
[manager or a worker node](/engine/swarm/key-concepts.md).

If the node is a:

* **Manager**: the `ucp-agent` service automatically starts serving all UCP
  components, including the UCP web UI and data stores used by UCP. The
  `ucp-agent` accomplishes this by
  [deploying several containers](#ucp-components-in-manager-nodes)
  on the node. By promoting a node to manager, UCP automatically becomes
  highly available and fault tolerant.
* **Worker**: on worker nodes, the `ucp-agent` service starts serving a proxy
  service that ensures only authorized users and other UCP services can run
  Docker commands in that node. The `ucp-agent` deploys a
  [subset of containers](#ucp-components-in-worker-nodes) on worker nodes.

## UCP internal components

The core component of UCP is a globally-scheduled service called `ucp-agent`.
When you install UCP on a node, or join a node to a swarm that's being managed
by UCP, the `ucp-agent` service starts running on that node.

Once this service is running, it deploys containers with other UCP components,
and it ensures they keep running. The UCP components that are deployed
on a node depend on whether the node is a manager or a worker.

> OS-specific component names
>
> Some UCP component names depend on the node's operating system. For example,
> on Windows, the `ucp-agent` component is named `ucp-agent-win`.
> [Learn about architecture-specific images](admin/install/architecture-specific-images.md).

### UCP components in manager nodes

Manager nodes run all UCP services, including the web UI and data stores that
persist the state of UCP. These are the UCP services running on manager nodes:

| UCP component       | Description                                                                                |
|:--------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ucp-agent           | Monitors the node and ensures the right UCP services are running                                                                                |
| ucp-reconcile       | When ucp-agent detects that the node is not running the right UCP components, it starts the ucp-reconcile container to converge the node to its desired state. It is expected for the ucp-reconcile container to remain in an exited state when the node is healthy. |
| ucp-auth-api        | The centralized service for identity and authentication used by UCP and DTR                                                                                |
| ucp-auth-store      | Stores authentication configurations and data for users, organizations, and teams                                                                                |
| ucp-auth-worker     | Performs scheduled LDAP synchronizations and cleans authentication and authorization data                                                                                |
| ucp-client-root-ca  | A certificate authority to sign client bundles                                                                                |
| ucp-cluster-root-ca | A certificate authority used for TLS communication between UCP components                                                                                |
| ucp-controller      | The UCP web server                                                                                |
| ucp-dsinfo          | Docker system information collection script to assist with troubleshooting                                                                                |
| ucp-kv              | Used to store the UCP configurations. Don't use it in your applications, since it's for internal use only                                                                                |
| ucp-metrics         | Used to collect and process metrics for a node, like the disk space available                                                                                |
| ucp-proxy           | A TLS proxy. It allows secure access to the local Docker Engine to UCP components                                                                                |
| ucp-swarm-manager   | Used to provide backwards-compatibility with Docker Swarm                                                                                |

### UCP components in worker nodes

Worker nodes are the ones where you run your applications. These are the UCP
services running on worker nodes:

| UCP component | Description                                                                                |
|:--------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ucp-agent     | Monitors the node and ensures the right UCP services are running                                                                                |
| ucp-dsinfo    | Docker system information collection script to assist with troubleshooting                                                                                |
| ucp-reconcile | When ucp-agent detects that the node is not running the right UCP components, it starts the ucp-reconcile container to converge the node to its desired state. It is expected for the ucp-reconcile container to remain in an exited state when the node is healthy. |
| ucp-proxy     | A TLS proxy. It allows secure access to the local Docker Engine to UCP components                                                                                |

## Volumes used by UCP

Docker UCP uses these named volumes to persist data in all nodes where it runs:

| Volume name                 | Description                                                                              |
|:----------------------------|:-----------------------------------------------------------------------------------------|
| ucp-auth-api-certs          | Certificate and keys for the authentication and authorization service                    |
| ucp-auth-store-certs        | Certificate and keys for the authentication and authorization store                      |
| ucp-auth-store-data         | Data of the authentication and authorization store, replicated across managers           |
| ucp-auth-worker-certs       | Certificate and keys for authentication worker                                           |
| ucp-auth-worker-data        | Data of the authentication worker                                                        |
| ucp-client-root-ca          | Root key material for the UCP root CA that issues client certificates                    |
| ucp-cluster-root-ca         | Root key material for the UCP root CA that issues certificates for swarm members         |
| ucp-controller-client-certs | Certificate and keys used by the UCP web server to communicate with other UCP components |
| ucp-controller-server-certs | Certificate and keys for the UCP web server running in the node                          |
| ucp-kv                      | UCP configuration data, replicated across managers                                       |
| ucp-kv-certs                | Certificates and keys for the key-value store                                            |
| ucp-metrics-data            | Monitoring data gathered by UCP                                                          |
| ucp-metrics-inventory       | Configuration file used by the ucp-metrics service                                       |
| ucp-node-certs              | Certificate and keys for node communication                                              |

You can customize the volume driver used for these volumes, by creating
the volumes before installing UCP. During the installation, UCP checks which
volumes don't exist in the node, and creates them using the default volume
driver.

By default, the data for these volumes can be found at
`/var/lib/docker/volumes/<volume-name>/_data`.

## How you interact with UCP

There are two ways to interact with UCP: the web UI or the CLI.

You can use the UCP web UI to manage your swarm, grant and revoke user
permissions, deploy, configure, manage, and monitor your applications.

![](images/architecture-3.svg)

UCP also exposes the standard Docker API, so you can continue using existing
tools like the Docker CLI client. Since UCP secures your cluster with role-based
access control, you need to configure your Docker CLI client and other client
tools to authenticate your requests using
[client certificates](user/access-ucp/index.md) that you can download
from your UCP profile page.

## Where to go next

* [System requirements](admin/install/system-requirements.md)
* [Plan your installation](admin/install/system-requirements.md)


text:
class CreateSearches < ActiveRecord::Migration
  def change
    create_table :searches do |t|
      t.string :keywords
      t.integer :category_id
      t.integer :city_id

      t.timestamps null: false
    end
  end
end


text:
<?php
namespace Westhoffswelt\LinkIt;

/**
 * Representation of one link entry
 */
class Link
{
    protected $parent;

    protected $source;

    protected $target;

    public function __construct($data, LinkList $parent)
    {
        $this->parent = $parent;

        if (($this->source = $this->getRealSourcePath($data[0])) === false) {
            throw new Exception\InvalidLink(
                $parent->getLinkFile()->getRealPath(),
                $data[0],
                $data[1]
            );
        }
        $this->target = $this->getRealTargetPath($data[1]);
    }

    public function getParent()
    {
        return $this->parent;
    }

    public function getSource()
    {
        return $this->source;
    }

    public function getTarget()
    {
        return $this->target;
    }

    public function realize()
    {
        if (\file_exists($this->target)
            || !is_writable(dirname($this->target))
            || !symlink($this->source, $this->target)
        ) {
            throw new Exception\LinkRealization($this->source, $this->target);
        }
    }

    protected function getRealSourcePath($path)
    {
        // The source path is most likely relative to the basepath of the
        // linkList definition file
        $oldWorkingDirectory = getcwd();
        \chdir($this->parent->getBasePath()->getRealPath());
        $source = \realpath($path);
        \chdir($oldWorkingDirectory);
        return $source;
    }

    protected function getRealTargetPath($path)
    {
        /*
         * Determining the real target path is a little bit tricky, as it is
         * a file which does most likely not exist yet. Therefore realpath can not
         * be used.
         */

        // If the Path does not start with a / or ~ character it is a realative
        // path to the link file basepath
        if ($path[0] !== "/" && $path[0] !== "~") {
            $path = $this->parent->getBasePath()->getRealpath() . "/" . $path;
        }

        // Split path into segments to ease the processing
        $segments = $this->splitIntoPathSegments($path);

        // First path segment could be ~-Character, which indicates the home
        // directory of the current user
        if ($segments[0] === "~") {
            \array_splice(
                $segments,
                0,
                1,
                $this->splitIntoPathSegments(
                    \getenv("HOME")
                )
            );
        }

        // Handling relative path elements (.. and .) is neccessary
        return "/" . \implode("/", $this->canonicalizePathSegments($segments));
    }

    protected function canonicalizePathSegments($segments)
    {
        return \array_reduce(
            $segments,
            function ($reduced, $current) {
                $reduced = ($reduced === null)
                    ? array()
                    : $reduced;

                switch ($current) {
                    case ".":
                        // Just ignore . references
                        break;
                    case "..":
                        array_pop($reduced);
                        break;
                    default:
                        array_push($reduced, $current);
                }

                return $reduced;
            }
        );
    }

    protected function splitIntoPathSegments($path)
    {
        // Split the path into segments removing empty parts (eg. foo///bar)
        return \array_values(
            \array_filter(
                \explode("/", $path),
                'strlen'
            )
        );
    }
}


text:
"""Example of simple text wrapping without using layout.
"""

__docformat__ = 'restructuredtext'
__version__ = '$Id$'

from pyglet.gl import *
from pyglet.window import Window
from pyglet.window import key
from pyglet import clock
from pyglet import font
from scene2d.textsprite import *

window = Window(visible=False, resizable=True)
arial = font.load('Arial', 24)
text = 'Type away... '

@window.event
def on_resize(width, height):
    sprite.width = width
    sprite.x = 10

@window.event
def on_text(text):
    sprite.text += text.replace('\r', '\n')

@window.event
def on_key_press(symbol, modifiers):
    if symbol == key.BACKSPACE:
        sprite.text = sprite.text[:-1]

sprite = TextSprite(arial, text, color=(0, 0, 0, 1))

fps = clock.ClockDisplay()
window.push_handlers(fps)

glClearColor(1, 1, 1, 1)

window.set_visible()
while not window.has_exit:
    window.dispatch_events()
    clock.tick()

    glClear(GL_COLOR_BUFFER_BIT)
    sprite.y = sprite.height  # TODO align on bottom
    sprite.draw()
    fps.draw()
    window.flip()


text:
"use strict";

exports.__esModule = true;
exports["default"] = createTargetConnector;

function createTargetConnector(backend) {
  return {
    dropTarget: function connectDropTarget() {
      return backend.connectDropTarget.apply(backend, arguments);
    }
  };
}

module.exports = exports["default"];


text:
package straightedge.geom.vision;

import com.jme3.math.Vector2f;

import straightedge.geom.*;

/**
 *
 * @author Keith
 */
public class VPShadowOnBoundary extends VisiblePoint{
	public int edgeIndex;
	public VPOccluder castingOccluderPoint;
	public VPShadowOnBoundary(Vector2f point, int edgeIndex, VPOccluder castingOccluderPoint){
		this.point = point;
		this.edgeIndex = edgeIndex;
		this.castingOccluderPoint = castingOccluderPoint;
	}

	public VPOccluder getCastingOccluderPoint() {
		return castingOccluderPoint;
	}

	public int getEdgeIndex() {
		return edgeIndex;
	}

	public int getType() {
		return SHADOW_ON_BOUNDARY;
	}
}


text:
package lucene.action;

public class TruncateAction extends BaseAction {
    public TruncateAction(String indexName) {
        super(indexName);
    }
}