changeset 2:b761116ea6ee draft

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/vienna_rna commit b'bd13ffd1c3e126a6dc59dd3c478347ec1b5824a3\n'
author rnateam
date Tue, 16 May 2017 16:26:45 -0400
parents 10b56bba8dee
children 3bc9bd5290c1
files macros.xml rnafold_SHAPE.py test-data/sample_3.fa test-data/sample_3.react test-data/sample_3_result.txt
diffstat 5 files changed, 508 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/macros.xml	Wed Dec 21 17:31:51 2016 -0500
+++ b/macros.xml	Tue May 16 16:26:45 2017 -0400
@@ -2,6 +2,7 @@
     <xml name="requirements">
         <requirements>
             <requirement type="package" version="2.2.10">viennarna</requirement>
+            <yield/>
         </requirements>
     </xml>
     <token name="@VERSION@">2.2.10</token>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rnafold_SHAPE.py	Tue May 16 16:26:45 2017 -0400
@@ -0,0 +1,45 @@
+### overcoming the problem of SHAPE data working with a single line.
+### creating multiple multiple files containg SHAPE data for a single sequence and running RNAfold for every
+### single sequence.
+
+import os
+import sys
+from os import system
+from Bio import SeqIO
+import re
+from subprocess import Popen, PIPE
+
+params_list = sys.argv[1:]
+param_list_no_shape = [s for s in params_list if not "--shape=" in s ]
+shape_file = [s for s in params_list if "--shape=" in s ]
+assert (len(shape_file) == 1)
+
+shape_file = shape_file[0]
+shape_file = shape_file.replace('--shape=', '')
+
+params_no_shape  =  " ".join(str(x) for x in param_list_no_shape)
+
+pattern = re.compile("^>.*$")
+id_line = ""
+with open(shape_file, 'r') as f:
+    content = f.read()
+    lines = content.split('\n')
+    for line in lines:
+        if pattern.match(line):
+            id_line = line.split()[0]
+            id_line = id_line[1:]
+            continue
+        else:
+            with open(id_line +'.tmp', "a") as clFile:
+                clFile.write(line + "\n")
+                
+input_file = sys.stdin
+
+for record in SeqIO.parse(input_file, "fasta"):
+    seq = ">{}\n{}".format(record.id,record.seq)
+    cmd =  " RNAfold  --shape=" + record.id + '.tmp ' + params_no_shape
+    p = Popen(cmd , stdin=PIPE, shell=True, stdout=PIPE, stderr=PIPE)
+    out,err = p.communicate(seq.encode())
+    if err:
+        raise RuntimeError("Error in calling RNAfold\n{}\n{}\n".format(out, err))
+    print (out.decode('utf-8').strip())
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/sample_3.fa	Tue May 16 16:26:45 2017 -0400
@@ -0,0 +1,6 @@
+>SECIS_1 test
+AUUUUAUCCAUGAAAGUGUUUCCUCUAAACCUAUGUGGAGGAACACCUGAUGUCCAGGAAAAU
+>6S_1 test1
+GAAACCCUAAUGUAUUCGAUAUAGUUCCUGAUAUUUUUGAACCGAACAAUUUUUUAUACCUAGGGAGCUUGGAGUUCCGGCGCGGCGCACAUGCCUUCACACGAGGAAGUGCAAACCGUUAGACAGAGCACCCACCUGCUUUAAUUGAGAGCGGGUUCAAAGGAAGGGAAUCCUAAACGGUACGAUUGGGGUUUCU
+>6S_2
+UUGUCCCUGCCGUGCUCGUGACUUGGCCAUACAUUCUCUGAACCUAUGUCUUACGGCAUAUGGGUUGCGGGAGUGUAGAGCUGGAGUGAUCGUCUACUCGUAGACGAACCCGAUGCUCUUCGGAUCGCGACCACCUUGAACCUCAGGGUUCGAGAUGCCGGCCUUGACGGCACAGGCGGGGCAUC
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/sample_3.react	Tue May 16 16:26:45 2017 -0400
@@ -0,0 +1,447 @@
+>SECIS_1	
+1	0.0657466222
+2	0.1280448842
+3	0.2786665403
+4	0.1391216354
+5	0.0272299574
+6	0.1717063095
+7	0.488732281
+8	3.3015172695
+9	0.414494604
+10	0.1957445189
+11	0.4670328791
+12	0.1943420556
+13	0.2099109521
+14	0.5846784488
+15	0.1296563697
+16	0.0359267698
+17	0.0438238841
+18	1.6364597431
+19	1.72206594665E-17
+20	0.0099928394
+21	0.0475042774
+22	0.0065948845
+23	0.0574522715
+24	0.2126102485
+25	1.2006488448
+26	0.6040825271
+27	0.4114049219
+28	1.1514597937
+29	1.216707413
+30	0.0186005737
+31	0.0841609069
+32	0.086771667
+33	1.1672973211
+34	0.8144419625
+35	0.2583987716
+36	0.0182542709
+37	0.0875979754
+38	0.094456587
+39	0.5206337515
+40	0.000517531
+41	0.0253820905
+42	0.2076338063
+43	0.0087295599
+44	0.0129264641
+45	0.0127365182
+46	0.1193338151
+47	0.0186183812
+48	0.3581141112
+49	0.0941009884
+50	0.2050905673
+51	0.0209195644
+52	0.6030952711
+53	5.2129588113
+54	0.1747678483
+55	1.2231479801
+56	0.4978854319
+57	0.5711590135
+58	0.2793524314
+59	0.0037936012
+60	0.2158137729
+61	0.5646393912
+62	0.6229186627
+63	0.0193621982
+>6S_1	
+1	0.1158690877
+2	0.0774028501
+3	0.2349947573
+4	1.72206594665E-17
+5	0.0926174169
+6	0.0505177415
+7	0.0457131819
+8	0.0194615986
+9	2.1495069267
+10	0.0409639397
+11	0.2185631969
+12	0.1776745985
+13	0.0086422926
+14	0.0241577615
+15	0.0092855631
+16	0.3453240509
+17	0.1535840586
+18	0.0180643958
+19	0.1188776616
+20	0.3091581196
+21	0.3748109806
+22	0.6187506508
+23	0.3511511383
+24	0.6512026704
+25	0.3096370415
+26	0.5283368492
+27	0.7500060952
+28	0.0352720444
+29	0.3776026196
+30	0.3489100484
+31	1.3035405919
+32	0.1023638167
+33	0.133082988
+34	0.0024118398
+35	0.0281166587
+36	0.2818828676
+37	0.1316060603
+38	0.1813992598
+39	0.0047490217
+40	0.0204058553
+41	0.0675891142
+42	0.045119933
+43	0.0266727645
+44	0.0673921107
+45	0.0085752561
+46	0.495476266
+47	0.8224799434
+48	0.5574272341
+49	0.2431151153
+50	0.256015696
+51	0.0386339787
+52	0.6618567864
+53	0.0707284393
+54	1.1215284869
+55	0.0463423016
+56	0.3338809513
+57	0.3987796157
+58	1.1046527917
+59	0.6156154318
+60	0.1179259769
+61	2.0333569471
+62	0.1224421595
+63	0.0266055429
+64	0.0298356423
+65	0.3004015135
+66	2.1966900004
+67	0.0222153137
+68	0.0095300422
+69	0.0503009918
+70	0.0418994997
+71	0.0384566069
+72	2.6211662666
+73	0.1704872628
+74	0.8386436572
+75	0.6961218859
+76	0.1995308419
+77	0.0552442152
+78	0.1937915065
+79	0.1239592493
+80	0.0782601391
+81	0.0138965117
+82	0.0231978646
+83	0.0150709773
+84	0.4084290821
+85	0.0792668417
+86	1.0630476211
+87	0.2524739666
+88	0.0229636507
+89	0.1153934877
+90	0.2693801005
+91	0.0071337145
+92	1.0279231796
+93	0.0574241281
+94	0.103312087
+95	0.2100864561
+96	0.0252070712
+97	0.6067864142
+98	0.0607860625
+99	0.5416948523
+100	0.7090251541
+101	2.0470096713
+102	0.0368697578
+103	0.1221648319
+104	0.0484836208
+105	0.7188621431
+106	0.2405585888
+107	0.1071170724
+108	0.6859305671
+109	0.0997679124
+110	0.0342400356
+111	0.0201635
+112	0.4527960874
+113	0.7018417748
+114	0.2561295384
+115	0.2788440973
+116	0.2437240042
+117	0.0984135237
+118	0.1146045041
+119	0.2116296362
+120	0.0360702095
+121	0.2006613525
+122	0.0635994434
+123	0.8384420629
+124	0.3546527057
+125	0.014380068
+126	0.0041004554
+127	0.2404132813
+128	0.0016204246
+129	0.016365643
+130	0.0025333389
+131	0.0207130798
+132	0.2199275512
+133	0.2973627433
+134	1.7680018464
+135	0.3120917444
+136	0.854288287
+137	0.4309335923
+138	2.3003988746
+139	0.047166557
+140	0.7391255635
+141	0.1357653755
+142	0.4672659386
+143	0.3601080698
+144	0.9111911856
+145	0.7435427597
+146	0.3353115579
+147	1.0513358906
+148	0.1406855309
+149	0.3543459659
+150	0.0561408821
+151	0.563013834
+152	0.1549691284
+153	0.7460309808
+154	0.0486849156
+155	0.1080587915
+156	0.0699642772
+157	0.4423435657
+158	0.0171555252
+159	0.0064557797
+160	0.4739275466
+161	0.2617128164
+162	0.0879369647
+163	0.0062762841
+164	0.1060085461
+165	0.0971932081
+166	0.3139785044
+167	0.0771649003
+168	0.0753029618
+169	0.5676607679
+170	0.9836368904
+171	0.6193661835
+172	0.3890022353
+173	0.3304911731
+174	0.9354752573
+175	2.5683088408
+176	0.6777050636
+177	0.0195000778
+178	0.0532349161
+179	0.0993391181
+180	0.0667310411
+181	0.0123690861
+182	0.0165201319
+183	0.2056431695
+184	0.0114477122
+185	0.1684423923
+186	0.6236165725
+187	0.2533573459
+188	7.4644850979
+189	1.72206594665E-17
+190	0.0510513818
+191	0.071993023
+192	0.093087642
+193	0.026770297
+194	0.1003921418
+195	0.731799564
+196	0.3882654324
+>6S_2	
+1	5.135077189
+2	0.0137794619
+3	0.0198585136
+4	0.0394762621
+5	0.1032256038
+6	0.0124879331
+7	0.050343991
+8	0.0266906427
+9	0.0867862234
+10	0.0250443701
+11	0.1241682715
+12	0.0888505404
+13	1.72206594665E-17
+14	0.0443782398
+15	0.0331749933
+16	1.190843321
+17	0.0083605324
+18	0.1025127456
+19	0.0318835351
+20	0.6764653014
+21	1.6659553696
+22	0.0532195755
+23	0.1306535914
+24	3.2368938797
+25	0.2999875752
+26	0.1771608894
+27	0.0735275063
+28	1.1463641343
+29	0.3436951718
+30	0.6339043401
+31	0.8229568123
+32	0.0567986298
+33	0.3413998482
+34	0.1291037675
+35	0.561127074
+36	0.0076983354
+37	0.147000237
+38	0.0214390185
+39	0.5304305785
+40	0.0785507542
+41	0.0483731004
+42	0.0976091996
+43	1.2125480978
+44	0.1865263845
+45	0.6312459899
+46	0.1817958047
+47	2.8617198725
+48	0.2055922577
+49	1.3068827801
+50	0.2629492567
+51	0.8571308379
+52	0.2726647331
+53	1.129084224
+54	0.275119436
+55	0.5874419445
+56	0.3657294569
+57	0.2500734975
+58	1.0443534711
+59	4.5331285532
+60	0.2551985691
+61	0.1800315837
+62	1.2079574507
+63	0.1377332438
+64	0.034281766
+65	0.0098202871
+66	0.9938878178
+67	0.0331980613
+68	0.2884058117
+69	0.1471099733
+70	0.0250835628
+71	0.0040433138
+72	2.1207460501
+73	0.7413016698
+74	0.2856087978
+75	0.1043896327
+76	2.5426831833
+77	0.024753755
+78	0.0197741979
+79	0.0256614712
+80	0.0931195919
+81	0.2341548619
+82	0.9442989
+83	0.6902004027
+84	0.2615426874
+85	0.1968596889
+86	0.1317761893
+87	0.3101105886
+88	0.3109082689
+89	0.6036478733
+90	0.1383132052
+91	1.72206594665E-17
+92	1.3701244222
+93	0.0259262955
+94	0.0427849321
+95	0.0059202715
+96	0.4620195968
+97	1.1627066739
+98	0.1193652803
+99	0.5039174355
+100	0.7685843498
+101	3.3504451177
+102	0.0156110762
+103	0.0405202895
+104	0.0448853051
+105	0.1130352336
+106	0.0128895533
+107	0.0140152443
+108	0.8487385272
+109	0.5411302314
+110	0.1921994675
+111	0.0804367301
+112	2.1393979849
+113	0.657192459
+114	0.9680746376
+115	0.0181673032
+116	0.1293355582
+117	0.0385348779
+118	0.0599847607
+119	0.0286153267
+120	0.0529816257
+121	0.0738905329
+122	1.9826160191
+123	0.6850277412
+124	0.0240149916
+125	0.1003714264
+126	0.0282377438
+127	0.016091267
+128	0.0654324545
+129	1.3672926211
+130	0.3123897874
+131	0.0125997931
+132	0.0326682275
+133	0.8141700098
+134	2.7208263459
+135	0.9376426669
+136	0.2104407859
+137	0.9213456642
+138	0.9496557623
+139	0.0158974709
+140	1.0394051723
+141	3.395502997
+142	0.2786545217
+143	0.0944673368
+144	0.1658691067
+145	1.5138095878
+146	0.2388473327
+147	0.0071582802
+148	0.0399196127
+149	0.0269685694
+150	0.0343298406
+151	0.0260244978
+152	0.1131275763
+153	0.0217325853
+154	0.1015784545
+155	0.0991349861
+156	1.4195713543
+157	0.5085589945
+158	0.1250938659
+159	0.788081555
+160	0.1135816768
+161	0.0633806979
+162	2.7826494
+163	1.8003487205
+164	0.7686439584
+165	0.0397996113
+166	0.8340757785
+167	0.0060961894
+168	0.0003936337
+169	0.0179660084
+170	0.033466093
+171	0.0469772809
+172	0.1070226766
+173	0.3447929483
+174	0.8559366126
+175	0.1279778477
+176	0.2188243998
+177	0.0449863446
+178	0.0382790499
+179	0.0022221768
+180	0.0311889472
+181	0.0257878168
+182	0.0172539125
+183	0.2710934097
+184	0.0914500662
+185	0.208503114
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/sample_3_result.txt	Tue May 16 16:26:45 2017 -0400
@@ -0,0 +1,9 @@
+>SECIS_1
+AUUUUAUCCAUGAAAGUGUUUCCUCUAAACCUAUGUGGAGGAACACCUGAUGUCCAGGAAAAU
+.((((...(((.(..(((.((((((((........))))))))))).).))).....)))).. (-27.97)
+>6S_1
+GAAACCCUAAUGUAUUCGAUAUAGUUCCUGAUAUUUUUGAACCGAACAAUUUUUUAUACCUAGGGAGCUUGGAGUUCCGGCGCGGCGCACAUGCCUUCACACGAGGAAGUGCAAACCGUUAGACAGAGCACCCACCUGCUUUAAUUGAGAGCGGGUUCAAAGGAAGGGAAUCCUAAACGGUACGAUUGGGGUUUCU
+(((((((...(((((.((.....((((((....((((((((((...................(((.((((.....((.((((.(..((((.(.((((.....))))).))))...))))).))..)))).)))....(((((.....))))).))))))))))..))))))......)))))))....))))))). (-110.38)
+>6S_2
+UUGUCCCUGCCGUGCUCGUGACUUGGCCAUACAUUCUCUGAACCUAUGUCUUACGGCAUAUGGGUUGCGGGAGUGUAGAGCUGGAGUGAUCGUCUACUCGUAGACGAACCCGAUGCUCUUCGGAUCGCGACCACCUUGAACCUCAGGGUUCGAGAUGCCGGCCUUGACGGCACAGGCGGGGCAUC
+.((.(((((((((((.(((.(...((((...((.((((.((((((..(((....))).....((((((((...((.(((((.((.((..((((((......))))))))))...))))).))..)))))))).............))))))))))))..)))).).))))))).))))))))).. (-129.27)