def call_commands_serially(commands, status_update_callback, logger,
                           stepslogger, params):
    """Run list of commands, one after another """
    #logger.write("Executing commands.\n\n")
    from sys import exit
    make = False
    for c in commands:
        if c[3] == 'stop':
            print "Stopping!"
            return
            break

        if params['verbose']:
            eprintf("\n\n\nIssuing Command : %s\n", c[1])

        eprintf("%s" % (c[0]))
        if c[3] in ['yes', 'redo'] and c[4]:
            result = getstatusoutput(c[1])
            if result[0] == 0:
                if c[3] in ['redo']:
                    eprintf('..... Redo Success!\n')
                else:
                    eprintf('..... Success!\n')
            else:
                eprintf('..... Error!\n')
                #print c
        elif c[3] == 'grid' and c[4]:
            blastgrid(c[1])
            continue
        elif c[3] == 'skip':
            eprintf('..... Skipping!\n')
            continue
        else:
            eprintf('..... Already Computed!\n')
            continue

        #status_update_callback('%s\n%s' %(result[0], result[0]))

        logger.write('COMMAND : \n%s \n' % (c[1]))
        if result[0] == 0:
            logger.write('Success!:\n%s\n' % (result[1]))
        else:
            #print result[1]
            try:
                printf('Error! : %s\n' % (result[1]))
                logger.write('Error!:\n%s\n' % (result[1]))
            except:
                pass

            break

        timestamp_pattern = '%Y-%m-%d %H:%M:%S'
        timestamp = datetime.now().strftime(timestamp_pattern)
        stepslogger.write('%s\t%s\n' % (c[2], timestamp))
def execute_pipeline_stage(pipeline_command):
     argv = [ x.strip() for x in pipeline_command.split() ]
     funcname = re.sub(r'.py$','', argv[0])
     funcname = re.sub(r'^.*/','', funcname)
     args = argv[1:] 
     
     if hasattr(python_scripts, funcname):
        methodtocall = getattr( getattr(python_scripts, funcname), funcname)
        result = methodtocall(args)
     else:
        result = getstatusoutput(pipeline_command)
     return result
def call_commands_serially(commands, status_update_callback, logger, stepslogger, params ):
    """Run list of commands, one after another """
    #logger.write("Executing commands.\n\n")
    from sys import exit
    make = False
    for c in commands:
        if c[3]=='stop':
           print "Stopping!"
           return 
           break

        if params['verbose']:
             eprintf("\n\n\nIssuing Command : %s\n", c[1])

        eprintf("%s" %(c[0]))
        if c[3] in ['yes', 'redo' ] and c[4]:
           result = getstatusoutput(c[1])
           if result[0] == 0 :
             if c[3] in ['redo']:
                eprintf('..... Redo Success!\n')
             else:
                eprintf('..... Success!\n')
           else:
             eprintf('..... Error!\n')
             #print c
        elif c[3]=='grid' and c[4]:
           blastgrid(c[1])
           continue  
        elif c[3]=='skip':
           eprintf('..... Skipping!\n')
           continue
        else:
           eprintf('..... Already Computed!\n')
           continue

        #status_update_callback('%s\n%s' %(result[0], result[0]))

        logger.write('COMMAND : \n%s \n' %( c[1]))
        if result[0] == 0 :
            logger.write('Success!:\n%s\n' %( result[1]))
        else:
            #print result[1]
            try:
               printf('Error! : %s\n' %(result[1]))
               logger.write('Error!:\n%s\n' %( result[1]))
            except:
               pass

            break 

        timestamp_pattern='%Y-%m-%d %H:%M:%S'
        timestamp = datetime.now().strftime(timestamp_pattern)
        stepslogger.write('%s\t%s\n' %( c[2], timestamp))
def format_db(formatdb_executable, seqType, refdb_sequence_file, algorithm):
     if algorithm=='BLAST':
         cmd='%s -dbtype %s -in %s' %(formatdb_executable, seqType, refdb_sequence_file)

     if algorithm=='LAST':
         dirname = os.path.dirname(refdb_sequence_file)    
         cmd='%s -p -c %s  %s' %(formatdb_executable, refdb_sequence_file, refdb_sequence_file)
         

     result= getstatusoutput(cmd)
     if result[0]==0:
        return True
     else:
        return False
Example #5
0
def startPathwayTools(ptoolsExec):
    cmd = ptoolsExec + " -api"
    status = getstatusoutput(cmd)