changeset 0:d7714f886224

Initial commit. Snapshot 61f45be
author oleg@oleg-desktop
date Thu, 29 Oct 2015 12:04:47 +0300
parents
children 5efe658422eb
files cmeth.xml cmeth_wrapper.py integration_jar.xml tool_dependencies.xml
diffstat 4 files changed, 110 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmeth.xml	Thu Oct 29 12:04:47 2015 +0300
@@ -0,0 +1,47 @@
+<tool id="cmeth" name="Cmeth" version="0.2.0">
+    <description>BS-Seq analysis</description>
+    <requirements>
+        <requirement type="package" version="0.0.1">integration_jar</requirement>
+    </requirements>
+    <stdio>
+        <!-- Wrapper ensures anything other than zero is an error -->
+        <exit_code range="1:"/>
+        <exit_code range=":-1"/>
+    </stdio>
+    <command interpreter="python">
+        #if $action.selection == "analyze"
+            cmeth_wrapper.py "${genome}" "${fdr}" analyze "${bam}"
+        #else
+            cmeth_wrapper.py "${genome}" "${fdr}" compare "${bam1}" "${bam2}"
+        #end if
+    </command>
+    <inputs>
+        <param name="genome" type="data" format="fasta" label="Genome build" description="Genome build reference"/>
+        <param name="fdr" size="5" type="float" value="0.0001" label="FDR"/>
+        <conditional name="action">
+            <param name="selection" type="select" label="Action">
+                <option value="analyze">Compute methylation</option>
+                <option value="compare">Compare methylation</option>
+            </param>
+            <when value="analyze">
+                <param name="bam" type="data" format="bam" label="Aligned BS-Seq bam" description="BAM BS-Seq Aligned reads to process"/>
+            </when>
+            <when value="compare">
+                <param name="bam1" type="data" format="bam" label="Aligned BS-Seq bam1" description="BAM BS-Seq Aligned reads to process 1"/>
+                <param name="bam2" type="data" format="bam" label="Aligned BS-Seq bam2" description="BAM BS-Seq Aligned reads to process 2"/>
+            </when>
+        </conditional>
+    </inputs>
+    <outputs>
+        #if $action.selection == "analyze"
+        <data name="result" format="csv" label="CG_unmethylated.csv"/>
+        #else
+        <data name="result" format="csv" label="CG_emr.csv"/>
+        #end if
+    </outputs>
+    <help>
+Cmeth is a tool for analyzing and comparing cytosine methylation from WGBS (whole-genome bisulfite sequencing) data.
+Both procedures rely on the nonparametric Bayesian switching HMM.
+https://github.com/JetBrains-Research/cmeth
+    </help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmeth_wrapper.py	Thu Oct 29 12:04:47 2015 +0300
@@ -0,0 +1,34 @@
+#!/usr/bin/env python
+
+import os
+import sys
+import subprocess
+
+argv = sys.argv[1:]
+print 'Arguments {0}'.format(argv)
+
+# Check command
+if len(argv) == 4:
+    genome, fdr, action, bam = argv
+    assert action == "analyze"
+else:
+    genome, fdr, action, bam1, bam2 = argv
+    assert action == "compare"
+
+# Configure main jar path
+jar = os.environ.get("INTEGRATION_JAR")
+print 'Using JAR distributive file {0}'.format(jar)
+
+cmd = 'java -cp {0} org.jetbrains.bio.genestack.FastaToTwoBitCLA {1} reference.2bit'.format(jar, genome)
+print 'Converting reference genome fasta to 2bit: {0}'.format(cmd)
+subprocess.check_call(cmd, cwd=None, shell=True)
+
+# See https://github.com/JetBrains-Research/cmeth for command line options
+if action == "analyze":
+    cmd = 'java -cp {0} org.jetbrains.bio.cmeth.CmethCLA ' \
+          'analyze -i {1} -r reference.2bit -fdr {2}'.format(jar, bam, fdr)
+else:
+    cmd = 'java -cp {0} org.jetbrains.bio.cmeth.CmethCLA ' \
+          'compare -1 {1} -2 {2} -r reference.2bit -fdr {3}'.format(jar, bam1, bam2, fdr)
+print 'Launching cmeth: {0}'.format(cmd)
+subprocess.check_call(cmd, cwd=None, shell=True)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/integration_jar.xml	Thu Oct 29 12:04:47 2015 +0300
@@ -0,0 +1,23 @@
+<!--
+Package for downloading latest successful development tools.
+Tags information is here:
+https://wiki.galaxyproject.org/ToolDependenciesTagSets
+-->
+<package name="integration_jar" version="0.0.1" prior_installation_required="True">
+    <install version="1.0">
+        <actions>
+            <action type="download_by_url">http://teamcity.jetbrains.com/guestAuth/repository/download/Epigenome_Tools_Integration/lastSuccessful/integration-Dev-all.jar</action>
+            <action type="move_directory_files">
+                <source_directory>.</source_directory>
+                <destination_directory>$INSTALL_DIR/</destination_directory>
+            </action>
+            <!-- Set environment variable $INTEGRATION_JAR so Python script knows where to look -->
+            <action type="set_environment">
+                <environment_variable name="$INTEGRATION_JAR" action="set_to">$INSTALL_DIR/integration-Dev-all.jar</environment_variable>
+            </action>
+        </actions>
+    </install>
+    <readme>
+        Downloads epigenome integration JAR.
+    </readme>
+</package>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tool_dependencies.xml	Thu Oct 29 12:04:47 2015 +0300
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<tool_dependency xmlns:xi="http://www.w3.org/1999/XSL/Transform">
+    <xi:include href="../integration_jar.xml" parse="xml" xpointer=""/>
+    <!-- For galaxy repo layout -->
+    <xi:include href="integration_jar.xml" parse="xml" xpointer=""/>
+</tool_dependency>