view bedtools_genomecov/genomeCoverageBed.xml @ 14:163cc2b61d5e draft default tip

Uploaded
author jackcurragh
date Fri, 27 Jan 2023 11:09:33 +0000
parents e956573b9f5a
children
line wrap: on
line source

<tool id="bedtools_genomecoveragebed" name="BedTools Genome Coverage" version="@TOOL_VERSION@" profile="@PROFILE@">
    <description>Compute Read Coverage Over An Entire Genome</description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="bio_tools" />
    <expand macro="requirements" />
    <expand macro="stdio" />
    <command><![CDATA[
bedtools genomecov
@GENOME_FILE_COVERAGE@

$split
$strand

#if str($report.report_select) == "bg":
    #if $report.zero_regions:
        $report.zero_regions
    #else:
        -bg
    #end if

    #if str($report.scale):
        -scale $report.scale
    #end if
#else:
    #if str($report.max):
        -max $report.max
    #end if
#end if
$d
$dz
$five
$three
| sort -k1,1 -k2,2n > '$output'
    ]]>
</command>
    <inputs>
        <conditional name="input_type">
            <param name="input_type_select" type="select" label="Input type">
                <option value="bed">@STD_BEDTOOLS_INPUT_LABEL@</option>
                <option value="bam" selected='true'>BAM</option>
            </param>
            <when value="bed">
                <param name="input" argument="-i" type="data" format="@STD_BEDTOOLS_INPUTS@" label="@STD_BEDTOOLS_INPUT_LABEL@ file" />
                <expand macro="input_conditional_genome_file" />
            </when>
            <when value="bam">
                <param name="input" argument="-ibam" type="data" format="bam" label="BAM file" />
            </when>
        </conditional>
        <conditional name="report">
            <param name="report_select" type="select" label="Output type">
                <option value="bg" selected="true">BedGraph coverage file</option>
                <option value="hist">Data suiteable for Histogram</option>
            </param>
            <when value="bg">
                <param name="zero_regions" argument="-bga" type="boolean" truevalue="-bga" falsevalue="" checked="false"
                    label="Report regions with zero coverage" help="If set, regions without any coverage will also be reported" />
                <param argument="-scale" type="float" value="1.0"
                    label="Scale the coverage by a constant factor"
                    help="Each bedGraph coverage value is multiplied by this factor before being reported. Useful for normalizing coverage by, e.g., reads per million (RPM)." />
            </when>
            <when value="hist">
                <param argument="-max" type="integer" value="0" label="Specify max depth"
                    help="Combine all positions with a depth >= max into a single bin in the histogram" />
            </when>
        </conditional>
        <expand macro="split" />
        <param argument="-strand" type="select" label="Calculate coverage based on">
            <option value="">both strands combined</option>
            <option value="-strand +">positive strand only</option>
            <option value="-strand -">negative strand only</option>
        </param>

        <param argument="-d" type="boolean" truevalue="-d" falsevalue="" checked="false"
            label="Report the depth at each genome position with 1-based coordinates" />
        <param argument="-dz" type="boolean" truevalue="-dz" falsevalue="" checked="false"
            label="Report the depth at each genome position with 0-based coordinatess" />
        <param name="five" argument="-5" type="boolean" truevalue="-5" falsevalue="" checked="false"
            label="Calculate coverage of 5’ positions" help="Instead of entire interval" />
        <param name="three" argument="-3" type="boolean" truevalue="-3" falsevalue="" checked="false"
            label="Calculate coverage of 3’ positions" help="Instead of entire interval" />
    </inputs>
    <outputs>
        <data name="output" format="bed">
            <change_format>
                <when input="report.report_select" value="hist" format="tabular" />
            </change_format>
        </data>
    </outputs>
    <tests>
        <test>
            <param name="input_type_select" value="bed" />
            <param name="input" value="genomeCoverageBed1.bed" ftype="bed" />
            <param name="genome_file_opts_selector" value="hist" />
            <param name="genome" value="genomeCoverageBed1.len" ftype="tabular" />
            <param name="report_select" value="hist" />
            <output name="output" file="genomeCoverageBed_result1.bed" ftype="tabular" />
        </test>
    </tests>
    <help><![CDATA[
**What it does**

This tool calculates the genome-wide coverage of intervals defined in a BAM or BED file and reports them in BedGraph format.

.. image:: $PATH_TO_IMAGES/genomecov-glyph.png

.. class:: warningmark

The input BED or BAM file must be sorted by chromosome name (but doesn't necessarily have to be sorted by start position).

-----

**Example 1**

Input (BED format)-
Overlapping, un-sorted intervals::

    chr1    140 176
    chr1    100 130
    chr1    120 147


Output (BedGraph format)-
Sorted, non-overlapping intervals, with coverage value on the 4th column::

    chr1    100 120 1
    chr1    120 130 2
    chr1    130 140 1
    chr1    140 147 2
    chr1    147 176 1

-----

**Example 2 - with ZERO-Regions selected (assuming hg19)**

Input (BED format)-
Overlapping, un-sorted intervals::

    chr1    140 176
    chr1    100 130
    chr1    120 147


BedGraph output will contain five columns:

    * 1. Chromosome name (or 'genome' for whole-genome coverage)
    * 2. Coverage depth
    * 3. The number of bases on chromosome (or genome) with depth equal to column 2.
    * 4. The size of chromosome (or entire genome) in base pairs
    * 5. The fraction of bases on chromosome (or entire genome) with depth equal to column 2.

**Example Output**:

    chr2L       0           1379895     23011544    0.0599653
    chr2L       1           837250      23011544    0.0363839
    chr2L       2           904442      23011544    0.0393038
    chr2L       3           913723      23011544    0.0397072
    chr2L       4           952166      23011544    0.0413778
    chr2L       5           967763      23011544    0.0420555
    chr2L       6           986331      23011544    0.0428624
    chr2L       7           998244      23011544    0.0433801
    chr2L       8           995791      23011544    0.0432735
    chr2L       9           996398      23011544    0.0432999


@REFERENCES@
    ]]></help>
    <expand macro="citations" />
</tool>