Repository 's_mart'
hg clone https://toolshed.g2.bx.psu.edu/repos/yufei-luo/s_mart

Changeset 8:4dded8b1fbc4 (2013-01-18)
Previous changeset 7:86c781421239 (2013-01-18) Next changeset 9:1eb55963fe39 (2013-03-14)
Commit message:
Deleted selected files
removed:
SMART/Java/Python/toolLauncher/RnaFoldLauncher.py
SMART/Java/Python/toolLauncher/__init__.py
b
diff -r 86c781421239 -r 4dded8b1fbc4 SMART/Java/Python/toolLauncher/RnaFoldLauncher.py
--- a/SMART/Java/Python/toolLauncher/RnaFoldLauncher.py Fri Jan 18 09:01:23 2013 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
[
b'@@ -1,379 +0,0 @@\n-#\n-# Copyright INRA-URGI 2009-2010\n-# \n-# This software is governed by the CeCILL license under French law and\n-# abiding by the rules of distribution of free software. You can use,\n-# modify and/ or redistribute the software under the terms of the CeCILL\n-# license as circulated by CEA, CNRS and INRIA at the following URL\n-# "http://www.cecill.info".\n-# \n-# As a counterpart to the access to the source code and rights to copy,\n-# modify and redistribute granted by the license, users are provided only\n-# with a limited warranty and the software\'s author, the holder of the\n-# economic rights, and the successive licensors have only limited\n-# liability.\n-# \n-# In this respect, the user\'s attention is drawn to the risks associated\n-# with loading, using, modifying and/or developing or reproducing the\n-# software by the user in light of its specific status of free software,\n-# that may mean that it is complicated to manipulate, and that also\n-# therefore means that it is reserved for developers and experienced\n-# professionals having in-depth computer knowledge. Users are therefore\n-# encouraged to load and test the software\'s suitability as regards their\n-# requirements in conditions enabling the security of their systems and/or\n-# data to be ensured and, more generally, to use and operate it in the\n-# same conditions as regards security.\n-# \n-# The fact that you are presently reading this means that you have had\n-# knowledge of the CeCILL license and that you accept its terms.\n-#\n-import os\n-import sys\n-import random\n-import subprocess\n-from SMART.Java.Python.structure.TranscriptList import TranscriptList\n-from SMART.Java.Python.structure.Transcript import Transcript\n-from SMART.Java.Python.misc.Progress import Progress\n-from commons.core.parsing.FastaParser import FastaParser\n-\n-\n-class RnaFoldStructure(object):\n-    """\n-    A structure to store the output of RNAFold\n-    @ivar name:         the name of the sequence\n-    @type name:         string\n-    @ivar sequence:     the sequence (with gaps)\n-    @type sequence:     string\n-    @ivar structure:    the bracket structure\n-    @type structure:    string\n-    @ivar energy:       the energy of the fold\n-    @type energy:       float\n-    @ivar interactions: the interactions inside the structure\n-    @ivar interactions: the interactions inside the structure\n-    """\n-\n-    def __init__(self, name, sequence, structure, energy):\n-        """\n-        Initialize the structure\n-        @param name       the name of the sequence\n-        @type  name:      string\n-        @param sequence:  the sequence (with gaps)\n-        @type  sequence:  string\n-        @param structure: the bracket structure\n-        @type  structure: string\n-        @param energy:    the energy of the fold\n-        @type  energy:    float\n-        """\n-        self.name         = name        \n-        self.sequence     = sequence\n-        self.structure    = structure\n-        self.energy       = energy\n-        self.interactions = None\n-\n-    \n-    def analyze(self):\n-        """\n-        Analyze the output, assign the interactions\n-        """\n-        if len(self.sequence) != len(self.structure):\n-            sys.exit("Sizes of sequence and structure differ (\'%s\' and \'%s\')!\\n" % (self.sequence, self.structure))\n-        stack                         = []\n-        self.interactions = [None for i in range(len(self.sequence))]\n-        for i in range(len(self.sequence)):\n-            if self.structure[i] == "(":\n-                stack.append(i)\n-            elif self.structure[i] == ")":\n-                if not stack:\n-                    sys.exit("Something wrong in the interaction line \'%s\'!\\n" % (self.structure))\n-                otherI = stack.pop()\n-                self.interactions[i]      = otherI\n-                self.interactions[otherI] = i\n-        if stack:\n-            sys.exit("Something wrong in the interaction line \'%s\'!\\n" % (self.structure))\n-\n-\n-    def getNbBulges(self, sta'..b'\n-        @type rnaFoldOutput: class L{RnaFoldStructure<RnaFoldStructure>}\n-        @ivar reverse:       invert the extensions\n-        @type reverse:       bool\n-        @return:             a t-uple of energy, number of insertions, number of bulges, strand\n-        """\n-        rnaFoldOutput.analyze()\n-        transcriptSize     = transcript.end - transcript.start + 1\n-        start              = fivePrimeExtension if not reverse else threePrimeExtension\n-        end                = start + transcriptSize\n-        energy             = rnaFoldOutput.energy\n-        nbBulges           = rnaFoldOutput.getNbBulges(start, end)\n-        (minStar, maxStar) = rnaFoldOutput.getStar(start, end)\n-        minStar           += transcript.start - start\n-        maxStar           += transcript.start - start\n-        if self.verbosity > 100:\n-            print "Getting structure with energy %d, nbBulges %d, miRna* %d-%d, strand %s" % (energy, nbBulges, minStar, maxStar, "-" if reverse else "+")\n-        return (energy, nbBulges, minStar, maxStar, reverse)\n-\n-    \n-    def fold(self, transcript):\n-        """\n-        Fold a transcript (in each strand)\n-        @ivar transcript: a transcript\n-        @type transcript: class L{Transcript<Transcript>}\n-        @return:          a t-uple of energy, number of insertions, number of bulges, strand\n-        """\n-        results     = [None] * self.nbStrands\n-        strands     = [False, True] if self.nbStrands == 2 else [False]\n-        minNbBulges = 1000000\n-        for i, reverse in enumerate(strands):\n-            self.writeInputFile(transcript, reverse, self.fivePrimeExtension, self.threePrimeExtension)\n-            self.startRnaFold()\n-            output = self.parseRnaFoldOutput()\n-            results[i]  = self.analyzeRnaFoldOutput(transcript, output, reverse, self.fivePrimeExtension, self.threePrimeExtension)\n-            minNbBulges = min(minNbBulges, results[i][1])\n-        for result in results:\n-            if result[1] == minNbBulges:\n-                return result\n-        return None\n-\n-\n-    def refold(self, transcript):\n-        """\n-        Fold a transcript, knowing where the miRNA starts and end\n-        @ivar transcript: a transcript\n-        @type transcript: class L{Transcript<Transcript>}\n-        @return:          the energy\n-        """\n-        miStar              = transcript.getTagValue("miRnaStar")\n-        startMiStar         = int(miStar.split("-")[0])\n-        endMiStart          = int(miStar.split("-")[1])\n-        fivePrimeExtension  = max(0, transcript.start - startMiStar) + 5\n-        threePrimeExtension = max(0, endMiStart - transcript.end) + 5\n-        self.writeInputFile(transcript, False, fivePrimeExtension, threePrimeExtension)\n-        self.startRnaFold()\n-        output = self.parseRnaFoldOutput()\n-        result = self.analyzeRnaFoldOutput(transcript, output, False, fivePrimeExtension, threePrimeExtension)\n-        return result[0]\n-\n-\n-    def computeResults(self):\n-        """\n-        Fold all and fill an output transcript list with the values\n-        """\n-        progress = Progress(self.inputTranscriptList.getNbTranscripts(), "Handling transcripts", self.verbosity)\n-        self.outputTranscriptList = TranscriptList()\n-        for transcript in self.inputTranscriptList.getIterator():\n-            result = self.fold(transcript)\n-            transcript.setTagValue("nbBulges", result[1])\n-            transcript.setTagValue("miRnaStar", "%d-%d" % (result[2], result[3]))\n-            transcript.setTagValue("miRNAstrand", result[4])\n-            transcript.setTagValue("energy", self.refold(transcript))\n-            self.outputTranscriptList.addTranscript(transcript)\n-            progress.inc()\n-        progress.done()\n-\n-\n-    def getResults(self):\n-        """\n-        Get an output transcript list with the values\n-        """\n-        if self.outputTranscriptList == None:\n-            self.computeResults()\n-        return self.outputTranscriptList\n'