Next changeset 1:ebc371f3c6b5 (2015-05-13) |
Commit message:
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit 71414cf7f040d610afc3f02be31446efc3a82a40-dirty |
added:
antaRNA.py antarna.xml tool_dependencies.xml |
b |
diff -r 000000000000 -r fcf4719d3831 antaRNA.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/antaRNA.py Wed May 13 11:02:53 2015 -0400 |
[ |
b'@@ -0,0 +1,1645 @@\n+import numpy\n+import sys\n+import random\n+import subprocess\n+import re\n+import decimal\n+import math\n+import os\n+import shutil\n+import time\n+import types\n+import argparse\n+#from argparse import RawTextHelpFormatter\n+\n+#############################\n+# FUNCTIONS\n+\n+def print2file(f, i, m):\n+\t"""\n+\t\tprint content i to file f in mode m\n+\t"""\n+\tline = str(i)\n+\tif m == "a":\n+\t\tcall = "echo \\"" + line + "\\" >> " + f\n+\telif m == "w":\n+\t\tcall = "echo \\"" + line + "\\" > " + f\n+\tos.system(call)\n+\n+# checking and correcting the alphabet of the constraint sequence\n+def checkSequenceConstraint(SC):\n+\t"""\n+\t\tChecks the Sequence constraint for illegal nucleotide characters\n+\t"""\n+\tout = ""\n+\tfor c in SC:\n+\t\tc = c.upper()\n+\t\tif c not in "ACGURYSWKMBDHVN": \n+# and c!= "R" and c != "Y" and c != "S" and c != "W" and c != "K" and c != "M" and c != "B" and c != "D" and c != "H" and c != "V":\n+\t\t\tif c == "T":\n+\t\t\t\tc = "U"\n+\t\t\telse:\n+\t\t\t\tprint "\\tIllegal Character in the constraint sequence!"\n+\t\t\t\tprint "\\tPlease use the IUPAC nomenclature for defining nucleotides in the constraint sequence!"\n+\t\t\t\tprint "\\tA \tAdenine"\n+\t\t\t\tprint "\\tC \tCytosine"\n+\t\t\t\tprint "\\tG \tGuanine"\n+\t\t\t\tprint "\\tT/U \tThymine/Uracil"\n+\t\t\t\tprint "\\tR \tA or G"\n+\t\t\t\tprint "\\tY \tC or T/U"\n+\t\t\t\tprint "\\tS \tG or C"\n+\t\t\t\tprint "\\tW \tA or T/U"\n+\t\t\t\tprint "\\tK \tG or T/U"\n+\t\t\t\tprint "\\tM \tA or C"\n+\t\t\t\tprint "\\tB \tC or G or T/U"\n+\t\t\t\tprint "\\tD \tA or G or T/U"\n+\t\t\t\tprint "\\tH \tA or C or T/U"\n+\t\t\t\tprint "\\tV \tA or C or G"\n+\t\t\t\tprint "\\tN\tany base"\n+\t\t\t\texit(0)\n+\t\tout += c\n+\treturn (1, out) \n+ \n+ \n+def transform(seq):\n+\t"""\n+\t\tTransforms "U" to "T" for the processing is done on DNA alphabet\n+\t"""\n+\tS = ""\n+\tfor s in seq:\n+\t\tif s == "T":\n+\t\t\tS += "U"\n+\t\telse:\n+\t\t\tS += s\n+\treturn S\n+ \n+ \n+def checkSimilarLength(s, SC):\n+\t"""\n+\t\tCompares sequence and structure constraint length\n+\t"""\n+\tif len(s) == len(SC):\n+\t\treturn 1\n+\telse:\n+\t\treturn 0\n+ \n+ \n+def isStructure(s):\n+\t"""\n+\t\tChecks if the structure constraint only contains "(", ")", and "." and legal fuzzy structure constraint characters.\n+\t"""\n+\treturnvalue = 1\n+\tfor a in range(0,len(s)):\n+\t\tif s[a] not in ".()[]{}<>":\n+\t\t\tif s[a] not in "ABCDEFGHIJKLMNOPQRSTUVWXYZ":\n+\t\t\t\treturnvalue = 0\n+\treturn returnvalue \n+\n+\n+def isBalanced(s):\n+\t"""\n+\t\tCheck if the structure s is of a balanced nature\n+\t"""\n+\t\n+\tbalance = 1\n+\tfor bracket in ["()", "[]", "{}", "<>"]:\n+\t\tcounter = 0\n+\t\tfor a in xrange(len(s)):\n+\t\t\tif s[a] in bracket[0]:\n+\t\t\t\tcounter += 1\n+\t\t\telif s[a] in bracket[1]:\n+\t\t\t\tcounter -= 1\n+\t\tif counter != 0:\n+\t\t\tbalance = 0\n+\treturn balance\n+\n+\n+\n+def fulfillsHairpinRule(s):\n+\t"""\n+\t\tCHECKING FOR THE 3 nt LOOP INTERSPACE\n+\t\t\tfor all kind of basepairs, even wihtin the pdeudoknots \n+\t"""\n+\t\n+\tfulfillsRules = 1\n+\tfor bracket in ["()", "[]", "{}", "<>"]:\n+\t\tlast_opening_char = 0\n+\t\tcheck = 0\n+\t\tfor a in xrange(len(s)):\n+\t\t\tif s[a] == bracket[0]:\n+\t\t\t\tlast_opening_char = a\n+\t\t\t\tcheck = 1\n+\t\t\telif s[a] == bracket[1] and check == 1:\n+\t\t\t\tcheck = 0\n+\t\t\t\tif a - last_opening_char < 4:\n+\t\t\t\t\treturn 0\n+\treturn 1\n+ \n+ \n+def isValidStructure(s):\n+\t"""\n+\t\tChecks, if the structure s is a valid structure\n+\t"""\n+\t\n+\tStructure = isStructure(s)\n+\tBalanced = isBalanced(s)\n+\tHairpinRule = fulfillsHairpinRule(s)\n+\t\n+\tif Structure == 1 and Balanced == 1 and HairpinRule == 1:\n+\t\treturn 1\n+\telse:\n+\t\tprint Structure, Balanced, HairpinRule\n+\t\treturn 0\n+\n+def loadIUPACcompatibilities(IUPAC, useGU):\n+\t"""\n+\t\tGenerating a hash containing all compatibilities of all IUPAC RNA NUCLEOTIDES\n+\t"""\n+\tcompatible = {}\n+\tfor nuc1 in IUPAC: # ITERATING OVER THE DIFFERENT GROUPS OF IUPAC CODE\n+\t\tsn1 = list(IUPAC[nuc1])\n+\t\tfor nuc2 in IUPAC: # ITERATING OVER THE DIFFERENT GROUPS OF IUPAC CODE\n+\t\t\tsn2 = list(IUPAC[nuc2])\n+\t\t\tcompatib = 0\n+\t\t\tfor c1 in sn1: # ITERATING OVER THE SINGLE NUCLEOTIDES WITHIN THE RESPECTIVE IUPAC CODE:\n+\t\t\t\tfor c2 in sn2: # ITERATING OVER THE SINGLE NUCLEOTIDES WITHIN THE RESPECTIVE IUPAC CODE:\n+\t\t\t\t\t# CHECKING THEIR COMPAT'..b'riance (sigma square) for the case of normal distribution sampling. The regular tGC value serves as expectation value (mu).\\n(DEFAULT: %(default)s, TYPE: %(type)s)\\n\\n", type=float, default=-1.0)\n+\t\n+\targument_parser.add_argument("-t", "--temperature", help = "Provides a temperature for the folding algorithms.\\n(DEFAULT: %(default)s, TYPE: %(type)s)\\n\\n", type=float, default=37.0)\n+\targument_parser.add_argument("-P", "--paramFile", help = "Changes the energy parameterfile of RNAfold. If using this explicitly, please provide a suitable energy file delivered by RNAfold. \\n(DEFAULT: %(default)s, TYPE: %(type)s)\\n\\n", type=str, default="")\n+\targument_parser.add_argument("-of","--output_file", help="Provide a path and an output file, e.g. \\"/path/to/the/target_file\\". \\n(DEFAULT: %(default)s, TYPE: %(type)s)\\n\\n", type=str, default="STDOUT")\n+\targument_parser.add_argument("-Cseq", "--Cseq", help="Sequence constraint using RNA nucleotide alphabet {A,C,G,U} and wild-card \\"N\\". \\n(TYPE: %(type)s)\\n\\n", type=str, default = "") \n+\targument_parser.add_argument("-l", "--level", help="Sets the level of allowed influence of sequence constraint on the structure constraint [0:no influence; 3:extensive influence].\\n(TYPE: %(type)s)\\n\\n", type=int, default = 1)\n+\targument_parser.add_argument("--name", help="Defines a name which is used in the sequence output. \\n(DEFAULT: %(default)s, TYPE: %(type)s)\\n\\n", type=str, default="antaRNA_")\n+\targument_parser.add_argument("-a", "--alpha", help="Sets alpha, probability weight for terrain pheromone influence. [0,1] \\n(DEFAULT: %(default)s, TYPE: %(type)s)\\n\\n", type=float, default=1.0)\n+\targument_parser.add_argument("-b", "--beta", help="Sets beta, probability weight for terrain path influence. [0,1]\\n(DEFAULT: %(default)s, TYPE: %(type)s)\\n\\n", type=float, default=1.0)\n+\targument_parser.add_argument("-er", "--ER", help="Pheromone evaporation rate. \\n(DEFAULT: %(default)s, TYPE: %(type)s)\\n\\n", type=float, default=0.2)\n+\targument_parser.add_argument("-Cstrw", "--Cstrweight", help="Structure constraint quality weighting factor. [0,1]\\n(DEFAULT: %(default)s, TYPE: %(type)s)\\n\\n", type=float, default=0.5)\n+\targument_parser.add_argument("-Cgcw", "--Cgcweight", help="GC content constraint quality weighting factor. [0,1]\\n(DEFAULT: %(default)s, TYPE: %(type)s)\\n\\n", type=float, default=5.0)\n+\targument_parser.add_argument("-Cseqw", "--Cseqweight", help="Sequence constraint quality weighting factor. [0,1]\\n(DEFAULT: %(default)s, TYPE: %(type)s)\\n\\n\\n", type=float, default=1.0)\n+\targument_parser.add_argument("-ov", "--output_verbose", help="Displayes intermediate output.\\n\\n", action="store_true") \n+\targument_parser.add_argument("-v", "--verbose", help="Prints additional features and stats to the headers of the produced sequences. Also adds the structure of the sequence.\\n\\n", action="store_true")\n+\t\n+\targs = argument_parser.parse_args()\n+\n+\texecute(args)\n+ \n+def checkForViennaTools():\n+\t"""\n+\tChecking for the presence of the Vienna tools in the system by which\'ing for RNAfold and RNAdistance\n+\t"""\n+\tRNAfold_output = subprocess.Popen(["which", "RNAfold"], stdout=subprocess.PIPE).communicate()[0].strip()\n+\tif len(RNAfold_output) > 0 and RNAfold_output.find("found") == -1 and RNAfold_output.find(" no ") == -1:\n+\t\treturn True\n+\telse:\n+\t\tprint "It seems the Vienna RNA Package is not installed on your machine. Please do so!"\n+\t\tprint "You can get it at http://www.tbi.univie.ac.at/"\n+\t\texit(0)\n+\n+\t\t\n+def checkForpKiss():\n+\t"""\n+\t\tChecking for the presence of pKiss\n+\t"""\n+ \tpKiss_output = subprocess.Popen(["which", "pKiss"], stdout=subprocess.PIPE).communicate()[0].strip()\n+\tif len(pKiss_output) > 0 and pKiss_output.find("found") == -1 and pKiss_output.find(" no ") == -1:\n+\t\treturn True\n+\telse:\n+\t\tprint "It seems that pKiss is not installed on your machine. Please do so!"\n+\t\tprint "You can get it at http://bibiserv2.cebitec.uni-bielefeld.de/pkiss"\n+\t\texit(0)\n+\t\t\n+\t\t\n+\t\t\n+if __name__ == "__main__":\n+\n+\texe()\n+ \n' |
b |
diff -r 000000000000 -r fcf4719d3831 antarna.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/antarna.xml Wed May 13 11:02:53 2015 -0400 |
[ |
@@ -0,0 +1,187 @@ +<tool id="antarna" name="antaRNA" version="1.1"> + <description> + Ant Colony Optimized RNA Sequence Design + </description> + <requirements> + <requirement type="package" version="2.2.12">pkiss</requirement> + <requirement type="package" version="3.2.5">rnashapes</requirement> + <requirement type="package" version="1.7.1">numpy</requirement> + <requirement type="package" version="2.1.5">vienna_rna</requirement> + </requirements> + <stdio> + <exit_code level="fatal" range="1:"/> + </stdio> + <version_command>python antaRNA.py --version</version_command> + <command interpreter="python"><![CDATA[antaRNA.py +#if $Cstr and $Cstr is not None: +-Cstr "$Cstr" +#end if + +#if $tGC and $tGC is not None: +-tGC $tGC +#end if + +#if $n and $n is not None: +-n $n +#end if +$GU + +#if $s and $s is not None: +-s $s +#end if + +#if $ip and $ip is not None: +-ip $ip +#end if + +#if $r and $r is not None: +-r $r +#end if + +#if $CC and $CC is not None: +-CC $CC +#end if + +#if $aTC and $aTC is not None: +-aTC $aTC +#end if +$p +$pkPar + +#if $strategy and $strategy is not None: +--strategy $strategy +#end if + +#if $tGCmax and $tGCmax is not None: +-tGCmax $tGCmax +#end if + +#if $tGCvar and $tGCvar is not None: +-tGCvar $tGCvar +#end if + +#if $t and $t is not None: +-t $t +#end if + +#if $P and $P is not None: +-P $P +#end if + +#if $of and $of is not None: +-of $of +#end if + +#if $Cseq and $Cseq is not None: +-Cseq $Cseq +#end if + +#if $l and $l is not None: +-l $l +#end if + +#if $name and $name is not None: +--name $name +#end if + +#if $a and $a is not None: +-a $a +#end if + +#if $b and $b is not None: +-b $b +#end if + +#if $er and $er is not None: +-er $er +#end if + +#if $Cstrw and $Cstrw is not None: +-Cstrw $Cstrw +#end if + +#if $Cgcw and $Cgcw is not None: +-Cgcw $Cgcw +#end if + +#if $Cseqw and $Cseqw is not None: +-Cseqw $Cseqw +#end if +$ov +$v +> $default]]></command> + <inputs> + <param label="Structure constraint using RNA dotbracket notation with fuzzy block constraint. (-Cstr)" name="Cstr" type="text"/> + <param label="Objective target GC content in [0,1]. (-tGC)" name="tGC" type="float" value="0"/> + <param label="Number of sequences which shall be produced. (-n)" name="n" type="integer" value="0"/> + <param checked="false" label="Allowing GU base pairs. (-GU)" name="GU" type="boolean" truevalue="-GU" falsevalue=""/> + <param default="none" label="Provides a seed value for the used pseudo random number generator. (-s)" name="s" type="text"/> + <param default="s" label="Select the improving method. h=hierarchical, s=score_based. (-ip)" name="ip" type="text"/> + <param label="Amount of maximal terrain resets, until the best solution is retuned as solution. (-r)" name="r" type="integer" value="5"/> + <param label="Delimits the convergence count criterion for a reset. (-CC)" name="CC" type="integer" value="130"/> + <param label="Delimits the amount of internal ants for termination convergence criterion for a reset. (-aTC)" name="aTC" type="integer" value="50"/> + <param checked="false" label="Switch to pseudoknot based prediction using pKiss. Check the pseudoknot parameter usage!!! (-p)" name="p" type="boolean" truevalue="-p" falsevalue=""/> + <param checked="false" label="Enable optimized parameters for the usage of pseudo knots (Further parameter input ignored). (-pkPar)" name="pkPar" type="boolean" truevalue="-pkPar" falsevalue=""/> + <param default="A" label="Defining the pKiss folding strategy. (--strategy)" name="strategy" type="text"/> + <param label="Provides a maximum tGC value [0,1] for the case of uniform distribution sampling. The regular tGC value serves as minimum value. (-tGCmax)" name="tGCmax" type="float" value="-1.0"/> + <param label="Provides a tGC variance (sigma square) for the case of normal distribution sampling. The regular tGC value serves as expectation value (mu). (-tGCvar)" name="tGCvar" type="float" value="-1.0"/> + <param label="Provides a temperature for the folding algorithms. (-t)" name="t" type="float" value="37.0"/> + <param default="" label="Changes the energy parameterfile of RNAfold. If using this explicitly, please provide a suitable energy file delivered by RNAfold. (-P)" name="P" type="text"/> + <param default="STDOUT" label="Provide a path and an output file, e.g. "/path/to/the/target_file". (-of)" name="of" type="text"/> + <param default="" label="Sequence constraint using RNA nucleotide alphabet {A,C,G,U} and wild-card "N". (-Cseq)" name="Cseq" type="text"/> + <param label="Sets the level of allowed influence of sequence constraint on the structure constraint [0:no influence; 3:extensive influence]. (-l)" name="l" type="integer" value="1"/> + <param default="antaRNA_" label="Defines a name which is used in the sequence output. (--name)" name="name" type="text"/> + <param label="Sets alpha, probability weight for terrain path influence. [0,1] (-a)" name="a" type="float" value="1.0"/> + <param label="Sets beta, probability weight for terrain pheromone influence. [0,1] (-b)" name="b" type="float" value="1.0"/> + <param label="Pheromone evaporation rate. (-er)" name="er" type="float" value="0.2"/> + <param label="Structure constraint quality weighting factor. [0,1] (-Cstrw)" name="Cstrw" type="float" value="0.5"/> + <param label="GC content constraint quality weighting factor. [0,1] (-Cgcw)" name="Cgcw" type="float" value="5.0"/> + <param label="Sequence constraint quality weighting factor. [0,1] (-Cseqw)" name="Cseqw" type="float" value="1.0"/> + <param checked="false" label="Displayes intermediate output. (-v)" name="v" type="boolean" truevalue="-v" falsevalue=""/> + <param checked="false" label="Prints additional output to the headers of the produced sequences. (-ov)" name="ov" type="boolean" truevalue="-ov" falsevalue=""/> + </inputs> + <outputs> + <data format="fasta" hidden="false" name="default"> + <change_format> + <when input="v" value="-v" format="txt" /> + <when input="ov" value="-ov" format="txt" /> + </change_format> + </data> + </outputs> + <tests> + <test> + <param name="Cstr" value="((..(..((...)))..))" /> + <param name="tGC" value="0.5" /> + <param name="n" value="1" /> + <output name="default"> + <assert_contents> + <has_text_matching expression="[ACGU]{19}"/> + </assert_contents> + </output> + </test> + </tests> + <help><![CDATA[ +. + +=========================== +antaRNA - ant assembled RNA +=========================== + +- antaRNA uses the VIENNNA RNA Package + - specifically it uses RNAfold and RNAdistance to calculate energies of and distances between secondary structures (version 2.1.x) + - for the parametrization of antaRNA the version 2.1.3 of the ViennaRNA package was used + + +- For questions and remarks please feel free to contact us at http://www.bioinf.uni-freiburg.de/ + +Example parameters: + - --Cstr "...(((...)))..." --tGC 0.5 -n 2 + - --Cstr ".........AAA(((...)))AAA........." --tGC 0.5 -n 10 --output_file /path/to/antaRNA_TESTRUN -ov + - --Cstr "BBBBB....AAA(((...)))AAA....BBBBB" --Cseq "NNNNANNNNNCNNNNNNNNNNNGNNNNNNUNNN" --tGC 0.5 -n 10 + + + ]]></help> + <citations> + </citations> +</tool> + |
b |
diff -r 000000000000 -r fcf4719d3831 tool_dependencies.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tool_dependencies.xml Wed May 13 11:02:53 2015 -0400 |
b |
@@ -0,0 +1,15 @@ +<?xml version="1.0"?> +<tool_dependency> + <package name="pkiss" version="2.2.12"> + <repository changeset_revision="a81b223cfe94" name="package_pkiss_2_2_12" owner="rnateam" prior_installation_required="True" toolshed="https://toolshed.g2.bx.psu.edu" /> + </package> + <package name="rnashapes" version="3.2.5"> + <repository changeset_revision="62faae9d2401" name="package_rnashapes_3_2_5" owner="rnateam" prior_installation_required="True" toolshed="https://toolshed.g2.bx.psu.edu" /> + </package> + <package name="numpy" version="1.7.1"> + <repository changeset_revision="c7ae57300a77" name="package_numpy_1_7" owner="iuc" prior_installation_required="True" toolshed="https://toolshed.g2.bx.psu.edu" /> + </package> + <package name="vienna_rna" version="2.1.5"> + <repository changeset_revision="3b53eda26527" name="package_vienna_rna_2_1" owner="iuc" toolshed="https://toolshed.g2.bx.psu.edu" /> + </package> +</tool_dependency> |