<tool id="macs2_predictd" name="MACS2 predictd" version="2.0.10.0">
    <description>Predict 'd' or fragment size from alignment results</description>
    <expand macro="requirements">
        <requirement type="package" version="3.0.1">R_3_0_1</requirement>
        <requirement type="package" version="4.1.0">gnu_awk</requirement>
    </expand>
    <expand macro="version_command" />
    <macros>
        <import>macs2_macros.xml</import>
    </macros>
    <command>
        macs2 predictd
            -i ${ ' '.join( map( lambda x:'"%s"' % ( x ), $infiles ) ) }
            @tag_size@
            @effective_genome_size@
            --bw "${ band_width }"
            --mfold "${ mfoldlo }" "${ mfoldhi }"

            ## remove the timepoint and strip the output
            2>&amp;1 | awk -F: '{print $4}' | awk '{$1=$1}1'

            &gt; "${ outfile }"
            
        &amp;&amp;

        Rscript predictd
    </command>
    <expand macro="stdio" />
    <inputs>
        <param name="infiles" type="data" format="bam,sam,bed" multiple="True" label="ChIP-seq alignment file" help="If multiple files are given, then they will all be read and combined. Note that pair-end data is not supposed to work with this command. (-i)" />
        <expand macro="conditional_effective_genome_size" />
        <expand macro="tag_size" />
        <expand macro="band_width" />

        <param name="mfoldlo" type="integer" label="Fold-enrichment lower limit" value="5"
            help="Select the regions with MFOLD high-confidence enrichment ratio against background to build model (--mfold)"/>
        <param name="mfoldhi" type="integer" label="Fold-enrichment upper-limit" value="50"
            help="Select the regions with MFOLD high-confidence enrichment ratio against background to build model (--mfold)"/>

    </inputs>

    <outputs>
        <data name="outfile" format="txt" label="${tool.name} on ${on_string} - d value" />
        <data name="outfile_image" from_work_dir="predictd_model.pdf" format="pdf" label="${tool.name} on ${on_string} - X-correlation image" />
    </outputs>
    <tests>
        <test>
            <param name="infiles" value="Control_200K.bed,ChIP_200K.bed" ftype="bed" />
            <param name="effective_genome_size_options_selector" value="3300000000" />
            <param name="tsize" value="-1.0"/>
            <param name="band_width" value="300"/>
            <param name="mfoldlo" value="5"/>
            <param name="mfoldhi" value="50"/>
            <output name="outfile" file="predictd_on_ChIP_200K_and_Control_200K.txt"/>
            <output name="outfile_image" file="predictd_on_ChIP_200K_and_Control_200K.pdf" lines_diff="5"/>
        </test>
    </tests>
    <help>
**What it does**

predictd from macs2


Note that pair-end data is not supposed to work with this command.


@citation@
    </help>
</tool>
