Mercurial > repos > rnateam > antarna
annotate antaRNA.py @ 1:be7f956817ef draft
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
author | rnateam |
---|---|
date | Fri, 08 May 2015 11:26:45 -0400 |
parents | 3fde35e023f4 |
children | 3d00f7b51b9c |
rev | line source |
---|---|
0
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1 import numpy |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
2 import sys |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
3 import random |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
4 import subprocess |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
5 import re |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
6 import decimal |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
7 import math |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
8 import os |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
9 import shutil |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
10 import time |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
11 import types |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
12 import argparse |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
13 #from argparse import RawTextHelpFormatter |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
14 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
15 ############################# |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
16 # FUNCTIONS |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
17 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
18 def print2file(f, i, m): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
19 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
20 print content i to file f in mode m |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
21 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
22 line = str(i) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
23 if m == "a": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
24 call = "echo \"" + line + "\" >> " + f |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
25 elif m == "w": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
26 call = "echo \"" + line + "\" > " + f |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
27 os.system(call) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
28 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
29 # checking and correcting the alphabet of the constraint sequence |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
30 def checkSequenceConstraint(SC): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
31 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
32 Checks the Sequence constraint for illegal nucleotide characters |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
33 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
34 out = "" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
35 for c in SC: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
36 c = c.upper() |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
37 if c not in "ACGURYSWKMBDHVN": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
38 # 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": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
39 if c == "T": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
40 c = "U" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
41 else: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
42 print "\tIllegal Character in the constraint sequence!" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
43 print "\tPlease use the IUPAC nomenclature for defining nucleotides in the constraint sequence!" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
44 print "\tA Adenine" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
45 print "\tC Cytosine" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
46 print "\tG Guanine" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
47 print "\tT/U Thymine/Uracil" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
48 print "\tR A or G" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
49 print "\tY C or T/U" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
50 print "\tS G or C" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
51 print "\tW A or T/U" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
52 print "\tK G or T/U" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
53 print "\tM A or C" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
54 print "\tB C or G or T/U" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
55 print "\tD A or G or T/U" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
56 print "\tH A or C or T/U" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
57 print "\tV A or C or G" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
58 print "\tN any base" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
59 exit(0) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
60 out += c |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
61 return (1, out) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
62 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
63 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
64 def transform(seq): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
65 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
66 Transforms "U" to "T" for the processing is done on DNA alphabet |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
67 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
68 S = "" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
69 for s in seq: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
70 if s == "T": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
71 S += "U" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
72 else: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
73 S += s |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
74 return S |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
75 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
76 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
77 def checkSimilarLength(s, SC): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
78 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
79 Compares sequence and structure constraint length |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
80 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
81 if len(s) == len(SC): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
82 return 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
83 else: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
84 return 0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
85 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
86 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
87 def isStructure(s): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
88 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
89 Checks if the structure constraint only contains "(", ")", and "." and legal fuzzy structure constraint characters. |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
90 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
91 returnvalue = 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
92 for a in range(0,len(s)): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
93 if s[a] not in ".()[]{}<>": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
94 if s[a] not in "ABCDEFGHIJKLMNOPQRSTUVWXYZ": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
95 returnvalue = 0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
96 return returnvalue |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
97 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
98 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
99 def isBalanced(s): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
100 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
101 Check if the structure s is of a balanced nature |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
102 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
103 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
104 balance = 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
105 for bracket in ["()", "[]", "{}", "<>"]: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
106 counter = 0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
107 for a in xrange(len(s)): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
108 if s[a] in bracket[0]: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
109 counter += 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
110 elif s[a] in bracket[1]: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
111 counter -= 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
112 if counter != 0: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
113 balance = 0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
114 return balance |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
115 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
116 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
117 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
118 def fulfillsHairpinRule(s): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
119 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
120 CHECKING FOR THE 3 nt LOOP INTERSPACE |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
121 for all kind of basepairs, even wihtin the pdeudoknots |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
122 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
123 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
124 fulfillsRules = 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
125 for bracket in ["()", "[]", "{}", "<>"]: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
126 last_opening_char = 0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
127 check = 0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
128 for a in xrange(len(s)): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
129 if s[a] == bracket[0]: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
130 last_opening_char = a |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
131 check = 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
132 elif s[a] == bracket[1] and check == 1: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
133 check = 0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
134 if a - last_opening_char < 4: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
135 return 0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
136 return 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
137 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
138 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
139 def isValidStructure(s): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
140 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
141 Checks, if the structure s is a valid structure |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
142 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
143 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
144 Structure = isStructure(s) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
145 Balanced = isBalanced(s) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
146 HairpinRule = fulfillsHairpinRule(s) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
147 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
148 if Structure == 1 and Balanced == 1 and HairpinRule == 1: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
149 return 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
150 else: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
151 print Structure, Balanced, HairpinRule |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
152 return 0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
153 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
154 def loadIUPACcompatibilities(IUPAC, useGU): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
155 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
156 Generating a hash containing all compatibilities of all IUPAC RNA NUCLEOTIDES |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
157 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
158 compatible = {} |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
159 for nuc1 in IUPAC: # ITERATING OVER THE DIFFERENT GROUPS OF IUPAC CODE |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
160 sn1 = list(IUPAC[nuc1]) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
161 for nuc2 in IUPAC: # ITERATING OVER THE DIFFERENT GROUPS OF IUPAC CODE |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
162 sn2 = list(IUPAC[nuc2]) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
163 compatib = 0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
164 for c1 in sn1: # ITERATING OVER THE SINGLE NUCLEOTIDES WITHIN THE RESPECTIVE IUPAC CODE: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
165 for c2 in sn2: # ITERATING OVER THE SINGLE NUCLEOTIDES WITHIN THE RESPECTIVE IUPAC CODE: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
166 # CHECKING THEIR COMPATIBILITY |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
167 if useGU == True: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
168 if (c1 == "A" and c2 == "U") or (c1 == "U" and c2 == "A") or (c1 == "C" and c2 == "G") or (c1 == "G" and c2 == "C") or (c1 == "G" and c2 == "U") or (c1 == "U" and c2 == "G"): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
169 compatib = 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
170 else: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
171 if (c1 == "A" and c2 == "U") or (c1 == "U" and c2 == "A") or (c1 == "C" and c2 == "G") or (c1 == "G" and c2 == "C"): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
172 compatib = 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
173 compatible[nuc1 + "_" + nuc2] = compatib # SAVING THE RESPECTIVE GROUP COMPATIBILITY, REVERSE SAVING IS NOT REQUIRED, SINCE ITERATING OVER ALL AGAINST ALL |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
174 return compatible |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
175 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
176 def isCompatibleToSet(c1, c2, IUPAC_compatibles): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
177 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
178 Checks compatibility of c1 wihtin c2 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
179 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
180 compatible = True |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
181 for setmember in c2: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
182 #print setmember |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
183 if isCompatible(c1, setmember, IUPAC_compatibles) == False: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
184 return False |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
185 return compatible |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
186 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
187 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
188 def isCompatible(c1, c2, IUPAC_compatibles): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
189 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
190 Checks compatibility between character c1 and c2 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
191 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
192 if IUPAC_compatibles[c1 + "_" + c2] == 1: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
193 return True |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
194 else: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
195 return False |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
196 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
197 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
198 def isStructureCompatible(lp1, lp2 ,bp): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
199 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
200 Checks, if the region within lp1 and lp2 is structurally balanced |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
201 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
202 x = lp1 + 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
203 while (x < lp2): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
204 if (bp[x] <= lp1 or bp[x] > lp2): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
205 return False |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
206 if x == bp[x]: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
207 x += 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
208 else: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
209 x = bp[x] + 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
210 return x == lp2 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
211 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
212 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
213 def checkConstaintCompatibility(basepairstack, sequenceconstraint, IUPAC_compatibles): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
214 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
215 Checks if the constraints are compatible to each other |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
216 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
217 returnstring = "" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
218 compatible = 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
219 for id1 in basepairstack: # key = (constraint , (pos, constraint))) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
220 constr1 = basepairstack[id1][0] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
221 id2 = basepairstack[id1][1][0] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
222 constr2 = basepairstack[id1][1][1] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
223 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
224 if id1 != id2 and not isCompatible(constr1, constr2, IUPAC_compatibles): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
225 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
226 compatible = 0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
227 returnstring += "nucleotide constraint " + str(constr1) + " at position " + str(id1) + " is not compatible with nucleotide constraint " + str(constr2) + " at position " + str(id2) + "\n" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
228 #if not isCompatible(basepairstack[basepair][0], basepairstack[basepair][1][1]): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
229 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
230 #compatible = 0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
231 #else: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
232 #returnstring += "nucleotide constraint " + str(basepairstack[basepair][0]) + " at position " + str(basepair) + " is compatible with nucleotide constraint " + str(basepairstack[basepair][1][1]) + " at position " + str(basepairstack[basepair][1][0]) + "\n" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
233 return (compatible, returnstring) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
234 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
235 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
236 def getLP(BPSTACK): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
237 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
238 Retreives valid lonley base pairs from a base pair stack |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
239 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
240 #20 ('N', (>BLOCK<, 'N')) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
241 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
242 # geting single base pairs |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
243 stack = {} |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
244 LP = {} |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
245 if type(BPSTACK[random.choice(BPSTACK.keys())]) == types.TupleType: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
246 for i in BPSTACK.keys(): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
247 #if str(BPSTACK[i][1][0]) not in "ABCDEFGHIJKLMNOPQRSTUVWXYZ": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
248 stack[i] = int(BPSTACK[i][1][0]) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
249 #print i , BPSTACK[i][1][0] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
250 else: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
251 for i in BPSTACK.keys(): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
252 #if str(BPSTACK[i]) not in "ABCDEFGHIJKLMNOPQRSTUVWXYZ": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
253 stack[i] = BPSTACK[i] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
254 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
255 # removing redundant base pair indices |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
256 for i in stack.keys(): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
257 if i >= stack[i]: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
258 del stack[i] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
259 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
260 # actual checking for single lonley base pairs |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
261 for i in stack.keys(): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
262 if not (i-1 in stack and stack[i-1] == stack[i] + 1) and not (i+1 in stack and stack[i+1] == stack[i] - 1): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
263 LP[i] = stack[i] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
264 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
265 ##actual removal of 2er lonley base pairs |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
266 for i in stack.keys(): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
267 if not (i-1 in stack and stack[i-1] == stack[i] + 1) and (i+1 in stack and stack[i+1] == stack[i] - 1) and not (i+2 in stack and stack[i+2] == stack[i] - 2): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
268 LP[i] = stack[i] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
269 LP[i+1] = stack[i+1] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
270 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
271 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
272 #if type(BPSTACK[random.choice(BPSTACK.keys())]) == types.TupleType: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
273 #for i in BPSTACK.keys(): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
274 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
275 ##if str(BPSTACK[i][1][0]) not in "ABCDEFGHIJKLMNOPQRSTUVWXYZ": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
276 #stack[i] = int(BPSTACK[i][1][0]) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
277 ##print i , BPSTACK[i][1][0] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
278 #else: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
279 #for i in BPSTACK.keys(): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
280 ##if str(BPSTACK[i]) not in "ABCDEFGHIJKLMNOPQRSTUVWXYZ": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
281 #stack[i] = BPSTACK[i] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
282 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
283 #for i in stack.keys(): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
284 #if i >= stack[i]: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
285 #del stack[i] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
286 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
287 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
288 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
289 return LP |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
290 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
291 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
292 def getBPStack(s, seq): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
293 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
294 Returns a dictionary of the corresponding basepairs of the structure s and the sequence constraint seq. |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
295 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
296 tmp_stack = {"()":[], "{}":[], "[]":[], "<>":[]} |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
297 bpstack = {} |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
298 for i in xrange(len(s)): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
299 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
300 # REGULAR SECONDARY STRUCTURE DETECTION |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
301 if s[i] in "(){}[]<>": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
302 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
303 no = 0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
304 ### opening |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
305 if s[i] in "([{<": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
306 if s[i] == "(": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
307 tmp_stack["()"].append((i, seq[i])) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
308 elif s[i] == "[": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
309 tmp_stack["[]"].append((i, seq[i])) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
310 elif s[i] == "{": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
311 tmp_stack["{}"].append((i, seq[i])) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
312 elif s[i] == "<": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
313 tmp_stack["<>"].append((i, seq[i])) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
314 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
315 #closing |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
316 elif s[i] in ")]}>": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
317 if s[i] == ")": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
318 no, constr = tmp_stack["()"].pop() |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
319 elif s[i] == "]": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
320 no, constr = tmp_stack["[]"].pop() |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
321 elif s[i] == "}": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
322 no, constr = tmp_stack["{}"].pop() |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
323 elif s[i] == ">": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
324 no, constr = tmp_stack["<>"].pop() |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
325 bpstack[no] = (constr, (i, seq[i])) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
326 bpstack[i] = (seq[i] ,(no, constr)) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
327 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
328 elif s[i] == ".": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
329 bpstack[i] = (seq[i], (i, seq[i])) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
330 elif s[i] in "ABCDEFGHIJKLMNOPQRSTUVWXYZ": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
331 bpstack[i] = (seq[i], (i, seq[i])) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
332 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
333 return (bpstack, getLP(bpstack)) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
334 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
335 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
336 def getbpStack(s): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
337 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
338 Returns a dictionary of the corresponding basepairs of the structure s and the sequence constraint seq. |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
339 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
340 tmp_stack = {"()":[], "{}":[], "[]":[], "<>":[]} |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
341 bpstack = {} |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
342 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
343 for i in xrange(len(s)): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
344 if s[i] in "(){}[]<>": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
345 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
346 no = 0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
347 ### opening |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
348 if s[i] in "([{<": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
349 if s[i] == "(": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
350 tmp_stack["()"].append(i) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
351 elif s[i] == "[": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
352 tmp_stack["[]"].append(i) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
353 elif s[i] == "{": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
354 tmp_stack["{}"].append(i) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
355 elif s[i] == "<": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
356 tmp_stack["<>"].append(i) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
357 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
358 #closing |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
359 elif s[i] in ")]}>": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
360 if s[i] == ")": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
361 no = tmp_stack["()"].pop() |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
362 elif s[i] == "]": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
363 no = tmp_stack["[]"].pop() |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
364 elif s[i] == "}": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
365 no = tmp_stack["{}"].pop() |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
366 elif s[i] == ">": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
367 no = tmp_stack["<>"].pop() |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
368 bpstack[no] = i # save basepair in the format {opening base id (opening seq constr,(closing base id, closing seq constr))} |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
369 bpstack[i] = no # save basepair in the format {closing base id (closing seq constr,(opening base id, opening seq constr))} |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
370 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
371 elif s[i] == ".": # no structural constaint given: produce entry, which references itself as a base pair partner.... |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
372 bpstack[i] = i |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
373 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
374 elif s[i] in "ABCDEFGHIJKLMNOPQRSTUVWXYZ": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
375 bpstack[i] = i |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
376 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
377 #elif s[i] in "ABCDEFGHIJKLMNOPQRSTUVWXYZ": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
378 ## per position, assigned to a certain block, the target nucleotide, with whcih it should interact is marked with the specific |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
379 ## block character |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
380 #bpstack[i] = s[i] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
381 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
382 return (bpstack, getLP(bpstack)) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
383 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
384 def maprange( a, b, s): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
385 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
386 Mapping function |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
387 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
388 (a1, a2), (b1, b2) = a, b |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
389 return b1 + ((s - a1) * (b2 - b1) / (a2 - a1)) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
390 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
391 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
392 def applyGCcontributionPathAdjustment(pathlength, tmpGC, nt): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
393 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
394 GC path length contribution calculation. |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
395 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
396 GCadjustment = 1.5 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
397 minimum = 0.5 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
398 upper = GCadjustment |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
399 lower = minimum |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
400 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
401 if nt == "A" or nt == "U": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
402 pathlength = pathlength * maprange( (0, 1) , (lower, upper), tmpGC) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
403 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
404 if nt == "G" or nt == "C": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
405 #pathlength = pathlength * (float(1-tmpGC)) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
406 pathlength = pathlength * maprange( (1, 0) , (lower, upper), tmpGC) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
407 return pathlength |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
408 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
409 def getConstraint(TE, BPstack, IUPAC, IUPAC_compatibles, IUPAC_reverseComplements): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
410 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
411 Dependend on the situation in the constraint an the respective path section, setting wether a specific constraint can be given or not (for that path section) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
412 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
413 # TE :: transition element / path section under dispute |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
414 # id1 :: id of the position of the caharacter to which the transition is leading to |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
415 # id2 :: id of the position of the character, which is listed in the BPinformation, it can be id1 as well, when no bp is present |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
416 # val :: BPstack information of the specific position |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
417 # constr1 :: constraining character of pos id1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
418 # constr2 :: constraining character of pos id2 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
419 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
420 id1 = int(TE.split(".")[0]) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
421 val = BPstack[id1] # check out the value of the destination character in the basepair/constraint stack |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
422 constr1 = val[0] # getting the constraint character of position id1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
423 id2 = int(val[1][0]) # getting position id2 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
424 constr2 = val[1][1] # getting the sequence constraint for position id2 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
425 targetNucleotide = TE.split(".")[1][-1:] # where the edge is leading to |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
426 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
427 c1 = set(IUPAC[constr1]) # getting all explicit symbols of c1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
428 c2 = set(IUPAC_reverseComplements[constr2]) # getting the reverse complement explicit symbols of c2 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
429 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
430 if targetNucleotide in c1: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
431 if id1 == id2: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
432 return 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
433 else: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
434 if targetNucleotide in c2: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
435 return 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
436 else: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
437 return 0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
438 else: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
439 return 0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
440 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
441 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
442 def getConstraint(TE, BPstack): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
443 # TE :: transition element / path section |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
444 # id1 :: id of the position of the caharacter to which the transition is leading to |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
445 # id2 :: id of the position of the character, which is listed in the BPinformation, it can be id1 as well, when no bp is present |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
446 # val :: BPstack information of the specific position |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
447 # constr1 :: constraining character of pos id1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
448 # constr2 :: constraining character of pos id2 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
449 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
450 ### BPstack [id1] = (constr1, (id2, constr2)) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
451 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
452 id1 = TE.split(".")[0] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
453 #print id1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
454 #id1 = TE.find(TE.strip("_")) # strip the path section and getting the position of the section |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
455 #if len(TE.strip("_")) == 2: # check if the path section is from an internal and not an initial transition |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
456 #id1 += 1 # increase position id1 by 1, since the last character of the section is the destination character |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
457 val = BPstack[int(id1)] # check out the value of the destination character in the basepair/constraint stack |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
458 constr1 = val[0] # getting the constraint character of position id1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
459 id2 = val[1][0] # getting position id2 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
460 constr2 = val[1][1] # getting the sequence constraint for position id2 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
461 #print TE, id1, constr1, id2, constr2, |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
462 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
463 #TE.split(".")[1][-1:] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
464 if id1 == id2: # both ids were the same with either character, sequential or no sequential constraint -> no basepair constraint |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
465 if constr1 == TE.split(".")[1][-1:] and constr2 == TE.split(".")[1][-1:]: # case if the single base constraints on position id1 == id2 are the same as the destination character on id1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
466 #print 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
467 return 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
468 elif constr1 == constr2 == "N": # case if the single base constraints on position id1 == id2 has no constraint |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
469 #print 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
470 return 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
471 else: # single base sequence constraints differ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
472 #print 0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
473 return 0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
474 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
475 elif id1 != id2: # showing differentq ids, indicating a bp, (basepair structural constraint) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
476 if constr1 == "N" and constr2 == "N": # no sequence constraint |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
477 #print 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
478 return 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
479 if constr1 == "N" and constr2 != "N": # c1 has no constraint, c2 has character constraint (sequence constraint of closing bases) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
480 if TE.split(".")[1][-1:] == complementBase(constr2): # the current path section destination base is equal to the complement base of the mentioned sequence constraint in constr2 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
481 #print 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
482 return 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
483 else: # case if the current path section destination base is not equeal to the mentioned complement sequence constraint in constr2 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
484 #print 0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
485 return 0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
486 if constr1 != "N" and constr2 == "N": # c1 has character constraint, c2 has no character constraint (sequence constraint in the opening base) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
487 if TE.split(".")[1][-1:] == constr1: # the current path section destination base is as constrained with constr1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
488 #print 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
489 return 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
490 else: # the current path section destination base is not as constrained in constr1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
491 #print 0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
492 return 0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
493 if constr1 != "N" and constr2 != "N": # both positions have sequential constraint |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
494 if TE.split(".")[1][-1:] == constr1: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
495 #print 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
496 return 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
497 else: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
498 #print 0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
499 return 0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
500 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
501 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
502 def applyTerrainModification(terrain, s, tmpGC, SC, BPstack, IUPAC, IUPAC_compatibles, IUPAC_reverseComplements): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
503 #nucleotides = {'A': 0, 'C': 1,'G': 2,'T': 3} |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
504 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
505 dels = [] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
506 for terrainelement in sorted(terrain): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
507 pheromone, pathlength = terrain[terrainelement] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
508 pheromone = getConstraint(terrainelement, BPstack, IUPAC, IUPAC_compatibles, IUPAC_reverseComplements) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
509 pathlength = getConstraint(terrainelement, BPstack, IUPAC, IUPAC_compatibles, IUPAC_reverseComplements) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
510 pathlength = applyGCcontributionPathAdjustment(pathlength, tmpGC,terrainelement.split(".")[1][-1:]) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
511 if pheromone * pathlength == 0: dels.append(terrainelement) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
512 terrain[terrainelement] = (pheromone, pathlength,[]) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
513 further_dels = {} |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
514 for terrainelement in sorted(dels): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
515 pos, nucs = terrainelement.split(".") |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
516 if int(pos) < len(s)-1: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
517 to_nt = nucs[-1:] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
518 successor_pos = int(pos) + 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
519 for i in ["A", "C", "G", "U"]: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
520 del_element = str(successor_pos) + "." + to_nt + i |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
521 further_dels[del_element] = 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
522 further_dels[terrainelement] = 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
523 # deleting the inbound and outbound edges, which are forbidden |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
524 for terrainelement in further_dels: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
525 del terrain[terrainelement] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
526 # allocate the appropriate children of edges |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
527 for terrainelement in terrain: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
528 pheromone, pathlength, children = terrain[terrainelement] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
529 pos, nucs = terrainelement.split(".") |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
530 if int(pos) < len(s): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
531 to_nt = nucs[-1:] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
532 successor_pos = int(pos) + 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
533 for i in ["A", "C", "G", "U"]: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
534 if str(successor_pos) + "." + to_nt + i in terrain: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
535 children.append(str(successor_pos) + "." + to_nt + i) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
536 terrain[terrainelement] = (pheromone, pathlength,children) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
537 starts = [] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
538 for i in ["A", "C", "G", "U"]: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
539 if str(0) + "." + i in terrain: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
540 starts.append(str(0) + "." + i) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
541 terrain["00.XY"] = (1, 1, starts) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
542 return (terrain, BPstack) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
543 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
544 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
545 def initTerrain(s): # THE CLASSIC |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
546 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
547 Initialization of the terrain with graph like terrain... vertices are modeled implicitly |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
548 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
549 nt = ["A","C","G","U"] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
550 nt2 = ["AA","AC","AG","AU","CA","CC","CG","CU","GA","GC","GG","GU","UA","UC","UG","UU"] # Allowed dinucleotides |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
551 e = {} |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
552 pathlength = 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
553 pheromone = 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
554 for p in xrange(len(s)): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
555 if p == 0: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
556 for i in nt: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
557 e["%s.%s"%(p,i)] = (pheromone, pathlength) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
558 elif p > 0: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
559 for n in nt2: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
560 e["%s.%s"%(p,n)] = (pheromone, pathlength) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
561 return e |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
562 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
563 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
564 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
565 def complementBase(c): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
566 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
567 Returns the complement RNA character of c (without GU base pairs) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
568 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
569 retChar = "" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
570 if c == "A" : |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
571 retChar = "U" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
572 elif c == "U": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
573 retChar = "A" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
574 elif c == "C": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
575 retChar = "G" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
576 elif c == "G": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
577 retChar = "C" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
578 return retChar |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
579 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
580 def printTerrain(terrain): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
581 #print sorted(terrain.keys()) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
582 tmp_i = "0" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
583 tmp_c = 0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
584 terrain = terrain[0] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
585 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
586 for a, i in enumerate(sorted(terrain.keys())): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
587 #print a |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
588 if i.split(".")[0] != tmp_i: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
589 print "\nElements:", tmp_c,"\n#########################\n", i, terrain[i] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
590 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
591 tmp_c = 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
592 tmp_i = i.split(".")[0] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
593 else: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
594 print i, terrain[i] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
595 tmp_c += 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
596 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
597 print "\nElements:", tmp_c |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
598 print "#########################" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
599 print len(terrain) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
600 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
601 def pickStep(tmp_steps, summe): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
602 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
603 Selects a step within the terrain |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
604 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
605 if len(tmp_steps) == 1: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
606 return tmp_steps[0][1] # returning the nucleotide of the only present step |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
607 else: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
608 rand = random.random() # draw random number |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
609 mainval = 0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
610 for choice in xrange(len(tmp_steps)): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
611 val, label = tmp_steps[choice] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
612 mainval += val/float(summe) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
613 if mainval > rand: # as soon, as the mainval gets larger than the random value the assignment is done |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
614 return label |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
615 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
616 def getPath(s, tmp_terrain, tmp_BPstack, alpha, beta, IUPAC, IUPAC_reverseComplements): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
617 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
618 Performs a walk through the terrain and assembles a sequence, while respecting the structure constraint and IUPAC base complementarity |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
619 of the base pairs GU, GC and AT |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
620 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
621 nt = ["A","C","G","U"] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
622 prev_edge = "00.XY" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
623 sequence = "" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
624 while len(sequence) < len(s): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
625 coming_from = sequence[-1:] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
626 summe = 0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
627 steps = [] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
628 i = len(sequence) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
629 allowed_nt = "ACGU" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
630 # base pair closing case check, with subsequent delivery of a reduced allowed nt set |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
631 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
632 if i > tmp_BPstack[i][1][0]: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
633 jump = tmp_BPstack[i][1][0] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
634 nuc_at_jump = sequence[jump] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
635 allowed_nt = IUPAC_reverseComplements[nuc_at_jump] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
636 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
637 #allowed_nt = complementBase(nuc_at_jump) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
638 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
639 # Checking for every possible nt if it is suitable for the selection procedure |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
640 for edge in tmp_terrain[prev_edge][-1]: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
641 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
642 if edge[-1:] in allowed_nt: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
643 pheromone, PL , children = tmp_terrain[edge] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
644 #if PL > 0: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
645 value = ((float(pheromone * alpha)) + ((1/float(PL)) * beta)) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
646 summe += value |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
647 steps.append((value, edge)) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
648 prev_edge = pickStep(steps, summe) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
649 sequence += prev_edge[-1:] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
650 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
651 return sequence |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
652 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
653 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
654 ### |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
655 # STRUCTURE PREDICTORS |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
656 ### |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
657 def getPKStructure(sequence, temperature, mode = "A"): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
658 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
659 Initialization pKiss mfe pseudoknot prediction |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
660 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
661 p2p = "pKiss" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
662 #p2p = "/usr/local/pkiss/2014-03-17/bin/pKiss_mfe" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
663 strategy = "--strategy " |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
664 t = "--temperature " + str(temperature) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
665 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
666 if mode == "A": strategy += "A" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
667 elif mode == "B": strategy += "B" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
668 elif mode == "C": strategy += "C" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
669 elif mode == "D": strategy += "D" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
670 elif mode == "P": strategy += "P" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
671 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
672 p = subprocess.Popen( ([p2p, "--mode mfe", strategy, t]), |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
673 #shell = True, |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
674 stdin = subprocess.PIPE, |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
675 stdout = subprocess.PIPE, |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
676 stderr = subprocess.PIPE, |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
677 close_fds = True) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
678 #print p.stderr.readline() |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
679 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
680 p.stdin.write(sequence+'\n') |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
681 pks = p.communicate() |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
682 structure = "".join(pks[0].split("\n")[2].split(" ")[-1:]) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
683 return structure |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
684 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
685 def init_RNAfold(temperature, paramFile = ""): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
686 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
687 Initialization RNAfold listener |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
688 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
689 #p2p = "/home/rk/Software/ViennaRNA/ViennaRNA-1.8.5/Progs/RNAfold" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
690 p2p = "RNAfold" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
691 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
692 t = "-T " + str(temperature) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
693 P = "" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
694 if paramFile != "": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
695 P = "-P " + paramFile |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
696 p = subprocess.Popen( ([p2p, '--noPS', '-d 2', t, P]), |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
697 #shell = True, |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
698 stdin = subprocess.PIPE, |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
699 stdout = subprocess.PIPE, |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
700 stderr = subprocess.PIPE, |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
701 close_fds = True) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
702 return p |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
703 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
704 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
705 def consult_RNAfold(seq, p): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
706 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
707 Consults RNAfold listener |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
708 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
709 p.stdin.write(seq+'\n') |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
710 out = "" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
711 for i in xrange(2): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
712 out += p.stdout.readline() |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
713 return out |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
714 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
715 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
716 def getRNAfoldStructure(struct2, process1): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
717 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
718 Retrieves folded structure of a RNAfold call |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
719 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
720 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
721 RNAfold_pattern = re.compile('.+\n([.()]+)\s.+') |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
722 #RNAdist_pattern = re.compile('.*\s([\d]+)') |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
723 RNAfold_match = RNAfold_pattern.match(consult_RNAfold(struct2, process1)) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
724 current_structure = "" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
725 #if RNAfold_match: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
726 return RNAfold_match.group(1) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
727 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
728 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
729 def init_RNAdistance(): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
730 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
731 Initialization of RNAdistance listener |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
732 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
733 #p2p = "/home/rk/Software/ViennaRNA/ViennaRNA-1.8.5/Progs/RNAdistance" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
734 p2p = "RNAdistance" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
735 p = subprocess.Popen( ([p2p]), |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
736 #shell = True, |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
737 stdin = subprocess.PIPE, |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
738 stdout = subprocess.PIPE, |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
739 stderr = subprocess.PIPE, |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
740 close_fds = True) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
741 return p |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
742 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
743 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
744 def consult_RNAdistance(s1, s2, p): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
745 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
746 Consulting the RNAdistance listener |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
747 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
748 p.stdin.write(s1+'\n') |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
749 p.stdin.write(s2+'\n') |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
750 out = "" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
751 out_tmp = p.stdout.readline().strip() |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
752 if out_tmp != "": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
753 out += out_tmp |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
754 return out |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
755 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
756 def getInducingSequencePositions(Cseq, degreeOfSequenceInducement): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
757 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
758 Delimiting the degree of structure inducement by the supplied sequence constraint. |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
759 0 : no sequence induced structure constraint |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
760 1 : "ACGT" induce structure (explicit nucleotide structure inducement level) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
761 2 : "MWKSYR" and "ACGT" (explicit and double instances) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
762 3 : "BDHV" , "MWKSYR" and "ACGT" (explicit, double, and triple instances) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
763 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
764 setOfNucleotides = "" # resembling the "0"-case |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
765 if degreeOfSequenceInducement == 1: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
766 setOfNucleotides = "ACGU" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
767 elif degreeOfSequenceInducement == 2: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
768 setOfNucleotides = "ACGUMWKSYR" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
769 elif degreeOfSequenceInducement == 3: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
770 setOfNucleotides = "ACGUMWKSYRBDHV" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
771 #elif degreeOfSequenceInducement == 4: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
772 #setOfNucleotides = "ACGTMWKSYRBDHVN" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
773 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
774 tmpSeq = "" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
775 listset = setOfNucleotides |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
776 for pos in Cseq: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
777 if pos not in listset: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
778 tmpSeq += "N" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
779 else: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
780 tmpSeq += pos |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
781 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
782 return setOfNucleotides, tmpSeq |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
783 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
784 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
785 def getBPDifferenceDistance(stack1, stack2): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
786 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
787 Based on the not identical amount of base pairs within both structure stacks |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
788 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
789 d = 0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
790 for i in stack1.keys(): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
791 # check base pairs in stack 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
792 if i < stack1[i] and stack1[i] != stack2[i]: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
793 d += 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
794 # check base pairs in stack 2 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
795 for i in stack2.keys(): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
796 if i < stack2[i] and stack1[i] != stack2[i]: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
797 d += 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
798 return d |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
799 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
800 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
801 def getStructuralDistance(target_structure, Cseq, path, RNAfold, verbose, LP, BP, RNAfold_pattern, IUPAC_compatibles, degreeOfSequenceInducement, pseudoknots, strategy): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
802 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
803 Calculator for Structural Distance |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
804 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
805 # fold the current solution's sequence to obtain the structure |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
806 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
807 current_structure = "" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
808 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
809 if pseudoknots: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
810 current_structure = getPKStructure(path,strategy) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
811 else: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
812 RNAfold_match = RNAfold_pattern.match(consult_RNAfold(path, RNAfold)) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
813 current_structure = RNAfold_match.group(1) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
814 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
815 # generate the current structure's base-pair stack |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
816 bp = getbpStack(current_structure)[0] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
817 # add case-dependend structural constraints in case of lonley basepairs formation |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
818 tmp_target_structure_bp = getbpStack(target_structure)[0] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
819 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
820 for lp in LP: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
821 if bp[lp] == LP[lp]: # if the base pair is within the current solution structure, re-add the basepair into the constraint structure. |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
822 #tmp_target_structure[lp] = "(" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
823 #tmp_target_structure[LP[lp]] = ")" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
824 tmp_target_structure_bp[lp] = LP[lp] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
825 tmp_target_structure_bp[LP[lp]] = lp |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
826 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
827 # REMOVE BLOCK CONSTRAINT AND SUBSTITUTE IT WITH SINGLE STRAND INFORMATION repsective with brackets, if allowed base pairs occure |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
828 # check for all allowed implicit constraint block declarators |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
829 for c in "ABCDEFGHIJKLMNOPQRSTUVWXYZ": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
830 occurances = [] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
831 for m in re.finditer(c, target_structure): # search for a declarator in the requested structure |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
832 occurances.append(m.start()) # save the corresponding index |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
833 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
834 # transform declarator into single stranded request |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
835 for i in occurances: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
836 #tmp_target_structure[i] = "." |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
837 tmp_target_structure_bp[i] = i |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
838 # infer a base pair within the block declarated positions, if the current structure provides it. |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
839 for i in occurances: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
840 for j in occurances: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
841 if i < j: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
842 if bp[i] == j: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
843 #tmp_target_structure[i] = "(" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
844 #tmp_target_structure[bp[i]] = ")" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
845 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
846 tmp_target_structure_bp[i] = bp[i] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
847 tmp_target_structure_bp[bp[i]] = i |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
848 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
849 # CHECK FOR SEQUENCE CONSTRAINT WHICH INDUCES STRUCTURE CONSTRAINT IN THE MOMENTARY SITUATION |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
850 #print "Checking Cseq influence and it's induced basepairs..." |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
851 IUPACinducers, tmp_Cseq = getInducingSequencePositions(Cseq, degreeOfSequenceInducement) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
852 if len(Cseq.strip("N")) > 0: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
853 #print "Processing Cseq influence" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
854 # Iterate over all positions within the Base Pair stack |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
855 for i in BP: # Check for each base index i |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
856 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
857 if i < bp[i]: # if the current index is samller that the affiliated in the basepair stack of the current solution |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
858 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
859 bp_j = bp[i] # Actual j index of the current solution |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
860 BP_j = BP[i][1][0] # j index of the requested structure |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
861 if (i != bp_j and i == BP_j and BP[i][0] in IUPACinducers ): # if i pairs with some other base in the current structure, and i is requested single stranded and the Sequence constraint is allowed to induce... |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
862 if (BP[bp_j][1][0] == bp_j and BP[bp_j][0] in IUPACinducers):# If position j is requested singlestranded and position j nucleotide can induce base pairs |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
863 #if isCompatible(bp[i][0], bp[i][1][1], IUPAC_compatibles): # If both nucleotides, i and j are actually compatible |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
864 #tmp_target_structure[i] = "(" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
865 #tmp_target_structure[bp_j] = ")" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
866 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
867 tmp_target_structure_bp[i] = bp[i] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
868 tmp_target_structure_bp[bp_j] = i |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
869 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
870 #tts = "".join(tmp_target_structure) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
871 dsreg = getBPDifferenceDistance(tmp_target_structure_bp, bp) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
872 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
873 # CHECK FOR ALL DETERMINED LONELY BASE PAIRS (i<j), if they are formed |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
874 failLP = 0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
875 for lp in LP: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
876 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
877 if bp[lp] != LP[lp]: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
878 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
879 isComp = isCompatible(path[lp],path[LP[lp]], IUPAC_compatibles) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
880 isStru = isStructureCompatible(lp, LP[lp] ,bp) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
881 if not ( isStru and isStru ): # check if the bases at the specific positions are compatible and check if the |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
882 # basepair can be formed according to pseudoknot free restriction. If one fails, a penalty distance is raised for that base pair |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
883 failLP += 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
884 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
885 #print dsreg, failLP, float(len(tmp_target_structure_bp)) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
886 dsLP = float(failLP) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
887 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
888 return (dsreg + dsLP) /float(len(tmp_target_structure_bp)) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
889 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
890 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
891 def getGC(sequence): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
892 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
893 Calculate GC content of a sequence |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
894 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
895 GC = 0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
896 for nt in sequence: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
897 if nt == "G" or nt == "C": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
898 GC = GC + 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
899 GC = GC/float(len(sequence)) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
900 return GC |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
901 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
902 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
903 def getGCDistance(tGC, gc2, L): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
904 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
905 Calculate the pseudo GC content distance |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
906 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
907 nt_coeff = L * tGC |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
908 pc_nt = (1/float(L))*100 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
909 # |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
910 d = gc2 - tGC |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
911 d = d * 100 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
912 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
913 f = math.floor(nt_coeff) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
914 c = math.ceil(nt_coeff) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
915 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
916 if d < 0: # |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
917 #print "case x",(abs(nt_coeff - f)), pc_nt, (abs(nt_coeff - f)) * pc_nt, |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
918 d = d + (abs(nt_coeff - f)) * pc_nt |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
919 elif d > 0: # case y |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
920 #print "case y", abs(nt_coeff - c), pc_nt, abs(nt_coeff - c) * pc_nt, |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
921 d = d - abs(nt_coeff - c) * pc_nt |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
922 elif d == 0: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
923 pass |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
924 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
925 d = round(d, 7) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
926 #d = max(0, abs(d)- ( max ( abs( math.ceil(nt_coeff)-(nt_coeff)) , abs(math.floor(nt_coeff)-(nt_coeff)) )/L)*100 ) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
927 return abs(d) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
928 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
929 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
930 def getSequenceEditDistance(SC, path): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
931 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
932 Calculate sequence edit distance of a solution to the constraint |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
933 """# |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
934 IUPAC = {"A":"A", "C":"C", "G":"G", "U":"U", "R":"AG", "Y":"CU", "S":"GC", "W":"AU","K":"GU", "M":"AC", "B":"CGU", "D":"AGU", "H":"ACU", "V":"ACG", "N":"ACGU"} |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
935 edit = 0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
936 for i in xrange(len(SC)): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
937 if path[i] not in IUPAC[SC[i]]: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
938 edit += 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
939 return edit/float(len(path)) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
940 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
941 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
942 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
943 def getTransitions(p): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
944 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
945 Retreive transitions of a specific path/sequence |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
946 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
947 transitions = [] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
948 for pos in xrange(len(p)): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
949 if pos == 0: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
950 transitions.append(str(pos) + "." + p[pos]) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
951 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
952 else: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
953 insert = p[pos-1] + p[pos] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
954 transitions.append(str(pos) + "." + insert) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
955 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
956 return transitions |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
957 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
958 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
959 def evaporate(t, er): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
960 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
961 Evaporate the terrain's pheromone trails |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
962 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
963 terr, BP = t |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
964 c = 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
965 for key in terr: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
966 p,l,c = terr[key] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
967 p *= (1-er) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
968 terr[key] = (p, l, c) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
969 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
970 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
971 def updateValue(distance, correction_term, omega): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
972 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
973 Retrieves a distance dependend pheromone value |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
974 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
975 if correction_term == 0: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
976 return 0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
977 else: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
978 if distance == 0: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
979 return omega * correction_term |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
980 else: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
981 return (1/float(distance)) * correction_term |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
982 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
983 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
984 def trailBlaze(p, c_s, s, ds, dgc, dseq, dn, t, correction_terms, BPstack, verbose): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
985 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
986 Pheromone Update function accorinding to the quality of the solution |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
987 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
988 terr, BP = t |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
989 bpstack, LP = getbpStack(c_s) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
990 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
991 struct_correction_term , GC_correction_term, seq_correction_term = correction_terms |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
992 omega = 2.23 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
993 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
994 bs = updateValue(ds, struct_correction_term, omega) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
995 bGC = updateValue(dgc, GC_correction_term, omega) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
996 if dseq != "n.a.": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
997 bSeq = updateValue(dseq, seq_correction_term, omega) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
998 d = bs + bGC + bSeq |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
999 else: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1000 d = bs + bGC |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1001 transitions = getTransitions(p) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1002 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1003 for trans in xrange(len(transitions)): # for each transition in the path |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1004 id1 = int(transitions[trans].split(".")[0]) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1005 tar_id2 = int(BPstack[id1][1][0]) # getting requested position id2 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1006 curr_id2 = int(bpstack[id1]) # getting the current situation |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1007 multiplicator = 0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1008 if tar_id2 == curr_id2 and id1 != tar_id2 and id1 != curr_id2: # case of a base pair, having both brackets on the correct position |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1009 multiplicator = 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1010 elif tar_id2 == curr_id2 and id1 == tar_id2 and id1 == curr_id2: # case of a single stranded base in both structures |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1011 multiplicator = 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1012 p, l, c = terr[transitions[trans]] # getting the pheromone and the length value of the single path transition |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1013 p += d * multiplicator |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1014 terr[transitions[trans]] = (p, l, c) # updating the values wihtin the terrain's |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1015 t = (terr, BP) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1016 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1017 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1018 def updateTerrain(p, c_s, s, ds, dgc, dseq, dn, t, er, correction_terms, BPstack, verbose, ant_count): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1019 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1020 General updating function |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1021 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1022 evaporate(t,er) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1023 trailBlaze(p, c_s, s, ds, dgc, dseq, dn, t, correction_terms, BPstack, verbose) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1024 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1025 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1026 def getUsedTime(start_time): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1027 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1028 Return the used time between -start time- and now. |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1029 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1030 end_time = time.time() |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1031 return end_time - start_time |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1032 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1033 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1034 def good2Go(SC, L, CC, STR): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1035 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1036 Check, if all input is correct and runnable |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1037 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1038 if (SC == 1 and L == 1 and CC == 1 and STR == 1): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1039 return True |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1040 else: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1041 print SC,L,CC,STR |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1042 return False |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1043 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1044 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1045 def getPathFromSelection( aps, s, terrain, alpha, beta, RNAfold, RNAfold_pattern, GC, SC, LP, verbose, IUPAC_compatibles, degreeOfSequenceInducement, IUPAC_reverseComplements, IUPAC, pseudoknots, strategy): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1046 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1047 Returns the winning path from a selection of pathes... |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1048 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1049 terr, BPs = terrain |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1050 win_path = 0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1051 for i in xrange(aps): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1052 # Generate Sequence |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1053 path = getPath(s, terr, BPs, alpha, beta, IUPAC, IUPAC_reverseComplements) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1054 # Measure sequence features and transform them into singular distances |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1055 distance_structural = float(getStructuralDistance(s, SC , path, RNAfold, verbose, LP, BPs, RNAfold_pattern, IUPAC_compatibles, degreeOfSequenceInducement, pseudoknots, strategy)) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1056 distance_GC = float(getGCDistance(GC,getGC(path), len(path))) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1057 distance_seq = float(getSequenceEditDistance(SC, path)) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1058 # Calculate Distance Score |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1059 D = distance_structural + distance_GC + distance_seq |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1060 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1061 # SELECT THE BEST-OUT-OF-k-SOLUTIONS according to distance score |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1062 if i == 0: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1063 win_path = (path, D, distance_structural, distance_GC, distance_seq) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1064 else: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1065 if D < win_path[1]: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1066 win_path = (path, D, distance_structural, distance_GC, distance_seq) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1067 return win_path |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1068 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1069 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1070 def substr(x, string, subst): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1071 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1072 Classical substring function |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1073 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1074 s1 = string[:x-1] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1075 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1076 s2 = string[x-1:x] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1077 s3 = string[x:] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1078 #s2 = s[x+len(string)-x-1:] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1079 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1080 return s1 + subst + s3 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1081 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1082 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1083 def inConvergenceCorridor(d_struct, d_gc, BS_d_struct, BS_d_gc): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1084 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1085 Check if a solutions qualities are within the convergence corridor |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1086 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1087 struct_var = ((BS_d_struct/float(4)) + 3 ) * 4 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1088 gc_var = (BS_d_gc + 1/float(100) * 5) + BS_d_gc + 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1089 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1090 if d_struct <= struct_var and d_gc <= gc_var: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1091 return True |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1092 else: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1093 return False |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1094 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1095 def getGCSamplingValue(GC, tGCmax, tGCvar): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1096 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1097 Returns a suitable GC value, dependend on the user input: Either returning the single GC value, |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1098 which the user entered, or a smpled GC value |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1099 from a designated distribution in it's interavals |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1100 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1101 returnval = 0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1102 if tGCmax == -1.0 and tGCvar == -1.0: # regular plain tGC value as requested |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1103 return GC |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1104 elif tGCmax != -1.0 and tGCvar == -1.0: # uniform distribution tGC value sampling |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1105 if GC < tGCmax: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1106 tmp_GC = tGCmax |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1107 tGCmax = GC |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1108 GC = tmp_GC |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1109 while returnval <= 0: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1110 returnval = float(numpy.random.uniform(low=GC, high=tGCmax, size=1)) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1111 return returnval |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1112 elif tGCmax == -1.0 and tGCvar != -1.0: # normal distribution tGC value sampling |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1113 while returnval <= 0: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1114 returnval = float(numpy.random.normal(GC, tGCvar, 1)) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1115 return returnval |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1116 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1117 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1118 def reachableGC(C_struct): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1119 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1120 Checks if a demanded GC target content is reachable in dependence with the given sequence constraint. |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1121 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1122 AU = 0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1123 for i in C_struct: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1124 if i == "A" or i == "U": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1125 AU += 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1126 maxGC = 1 - (AU / float(len(C_struct))) # 1 - min_GC |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1127 return maxGC |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1128 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1129 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1130 def runColony(s, SC, objective_to_target_distance, GC, alpha, beta, evaporation_rate, correction_terms, verbose, IUPAC, IUPAC_compatibles, degreeOfSequenceInducement, IUPAC_reverseComplements, termination_convergence, convergence_count, reset_limit, improve, temperature, paramFile, pseudoknots, strategy): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1131 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1132 Execution function of a single ant colony finding one solution sequence |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1133 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1134 retString = "" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1135 retString2 = "" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1136 BPstack, LP = getBPStack(s, SC) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1137 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1138 rGC = reachableGC(SC) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1139 GC_message = "" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1140 if GC > rGC: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1141 print >> sys.stderr, "WARNING: Chosen target GC %s content is not reachable due to sequence constraint! Sequence Constraint GC-content is: %s" % (GC, rGC) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1142 GC = rGC |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1143 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1144 # Initial Constraint Checks prior to execution |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1145 STR = isValidStructure(s) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1146 START_SC , SC = checkSequenceConstraint(str(SC)) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1147 START_LENGTH = checkSimilarLength(str(s), str(SC)) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1148 START_constraint_compatibility , CompReport = checkConstaintCompatibility(BPstack, SC, IUPAC_compatibles) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1149 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1150 g2g = good2Go(START_SC, START_LENGTH, START_constraint_compatibility, STR) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1151 if (g2g == 1): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1152 start_time = time.time() |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1153 max_time = 600 # seconds |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1154 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1155 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1156 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1157 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1158 #### |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1159 # INITIALIZATION OF THE RNA TOOLs |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1160 # |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1161 RNAfold = init_RNAfold(temperature, paramFile) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1162 #RNAdistance = init_RNAdistance() |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1163 RNAfold_pattern = re.compile('.+\n([.()]+)\s.+') |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1164 #RNAdist_pattern = re.compile('.*\s([\d]+)') |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1165 # |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1166 #### |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1167 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1168 terrain = initTerrain(s) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1169 #print len(terrain), |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1170 terrain = applyTerrainModification(terrain, s, GC, SC, BPstack, IUPAC, IUPAC_compatibles, IUPAC_reverseComplements) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1171 #print len(terrain[0]) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1172 #printTerrain(terrain) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1173 #exit(0) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1174 global_ant_count = 0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1175 global_best_ants = 0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1176 criterion = False |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1177 met = True |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1178 ant_no = 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1179 prev_res = 0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1180 seq = "" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1181 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1182 counter = 0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1183 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1184 dstruct_log = [] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1185 dGC_log = [] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1186 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1187 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1188 distance_structural = 1000 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1189 distance_GC = 1000 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1190 distance_seq = 1000 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1191 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1192 convergence = convergence_count |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1193 convergence_counter = 0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1194 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1195 resets = 0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1196 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1197 path = "" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1198 curr_structure = "" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1199 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1200 Dscore = 100000 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1201 distance_structural = 10000 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1202 distance_GC = 10000 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1203 distance_seq = 10000 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1204 best_solution = (path, curr_structure, Dscore, distance_structural, distance_GC, distance_seq) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1205 best_solution_local = (path, curr_structure, Dscore, distance_structural, distance_GC, distance_seq) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1206 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1207 best_solution_since = 0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1208 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1209 ants_per_selection = 10 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1210 if len(LP) > 0 : |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1211 for lp in LP: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1212 s = substr(lp + 1, s, ".") |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1213 s = substr(LP[lp] + 1, s, ".") |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1214 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1215 init = 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1216 while criterion != met and getUsedTime(start_time) < max_time: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1217 iteration_start = time.time() |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1218 global_ant_count += 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1219 global_best_ants += 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1220 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1221 path_info = getPathFromSelection(ants_per_selection, s, terrain, alpha, beta, RNAfold, RNAfold_pattern, GC, SC, LP, verbose, IUPAC_compatibles, degreeOfSequenceInducement, IUPAC_reverseComplements, IUPAC, pseudoknots, strategy) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1222 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1223 distance_structural_prev = distance_structural |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1224 distance_GC_prev = distance_GC |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1225 distance_seq_prev = distance_seq |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1226 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1227 path, Dscore , distance_structural, distance_GC, distance_seq = path_info |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1228 curr_structure = "" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1229 if pseudoknots: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1230 curr_structure = getPKStructure(path, strategy) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1231 else: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1232 curr_structure = getRNAfoldStructure(path, RNAfold) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1233 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1234 curr_solution = (path,curr_structure, Dscore, distance_structural, distance_GC, distance_seq) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1235 # BEST SOLUTION PICKING |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1236 if improve == "h": # hierarchical check |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1237 # for the global best solution |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1238 if distance_structural < best_solution[3] or (distance_structural == best_solution[3] and distance_GC < best_solution[4]): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1239 best_solution = curr_solution |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1240 ant_no = 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1241 # for the local (reset) best solution |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1242 if distance_structural < best_solution_local[3] or (distance_structural == best_solution_local[3] and distance_GC < best_solution_local[4]): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1243 best_solution_local = curr_solution |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1244 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1245 elif improve == "s": #score based check |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1246 # store best global solution |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1247 if Dscore < best_solution[2]: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1248 best_solution = curr_solution |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1249 ant_no = 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1250 # store best local solution for this reset |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1251 if Dscore < best_solution_local[2]: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1252 best_solution_local = curr_solution |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1253 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1254 # OLD ' BEST SOLUTION ' PICKING |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1255 # if Dscore < best_solution[2]: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1256 # best_solution = (path,curr_structure, Dscore, distance_structural, distance_GC, distance_seq) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1257 # |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1258 # if Dscore < best_solution_local[2]: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1259 # best_solution_local = (path,curr_structure, Dscore, distance_structural, distance_GC, distance_seq) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1260 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1261 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1262 distance_DN = 0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1263 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1264 if verbose: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1265 print "SCORE " + str(Dscore) + " Resets " + str(resets) + " #Ant " + str(global_ant_count) + " out of " + str(ants_per_selection) + " cc " + str(convergence_counter) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1266 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1267 print s, " <- target struct" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1268 print best_solution[0] , " <- BS since ", str(best_solution_since), "Size of Terrrain:", len(terrain[0]) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1269 print best_solution[1] , " <- BS Dscore " + str(best_solution[2]) + " ds " + str(best_solution[3]) + " dGC " + str(best_solution[4]) + " dseq " + str(best_solution[5])+ " LP " + str(len(LP)) + " <- best solution stats" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1270 print curr_structure, " <- CS" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1271 print path, |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1272 print " <- CS", "Dscore", str(Dscore), "ds", distance_structural, "dGC", distance_GC, "GC", getGC(path)*100, "Dseq", distance_seq |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1273 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1274 #### UPDATING THE TERRAIN ACCORDING TO THE QUALITY OF THE CURRENT BESTO-OUT-OF-k SOLUTION |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1275 updateTerrain(path, curr_structure, s, distance_structural,distance_GC, distance_seq, distance_DN, terrain, evaporation_rate, correction_terms, BPstack, verbose, global_ant_count) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1276 #### |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1277 if verbose: print "Used time for one iteration", time.time() - iteration_start |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1278 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1279 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1280 # CONVERGENCE AND TERMINATION CRITERION MANAGEMENT |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1281 #print distance_structural, distance_GC, best_solution_local[3], best_solution_local[4] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1282 if inConvergenceCorridor(curr_solution[3], curr_solution[4], best_solution_local[3], best_solution_local[4]): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1283 convergence_counter += 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1284 if distance_structural_prev == distance_structural and distance_GC_prev == distance_GC: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1285 convergence_counter += 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1286 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1287 if best_solution[3] == objective_to_target_distance: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1288 if best_solution[4] == 0.0: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1289 break |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1290 ant_no = ant_no + 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1291 convergence_counter -= 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1292 else: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1293 ant_no = 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1294 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1295 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1296 if ant_no == termination_convergence or resets >= reset_limit or global_ant_count >= 100000 or best_solution_since == 5: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1297 break |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1298 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1299 # RESET |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1300 if ant_no < termination_convergence and convergence_counter >= convergence: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1301 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1302 terrain = initTerrain(s) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1303 terrain = applyTerrainModification(terrain, s, GC, SC, BPstack, IUPAC, IUPAC_compatibles, IUPAC_reverseComplements) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1304 criterion = False |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1305 met = True |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1306 ant_no = 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1307 prev_res = 0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1308 pre_path = "_" * len(s) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1309 path = "" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1310 curr_structure = "" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1311 counter = 0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1312 Dscore = 100000 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1313 distance_structural = 1000 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1314 distance_GC = 1000 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1315 distance_seq = 1000 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1316 best_solution_local = (path, curr_structure, Dscore, distance_structural, distance_GC, distance_seq) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1317 convergence = convergence_count |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1318 convergence_counter = 0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1319 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1320 if resets == 0: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1321 sentinel_solution = best_solution |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1322 best_solution_since += 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1323 else: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1324 if best_solution[2] < sentinel_solution[2]: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1325 sentinel_solution = best_solution |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1326 best_solution_since = 0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1327 else: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1328 best_solution_since += 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1329 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1330 resets += 1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1331 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1332 duration = getUsedTime(start_time) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1333 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1334 retString += "|Ants:" + str(global_ant_count) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1335 retString += "|Resets:" + str(resets) + "/" + str(reset_limit) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1336 retString += "|AntsTC:" + str(termination_convergence) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1337 retString += "|CC:" + str(convergence_count) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1338 retString += "|IP:" + str(improve) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1339 retString += "|BSS:" + str(best_solution_since) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1340 #if GC_message != "": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1341 # retString += GC_message + "\n" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1342 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1343 sequence = best_solution[0] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1344 struct = best_solution[1] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1345 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1346 retString += "|LP:" + str(len(LP)) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1347 retString += "|ds:" + str(getStructuralDistance(s,SC, sequence, RNAfold, verbose, LP, BPstack, RNAfold_pattern, IUPAC_compatibles, degreeOfSequenceInducement, pseudoknots, strategy)) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1348 retString += "|dGC:" + str(best_solution[4]) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1349 retString += "|GC:" + str(getGC(sequence)*100) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1350 retString += "|dseq:" + str(getSequenceEditDistance(SC, sequence)) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1351 retString += "|L:" + str(len(sequence)) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1352 retString += "|Time:" + str(duration) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1353 retString2 += "\n" + struct + "\n" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1354 retString2 += sequence |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1355 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1356 # CLOSING THE PIPES TO THE PROGRAMS |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1357 RNAfold.communicate() |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1358 #RNAdistance.communicate() |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1359 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1360 else: # Structural premisses are not met, htherefore the program will halt with a failure message |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1361 retString += "\nSome mistake detected\n" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1362 retString += "SequenceConstraintCheck: " + str(START_SC) + "\nSequenceConstraint: " + str(SC) + "\nLengthCheck: " + str(START_LENGTH) + "\nConstraintCompatibility: " + str(START_constraint_compatibility)+ "\n" + CompReport + "\n" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1363 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1364 return (retString, retString2) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1365 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1366 def findSequence(structure, Cseq, tGC, colonies, name, alpha, beta, evaporation_rate, struct_correction_term, GC_correction_term, seq_correction_term, degreeOfSequenceInducement, file_id, verbose, output_verbose, tGCmax, tGCvar, termination_convergence, convergence_count, reset_limit, improve, seed, temperature, paramFile, pseudoknots, strategy, useGU, return_mod = False): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1367 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1368 MAIN antaRNA - ant assembled RNA |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1369 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1370 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1371 if seed != "none": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1372 random.seed(seed) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1373 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1374 if Cseq == "": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1375 sequenceconstraint = "N" * len(structure) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1376 else: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1377 sequenceconstraint = str(Cseq) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1378 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1379 alpha = float(alpha) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1380 beta = float(beta) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1381 tGC = float(tGC) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1382 evaporation_rate = float(evaporation_rate) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1383 struct_correction_term = float(struct_correction_term) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1384 GC_correction_term = float(GC_correction_term) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1385 seq_correction_term = float(seq_correction_term) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1386 colonies = int(colonies) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1387 file_id = str(file_id) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1388 verbose = verbose |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1389 output_verbose = output_verbose |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1390 correction_terms = struct_correction_term, GC_correction_term, seq_correction_term |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1391 temperature = float(temperature) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1392 print_to_STDOUT = (file_id == "STDOUT") |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1393 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1394 useGU = useGU |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1395 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1396 if return_mod == False: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1397 if print_to_STDOUT == False: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1398 outfolder = '/'.join(file_id.strip().split("/")[:-1]) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1399 curr_dir = os.getcwd() |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1400 if not os.path.exists(outfolder): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1401 os.makedirs(outfolder) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1402 os.chdir(outfolder) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1403 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1404 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1405 sequenceconstraint = transform(sequenceconstraint) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1406 ############################################### |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1407 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1408 # Allowed deviation from the structural target: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1409 objective_to_target_distance = 0.0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1410 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1411 # Loading the IUPAC copatibilities of nuleotides and their abstract representing symbols |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1412 IUPAC = {"A":"A", "C":"C", "G":"G", "U":"U", "R":"AG", "Y":"CU", "S":"GC", "W":"AU","K":"GU", "M":"AC", "B":"CGU", "D":"AGU", "H":"ACU", "V":"ACG", "N":"ACGU"} |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1413 IUPAC_compatibles = loadIUPACcompatibilities(IUPAC, useGU) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1414 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1415 IUPAC_reverseComplements = {} |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1416 if useGU == False: ## Without the GU basepair |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1417 IUPAC_reverseComplements = {"A":"U", "C":"G", "G":"C", "U":"A", "R":"UC", "Y":"AG", "S":"GC", "W":"UA","K":"CA", "M":"UG", "B":"AGC", "D":"ACU", "H":"UGA", "V":"UGC", "N":"ACGU"} |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1418 else: ## allowing the GU basepair |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1419 IUPAC_reverseComplements = {"A":"U", "C":"G", "G":"UC", "U":"AG", "R":"UC", "Y":"AG", "S":"UGC", "W":"UAG","K":"UCAG", "M":"UG", "B":"AGCU", "D":"AGCU", "H":"UGA", "V":"UGC", "N":"ACGU"} |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1420 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1421 result = [] |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1422 for col in xrange(colonies): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1423 # Checking the kind of taget GC value should be used |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1424 GC = getGCSamplingValue(tGC, tGCmax, tGCvar) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1425 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1426 # Actual execution of a ant colony procesdure |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1427 output_v, output_w = runColony(structure, sequenceconstraint, objective_to_target_distance, GC, alpha, beta, evaporation_rate, correction_terms, verbose, IUPAC, IUPAC_compatibles, degreeOfSequenceInducement, IUPAC_reverseComplements, termination_convergence, convergence_count, reset_limit, improve, temperature, paramFile, pseudoknots, strategy) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1428 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1429 # Post-Processing the output of a ant colony procedure |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1430 line = ">" + name + str(col) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1431 if output_verbose: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1432 line += "|Cstr:" + structure + "|Cseq:" + sequenceconstraint + "|Alpha:" + str(alpha) + "|Beta:" + str(beta) + "|tGC:" + str(GC) + "|ER:" + str(evaporation_rate) + "|Struct_CT:" + str(struct_correction_term) + "|GC_CT:" + str(GC_correction_term) + "|Seq_CT:" + str(seq_correction_term) + output_v + output_w |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1433 else: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1434 line += output_w |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1435 if return_mod == False: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1436 if print_to_STDOUT: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1437 print line |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1438 else: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1439 if col == 0: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1440 print2file(file_id, line, 'w') |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1441 else: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1442 print2file(file_id, line, 'a') |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1443 else: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1444 result.append(line) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1445 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1446 if return_mod == True: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1447 return result |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1448 if print_to_STDOUT == False: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1449 os.chdir(curr_dir) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1450 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1451 def execute(args): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1452 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1453 CHECK AND PARSE THE COMMAND LINE STUFF |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1454 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1455 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1456 # Checking the arguments, parsed from the shell |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1457 ############################################### |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1458 name = args.name |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1459 structure = args.Cstr |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1460 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1461 if args.Cseq == "": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1462 sequenceconstraint = "N" * len(structure) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1463 else: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1464 sequenceconstraint = args.Cseq |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1465 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1466 seed = args.seed |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1467 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1468 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1469 alpha = args.alpha |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1470 beta = args.beta |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1471 tGC = args.tGC |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1472 evaporation_rate = args.ER |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1473 struct_correction_term = args.Cstrweight |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1474 GC_correction_term = args.Cgcweight |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1475 seq_correction_term = args.Cseqweight |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1476 colonies = args.noOfColonies |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1477 degreeOfSequenceInducement = args.level |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1478 file_id = args.output_file |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1479 verbose = args.verbose |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1480 output_verbose = args.output_verbose |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1481 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1482 tGCmax = args.tGCmax |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1483 tGCvar = args.tGCvar |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1484 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1485 termination_convergence = args.antsTerConv |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1486 convergence_count = args.ConvergenceCount |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1487 temperature = args.temperature |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1488 reset_limit = args.Resets |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1489 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1490 improve = args.improve_procedure |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1491 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1492 ### RNAfold parameterfile |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1493 paramFile = args.paramFile |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1494 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1495 # Using the pkiss program under user changeable parameters |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1496 pseudoknots = args.pseudoknots |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1497 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1498 # Loading the optimized parameters for pseudoknots and ignore user input |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1499 if args.pseudoknot_parameters: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1500 alpha = 1.0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1501 beta = 0.1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1502 evaporation_rate = 0.2 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1503 struct_correction_term = 0.1 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1504 GC_correction_term = 1.0 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1505 seq_correction_term = 0.5 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1506 termination_convergence = 50 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1507 convergence_count = 100 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1508 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1509 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1510 strategy = args.strategy |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1511 useGU = args.useGUBasePair |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1512 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1513 checkForViennaTools() |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1514 if pseudoknots: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1515 checkForpKiss() |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1516 findSequence(structure, sequenceconstraint, tGC, colonies, name, alpha, beta, evaporation_rate, struct_correction_term, GC_correction_term, seq_correction_term, degreeOfSequenceInducement, file_id, verbose, output_verbose, tGCmax, tGCvar, termination_convergence, convergence_count, reset_limit, improve, seed, temperature, paramFile, pseudoknots, strategy, useGU) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1517 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1518 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1519 def exe(): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1520 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1521 MAIN EXECUTABLE WHICH PARSES THE INPUT LINE |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1522 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1523 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1524 argument_parser = argparse.ArgumentParser( |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1525 description = """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1526 Ant Colony Optimized RNA Sequence Design |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1527 """, |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1528 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1529 epilog = """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1530 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1531 ######################################################################### |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1532 # antaRNA - ant assembled RNA # |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1533 # -> Ant Colony Optimized RNA Sequence Design # |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1534 # ------------------------------------------------------------ # |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1535 # Robert Kleinkauf (c) 2015 # |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1536 # Bioinformatics, Albert-Ludwigs University Freiburg, Germany # |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1537 ######################################################################### |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1538 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1539 - For antaRNA only the VIENNNA RNA Package must be installed on your linux system. |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1540 antaRNA will only check, if the executables of RNAfold and RNAdistance of the ViennaRNA package can be found. If those programs are |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1541 not installed correctly, no output will be generated, an also no warning will be prompted. |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1542 So the binary path of the Vienna Tools must be set up correctly in your system's PATH variable in order to run antaRNA correctly! |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1543 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1544 - antaRNA was only tested under Linux. |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1545 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1546 - For questions and remarks please feel free to contact us at http://www.bioinf.uni-freiburg.de/ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1547 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1548 Example calls: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1549 python antaRNA.py --Cstr "...(((...)))..." --tGC 0.5 -n 2 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1550 python antaRNA.py --Cstr ".........AAA(((...)))AAA........." --tGC 0.5 -n 10 --output_file /path/to/antaRNA_TESTRUN -ov |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1551 python antaRNA.py --Cstr "BBBBB....AAA(((...)))AAA....BBBBB" --Cseq "NNNNANNNNNCNNNNNNNNNNNGNNNNNNUNNN" --tGC 0.5 -n 10 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1552 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1553 ######################################################################### |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1554 # --- Hail to the Queen!!! All power to the swarm!!! --- # |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1555 ######################################################################### |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1556 """, |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1557 #formatter_class=RawTextHelpFormatter |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1558 ) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1559 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1560 # mandatorys |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1561 argument_parser.add_argument("-Cstr", "--Cstr", help="Structure constraint using RNA dotbracket notation with fuzzy block constraint. \n(TYPE: %(type)s)\n\n", type=str, required=True) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1562 argument_parser.add_argument("-tGC", "--tGC", help="Objective target GC content in [0,1].\n(TYPE: %(type)s)\n\n", type=float, required=True) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1563 argument_parser.add_argument("-n", "--noOfColonies", help="Number of sequences which shall be produced. \n(TYPE: %(type)s)\n\n\n\n", type=int, required=True) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1564 argument_parser.add_argument("-GU", "--useGUBasePair", help="Allowing GU base pairs. \n\n", action="store_true") |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1565 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1566 argument_parser.add_argument("-s", "--seed", help = "Provides a seed value for the used pseudo random number generator.\n(DEFAULT: %(default)s, TYPE: %(type)s)\n\n", type=str, default="none") |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1567 argument_parser.add_argument("-ip", "--improve_procedure", help = "Select the improving method. h=hierarchical, s=score_based.\n(DEFAULT: %(default)s, TYPE: %(type)s)\n\n", type=str, default="s") |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1568 argument_parser.add_argument("-r", "--Resets", help = "Amount of maximal terrain resets, until the best solution is retuned as solution.\n(DEFAULT: %(default)s, TYPE: %(type)s)\n\n", type=int, default=5) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1569 argument_parser.add_argument("-CC", "--ConvergenceCount", help = "Delimits the convergence count criterion for a reset.\n(DEFAULT: %(default)s, TYPE: %(type)s)\n\n", type=int, default=130) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1570 argument_parser.add_argument("-aTC", "--antsTerConv", help = "Delimits the amount of internal ants for termination convergence criterion for a reset.\n(DEFAULT: %(default)s, TYPE: %(type)s)\n\n", type=int, default=50) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1571 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1572 argument_parser.add_argument("-p", "--pseudoknots", help = "Switch to pseudoknot based prediction using pKiss. Check the pseudoknot parameter usage!!!\n\n", action="store_true") |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1573 argument_parser.add_argument("-pkPar", "--pseudoknot_parameters", help = "Enable optimized parameters for the usage of pseudo knots (Further parameter input ignored).\n\n", action="store_true") |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1574 argument_parser.add_argument("--strategy", help = "Defining the pKiss folding strategy.\n(DEFAULT: %(default)s, TYPE: %(type)s)\n\n", type=str, default="A") |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1575 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1576 # Mutual Exclusiv target GC distribution variables |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1577 #tGCgroup = argument_parser.add_mutually_exclusive_group() |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1578 argument_parser.add_argument("-tGCmax", "--tGCmax", help = "Provides a maximum tGC value [0,1] for the case of uniform distribution sampling. The regular tGC value serves as minimum value.\n(DEFAULT: %(default)s, TYPE: %(type)s)\n\n", type=float, default=-1.0) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1579 argument_parser.add_argument("-tGCvar", "--tGCvar", help = "Provides a tGC variance (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) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1580 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1581 argument_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) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1582 argument_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="") |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1583 argument_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") |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1584 argument_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 = "") |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1585 argument_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) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1586 argument_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_") |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1587 argument_parser.add_argument("-a", "--alpha", help="Sets alpha, probability weight for terrain path influence. [0,1]\n(DEFAULT: %(default)s, TYPE: %(type)s)\n\n", type=float, default=1.0) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1588 argument_parser.add_argument("-b", "--beta", help="Sets beta, probability weight for terrain pheromone influence. [0,1] \n(DEFAULT: %(default)s, TYPE: %(type)s)\n\n", type=float, default=1.0) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1589 argument_parser.add_argument("-er", "--ER", help="Pheromone evaporation rate. \n(DEFAULT: %(default)s, TYPE: %(type)s)\n\n", type=float, default=0.2) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1590 argument_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) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1591 argument_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) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1592 argument_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) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1593 argument_parser.add_argument("-v", "--verbose", help="Displayes intermediate output.\n\n", action="store_true") |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1594 argument_parser.add_argument("-ov", "--output_verbose", help="Prints additional output to the headers of the produced sequences.\n\n", action="store_false") |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1595 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1596 args = argument_parser.parse_args() |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1597 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1598 execute(args) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1599 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1600 def checkForViennaTools(): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1601 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1602 Checking for the presence of the Vienna tools in the system by which'ing for RNAfold and RNAdistance |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1603 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1604 RNAfold_output = subprocess.Popen(["which", "RNAfold"], stdout=subprocess.PIPE).communicate()[0].strip() |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1605 if len(RNAfold_output) > 0 and RNAfold_output.find("found") == -1 and RNAfold_output.find(" no ") == -1: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1606 return True |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1607 else: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1608 print "It seems the Vienna RNA Package is not installed on your machine. Please do so!" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1609 print "You can get it at http://www.tbi.univie.ac.at/" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1610 exit(0) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1611 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1612 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1613 def checkForpKiss(): |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1614 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1615 Checking for the presence of pKiss |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1616 """ |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1617 pKiss_output = subprocess.Popen(["which", "pKiss"], stdout=subprocess.PIPE).communicate()[0].strip() |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1618 if len(pKiss_output) > 0 and pKiss_output.find("found") == -1 and pKiss_output.find(" no ") == -1: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1619 return True |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1620 else: |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1621 print "It seems that pKiss is not installed on your machine. Please do so!" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1622 print "You can get it at http://bibiserv2.cebitec.uni-bielefeld.de/pkiss" |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1623 exit(0) |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1624 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1625 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1626 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1627 if __name__ == "__main__": |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1628 |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1629 exe() |
3fde35e023f4
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/antarna/ commit c48d2707acb0e6b6d9dc3aa19d1ce13d7249dc46-dirty
rnateam
parents:
diff
changeset
|
1630 |