view cmFinder.py @ 2:ad6c540bb63d draft

planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust/CMFinder commit 057c2fd398055dc86eb2c00d8a74f301d5c231d9-dirty
author rnateam
date Wed, 22 Feb 2017 16:50:47 -0500
parents 78772eedd780
children
line wrap: on
line source

import os
import sys
from shutil import copyfile
from os import system


def sh(script):
    system("bash -c '%s'" % script)


model_tree_stk = sys.argv[1]
cmfinder_fa = sys.argv[2]
path = sys.argv[3]

gapCmd = ""
gapVal = ""
if len(sys.argv) > 4:
    gapCmd = sys.argv[4]
    gapVal = sys.argv[5]


cmd = " cp -f %s model.cmfinder.stk" % (model_tree_stk)
sh(cmd)

alifoldCmd = "%salifold.pl -file  %s" % (path, model_tree_stk)
# alifoldCmd = "perl " + path + "/alifold.pl -file " + model_tree_stk
sh(alifoldCmd)

cmd_stk = "%smloc2stockholm.pl -file model.cmfinder.stk  -split_input yes --con_struct %s.alifold" % (path, model_tree_stk)
# cmd_stk = "perl " + path + "/mloc2stockholm.pl -file model.cmfinder.stk  -split_input yes --con_struct " + model_tree_stk + ".alifold"
sh(cmd_stk)

model_tree_stk_sth = "model.cmfinder.stk.sth"
x = "cat " + model_tree_stk_sth
sh("mv model.cmfinder.stk.sth model.tree.stk")

sh("cmfinder %s %s -a model.tree.stk %s output > model.cmfinder.stk" % (gapCmd, gapVal, cmfinder_fa))
# sh("cmfinder " + gapCmd + " " + gapVal + " -a model.tree.stk" + " " + cmfinder_fa + " " + " output > model.cmfinder.stk")

if os.path.isfile('output'):
    sh("rm output")
else:
    copyfile("model.tree.stk", "model.cmfinder.stk")