Mercurial > repos > rnateam > graphclust_cmfinder
annotate cmFinder.py @ 3:8269a9caef07 draft
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust/CMFinder commit b'7e5cd452018ae9507c2d1cd13dd688a747550393\n'
author | rnateam |
---|---|
date | Fri, 17 Mar 2017 08:23:09 -0400 |
parents | b151301a2d25 |
children |
rev | line source |
---|---|
0
b151301a2d25
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust/CMFinder commit 21aaee40723b5341b4236edeb0e72995c2054053
rnateam
parents:
diff
changeset
|
1 import os |
b151301a2d25
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust/CMFinder commit 21aaee40723b5341b4236edeb0e72995c2054053
rnateam
parents:
diff
changeset
|
2 import sys |
b151301a2d25
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust/CMFinder commit 21aaee40723b5341b4236edeb0e72995c2054053
rnateam
parents:
diff
changeset
|
3 from shutil import copyfile |
b151301a2d25
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust/CMFinder commit 21aaee40723b5341b4236edeb0e72995c2054053
rnateam
parents:
diff
changeset
|
4 from os import system |
b151301a2d25
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust/CMFinder commit 21aaee40723b5341b4236edeb0e72995c2054053
rnateam
parents:
diff
changeset
|
5 |
b151301a2d25
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust/CMFinder commit 21aaee40723b5341b4236edeb0e72995c2054053
rnateam
parents:
diff
changeset
|
6 |
b151301a2d25
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust/CMFinder commit 21aaee40723b5341b4236edeb0e72995c2054053
rnateam
parents:
diff
changeset
|
7 def sh(script): |
b151301a2d25
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust/CMFinder commit 21aaee40723b5341b4236edeb0e72995c2054053
rnateam
parents:
diff
changeset
|
8 system("bash -c '%s'" % script) |
b151301a2d25
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust/CMFinder commit 21aaee40723b5341b4236edeb0e72995c2054053
rnateam
parents:
diff
changeset
|
9 |
b151301a2d25
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust/CMFinder commit 21aaee40723b5341b4236edeb0e72995c2054053
rnateam
parents:
diff
changeset
|
10 |
b151301a2d25
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust/CMFinder commit 21aaee40723b5341b4236edeb0e72995c2054053
rnateam
parents:
diff
changeset
|
11 model_tree_stk = sys.argv[1] |
b151301a2d25
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust/CMFinder commit 21aaee40723b5341b4236edeb0e72995c2054053
rnateam
parents:
diff
changeset
|
12 cmfinder_fa = sys.argv[2] |
b151301a2d25
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust/CMFinder commit 21aaee40723b5341b4236edeb0e72995c2054053
rnateam
parents:
diff
changeset
|
13 path = sys.argv[3] |
b151301a2d25
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust/CMFinder commit 21aaee40723b5341b4236edeb0e72995c2054053
rnateam
parents:
diff
changeset
|
14 |
b151301a2d25
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust/CMFinder commit 21aaee40723b5341b4236edeb0e72995c2054053
rnateam
parents:
diff
changeset
|
15 gapCmd = "" |
b151301a2d25
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust/CMFinder commit 21aaee40723b5341b4236edeb0e72995c2054053
rnateam
parents:
diff
changeset
|
16 gapVal = "" |
b151301a2d25
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust/CMFinder commit 21aaee40723b5341b4236edeb0e72995c2054053
rnateam
parents:
diff
changeset
|
17 if len(sys.argv) > 4: |
b151301a2d25
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust/CMFinder commit 21aaee40723b5341b4236edeb0e72995c2054053
rnateam
parents:
diff
changeset
|
18 gapCmd = sys.argv[4] |
b151301a2d25
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust/CMFinder commit 21aaee40723b5341b4236edeb0e72995c2054053
rnateam
parents:
diff
changeset
|
19 gapVal = sys.argv[5] |
b151301a2d25
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust/CMFinder commit 21aaee40723b5341b4236edeb0e72995c2054053
rnateam
parents:
diff
changeset
|
20 |
b151301a2d25
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust/CMFinder commit 21aaee40723b5341b4236edeb0e72995c2054053
rnateam
parents:
diff
changeset
|
21 |
b151301a2d25
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust/CMFinder commit 21aaee40723b5341b4236edeb0e72995c2054053
rnateam
parents:
diff
changeset
|
22 cmd = " cp -f %s model.cmfinder.stk" % (model_tree_stk) |
b151301a2d25
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust/CMFinder commit 21aaee40723b5341b4236edeb0e72995c2054053
rnateam
parents:
diff
changeset
|
23 sh(cmd) |
b151301a2d25
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust/CMFinder commit 21aaee40723b5341b4236edeb0e72995c2054053
rnateam
parents:
diff
changeset
|
24 |
b151301a2d25
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust/CMFinder commit 21aaee40723b5341b4236edeb0e72995c2054053
rnateam
parents:
diff
changeset
|
25 alifoldCmd = "%salifold.pl -file %s" % (path, model_tree_stk) |
b151301a2d25
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust/CMFinder commit 21aaee40723b5341b4236edeb0e72995c2054053
rnateam
parents:
diff
changeset
|
26 # alifoldCmd = "perl " + path + "/alifold.pl -file " + model_tree_stk |
b151301a2d25
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust/CMFinder commit 21aaee40723b5341b4236edeb0e72995c2054053
rnateam
parents:
diff
changeset
|
27 sh(alifoldCmd) |
b151301a2d25
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust/CMFinder commit 21aaee40723b5341b4236edeb0e72995c2054053
rnateam
parents:
diff
changeset
|
28 |
b151301a2d25
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust/CMFinder commit 21aaee40723b5341b4236edeb0e72995c2054053
rnateam
parents:
diff
changeset
|
29 cmd_stk = "%smloc2stockholm.pl -file model.cmfinder.stk -split_input yes --con_struct %s.alifold" % (path, model_tree_stk) |
b151301a2d25
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust/CMFinder commit 21aaee40723b5341b4236edeb0e72995c2054053
rnateam
parents:
diff
changeset
|
30 # cmd_stk = "perl " + path + "/mloc2stockholm.pl -file model.cmfinder.stk -split_input yes --con_struct " + model_tree_stk + ".alifold" |
b151301a2d25
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust/CMFinder commit 21aaee40723b5341b4236edeb0e72995c2054053
rnateam
parents:
diff
changeset
|
31 sh(cmd_stk) |
b151301a2d25
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust/CMFinder commit 21aaee40723b5341b4236edeb0e72995c2054053
rnateam
parents:
diff
changeset
|
32 |
b151301a2d25
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust/CMFinder commit 21aaee40723b5341b4236edeb0e72995c2054053
rnateam
parents:
diff
changeset
|
33 model_tree_stk_sth = "model.cmfinder.stk.sth" |
b151301a2d25
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust/CMFinder commit 21aaee40723b5341b4236edeb0e72995c2054053
rnateam
parents:
diff
changeset
|
34 x = "cat " + model_tree_stk_sth |
b151301a2d25
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust/CMFinder commit 21aaee40723b5341b4236edeb0e72995c2054053
rnateam
parents:
diff
changeset
|
35 sh("mv model.cmfinder.stk.sth model.tree.stk") |
b151301a2d25
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust/CMFinder commit 21aaee40723b5341b4236edeb0e72995c2054053
rnateam
parents:
diff
changeset
|
36 |
b151301a2d25
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust/CMFinder commit 21aaee40723b5341b4236edeb0e72995c2054053
rnateam
parents:
diff
changeset
|
37 sh("cmfinder %s %s -a model.tree.stk %s output > model.cmfinder.stk" % (gapCmd, gapVal, cmfinder_fa)) |
b151301a2d25
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust/CMFinder commit 21aaee40723b5341b4236edeb0e72995c2054053
rnateam
parents:
diff
changeset
|
38 # sh("cmfinder " + gapCmd + " " + gapVal + " -a model.tree.stk" + " " + cmfinder_fa + " " + " output > model.cmfinder.stk") |
b151301a2d25
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust/CMFinder commit 21aaee40723b5341b4236edeb0e72995c2054053
rnateam
parents:
diff
changeset
|
39 |
b151301a2d25
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust/CMFinder commit 21aaee40723b5341b4236edeb0e72995c2054053
rnateam
parents:
diff
changeset
|
40 if os.path.isfile('output'): |
b151301a2d25
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust/CMFinder commit 21aaee40723b5341b4236edeb0e72995c2054053
rnateam
parents:
diff
changeset
|
41 sh("rm output") |
b151301a2d25
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust/CMFinder commit 21aaee40723b5341b4236edeb0e72995c2054053
rnateam
parents:
diff
changeset
|
42 else: |
b151301a2d25
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust/CMFinder commit 21aaee40723b5341b4236edeb0e72995c2054053
rnateam
parents:
diff
changeset
|
43 copyfile("model.tree.stk", "model.cmfinder.stk") |