Example #1
0
import sys
import stat
import mstb_helper as helper

usage_mesg = 'Usage: prepare-omssa.py'

dirname = 'omssa'

MSTB_HOME = helper.get_mstb_home()
CWD = helper.get_cwd()

conf = helper.read_conf( os.path.join(CWD,'mstb.conf') )
if( len(conf) == 0 ):
    sys.exit(1)

helper.check_conf_term(conf,'DB_NAME')
helper.check_conf_file(conf,'PATH_OMSSACL')

path_dir = os.path.join(CWD,dirname)
if( not os.access(path_dir,os.R_OK) ):
    sys.stderr.write("Create %s.\n"%(path_dir))
    os.mkdir(path_dir)

if( not os.path.isdir(path_dir) ):
    sys.stderr.write('\n%s is not a directory.\n'%path_dir)
    sys.stderr.write('Rename it and make %s directory.\n\n'%path_dir)
    sys.exit(1)

filename_cmd_tmpl = os.path.join(MSTB_HOME,'tmpl','omssa.cmd')
f_cmd_tmpl = open(filename_cmd_tmpl,'r')
cmd_tmpl = ''.join( f_cmd_tmpl.readlines() )
import stat
import mstb_helper as helper

usage_mesg = 'Usage: prepare-sequest-TPP.py'

dirname = 'sequest'

MSTB_HOME = helper.get_mstb_home()
CWD = helper.get_cwd()

conf = helper.read_conf( os.path.join(CWD,'mstb.conf') )
if( len(conf) == 0 ):
    sys.exit(1)

helper.check_conf_file(conf,'PATH_XINTERACT')
helper.check_conf_term(conf,'DB_DECOY_PREFIX')

sample_list = dict()
for basename_pepxml in os.listdir(dirname):
    if( not basename_pepxml.endswith('.pepxml') ):
        continue
    sample_name = '_'.join( basename_pepxml.split('_')[1:3])
    if( not sample_list.has_key(sample_name) ):
        sample_list[sample_name] = []
    sample_list[sample_name].append( os.path.join(CWD,dirname,basename_pepxml) )

filename_sh = os.path.join(CWD,'scripts','run-sequest-TPP.sh')
f_sh = open(filename_sh,'w')
f_sh.write('#!/bin/bash\n')

dirname_tmp = os.path.join(CWD,'tmp')