Mercurial > repos > urgi-team > teiso
changeset 0:3d22562b4489 draft
Uploaded
author | urgi-team |
---|---|
date | Fri, 29 Apr 2016 09:11:18 -0400 |
parents | |
children | 15d6811e6bf5 |
files | TEiso/ClosestToStartSite_Wrapper.py TEiso/ClosestToStartSite_Wrapper.xml TEiso/CufflinksGTFToBed_Wrapper.py TEiso/CufflinksGTFToBed_Wrapper.xml TEiso/GFFToBed_Wrapper.py TEiso/GFFToBed_Wrapper.xml TEiso/tool_dependencies.xml |
diffstat | 7 files changed, 461 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TEiso/ClosestToStartSite_Wrapper.py Fri Apr 29 09:11:18 2016 -0400 @@ -0,0 +1,68 @@ +#!/usr/bin/env python + + +import subprocess, tempfile, sys, os, glob, shutil, time +from optparse import OptionParser +from commons.core.utils.RepetOptionParser import RepetOptionParser + + +class ClosestToStartSiteWrapper(object): + + def __init__(self): + self._options = None + + + def stop_err(self, msg ): + sys.stderr.write( "%s\n" % msg ) + sys.exit() + + + def setAttributesFromCmdLine(self): + self._toolVersion = "1.0" + description = "ClosestToStartSite version %s" % self._toolVersion + epilog = "\n parses a bed file and create a bed file to create a report about positions of features A to features B. \n" + epilog += "example: ClosestToStartSite.py -i <inputFile> -o <outputFile>\n" + parser = RepetOptionParser(description = description, epilog = epilog, version = self._toolVersion) + parser.add_option("-i", "--inputFile", dest = "inputFile", action = "store", type = "string", help = "Input GTF File name(transcript.gtf of Cufflinks).", default = "") + parser.add_option("-o", "--outputFile", dest = "outputFile", action = "store", type = "string", help = "output Bed File name", default = "") + parser.add_option("-v", "--verbosity", dest = "verbosity", action = "store", type = "int", help = "Verbosity [optional] [default: 3]",default = 3) + options = parser.parse_args()[0] + self._setAttributesFromOptions(options) + + def _setAttributesFromOptions(self, options): + self._options = options + + def run(self): + prg = "ClosestToStartSite.py" + args = "" + args += "-i %s" % self._options.inputFile + cmd = "%s %s" %(prg, args) + print cmd + + try: + tmp_err = tempfile.NamedTemporaryFile().name + tmp_stderr = open( tmp_err, 'wb' ) + proc = subprocess.Popen( args=cmd, shell=True, cwd=".", stderr=tmp_stderr ) + returncode = proc.wait() + tmp_stderr.close() + # get stderr, allowing for case where it's very large + tmp_stderr = open( tmp_err, 'rb' ) + stderr = '' + buffsize = 1048576 + try: + while True: + stderr += tmp_stderr.read( buffsize ) + if not stderr or len( stderr ) % buffsize != 0: + break + except OverflowError: + pass + tmp_stderr.close() + if stderr: + raise Exception, stderr + except Exception, e: + self.stop_err( 'Error in ClosestToStartSite:\n' + str( e ) ) + +if __name__ == "__main__": + iWrapper = ClosestToStartSiteWrapper() + iWrapper.setAttributesFromCmdLine() + iWrapper.run()
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TEiso/ClosestToStartSite_Wrapper.xml Fri Apr 29 09:11:18 2016 -0400 @@ -0,0 +1,133 @@ +<tool id="ClosestToStartSite" name="ClosestToStartSite" version="1.0"> + <description>ClosestToStartSite parses a bed file and create a bed file to create a report about positions of features A to features B.</description> + <requirements> + <requirement type="package" version="1.0">TEiso_Tools</requirement> + </requirements> + <version_command> + ClosestToStartSite.py --version + </version_command> + <command interpreter="python"> + ClosestToStartSite_Wrapper.py -i $inputFile -o $outputFile + </command> + <inputs> + <param name="inputFile" type="data" format="bed" label="indicate a bed file."/> + </inputs> + <outputs> + <data name="outputFile" format="bed" label="${tool.name} on ${on_string} (BED)"/> + </outputs> + <help><![CDATA[ + +**ClosestToStartSite_wrapper parses a bed file and create a bed file to create a report about positions of features A to features B.** + + +**what it does :** + +parses a bed file and create a bed file to create a report about positions of features A to features B + +----- + +**input format :** + +.. class:: infomark + +**output format :** + +fake 140 532 CUFF.1.1 CUFF.1 + 26875.607 + +----- + + + +****** "B_close_TSS" +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + F[1] gene F[2] + =========================> + ------------ + F[8] F[9] + + + F[1] F[2] + <========================= + --------------- + + +****** "B_overlap_TSS" +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + F[1] gene F[2] + =========================> + ------------- + F[8] F[9] + + gene + F[1]=========================>F[2] + + F[8]---------------F[9] + + + + F[1]=============================>F[2] + F[8]---------------F[9] + + + F[1]<=============================F[2] + --------------------------- + F[8] F[9] + + + F[1]<=============================F[2] + F[8]---------------F[9] + + + F[1]<=============================F[2] + F[8]---------------F[9] + +****** "B-inclus-A" +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + + + F[1] gene F[2] + ============================== + ------------- + F[8] F[9] + +****** "A-inclus-B" +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + + F[1]======================F[2] + F[8]----------------------------------------------------F[9] + + + + + F[1]==================================>F[2] + F[8]----------------------------------------------------------F[9] + + + + F[1]<==================================F[2] + F[8]----------------------------------------------------------F[9] + + + +****** "A-inclus-B-inTSS" +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + F[1]<==================================F[2] + [8]----------------------------------------------------------F[9] + + + F[1]==================================>F[2] + F[8]----------------------------------------------------------F[9] + + +----- + +**reference :** + +]]> + </help> +</tool>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TEiso/CufflinksGTFToBed_Wrapper.py Fri Apr 29 09:11:18 2016 -0400 @@ -0,0 +1,68 @@ +#!/usr/bin/env python + + +import subprocess, tempfile, sys, os, glob, shutil, time +from optparse import OptionParser +from commons.core.utils.RepetOptionParser import RepetOptionParser + + +class CufflinksGTFToBedWrapper(object): + + def __init__(self): + self._options = None + + + def stop_err(self, msg ): + sys.stderr.write( "%s\n" % msg ) + sys.exit() + + + def setAttributesFromCmdLine(self): + self._toolVersion = "1.0" + description = "CufflinksGTFToBed version %s" % self._toolVersion + epilog = "\n parses a GTF file of Cufflinks and create a bed file. \n" + epilog += "example: CufflinksGTFToBed.py -i <inputFile> -o <outputFile>\n" + parser = RepetOptionParser(description = description, epilog = epilog, version = self._toolVersion) + parser.add_option("-i", "--inputFile", dest = "inputFile", action = "store", type = "string", help = "Input GTF File name(transcript.gtf of Cufflinks).", default = "") + parser.add_option("-o", "--outputFile", dest = "outputFile", action = "store", type = "string", help = "output Bed File name", default = "") + parser.add_option("-v", "--verbosity", dest = "verbosity", action = "store", type = "int", help = "Verbosity [optional] [default: 3]",default = 3) + options = parser.parse_args()[0] + self._setAttributesFromOptions(options) + + def _setAttributesFromOptions(self, options): + self._options = options + + def run(self): + prg = "CufflinksGTFToBed.py" + args = "" + args += "-i %s" % self._options.inputFile + cmd = "%s %s" %(prg, args) + print cmd + + try: + tmp_err = tempfile.NamedTemporaryFile().name + tmp_stderr = open( tmp_err, 'wb' ) + proc = subprocess.Popen( args=cmd, shell=True, cwd=".", stderr=tmp_stderr ) + returncode = proc.wait() + tmp_stderr.close() + # get stderr, allowing for case where it's very large + tmp_stderr = open( tmp_err, 'rb' ) + stderr = '' + buffsize = 1048576 + try: + while True: + stderr += tmp_stderr.read( buffsize ) + if not stderr or len( stderr ) % buffsize != 0: + break + except OverflowError: + pass + tmp_stderr.close() + if stderr: + raise Exception, stderr + except Exception, e: + self.stop_err( 'Error in TranscriptToBed:\n' + str( e ) ) + +if __name__ == "__main__": + iWrapper = CufflinksGTFToBedWrapper() + iWrapper.setAttributesFromCmdLine() + iWrapper.run()
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TEiso/CufflinksGTFToBed_Wrapper.xml Fri Apr 29 09:11:18 2016 -0400 @@ -0,0 +1,52 @@ +<tool id="CufflinksGTFToBed" name="CufflinksGTFToBed" version="1.0"> + <description>CufflinksGTFToBed can convert a result GTF file of Cufflinks into a bed file.</description> + <requirements> + <requirement type="package" version="1.0">TEiso_Tools</requirement> + </requirements> + <version_command> + CufflinksGTFToBed.py --version + </version_command> + <command interpreter="python"> + CufflinksGTFToBed_Wrapper.py -i $inputFile -o $outputFile + </command> + <inputs> + <param name="inputFile" type="data" format="gtf" label="indicate a transcript GTF file of cufflinks."/> + </inputs> + <outputs> + <data name="outputFile" format="bed" label="${tool.name} on ${on_string} (BED)"/> + </outputs> + <help><![CDATA[ + +**CufflinksGTFToBed_wrapper converts a result GTF file of Cufflinks into a bed file.** + + +**what it does :** + +converts a result GTF file of Cufflinks into a bed file. + +It can take: Chromosome, Start, End, strand, Isoform ID, Gene ID, value of FPKM + +----- + +**input format :** + +.. class:: infomark + +fake Cufflinks transcript 140 532 1000 + . gene_id "CUFF.1"; +transcript_id "CUFF.1.1"; FPKM "26875.6073354154"; frac "1.000000"; conf_lo "24989.806681"; conf_hi "28761.407990"; cov "752.375132"; +----- + +**output format :** + +fake 140 532 CUFF.1.1 CUFF.1 + 26875.607 + +----- + + +----- + +**reference :** + +]]> + </help> +</tool>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TEiso/GFFToBed_Wrapper.py Fri Apr 29 09:11:18 2016 -0400 @@ -0,0 +1,68 @@ +#!/usr/bin/env python + + +import subprocess, tempfile, sys, os, glob, shutil, time +from optparse import OptionParser +from commons.core.utils.RepetOptionParser import RepetOptionParser + + +class GFFToBedWrapper(object): + + def __init__(self): + self._options = None + + + def stop_err(self, msg ): + sys.stderr.write( "%s\n" % msg ) + sys.exit() + + + def setAttributesFromCmdLine(self): + self._toolVersion = "1.0" + description = "GFFToBed version %s" % self._toolVersion + epilog = "\n parses a GFF file and create a bed file. \n" + epilog += "example: GFFToBed.py -i <inputFile> -o <outputFile>\n" + parser = RepetOptionParser(description = description, epilog = epilog, version = self._toolVersion) + parser.add_option("-i", "--inputFile", dest = "inputFile", action = "store", type = "string", help = "Input GFF File name.", default = "") + parser.add_option("-o", "--outputFile", dest = "outputFile", action = "store", type = "string", help = "output Bed File name", default = "") + parser.add_option("-v", "--verbosity", dest = "verbosity", action = "store", type = "int", help = "Verbosity [optional] [default: 3]",default = 3) + options = parser.parse_args()[0] + self._setAttributesFromOptions(options) + + def _setAttributesFromOptions(self, options): + self._options = options + + def run(self): + prg = "GFFToBed.py" + args = "" + args += "-i %s" % self._options.inputFile + cmd = "%s %s" %(prg, args) + print cmd + + try: + tmp_err = tempfile.NamedTemporaryFile().name + tmp_stderr = open( tmp_err, 'wb' ) + proc = subprocess.Popen( args=cmd, shell=True, cwd=".", stderr=tmp_stderr ) + returncode = proc.wait() + tmp_stderr.close() + # get stderr, allowing for case where it's very large + tmp_stderr = open( tmp_err, 'rb' ) + stderr = '' + buffsize = 1048576 + try: + while True: + stderr += tmp_stderr.read( buffsize ) + if not stderr or len( stderr ) % buffsize != 0: + break + except OverflowError: + pass + tmp_stderr.close() + if stderr: + raise Exception, stderr + except Exception, e: + self.stop_err( 'Error in GFFToBed:\n' + str( e ) ) + +if __name__ == "__main__": + iWrapper = GFFToBedWrapper() + iWrapper.setAttributesFromCmdLine() + iWrapper.run()
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TEiso/GFFToBed_Wrapper.xml Fri Apr 29 09:11:18 2016 -0400 @@ -0,0 +1,53 @@ +<tool id="GFFToBed" name="GFFToBed" version="1.0"> + <description>GFFToBed can convert a result GTF file of Cufflinks into a bed file.</description> + <requirements> + <requirement type="package" version="1.0">TEiso_Tools</requirement> + </requirements> + <version_command> + GFFToBed.py --version + </version_command> + <command interpreter="python"> + GFFToBedWrapper_Wrapper.py -i $inputFile -o $outputFile + </command> + <inputs> + <param name="inputFile" type="data" format="gff" label="indicate a transcript GTF file of cufflinks."/> + </inputs> + <outputs> + <data name="outputFile" format="bed" label="${tool.name} on ${on_string} (BED)"/> + </outputs> + <help><![CDATA[ + +**GFFToBed_wrapper converts a result GTF file of Cufflinks into a bed file.** + + +**what it does :** + +converts a result GTF file of Cufflinks into a bed file. + +It can take: Chromosome, Start, End, ID, Target, strand + +----- + +**input format :** + +.. class:: infomark + +2L DmelCaf1_2_2_REPET_TEs match 47519 52563 0.0 + . ID=ms1_dmel_chr2L_RIX-comp_DmelCaf1_2_2-B-P58.20-Map11;Target=RIX-comp_DmelCaf1_2_2-B-P58.20-Map11 6 5050;Identity=99.8 + + +----- + +**output format :** + +2L 47519 52563 ms1_dmel_chr2L_RIX-comp_DmelCaf1_2_2-B-P58.20-Map11 RIX-comp_DmelCaf1_2_2-B-P58.20-Map11 6 5050 + + +----- + + +----- + +**reference :** + +]]> + </help> +</tool>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TEiso/tool_dependencies.xml Fri Apr 29 09:11:18 2016 -0400 @@ -0,0 +1,19 @@ +<?xml version="1.0"?> +<tool_dependency> + <package name="TEiso_Tools" version="1.0"> + <install version="1.0"> + <actions> + <action type="download_by_url">https://urgi.versailles.inra.fr/download/TEiso/TEisotools-1.0.tar.gz</action> + <action type="shell_command">python setup_TEiso.py install</action> + <action type="move_directory_files"> + <source_directory>.</source_directory> + <destination_directory>$INSTALL_DIR</destination_directory> + </action> + <action type="set_environment"> + <environment_variable name="PYTHONPATH" action="prepend_to">$INSTALL_DIR</environment_variable> + <environment_variable name="PATH" action="prepend_to">$INSTALL_DIR/bin</environment_variable> + </action> + </actions> + </install> + </package> +</tool_dependency>