view macros.xml @ 22:9a913cdee30e draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/multiqc commit 57b36cfbdd1663aef43d03b76e37364cc5bdeef3"
author iuc
date Wed, 03 Nov 2021 15:17:39 +0000
parents
children abfd8a6544d7
line wrap: on
line source

<macros>
    <token name="@TOOL_VERSION@">1.11</token>
    <token name="@VERSION_SUFFIX@">0</token>
    <xml name="bio_tools">
        <xrefs>
            <xref type="bio.tools">multiqc</xref>
        </xrefs>
    </xml>
    <xml name="requirements">
        <requirements>
            <requirement type="package" version="@TOOL_VERSION@">multiqc</requirement>
         </requirements>
    </xml>

    <token name="@ESCAPE_IDENTIFIER@">
        <![CDATA[
        #set identifier = re.sub('[^\s\w\-]', '_', str($file.element_identifier))
    ]]></token>

    <token name="@CHECK_LN_FILE@">
        <![CDATA[
        #if $file_path in $file_paths
            #set $file_path += '_' + str($file_paths.count($file_path))
        #end if
        #set $file_paths += [$file_path]
        grep -q '$pattern' $file || die "Module '${repeat.software_cond.software}: '$pattern' not found in the file '$identifier'" &&
        ln -s '$file' '$file_path'  &&
    ]]></token>
        
    <token name="@CREATE_REPEAT_DIR_1@">
        <![CDATA[
        #set repeat_dir = os.path.join($software_dir, str($repeat2.type) + '_' + str($j))
        mkdir '$repeat_dir' &&
    ]]></token>

    <token name="@CREATE_REPEAT_DIR_1@">
        <![CDATA[
        #set repeat_dir = os.path.join($software_dir, str($repeat2.type) + '_' + str($j))
        mkdir '$repeat_dir' &&
                ]]></token>
                <token name="@CREATE_REPEAT_DIR_2@">
        <![CDATA[
        #set repeat_dir = os.path.join($software_dir, str($repeat2.type.type) + '_' + str($j))
        mkdir '$repeat_dir' &&
                ]]></token>
                <token name="@LN_FILES@">
        <![CDATA[
        #set file_paths = []
        #for $file in $repeat.software_cond.input
            @ESCAPE_IDENTIFIER@
            #set file_path = os.path.join($software_dir, str($identifier))
            @CHECK_LN_FILE@
        #end for
    ]]></token>

    <token name="@LN_2_FILES@">
        <![CDATA[
        #set file_paths = []
        @CREATE_REPEAT_DIR_1@
        #for $file in $repeat2.input
            #set identifier = re.sub('[^\s\w\-]', '_', str($file.element_identifier))
            #set file_path = os.path.join($repeat_dir, str($identifier))
            @CHECK_LN_FILE@
        #end for
    ]]></token>

    <token name="@LN_3_FILES@">
        <![CDATA[
        #set file_paths = []
        #for $file in $repeat2.type.input
            #set identifier = re.sub('[^\s\w\-]', '_', str($file.element_identifier))
            #set file_path = os.path.join($repeat_dir, str($identifier))
            @CHECK_LN_FILE@
        #end for
    ]]></token>

    <token name="@BISMARK_INPUT@"><![CDATA[
        #for $j, $repeat2 in enumerate( $repeat.software_cond.output )
            @CREATE_REPEAT_DIR_1@
            #if str($repeat2.type) == "align"
                #for $file in $repeat2.input
                    @ESCAPE_IDENTIFIER@
                    #set file_path = os.path.join($repeat_dir, str($identifier) + '_SE_report.txt')
                    ln -s '$file' '$file_path' &&
                #end for
            #elif str($repeat2.type) == "dedup"
                #for $file in $repeat2.input
                    @ESCAPE_IDENTIFIER@
                    #set file_path = os.path.join($repeat_dir, str($identifier) + '_deduplication_report.txt')
                    ln -s '$file' '$file_path' &&
                #end for
            #elif str($repeat2.type) == "meth_extract"
                #for $file in $repeat2.input
                    @ESCAPE_IDENTIFIER@
                    #set file_path = os.path.join($repeat_dir, str($identifier) + '_splitting_report.txt')
                    ln -s '$file' '$file_path' &&
                #end for
            #elif str($repeat2.type) == "m_bias"
                #for $file in $repeat2.input
                    @ESCAPE_IDENTIFIER@
                    #set file_path = os.path.join($repeat_dir, str($identifier) + '_M-bias.txt')
                    ln -s '$file' '$file_path' &&
                #end for
            #elif str($repeat2.type) == "bam2nuc"
                #for $file in $repeat2.input
                    @ESCAPE_IDENTIFIER@
                    #set file_path = os.path.join($repeat_dir, str($identifier) + '.nucleotide_stats.txt')
                    ln -s '$file' '$file_path' &&
                #end for
            #end if
        #end for
    ]]></token>

    <token name="@DEEPTOOLS_INPUT@"><![CDATA[
        #for $j, $repeat2 in enumerate( $repeat.software_cond.output )
            #if str($repeat2.type) == "bamPEFragmentSize"
                #set $pattern = "Frag."
                @LN_2_FILES@
            #elif str($repeat2.type) == "estimateReadFiltering"
                #set $pattern = "Internally-determined Duplicate"
                @LN_2_FILES@
            #elif str($repeat2.type) == "plotCoverageStdout"
                #set $pattern = "sample"
                @LN_2_FILES@
            #elif str($repeat2.type) == "plotCoverageOutRawCounts"
                #set $pattern = "#plotCoverage --outRawCounts"
                @LN_2_FILES@
            #elif str($repeat2.type) == "plotEnrichment"
                #set $pattern = "featureReadCount"
                @LN_2_FILES@
            #elif str($repeat2.type) == "plotFingerprintOutRawCounts"
                #set $pattern = "#plotFingerprint --outRawCounts"
                @LN_2_FILES@
            #end if
        #end for
    ]]></token>

    <token name="@PICCARD_INPUT@"><![CDATA[
        #for $j, $repeat2 in enumerate( $repeat.software_cond.output )
            #if str($repeat2.type) == "alignment_metrics"
                #set $pattern = "picard.analysis.AlignmentSummaryMetrics"
                @LN_2_FILES@
            #elif str($repeat2.type) == "basedistributionbycycle"
                #set $pattern = "picard.analysis.BaseDistributionByCycleMetrics"
                @LN_2_FILES@
            #elif str($repeat2.type) == "gcbias"
                #set $pattern = "picard.analysis.GcBias"
                @LN_2_FILES@
            #elif str($repeat2.type) == "hsmetrics"
                #set $pattern = "picard.analysis.directed.HsMetrics"
                @   @
            #elif str($repeat2.type) == "insertsize"
                #set $pattern = "picard.analysis.InsertSizeMetrics"
                @LN_2_FILES@
            #elif str($repeat2.type) == "markdups"
                #set $pattern = "MarkDuplicates"
                @LN_2_FILES@
            #elif str($repeat2.type) == "oxogmetrics"
                #set $pattern = "picard.analysis.CollectOxoGMetrics"
                @LN_2_FILES@
            #elif str($repeat2.type) == "pcr_metrics"
                #set $pattern = "picard.analysis.directed.TargetedPcrMetrics"
                @LN_2_FILES@
            #elif str($repeat2.type) == "rnaseqmetrics"
                #set $pattern = "Collect"
                @LN_2_FILES@
            #elif str($repeat2.type) == "rrbs_metrics"
                #set $pattern = "picard.analysis.RrbsSummaryMetrics"
                @LN_2_FILES@
            #elif str($repeat2.type) == "wgs_metrics"
                #set $pattern = "picard.analysis.CollectWgsMetrics$WgsMetrics"
                @LN_2_FILES@
            #end if
        #end for
    ]]></token>

    <token name="@FASTQC_INPUT@"><![CDATA[
        #for $j, $repeat2 in enumerate( $repeat.software_cond.output )
            @CREATE_REPEAT_DIR_1@
            #if str($repeat2.type) == "data"
                #for $k, $file in enumerate($repeat2.input)
                    #set file_dir = os.path.join($repeat_dir, 'file_' + str($k))
                    #set file_path = os.path.join($file_dir, 'fastqc_data.txt')
                    mkdir '$file_dir' &&
                    ln -s '$file' '$file_path' &&
                #end for
            #elif str($repeat2.type) == "theoretical_gc"
                #for $file in $repeat2.input
                    @ESCAPE_IDENTIFIER@
                    #set file_path = os.path.join($repeat_dir, str($identifier) + '_fastqc_theoretical_gc')
                    ln -s '$file' '$file_path' &&
                #end for
            #end if
        #end for
    ]]></token>

    <token name="@RSEQ_INPUT@"><![CDATA[
        #for $j, $repeat2 in enumerate( $repeat.software_cond.output )
            @CREATE_REPEAT_DIR_2@
            #if str($repeat2.type.type) == "bam_stat"
                #set $pattern = "Proper-paired reads map to different chrom:"
                @LN_3_FILES@
            #elif str($repeat2.type.type) == "gene_body_coverage"
                #for $k, $file in enumerate($repeat2.type.input)
                    #set file_path = os.path.join($repeat_dir, 'file_' + str($k) + '.geneBodyCoverage.txt')
                    ln -s '$file' '$file_path' &&
                #end for
            #elif str($repeat2.type.type) == "inner_distance"
                #for $k, $file in enumerate($repeat2.type.input)
                    #set file_path = os.path.join($repeat_dir, 'file_' + str($k) + '.inner_distance_freq.txt')
                    ln -s '${file}' '$file_path' &&
                #end for
            #elif str($repeat2.type.type) == "junction_annotation"
                #set $pattern = "Partial Novel Splicing Junctions:"
                @LN_3_FILES@
            #elif str($repeat2.type.type) == "read_gc"
                #for $k, $file in enumerate($repeat2.type.input)
                    #set file_path = os.path.join($repeat_dir, 'file_' + str($k) + '.GC.xls')
                    ln -s '$file' '$file_path' &&
                #end for
            #elif str($repeat2.type.type) == "junction_annotation"
                #set $pattern = "Group               Total_bases         Tag_count           Tags/Kb"
                @LN_3_FILES@
            #elif str($repeat2.type.type) == "read_distribution"
                #set $pattern = "Group               Total_bases         Tag_count           Tags/Kb"
                @LN_3_FILES@
            #elif str($repeat2.type.type) == "read_duplication_pos"
                #for $k, $file in enumerate($repeat2.type.input)
                    #set file_path = os.path.join($repeat_dir, 'file_' + str($k) + '.pos.DupRate.xls')
                    ln -s '$file' '$file_path' &&
                #end for
            #elif str($repeat2.type.type) == "infer_experiment"
                #set $pattern = "Fraction of reads explained by"
                #for $file in $repeat2.type.input
                    @ESCAPE_IDENTIFIER@
                    #set file_path = os.path.join($repeat_dir, str($identifier))
                    grep -q "$pattern" $file || die "'$pattern' not found in the file" &&
                    ln -s '$file' '$file_path' &&
                #end for
            #end if
        #end for
    ]]></token>

    <token name="@VCFTOOLS_INPUT@"><![CDATA[
        #for $j, $repeat2 in enumerate( $repeat.software_cond.output )
            @CREATE_REPEAT_DIR_2@
            #if str($repeat2.type.type) == "relatedness2"
                #for $file in $repeat2.type.input
                    @ESCAPE_IDENTIFIER@
                    #set file_path = os.path.join($repeat_dir, str($identifier) + '.relatedness2')
                    ln -s '$file' '$file_path' &&
                #end for
            #elif str($repeat2.type) == "tstv_by_count"
                #for $file in $repeat2.type.input
                    @ESCAPE_IDENTIFIER@
                    #set file_path = os.path.join($repeat_dir, str($identifier) + '.TsTv.count')
                    ln -s '$file' '$file_path' &&
                #end for
            #elif str($repeat2.type) == "tstv_by_qual"
                #for $file in $repeat2.type.input
                    @ESCAPE_IDENTIFIER@
                    #set file_path = os.path.join($repeat_dir, str($identifier) + '.TsTv.qual')
                    ln -s '$file' '$file_path' &&
                #end for
            #elif str($repeat2.type) == "tstv_summary"
                #for $file in $repeat2.type.input
                    @ESCAPE_IDENTIFIER@
                    #set file_path = os.path.join($repeat_dir, str($identifier) + '.TsTv.summary')
                    ln -s '$file' '$file_path' &&
                #end for
            #end if
        #end for
    ]]></token>
    
    <token name="@QUALIMAP_INPUT@"><![CDATA[
        #for $file in $repeat.software_cond.input
            #if re.search("genome_results", str($file.element_identifier))
                sample="\$(grep 'bam file = ' $file | sed 's/bam file = //g' | sed 's: ::g')" &&
                dir_name="$software_dir/\${sample}" &&
                mkdir -p \${dir_name} &&
                filepath_1="\${dir_name}/genome_results.txt" &&
                ln -sf '$file' \${filepath_1} &&
            #elif re.search("coverage_histogram", str($file.element_identifier))
                nested_dir_name="\${dir_name}/raw_data_qualimapReport/" &&
                mkdir -p \${nested_dir_name} &&
                filepath_2="\${nested_dir_name}/coverage_histogram.txt" &&
                ln -sf '$file' \${filepath_2} &&
            #elif re.search("gc-content_distribution", str($file.element_identifier))
                nested_dir_name="\${dir_name}/raw_data_qualimapReport/" &&
                mkdir -p \${nested_dir_name} &&
                filepath_3="\${nested_dir_name}/mapped_reads_gc-content_distribution.txt" &&
                ln -sf '$file' \${filepath_3} &&
            #else
                #pass
            #end if
        #end for
    ]]></token>

    <token name="@SALMON_INPUT@"><![CDATA[
        #for $j, $repeat2 in enumerate( $repeat.software_cond.output )
            @CREATE_REPEAT_DIR_2@
            #if str($repeat2.type.type) == "meta"
                #for $k, $file in enumerate($repeat2.type.input)
                    #set file_dir = os.path.join($repeat_dir, 'file_' + str($k))
                    #set file_path = os.path.join($file_dir, 'meta_info.json')
                    mkdir '$file_dir' &&
                    ln -s '$file' '$file_path' &&
                #end for
            #elif str($repeat2.type.type) == "fld"
                #for $k, $file in enumerate($repeat2.type.input)
                    #set file_dir = os.path.join($repeat_dir, 'file_' + str($k))
                    #set file_path = os.path.join($file_dir,'flenDist.txt')
                    mkdir '$file_dir' &&
                    ln -s '$file' '$file_path' &&
                #end for
            #end if
        #end for
    ]]></token>

    <token name="@SAMTOOLS_INPUT@"><![CDATA[
        #for $j, $repeat2 in enumerate( $repeat.software_cond.output )
            @CREATE_REPEAT_DIR_2@
            #if str($repeat2.type.type) == "stats"
                #set $pattern = "This file was produced by samtools stats"
                @LN_3_FILES@
            #elif str($repeat2.type.type) == "flagstat"
                #set $pattern = "in total (QC-passed reads + QC-failed reads)"
                @LN_3_FILES@
            #elif str($repeat2.type.type) == "idxstats"
                #for $file in $repeat2.type.input
                    @ESCAPE_IDENTIFIER@
                    #set file_path = os.path.join($repeat_dir, str($identifier) + '_idxstat')
                    ln -s '$file' '$file_path' &&
                #end for
            #elif str($repeat2.type.type) == "rmdup"
                #set $pattern = "[bam_rmdup"
                @LN_3_FILES@
            #end if
        #end for
    ]]></token>

    <token name="@STAR_INPUT@"><![CDATA[
        #for $j, $repeat2 in enumerate( $repeat.software_cond.output )
            @CREATE_REPEAT_DIR_2@
            #if str($repeat2.type.type) == "log"
                #for $file in $repeat2.type.input
                    @ESCAPE_IDENTIFIER@
                    #set file_path = os.path.join($repeat_dir, str($identifier) + '_Log.final.out')
                    ln -s '$file' '$file_path' &&
                #end for
            #elif str($repeat2.type.type) == "genecounts"
                #for $file in $repeat2.type.input
                    @ESCAPE_IDENTIFIER@
                    #set file_path = os.path.join($repeat_dir, str($identifier) + '_ReadsPerGene.out.tab')
                    ln -s '$file' '$file_path' &&
                #end for
            #end if
        #end for
    ]]></token>

    <xml name="element_assert" token_name="" token_lines="" token_columns="" token_text="">
        <element name="@NAME@">
            <assert_contents>
                <has_n_columns n="@COLUMNS@"/>
                <has_n_lines n="@LINES@"/>
                <has_text text="@TEXT@"/>
                <yield/>
            </assert_contents>
        </element>
    </xml>

    <xml name="citations">
        <citations>
            <citation type="doi">10.1101/gr.244293.118</citation>
        </citations>
    </xml>
</macros>