Example #1
0
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() )
f_cmd_tmpl.close()
import sys
import stat
import mstb_helper as helper

usage_mesg = 'Usage: prepare-inspect.py'

dirname = 'inspect'

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,'DB_TRIE')
helper.check_conf_file(conf,'PATH_INSPECT')
helper.check_conf_file(conf,'DIR_INSPECT')

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','inspect.cmd')
f_cmd_tmpl = open(filename_cmd_tmpl,'r')
#!/usr/bin/env python
import os
import sys
import stat
import mstb_helper as helper

usage_mesg = 'Usage: prepare-mzxml_gz2mgf.py'

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_MSCONVERT')

filename_sh = os.path.join(CWD,'scripts','run-mzxml_gz2mgf.sh')
f_sh = open(filename_sh,'w')
f_sh.write('#!/bin/bash\n')
for basename_mzxml in helper.get_mzxml_list():
    filename_base = basename_mzxml.replace('.mzXML.gz','')
    filename_mzxml = os.path.join(CWD,'mzXML',basename_mzxml)
    f_sh.write('%s %s -z -o mgf\n'%(conf['PATH_MSCONVERT'],filename_mzxml))
f_sh.close()

os.chmod(filename_sh,stat.S_IRWXU)
sys.stderr.write('\nmzXML.gz-to-mgf is ready. Run %s.\n\n'%(filename_sh))
import mstb_helper as helper

usage_mesg = 'Usage: prepare-tandemK.py'

dirname = 'tandemK'
filename_taxon_xml = 'tandem-taxonomy.xml'

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,'DB_FASTAPRO')
helper.check_conf_file(conf,'PATH_TANDEMK_EXE')
helper.check_conf_file(conf,'PATH_TANDEM2XML')
helper.check_conf_file(conf,'PATH_TANDEMK_DEFAULT_PARAM')

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_taxon_tmpl = os.path.join(MSTB_HOME,'tmpl',filename_taxon_xml)
Example #5
0
import sys
import stat
import mstb_helper as helper

usage_mesg = 'Usage: prepare-MSGFDB.py'

dirname = 'MSGFDB'

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,'DB_FASTA')
helper.check_conf_file(conf,'PATH_MSGFDB_JAR')

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','MSGFDB.cmd')
f_cmd_tmpl = open(filename_cmd_tmpl,'r')
cmd_tmpl = ''.join( f_cmd_tmpl.readlines() )
import sys
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')