Mercurial > repos > bgruening > pileometh
changeset 3:f112bf3dd5ff draft
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/pileometh commit 5468fb89708be679e4e580074734e671f60a9648
author | bgruening |
---|---|
date | Mon, 13 Feb 2017 22:44:01 -0500 (2017-02-14) |
parents | cda51d96a9bc |
children | b327b539ec58 |
files | MethylDackel.xml PileOMeth.xml test-data/test_3.bedGraph test-data/test_4.bedGraph test-data/test_5.methylKit tool_dependencies.xml |
diffstat | 6 files changed, 605 insertions(+), 294 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MethylDackel.xml Mon Feb 13 22:44:01 2017 -0500 @@ -0,0 +1,453 @@ +<tool id="pileometh" name="MethylDackel" version="0.2.1"> + <description>A tool for processing bisulfite sequencing alignments</description> + <requirements> + <requirement type="package" version="0.2.1">methyldackel</requirement> + </requirements> + <stdio> + <!-- Anything other than zero is an error --> + <exit_code range="1:" /> + <exit_code range=":-1" /> + <!-- In case the return code has not been set propery check stderr too --> + <regex match="Error:" /> + <regex match="Exception:" /> + </stdio> + <version_command><![CDATA[MethylDackel --version]]></version_command> + <command><![CDATA[ + #if $reference_source.reference_source_selector == "cached": + ln -s $reference_source.ref_file.fields.path reference.fasta && + #else: + ln -s $reference_source.ref_file reference.fasta && + #end if + + MethylDackel + $main_task.task + + #if $main_task.task == "extract": + -o output + $main_task.mergeContext + #if str($main_task.OT).strip() != "": + --OT $main_task.OT + #end if + #if str($main_task.OB).strip() != "": + --OB $main_task.OB + #end if + #if str($main_task.CTOT).strip() != "": + --CTOT $main_task.CTOT + #end if + #if str($main_task.CTOB).strip() != "": + --CTOB $main_task.CTOB + #end if + #end if + + #if $advanced_options.options=="yes": + #if $advanced_options.mbias_regionString: + -r $advanced_options.mbias_regionString + #end if + $advanced_options.keepDupes + $advanced_options.keepSingleton + $advanced_options.keepDiscordant + -q $advanced_options.min_mapq + -p $advanced_options.min_phred + -D $advanced_options.max_pbdepth + #if $main_task.task == "extract": + -d $advanced_options.min_pbdepth + --ignoreFlags $advanced_options.ignoreFlags + --requireFlags $advanced_options.requireFlags + $advanced_options.fraction + $advanced_options.counts + $advanced_options.methylKit + $advanced_options.logit + #if str($advanced_options.nOT).strip() != "": + --nOT $advanced_options.nOT + #end if + #if str($advanced_options.nOB).strip() != "": + --nOB $advanced_options.nOB + #end if + #if str($advanced_options.nCTOT).strip() != "": + --nCTOT $advanced_options.nCTOT + #end if + #if str($advanced_options.nCTOB).strip() != "": + --nCTOB $advanced_options.nCTOB + #end if + #end if + $advanced_options.CHG + $advanced_options.CHH + #end if + + reference.fasta + + $input_sortedAlignBAM + + #if $main_task.task == "mbias": + out_mbias && + touch out_mbias_OT.svg && + touch out_mbias_OB.svg && + touch out_mbias_CTOT.svg && + touch out_mbias_CTOB.svg + #end if + ]]></command> + <inputs> + <conditional name="reference_source"> + <param name="reference_source_selector" type="select" label="Load reference genome from"> + <option value="cached">Local cache</option> + <option value="history">History</option> + </param> + <when value="cached"> + <param name="ref_file" type="select" label="Using reference genome" help="Reference sequence"> + <options from_data_table="all_fasta"/> + <validator type="no_options" message="A built-in reference genome is not available for the build associated with the selected input file"/> + </param> + </when> + <when value="history"> + <param name="ref_file" type="data" format="fasta" label="Use the folloing dataset as the reference sequence" help="REFERENCE_SEQUENCE; You can upload a FASTA sequence to the history and use it as reference" /> + </when> + </conditional> + + <param name="input_sortedAlignBAM" multiple="False" type="data" format="bam" label="sorted_alignments.bam"/> + <conditional name="main_task"> + <param name="task" type="select" label="What do you want to do?" > + <option value="extract">Extract methylation metrics from an alignment file in BAM/CRAM format</option> + <option value="mbias">Determine the position-dependent methylation bias in a dataset, producing diagnostic SVG images</option> + </param> + <when value="extract"> + <param name="mergeContext" type="boolean" checked="false" truevalue="--mergeContext" falsevalue="" + label="Merge per-Cytosine metrics from CpG and CHG contexts into per-CPG or per-CHG metrics" help="(--mergeContext)" /> + <param name="OT" type="text" value="" label="Original top strand bounds (comma-separated, no spaces)" + help="Inclusion bounds for methylation calls from reads/pairs + origination from the original top strand. Suggested values can + be obtained from the MBias program. Each integer represents a + 1-based position on a read. For example --OT A,B,C,D + translates to, 'Include calls at positions from A through B + on read #1 and C through D on read #2'. If a 0 is used a any + position then that is translated to mean start/end of the + alignment, as appropriate. For example, --OT 5,0,0,0 would + include all but the first 4 bases on read #1. Users are + strongly advised to consult a methylation bias plot, for + example by using the MBias program." /> + <param name="OB" type="text" value="" label="Original bottom strand bounds (comma-separated, no spaces)" /> + <param name="CTOT" type="text" value="" label="Complementary to the original bottom strand bounds (comma-separated, no spaces)" /> + <param name="CTOB" type="text" value="" label="Complementary to the original bottom strand bounds (comma-separated, no spaces)" /> + </when> + <when value="mbias"/> + </conditional> + <conditional name="advanced_options"> + <param name="options" type="select" label="Advanced options"> + <option value="">Hide advanced options</option> + <option value="yes">Display advanced options</option> + </param> + <when value="yes"> + <param name="mbias_regionString" type="text" value="" label="Region string in which to extract methylation"/> + <param name="keepDupes" type="boolean" checked="false" truevalue="--keepDupes" falsevalue="" + label="By default, any alignment marked as a duplicate is ignored. This option causes them to be incorporated" /> + <param name="keepSingleton" type="boolean" checked="false" truevalue="--keepSingleton" falsevalue="" + label="By default, if only one read in a pair aligns (a singleton) then it's ignored." /> + <param name="keepDiscordant" type="boolean" checked="false" truevalue="--keepDiscordant" falsevalue="" + label="By default, paired-end alignments with the properly-paired bit unset in the FLAG field are ignored. Note that the definition of concordant and discordant is based on your aligner settings." /> + <param name="min_mapq" type="integer" value="10" label="Minimum MAPQ threshold to include an alignment (default 10)"/> + <param name="min_phred" type="integer" value="5" label="Minimum Phred threshold to include a base (default 5). This must be >0."/> + <param name="max_pbdepth" type="integer" value="2000" label="Maximum per-base depth (default 2000)"/> + <param name="min_pbdepth" type="integer" value="1" min="1" label="Minimum per-base depth" + help="Minimum per-base dpeth for reporting output. If you use --mergeContext (above), then this applies to the merged CpG/CHG (default 1). (-d)" /> + + <param name="ignoreFlags" type="integer" value="3840" label="Ignore certain alignments" + help="By deault, any alignment marked as secondary (bit 0x100), failing QC (bit 0x200), a PCR/optical duplicate (0x400) or supplemental (0x800) is ignored. This equates to a value of 0xF00 or 3840 in decimal. If you would like to change that, you can specify a new value here." /> + <param name="requireFlags" type="integer" value="0" label="Require alignment flags" + help="Require each alignment to have all bits in this value present, or else the alignment is ignored. This is equivalent to the -f option in samtools. The default is 0, which includes all alignments." /> + + <param name="fraction" type="boolean" checked="false" truevalue="--fraction" falsevalue="" + label="Extract fractional methylation (only) at each position. This is mutually exclusive with --counts, --logit, and --methylKit" /> + <param name="counts" type="boolean" checked="false" truevalue="--counts" falsevalue="" + label="Extract base counts (only) at each position. This is mutually exclusive with --fraction, --logit, and --methylKit" /> + <param name="logit" type="boolean" checked="false" truevalue="--logit" falsevalue="" + label="Extract logit(M/(M+U)) (only) at each position. This is mutually exclusive with --counts, --fraction, and --methylKit" /> + <param name="methylKit" type="boolean" checked="false" truevalue="--methylKit" falsevalue="" + label="Output in the format required by methylKit. This is mutually exclusive with --counts, --fraction, and --logit" /> + + <param name="CHG" type="boolean" checked="false" truevalue="--CHG" falsevalue="" + label="Additional output file with CHG methylation metrics" /> + <param name="CHH" type="boolean" checked="false" truevalue="--CHH" falsevalue="" + label="Additional output file with CHH methylation metrics" /> + + <param name="nOT" type="text" value="" label="Original top strand absolute bounds (comma-separated, no spaces)" + help="Like --OT, but always exclude INT bases from a given end + from inclusion,regardless of the length of an alignment. This + is useful in cases where reads may have already been trimmed + to different lengths, but still none-the-less contain a + certain length bias at one or more ends." /> + <param name="nOB" type="text" value="" label="Original bottom strand absolute bounds (comma-separated, no spaces)" /> + <param name="nCTOT" type="text" value="" label="Complementary to the original bottom strand absolute bounds (comma-separated, no spaces)" /> + <param name="nCTOB" type="text" value="" label="Complementary to the original bottom strand absolute bounds (comma-separated, no spaces)" /> + </when> + <when value=""/> + </conditional> + </inputs> + <outputs> + <data name="outFileExtractCpG" format="bedgraph" from_work_dir="output_CpG.bedGraph" + label="${tool.name} on ${on_string}"> + <filter>main_task['task'] == "extract"</filter> + <filter>not advanced_options['logit']</filter> + <filter>not advanced_options['methylKit']</filter> + <filter>not advanced_options['counts']</filter> + <filter>not advanced_options['fraction']</filter> + </data> + <data name="outFileExtractCpGLogit" format="bedgraph" from_work_dir="output_CpG.logit.bedGraph" + label="${tool.name} on ${on_string} (logit)"> + <filter>main_task['task'] == "extract" and advanced_options['logit']</filter> + </data> + <data name="outFileExtractCpGMethylKit" format="text" from_work_dir="output_CpG.methylKit" + label="${tool.name} on ${on_string} (MethylKit)"> + <filter>main_task['task'] == "extract" and advanced_options['methylKit']</filter> + </data> + <data name="outFileExtractCpGCounts" format="bedgraph" from_work_dir="output_CpG.counts.bedGraph" + label="${tool.name} on ${on_string} (counts)"> + <filter>main_task['task'] == "extract" and advanced_options['counts']</filter> + </data> + <data name="outFileExtractCpGFraction" format="bedgraph" from_work_dir="output_CpG.meth.bedGraph" + label="${tool.name} on ${on_string} (fraction)"> + <filter>main_task['task'] == "extract" and advanced_options['fraction']</filter> + </data> + <data name="outFileExtractCHG" format="bedgraph" from_work_dir="output_CHG.bedGraph" + label="${tool.name} on ${on_string} (CHG)"> + <filter>main_task['task'] == 'extract'</filter> + <filter>advanced_options['options'] == "yes"</filter> + <filter>advanced_options['CHG']</filter> + <filter>not advanced_options['logit']</filter> + <filter>not advanced_options['methylKit']</filter> + <filter>not advanced_options['counts']</filter> + <filter>not advanced_options['fraction']</filter> + </data> + <data name="outFileExtractCHGLogit" format="bedgraph" from_work_dir="output_CHG.logit.bedGraph" + label="${tool.name} on ${on_string} (CHG logit)"> + <filter>main_task['task'] == "extract" and advanced_options['logit']</filter> + <filter>advanced_options['options'] == "yes"</filter> + <filter>advanced_options['CHG']</filter> + </data> + <data name="outFileExtractCHGMethylKit" format="text" from_work_dir="output_CHG.methylKit" + label="${tool.name} on ${on_string} (CHG MethylKit)"> + <filter>main_task['task'] == "extract" and advanced_options['methylKit']</filter> + <filter>advanced_options['options'] == "yes"</filter> + <filter>advanced_options['CHG']</filter> + </data> + <data name="outFileExtractCHGCounts" format="bedgraph" from_work_dir="output_CHG.counts.bedGraph" + label="${tool.name} on ${on_string} (CHG counts)"> + <filter>main_task['task'] == "extract" and advanced_options['counts']</filter> + <filter>advanced_options['options'] == "yes"</filter> + <filter>advanced_options['CHG']</filter> + </data> + <data name="outFileExtractCHGFraction" format="bedgraph" from_work_dir="output_CHG.meth.bedGraph" + label="${tool.name} on ${on_string} (CHG fraction)"> + <filter>main_task['task'] == "extract" and advanced_options['fraction']</filter> + <filter>advanced_options['options'] == "yes"</filter> + <filter>advanced_options['CHG']</filter> + </data> + <data name="outFileExtractCHH" format="bedgraph" from_work_dir="output_CHH.bedGraph" + label="${tool.name} on ${on_string} (CHH)"> + <filter>main_task['task'] == 'extract'</filter> + <filter>advanced_options['options'] == "yes"</filter> + <filter>advanced_options['CHH']</filter> + <filter>not advanced_options['logit']</filter> + <filter>not advanced_options['methylKit']</filter> + <filter>not advanced_options['counts']</filter> + <filter>not advanced_options['fraction']</filter> + </data> + <data name="outFileExtractCHHLogit" format="bedgraph" from_work_dir="output_CHH.logit.bedGraph" + label="${tool.name} on ${on_string} (CHH logit)"> + <filter>main_task['task'] == "extract" and advanced_options['logit']</filter> + <filter>advanced_options['options'] == "yes"</filter> + <filter>advanced_options['CHH']</filter> + </data> + <data name="outFileExtractCHHMethylKit" format="text" from_work_dir="output_CHH.methylKit" + label="${tool.name} on ${on_string} (CHH MethylKit)"> + <filter>main_task['task'] == "extract" and advanced_options['methylKit']</filter> + <filter>advanced_options['options'] == "yes"</filter> + <filter>advanced_options['CHH']</filter> + </data> + <data name="outFileExtractCHHCounts" format="bedgraph" from_work_dir="output_CHH.counts.bedGraph" + label="${tool.name} on ${on_string} (CHH counts)"> + <filter>main_task['task'] == "extract" and advanced_options['counts']</filter> + <filter>advanced_options['options'] == "yes"</filter> + <filter>advanced_options['CHH']</filter> + </data> + <data name="outFileExtractCHHFraction" format="bedgraph" from_work_dir="output_CHH.meth.bedGraph" + label="${tool.name} on ${on_string} (CHH fraction)"> + <filter>main_task['task'] == "extract" and advanced_options['fraction']</filter> + <filter>advanced_options['options'] == "yes"</filter> + <filter>advanced_options['CHH']</filter> + </data> + <data name="outFileMbiasCpGOT" format="svg" from_work_dir="out_mbias_OT.svg" + label="${tool.name} on ${on_string} (methylation bias, original top strand)"> + <filter>main_task['task'] == 'mbias'</filter> + </data> + <data name="outFileMbiasCpGOB" format="svg" from_work_dir="out_mbias_OB.svg" + label="${tool.name} on ${on_string} (methylation bias, original bottom strand)"> + <filter>main_task['task'] == 'mbias'</filter> + </data> + <data name="outFileMbiasCpGCTOT" format="svg" from_work_dir="out_mbias_CTOT.svg" + label="${tool.name} on ${on_string} (methylation bias, complementary to the original top strand)"> + <filter>main_task['task'] == 'mbias'</filter> + </data> + <data name="outFileMbiasCpGCTOB" format="svg" from_work_dir="out_mbias_CTOB.svg" + label="${tool.name} on ${on_string} (methylation bias, complementary to the original bottom strand)"> + <filter>main_task['task'] == 'mbias'</filter> + </data> + </outputs> + <tests> + <test> + <param name="task" value="extract" /> + <param name="min_mapq" value="2" /> + <param name="reference_source_selector" value="history" /> + <param name="ref_file" value="cg100.fa" ftype="fasta" /> + <param name="input_sortedAlignBAM" value="cg_aln.bam" ftype="bam"/> + <param name="mergeContext" value="false"/> + <param name="options" value="yes"/> + <output name="outFileExtractCpG" file="test_1.bedGraph" ftype="bedgraph" compare="diff"/> + </test> + <test> + <param name="task" value="mbias" /> + <param name="min_mapq" value="2" /> + <param name="options" value="yes"/> + <param name="reference_source_selector" value="history" /> + <param name="ref_file" value="cg100.fa" ftype="fasta" /> + <param name="input_sortedAlignBAM" value="cg_aln.bam" ftype="bam"/> + <output name="outFileMbiasCpG" file="test_2_output.svg" ftype="svg" compare="diff"/> + </test> + <test> + <param name="task" value="extract" /> + <param name="min_mapq" value="2" /> + <param name="options" value="yes"/> + <param name="CHH" value="True"/> + <param name="reference_source_selector" value="history" /> + <param name="ref_file" value="cg100.fa" ftype="fasta" /> + <param name="input_sortedAlignBAM" value="cg_aln.bam" ftype="bam"/> + <param name="mergeContext" value="false"/> + <param name="options" value="yes"/> + <output name="outFileExtractCpG" file="test_1.bedGraph" ftype="bedgraph" compare="diff"/> + <output name="outFileExtractCHH" file="test_2.bedGraph" ftype="bedgraph" compare="diff"/> + </test> + <test> + <param name="task" value="extract" /> + <param name="min_mapq" value="2" /> + <param name="reference_source_selector" value="history" /> + <param name="ref_file" value="cg100.fa" ftype="fasta" /> + <param name="input_sortedAlignBAM" value="cg_aln.bam" ftype="bam"/> + <param name="options" value="yes"/> + <param name="fraction" value="true" /> + <output name="outFileExtractCpGFraction" file="test_3.bedGraph" ftype="bedgraph" compare="diff"/> + </test> + <test> + <param name="task" value="extract" /> + <param name="min_mapq" value="2" /> + <param name="reference_source_selector" value="history" /> + <param name="ref_file" value="cg100.fa" ftype="fasta" /> + <param name="input_sortedAlignBAM" value="cg_aln.bam" ftype="bam"/> + <param name="options" value="yes"/> + <param name="logit" value="true" /> + <output name="outFileExtractCpGLogit" file="test_4.bedGraph" ftype="bedgraph" compare="diff"/> + </test> + <test> + <param name="task" value="extract" /> + <param name="min_mapq" value="2" /> + <param name="reference_source_selector" value="history" /> + <param name="ref_file" value="cg100.fa" ftype="fasta" /> + <param name="input_sortedAlignBAM" value="cg_aln.bam" ftype="bam"/> + <param name="options" value="yes"/> + <param name="methylKit" value="true" /> + <output name="outFileExtractCpGMethylKit" file="test_5.methylKit" ftype="text" compare="diff"/> + </test> + </tests> + <help><![CDATA[ + +.. image:: $PATH_TO_IMAGES/MethylDackelLogo.png + :align: left + +**What it does** + +MethylDackel (formerly named PileOMeth, which was a temporary name derived due to it using a PILEup to extract METHylation metrics) will process a coordinate-sorted and indexed BAM or CRAM file containing some form of BS-seq alignments and extract per-base methylation metrics from them. MethylDackel requires an indexed fasta file containing the reference genome as well. + +By default, MethylDackel will only calculate metrics for Cytosines in a CpG context, but metrics for those in CHG and CHH contexts are supported as well. + +**Methylation context** + +MethylDackel groups all Cytosines into one of three sequence contexts: CpG, CHG, and CHH. Here, H is the IUPAC ambiguity code for any nucleotide other than G. If an N is encountered in the reference sequence, then the context will be assigned to CHG or CHH, as appropriate (e.g., CNG would be categorized as in a CHG context and CNC as in a CHH context). If a Cytosine is close enough to the end of a chromosome/contig such that its context can't be inferred, then it is categorized as CHH (e.g., a Cytosine as the last base of a chromosome is considered as being in a CHH context). + + +**Output information** + +If no methylation can be found, the output will be empty. + +Otherwise a variant of bedGraph that's similar to the "coverage" file is produced. In short, each line consists of 6 tab separated columns: + +1. The chromosome/contig/scaffold name +2. The start coordinate +3. The end coordinate +4. The methylation percentage rounded to an integer +5. The number of alignments/pairs reporting methylated bases +6. The number of alignments/pairs reporting unmethylated bases + +All coordinates are 0-based half open, which conforms to the bedGraph definition. When paired-end reads are aligned, it can often occur that their alignments overlap. In such cases, MethylDackel will not count both reads of the pair in its output, as doing so would lead to incorrect downstream statistical results. + +An example of the output is below:: + +#track type="bedGraph" description="SRR1182519.sorted CpG methylation levels" +#1 25115 25116 100 3 0 +#1 29336 29337 50 1 1 + +Note the header line, which starts with "track". The "description" field is used as a label in programs such as IGV. Each of the subsequent lines describe single Cytosines, the 25116th and 29337th base on chromosome 1, respectively. The first position has 3 alignments (or pairs of alignments) indicating methylation and 0 indicating unmethylation (100% methylation) and the second position has 1 alignment each supporting methylation and unmethylation (50% methylation). + +**Per-CpG/CHG metrics** + +In many circumstances, it's desireable for metrics from individual Cytosines in a CpG to be merged, producing per-CpG metrics rather than per-Cytosine metrics. This can be accomplished with the **Merge per-Cytosine** parameter. If this is used, then this output:: + +#track type="bedGraph" description="SRR1182519.sorted CpG methylation levels" +#1 25114 25115 100 2 1 +#1 25115 25116 100 3 0 + +is changed to this:: + +#track type="bedGraph" description="SRR1182519.sorted merged CpG methylation levels" +#1 25114 25116 100 5 1 + +This also works for CHG-level metrics. If bedGraph files containing per-Cytosine metrics already exist, they can be converted to instead contain per-CpG/CHG metrics with MethylDackel mergeContext. + +**Methylation bias plotting and correction** + +In an ideal experiment, we expect that the probability of observing a methylated C is constant across the length of any given read. In practice, however, there are often increases/decreases in observed methylation rate at the ends of reads and/or more global changes. These are termed methylation bias and including such regions in the extracted methylation metrics will result in noisier and less accurate data. For this reason, users are strongly encouraged to make a methylation bias plot. + +That command will create a methylation bias (mbias for short) plot for each of the strands for which there are valid alignments. +The resulting mbias graphs are in SVG format and can be viewed in most modern web browsers: + +.. image:: $PATH_TO_IMAGES/example.svg + + +If you have paired-end data, both reads in the pair will be shown separately, as is the case above. The program will suggest regions for inclusion ("--OT 2,0,0,98" above) and mark them on the plot, if applicable. The format of this output is described in MethylDackel extract -h. These suggestions should not be accepted blindly; users are strongly encouraged to have a look for themselves and tweak the actual bounds as appropriate. The lines indicate the average methylation percentage at a given position and the shaded regions the 99.9% confidence interval around it. This is useful in gauging how many methylation calls a given position has relative to its neighbors. Note the spike in methylation at the end of read #2 and the corresponding dip at the beginning of read #1. This is common and these regions can be ignored with the suggested trimming bounds. Note also that the numbers refer to the first and last base that should be included during methylation extraction, not the last and first base to ignore!. + +**Excluding low-coverage regions** + +If your downstream analysis requires an absolute minimum coverage (here, defined as the number of methylation calls kept after filtering for MAPQ, phred score, etc.), you can use the `--minDepth` option to achieve this. By default, `MethylDackel extract` will output all methylation metrics as long as the coverage is at least 1. If you use `--minDepth 10`, then only sites covered at least 10x will be output. This works in conjunction with the `--mergeContext` option, above. So if you request per-CpG context output (i.e., with `--mergeContext`) and `--minDepth 10` then only CpGs with a minimum coverage of 10 will be output. + +**Logit, fraction, and counts only output** + +The standard output described above can be modified if you supply the `--fraction`, `--counts`, or `--logit` options to `MethylDackel extract`. + +The `--fraction` option essentially produces the first 4 columns of the standard output described above. The only other difference is that the range of the 4th column is now between 0 and 1, instead of 0 and 100. Instead of producing a file ending simply in `.bedGraph`, one ending in `.meth.bedGraph` will instead be produced. + +The `--counts` option produces the first three columns of the standard output followed by a column of total coverage counts. This last column is equivalent to the sum of the 5th and 6th columns of the standard output. The resulting file ends in `.counts.bedGraph` rather than simply `.bedGraph`. + +The `--logit` option produces the first three columns of the standard output followed by the logit transformed methylation fraction. The logit transformation is log(Methylation fraction/(1-Methylation fraction)). Note that log uses base e. Logit transformed methylation values range between +/- infinity, rather than [0,1]. The resulting file ends in `.logit.bedGraph` rather than simply `.bedGraph`. + +Note that these options may be combined with `--mergeContext`. However, `MethylDackel mergeContext` can not be used after the fact to combine these. + +**methylKit-compatible output** + +methylKit has its own format, which can be produced with the `--methylKit` option. Merging Cs into CpGs or CHGs is forbidden in this format. Likewise, this option is mutually exclusive with `--logit` et al. + + +----- + +**MethylDackel** is a Free and Open Source Software, see more details on the MethylDackel_ Website. + +.. _MethylDackel: https://github.com/dpryan79/MethylDackel + ]]></help> + <citations> + </citations> +</tool>
--- a/PileOMeth.xml Mon Feb 13 07:09:59 2017 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,289 +0,0 @@ -<tool id="pileometh" name="PileOMeth" version="0.1.13"> - <description>A tool for processing bisulfite sequencing alignments</description> - <requirements> - <requirement type="package" version="0.1.13">pileometh</requirement> - </requirements> - <stdio> - <!-- Anything other than zero is an error --> - <exit_code range="1:" /> - <exit_code range=":-1" /> - <!-- In case the return code has not been set propery check stderr too --> - <regex match="Error:" /> - <regex match="Exception:" /> - </stdio> - <version_command><![CDATA[PileOMeth --version]]></version_command> - <command><![CDATA[ - #if $reference_source.reference_source_selector == "cached": - ln -s $reference_source.ref_file.fields.path reference.fasta && - #else: - ln -s $reference_source.ref_file reference.fasta && - #end if - - PileOMeth - $main_task.task - - #if $main_task.task == "extract": - -o output - $main_task.mergeContext - #if str($main_task.OT).strip() != "": - --OT $main_task.OT - #end if - #if str($main_task.OB).strip() != "": - --OB $main_task.OB - #end if - #if str($main_task.CTOT).strip() != "": - --CTOT $main_task.CTOT - #end if - #if str($main_task.CTOB).strip() != "": - --CTOB $main_task.CTOB - #end if - $main_task.keepSingleton - $main_task.keepDiscordant - $main_task.fraction - #end if - - #if $advanced_options.options=="yes": - #if $advanced_options.mbias_regionString: - -r $advanced_options.mbias_regionString - #end if - $advanced_options.keepDupes - $advanced_options.keepSingleton - -q $advanced_options.min_mapq - -p $advanced_options.min_phred - -D $advanced_options.max_pbdepth - #if $main_task.task == "extract": - -d $advanced_options.min_pbdepth - #end if - $advanced_options.CHG - $advanced_options.CHH - #end if - - reference.fasta - - $input_sortedAlignBAM - - #if $main_task.task == "mbias": - $main_task.keepSingleton_mbias - $main_task.keepDiscordant_mbias - out_mbias && - touch out_mbias_OT.svg && - touch out_mbias_OB.svg && - touch out_mbias_CTOT.svg && - touch out_mbias_CTOB.svg - #end if - ]]></command> - <inputs> - <conditional name="reference_source"> - <param name="reference_source_selector" type="select" label="Load reference genome from"> - <option value="cached">Local cache</option> - <option value="history">History</option> - </param> - <when value="cached"> - <param name="ref_file" type="select" label="Using reference genome" help="Reference sequence"> - <options from_data_table="all_fasta"/> - <validator type="no_options" message="A built-in reference genome is not available for the build associated with the selected input file"/> - </param> - </when> - <when value="history"> - <param name="ref_file" type="data" format="fasta" label="Use the folloing dataset as the reference sequence" help="REFERENCE_SEQUENCE; You can upload a FASTA sequence to the history and use it as reference" /> - </when> - </conditional> - - <param name="input_sortedAlignBAM" multiple="False" type="data" format="bam" label="sorted_alignments.bam"/> - <conditional name="main_task"> - <param name="task" type="select" label="What do you want to do?" > - <option value="extract">Extract methylation metrics from an alignment file in BAM/CRAM format</option> - <option value="mbias">Determine the position-dependent methylation bias in a dataset, producing diagnostic SVG images</option> - </param> - <when value="extract"> - <param name="mergeContext" type="boolean" checked="false" truevalue="--mergeContext" falsevalue="" - label="Merge per-Cytosine metrics from CpG and CHG contexts into per-CPG or per-CHG metrics" help="(--mergeContext)" /> - <param name="OT" type="text" value="" label="Original top strand bounds (comma-separated, no spaces)" - help="Inclusion bounds for methylation calls from reads/pairs - origination from the original top strand. Suggested values can - be obtained from the MBias program. Each integer represents a - 1-based position on a read. For example --OT A,B,C,D - translates to, 'Include calls at positions from A through B - on read #1 and C through D on read #2'. If a 0 is used a any - position then that is translated to mean start/end of the - alignment, as appropriate. For example, --OT 5,0,0,0 would - include all but the first 4 bases on read #1. Users are - strongly advised to consult a methylation bias plot, for - example by using the MBias program." /> - <param name="OB" type="text" value="" label="Original bottom strand bounds (comma-separated, no spaces)" /> - <param name="CTOT" type="text" value="" label="Complementary to the original bottom strand bounds (comma-separated, no spaces)" /> - <param name="CTOB" type="text" value="" label="Complementary to the original bottom strand bounds (comma-separated, no spaces)" /> - <param name="keepSingleton" type="boolean" checked="false" truevalue="--keepSingleton" falsevalue="" /> - <param name="keepDiscordant" type="boolean" checked="false" truevalue="--keepDiscordant" falsevalue="" /> - <param name="fraction" type="boolean" checked="false" truevalue="--fraction" falsevalue="" /> - - </when> - <when value="mbias"> - <param name="keepSingleton_mbias" type="boolean" checked="false" truevalue="--keepSingleton" falsevalue="" /> - <param name="keepDiscordant_mbias" type="boolean" checked="false" truevalue="--keepDiscordant" falsevalue="" /> - </when> - </conditional> - <conditional name="advanced_options"> - <param name="options" type="select" label="Advanced options"> - <option value="">Hide advanced options</option> - <option value="yes">Display advanced options</option> - </param> - <when value="yes"> - <param name="mbias_regionString" type="text" value="" label="Region string in which to extract methylation"/> - <param name="keepDupes" type="boolean" checked="false" truevalue="--keepDupes" falsevalue="" - label="By default, any alignment marked as a duplicate is ignored. This option causes them to be incorporated" /> - <param name="keepSingleton" type="boolean" checked="false" truevalue="--keepSingleton" falsevalue="" - label="By default, if only one read in a pair aligns (a singleton) then it's ignored." /> - <param name="min_mapq" type="integer" value="10" label="Minimum MAPQ threshold to include an alignment (default 10)"/> - <param name="min_phred" type="integer" value="5" label="Minimum Phred threshold to include a base (default 5). This must be >0."/> - <param name="max_pbdepth" type="integer" value="2000" label="Maximum per-base depth (default 2000)"/> - <param name="min_pbdepth" type="integer" value="1" min="1" label="Minimum per-base depth" - help="Minimum per-base dpeth for reporting output. If you use --mergeContext (above), then this applies to the merged CpG/CHG (default 1). (-d)" /> - - <param name="CHG" type="boolean" checked="false" truevalue="--CHG" falsevalue="" - label="Additional output file with CHG methylation metrics" /> - <param name="CHH" type="boolean" checked="false" truevalue="--CHH" falsevalue="" - label="Additional output file with CHH methylation metrics" /> - </when> - <when value=""/> - </conditional> - </inputs> - <outputs> - <data name="outFileExtractCpG" format="bedgraph" from_work_dir="output_CpG.bedGraph" - label="${tool.name} on ${on_string}"> - <filter>main_task['task'] == "extract"</filter> - </data> - <data name="outFileExtractCHG" format="bedgraph" from_work_dir="output_CHG.bedGraph" - label="${tool.name} on ${on_string} (CHG)"> - <filter>main_task['task'] == 'extract'</filter> - <filter>advanced_options['options'] == "yes"</filter> - <filter>advanced_options['CHG']</filter> - </data> - <data name="outFileExtractCHH" format="bedgraph" from_work_dir="output_CHH.bedGraph" - label="${tool.name} on ${on_string} (CHH)"> - <filter>main_task['task'] == 'extract'</filter> - <filter>advanced_options['options'] == "yes"</filter> - <filter>advanced_options['CHH']</filter> - </data> - <data name="outFileMbiasCpGOT" format="svg" from_work_dir="out_mbias_OT.svg" - label="${tool.name} on ${on_string} (methylation bias, original top strand)"> - <filter>main_task['task'] == 'mbias'</filter> - </data> - <data name="outFileMbiasCpGOB" format="svg" from_work_dir="out_mbias_OB.svg" - label="${tool.name} on ${on_string} (methylation bias, original bottom strand)"> - <filter>main_task['task'] == 'mbias'</filter> - </data> - <data name="outFileMbiasCpGCTOT" format="svg" from_work_dir="out_mbias_CTOT.svg" - label="${tool.name} on ${on_string} (methylation bias, complementary to the original top strand)"> - <filter>main_task['task'] == 'mbias'</filter> - </data> - <data name="outFileMbiasCpGCTOB" format="svg" from_work_dir="out_mbias_CTOB.svg" - label="${tool.name} on ${on_string} (methylation bias, complementary to the original bottom strand)"> - <filter>main_task['task'] == 'mbias'</filter> - </data> - </outputs> - <tests> - <test> - <param name="task" value="extract" /> - <param name="min_mapq" value="2" /> - <param name="reference_source_selector" value="history" /> - <param name="ref_file" value="cg100.fa" ftype="fasta" /> - <param name="input_sortedAlignBAM" value="cg_aln.bam" ftype="bam"/> - <param name="mergeContext" value="false"/> - <param name="options" value="yes"/> - <output name="outFileExtractCpG" file="test_1.bedGraph" ftype="bedgraph" compare="diff"/> - </test> - <test> - <param name="task" value="mbias" /> - <param name="min_mapq" value="2" /> - <param name="options" value="yes"/> - <param name="reference_source_selector" value="history" /> - <param name="ref_file" value="cg100.fa" ftype="fasta" /> - <param name="input_sortedAlignBAM" value="cg_aln.bam" ftype="bam"/> - <output name="outFileMbiasCpG" file="test_2_output.svg" ftype="svg" compare="diff"/> - </test> - <test> - <param name="task" value="extract" /> - <param name="min_mapq" value="2" /> - <param name="options" value="yes"/> - <param name="CHH" value="True"/> - <param name="reference_source_selector" value="history" /> - <param name="ref_file" value="cg100.fa" ftype="fasta" /> - <param name="input_sortedAlignBAM" value="cg_aln.bam" ftype="bam"/> - <param name="mergeContext" value="false"/> - <param name="options" value="yes"/> - <output name="outFileExtractCpG" file="test_1.bedGraph" ftype="bedgraph" compare="diff"/> - <output name="outFileExtractCHH" file="test_2.bedGraph" ftype="bedgraph" compare="diff"/> - </test> - </tests> - <help><![CDATA[ -**What it does** - -PileOMeth (using a PILEup to extract METHylation metrics) will process a coordinate-sorted and indexed BAM or CRAM file containing some form of BS-seq alignments and extract per-base methylation metrics from them. PileOMeth requires an indexed fasta file containing the reference genome as well. - -By default, PileOMeth will only calculate metrics for Cytosines in a CpG context, but metrics for those in CHG and CHH contexts are supported as well. - -**Methylation context** - -PileOMeth groups all Cytosines into one of three sequence contexts: CpG, CHG, and CHH. Here, H is the IUPAC ambiguity code for any nucleotide other than G. If an N is encountered in the reference sequence, then the context will be assigned to CHG or CHH, as appropriate (e.g., CNG would be categorized as in a CHG context and CNC as in a CHH context). If a Cytosine is close enough to the end of a chromosome/contig such that its context can't be inferred, then it is categorized as CHH (e.g., a Cytosine as the last base of a chromosome is considered as being in a CHH context). - - -**Output information** - -If no methylation can be found, the output will be empty. - -Otherwise a variant of bedGraph that's similar to the "coverage" file is produced. In short, each line consists of 6 tab separated columns: - -1. The chromosome/contig/scaffold name -2. The start coordinate -3. The end coordinate -4. The methylation percentage rounded to an integer -5. The number of alignments/pairs reporting methylated bases -6. The number of alignments/pairs reporting unmethylated bases - -All coordinates are 0-based half open, which conforms to the bedGraph definition. When paired-end reads are aligned, it can often occur that their alignments overlap. In such cases, PileOMeth will not count both reads of the pair in its output, as doing so would lead to incorrect downstream statistical results. - -An example of the output is below:: - -#track type="bedGraph" description="SRR1182519.sorted CpG methylation levels" -#1 25115 25116 100 3 0 -#1 29336 29337 50 1 1 - -Note the header line, which starts with "track". The "description" field is used as a label in programs such as IGV. Each of the subsequent lines describe single Cytosines, the 25116th and 29337th base on chromosome 1, respectively. The first position has 3 alignments (or pairs of alignments) indicating methylation and 0 indicating unmethylation (100% methylation) and the second position has 1 alignment each supporting methylation and unmethylation (50% methylation). - -**Per-CpG/CHG metrics** - -In many circumstances, it's desireable for metrics from individual Cytosines in a CpG to be merged, producing per-CpG metrics rather than per-Cytosine metrics. This can be accomplished with the **Merge per-Cytosine** parameter. If this is used, then this output:: - -#track type="bedGraph" description="SRR1182519.sorted CpG methylation levels" -#1 25114 25115 100 2 1 -#1 25115 25116 100 3 0 - -is changed to this:: - -#track type="bedGraph" description="SRR1182519.sorted merged CpG methylation levels" -#1 25114 25116 100 5 1 - -This also works for CHG-level metrics. If bedGraph files containing per-Cytosine metrics already exist, they can be converted to instead contain per-CpG/CHG metrics with PileOMeth mergeContext. - -**Methylation bias plotting and correction** - -In an ideal experiment, we expect that the probability of observing a methylated C is constant across the length of any given read. In practice, however, there are often increases/decreases in observed methylation rate at the ends of reads and/or more global changes. These are termed methylation bias and including such regions in the extracted methylation metrics will result in noisier and less accurate data. For this reason, users are strongly encouraged to make a methylation bias plot. - -That command will create a methylation bias (mbias for short) plot for each of the strands for which there are valid alignments. -The resulting mbias graphs are in SVG format and can be viewed in most modern web browsers: - -.. image:: example.svg - - -If you have paired-end data, both reads in the pair will be shown separately, as is the case above. The program will suggest regions for inclusion ("--OT 2,0,0,98" above) and mark them on the plot, if applicable. The format of this output is described in PileOMeth extract -h. These suggestions should not be accepted blindly; users are strongly encouraged to have a look for themselves and tweak the actual bounds as appropriate. The lines indicate the average methylation percentage at a given position and the shaded regions the 99.9% confidence interval around it. This is useful in gauging how many methylation calls a given position has relative to its neighbors. Note the spike in methylation at the end of read #2 and the corresponding dip at the beginning of read #1. This is common and these regions can be ignored with the suggested trimming bounds. Note also that the numbers refer to the first and last base that should be included during methylation extraction, not the last and first base to ignore!. - ------ - -**PileOMeth** is a Free and Open Source Software, see more details on the PileOMeth_ Website. - -.. _PileOMeth: https://github.com/dpryan79/PileOMeth - ]]></help> - <citations> - </citations> -</tool>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/test_3.bedGraph Mon Feb 13 22:44:01 2017 -0500 @@ -0,0 +1,49 @@ +track type="bedGraph" description="output CpG methylation fractions" +chrCG 0 1 1.000000 +chrCG 2 3 1.000000 +chrCG 4 5 1.000000 +chrCG 6 7 1.000000 +chrCG 8 9 1.000000 +chrCG 10 11 1.000000 +chrCG 12 13 1.000000 +chrCG 14 15 1.000000 +chrCG 18 19 1.000000 +chrCG 20 21 1.000000 +chrCG 22 23 1.000000 +chrCG 24 25 1.000000 +chrCG 26 27 1.000000 +chrCG 28 29 1.000000 +chrCG 30 31 1.000000 +chrCG 32 33 1.000000 +chrCG 34 35 1.000000 +chrCG 36 37 1.000000 +chrCG 38 39 1.000000 +chrCG 40 41 1.000000 +chrCG 42 43 1.000000 +chrCG 44 45 1.000000 +chrCG 46 47 1.000000 +chrCG 48 49 1.000000 +chrCG 50 51 1.000000 +chrCG 52 53 1.000000 +chrCG 54 55 1.000000 +chrCG 56 57 1.000000 +chrCG 58 59 1.000000 +chrCG 60 61 1.000000 +chrCG 62 63 1.000000 +chrCG 64 65 1.000000 +chrCG 66 67 1.000000 +chrCG 68 69 1.000000 +chrCG 70 71 1.000000 +chrCG 72 73 1.000000 +chrCG 74 75 1.000000 +chrCG 76 77 1.000000 +chrCG 78 79 1.000000 +chrCG 80 81 1.000000 +chrCG 82 83 1.000000 +chrCG 84 85 1.000000 +chrCG 86 87 1.000000 +chrCG 88 89 1.000000 +chrCG 90 91 1.000000 +chrCG 92 93 1.000000 +chrCG 94 95 1.000000 +chrCG 96 97 1.000000
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/test_4.bedGraph Mon Feb 13 22:44:01 2017 -0500 @@ -0,0 +1,49 @@ +track type="bedGraph" description="output CpG logit transformed methylation fractions" +chrCG 0 1 inf +chrCG 2 3 inf +chrCG 4 5 inf +chrCG 6 7 inf +chrCG 8 9 inf +chrCG 10 11 inf +chrCG 12 13 inf +chrCG 14 15 inf +chrCG 18 19 inf +chrCG 20 21 inf +chrCG 22 23 inf +chrCG 24 25 inf +chrCG 26 27 inf +chrCG 28 29 inf +chrCG 30 31 inf +chrCG 32 33 inf +chrCG 34 35 inf +chrCG 36 37 inf +chrCG 38 39 inf +chrCG 40 41 inf +chrCG 42 43 inf +chrCG 44 45 inf +chrCG 46 47 inf +chrCG 48 49 inf +chrCG 50 51 inf +chrCG 52 53 inf +chrCG 54 55 inf +chrCG 56 57 inf +chrCG 58 59 inf +chrCG 60 61 inf +chrCG 62 63 inf +chrCG 64 65 inf +chrCG 66 67 inf +chrCG 68 69 inf +chrCG 70 71 inf +chrCG 72 73 inf +chrCG 74 75 inf +chrCG 76 77 inf +chrCG 78 79 inf +chrCG 80 81 inf +chrCG 82 83 inf +chrCG 84 85 inf +chrCG 86 87 inf +chrCG 88 89 inf +chrCG 90 91 inf +chrCG 92 93 inf +chrCG 94 95 inf +chrCG 96 97 inf
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/test_5.methylKit Mon Feb 13 22:44:01 2017 -0500 @@ -0,0 +1,49 @@ +chrBase chr base strand coverage freqC freqT +chrCG.1 chrCG 1 F 1 100.00 0.00 +chrCG.3 chrCG 3 F 1 100.00 0.00 +chrCG.5 chrCG 5 F 1 100.00 0.00 +chrCG.7 chrCG 7 F 1 100.00 0.00 +chrCG.9 chrCG 9 F 1 100.00 0.00 +chrCG.11 chrCG 11 F 1 100.00 0.00 +chrCG.13 chrCG 13 F 1 100.00 0.00 +chrCG.15 chrCG 15 F 1 100.00 0.00 +chrCG.19 chrCG 19 F 1 100.00 0.00 +chrCG.21 chrCG 21 F 1 100.00 0.00 +chrCG.23 chrCG 23 F 1 100.00 0.00 +chrCG.25 chrCG 25 F 1 100.00 0.00 +chrCG.27 chrCG 27 F 1 100.00 0.00 +chrCG.29 chrCG 29 F 1 100.00 0.00 +chrCG.31 chrCG 31 F 1 100.00 0.00 +chrCG.33 chrCG 33 F 1 100.00 0.00 +chrCG.35 chrCG 35 F 1 100.00 0.00 +chrCG.37 chrCG 37 F 1 100.00 0.00 +chrCG.39 chrCG 39 F 1 100.00 0.00 +chrCG.41 chrCG 41 F 1 100.00 0.00 +chrCG.43 chrCG 43 F 1 100.00 0.00 +chrCG.45 chrCG 45 F 1 100.00 0.00 +chrCG.47 chrCG 47 F 1 100.00 0.00 +chrCG.49 chrCG 49 F 1 100.00 0.00 +chrCG.51 chrCG 51 F 1 100.00 0.00 +chrCG.53 chrCG 53 F 1 100.00 0.00 +chrCG.55 chrCG 55 F 1 100.00 0.00 +chrCG.57 chrCG 57 F 1 100.00 0.00 +chrCG.59 chrCG 59 F 1 100.00 0.00 +chrCG.61 chrCG 61 F 1 100.00 0.00 +chrCG.63 chrCG 63 F 1 100.00 0.00 +chrCG.65 chrCG 65 F 1 100.00 0.00 +chrCG.67 chrCG 67 F 1 100.00 0.00 +chrCG.69 chrCG 69 F 1 100.00 0.00 +chrCG.71 chrCG 71 F 1 100.00 0.00 +chrCG.73 chrCG 73 F 1 100.00 0.00 +chrCG.75 chrCG 75 F 1 100.00 0.00 +chrCG.77 chrCG 77 F 1 100.00 0.00 +chrCG.79 chrCG 79 F 1 100.00 0.00 +chrCG.81 chrCG 81 F 1 100.00 0.00 +chrCG.83 chrCG 83 F 1 100.00 0.00 +chrCG.85 chrCG 85 F 1 100.00 0.00 +chrCG.87 chrCG 87 F 1 100.00 0.00 +chrCG.89 chrCG 89 F 1 100.00 0.00 +chrCG.91 chrCG 91 F 1 100.00 0.00 +chrCG.93 chrCG 93 F 1 100.00 0.00 +chrCG.95 chrCG 95 F 1 100.00 0.00 +chrCG.97 chrCG 97 F 1 100.00 0.00
--- a/tool_dependencies.xml Mon Feb 13 07:09:59 2017 -0500 +++ b/tool_dependencies.xml Mon Feb 13 22:44:01 2017 -0500 @@ -1,21 +1,21 @@ <?xml version="1.0"?> <tool_dependency> - <package name="pileometh" version="0.1.13"> + <package name="methyldackel" version="0.2.1"> <install version="1.0"> <actions> - <action target_filename="PileOMeth-0.1.13.tar.gz" type="download_by_url">https://github.com/dpryan79/PileOMeth/archive/0.1.13.tar.gz</action> + <action target_filename="MethylDackel-0.2.1.tar.gz" type="download_by_url">https://github.com/dpryan79/MethylDackel/archive/0.2.1.tar.gz</action> <action type="shell_command">make</action> <action type="shell_command">make install prefix=$INSTALL_DIR/bin</action> <action type="set_environment"> <environment_variable name="PATH" action="prepend_to">$INSTALL_DIR/bin</environment_variable> - <environment_variable name="PILEOMETH_ROOT_PATH" action="set_to">$INSTALL_DIR</environment_variable> + <environment_variable name="METHYLDACKEL_ROOT_PATH" action="set_to">$INSTALL_DIR</environment_variable> </action> </actions> </install> <readme> <![CDATA[ - PileOMeth: A tool for processing bisulfite sequencing alignments. - See https://github.com/dpryan79/PileOMeth/ + MethylDackel: A tool for processing bisulfite sequencing alignments. + See https://github.com/dpryan79/MethylDackel/ ]]> </readme> </package>