Пример #1
0
def process(n):
    fasta_file = opts[FASTA]    
    fasta_file+="."+format(n-1,'05n')
    file = os.path.abspath(fasta_file)
    cmd = "ddb.pl -mode update -submode nr -taxid 1 -filename %s" % file
    hddb.tunnel()
    _debug(cmd)
    subprocess.check_call(cmd,shell=True)
Пример #2
0
def process(n):
    fasta_file = opts[FASTA]
    fasta_file+=".%i" % n-1
    file = os.path.abspath(fasta_file)
    cmd = "ddb.pl -mode update -submode nr -filename %s" % file
    hddb.tunnel()
    _debug(cmd)
    subprocess.check_call(cmd,shell=True)
    cmd = "ddb.pl -mode update -submode nr"
Пример #3
0
def protein(sequence_key):
    #subprocess.check_call("nohup `which Xvfb` :20 -screen 0 1024x768x24 &> /dev/null & sleep 7",shell=True)
    print >>sys.stderr, os.getenv("HOSTNAME")+" "+os.getenv("SGE_TASK_ID")
    hddb.tunnel()
    #-Djava.awt.headless=true
    #DISPLAY=localhost:20.0
    cmd = "ddb.pl -mode export -submode ginzu2yeastrc -ginzu 1 -parent_sequence_key %i" % sequence_key
    subprocess.check_call(cmd,shell=True)
    return sequence_key
Пример #4
0
def remcm(sequence_key):
    import sys
    import os
    from hpf.hddb import tunnel, kill_tunnel 
    tunnel(5)
    from hpf.mcm.process import McmReRun
    from hpf.mcm import McmDB
    with open("/scratch/kd35/db175/data.mammothDb") as handle:
        mcmdb = McmDB.load(handle)
    mcmdb.scop='1.75'
    mcmdb.list_file = "/scratch/kd35/db175/list.mammoth"
    # Add int keys to the mcmdb._dict (this is rough)
    for key in mcmdb._dict.keys():
        mcmdb._dict[int(key)] = mcmdb._dict[key]
    jobdir = "/scratch/kd35/tmp/mcm/jobs/%i" % int(sequence_key)
    try:
    # Create an McmReRun task and run it
        if not os.path.exists(jobdir):
            os.mkdir(jobdir)
        os.chdir(jobdir)
        log_file = "/scratch/kd35/tmp/mcm/jobs/%i/outlog" % int(sequence_key)
        out_handle = open(log_file,"w")
        runtime().set_log(stdout=out_handle, stderr=out_handle)
        logging.basicConfig(filename=log_file, filemode='a')
        runtime().debug(os.environ['HOSTNAME'])
        task = McmReRun(jobdir,mcmdb,int(sequence_key))
        task.run()
    finally:
    # Clean up: gzip results, save log file, remove all other tmp files
        import subprocess
        runtime().debug("finally")
        for file in os.listdir(jobdir):
        if "data.mammoth" in file: 
            #save and gzip
            subprocess.Popen([r"gzip","-f",file])
        elif "outlog" in file:
            runtime().debug("saving outlog")
        else:
            os.remove(os.path.join(jobdir,file))
    #os.rmdir(jobdir)
    kill_tunnel()

    
def main(*args):
    pool = processor(synchronous=runtime().opt(SYNCHRONOUS))
    runtime().debug("Using processor",pool)
    pool.make_tasks(None)
    consume(pool.run(remcm))
    
def _do(argv):
    r = runtime()
    r.description("""
    remcm.py [-options]
    Re-MCM a set of sequence keys.  Expects a 'tasks.pickle'.
    """)
    r.add_option(Flag(SYNCHRONOUS, "s", description="Run this script synchronously without any multi-processing"))
    args = r.parse_options(argv)
    main(*args)

if __name__=="__main__":
    _do(sys.argv[1:])
Пример #5
0
#!/usr/bin/env python
'''
Created on Apr 6, 2010

Takes a list of prediction codes to set up input files and create a task pickle 
for running MCM.
Originally used to re-do the since solved.

@author: Patrick
'''
from hpf.hddb import tunnel
tunnel(sleep=1)
import sys, os
import getopt
import shutil
from hpf.runtime import runtime, Flag, FileOption, debug, DEBUG
from hpf.utilities import consume
from hpf.processing import processor, SYNCHRONOUS
from hpf.mcm.mcm import SCRATCH
from hpf.hddb.db import *

FRAGMENTS = "fragments"
SCRATCH = "SCRATCH"
HPF1_DECOYS = "hpf1_decoys"
HPF2_DECOYS = "hpf2_decoys"

def prep(prediction_code):
    runtime().debug("Running on",prediction_code)
    with PrepPredictionCode(prediction_code,
                            runtime().opt(SCRATCH),
                            runtime().opt(HPF1_DECOYS),
Пример #6
0
def _connection(db="hpf"):
    global _db
    if _db == None:
        tunnel(5)
        _db = MySQLdb.connect(host="127.0.0.1",port=13307,db=db,user="******",passwd="bonneaulab")
    return _db