Пример #1
0
def post_xsq2purity(outFileN, server='smc1', dbN='ircr1'):
    cmd = 'cat %s/*/*tumor_frac.txt | /usr/bin/python %s/Integration/prepDB_xsq_purity.py > %s' % (
        mysetting.wxsPurityDir, mysetting.SRC_HOME, outFileN)
    os.system(cmd)
    mymysql.reset_table(tableN='xsq_purity',
                        dataFileN=outFileN,
                        user=mysetting.mysqlH[server]['user'],
                        passwd=mysetting.mysqlH[server]['passwd'],
                        db=dbN,
                        host=mysetting.mysqlH[server]['host'])
    # add normal if missed
    (con,
     cursor) = mymysql.connectDB(user=mysetting.mysqlH[server]['user'],
                                 passwd=mysetting.mysqlH[server]['passwd'],
                                 db=dbN,
                                 host=mysetting.mysqlH[server]['host'])
    cursor.execute('''SELECT DISTINCT samp_id FROM %s.xsq_purity''' % dbN)
    sIdL = [x for (x, ) in cursor.fetchall()]
    cursor.execute(
        '''SELECT DISTINCT samp_id FROM %s.sample_tag WHERE tag = "XSeq_SS"'''
        % dbN)
    refL = [x for (x, ) in cursor.fetchall()]
    for sid in sIdL:
        if sid in refL:
            print sid
            cursor.execute(
                '''UPDATE %s.sample_tag SET samp_id="%s", tag="XSeq_SS,N" WHERE samp_id="%s" and tag="XSeq_SS"'''
                % (dbN, sid, sid))
Пример #2
0
def post_xsq2cn(outFileN, platform='', server='smc1', dbN='ircr1'):
	if platform == 'CS':
		cmd = 'cat %s/*/*%s.cn_gene.dat | /usr/bin/python %s/Integration/prepDB_xsq_cn.py > %s' % (mysetting.CScnaDir,platform, mysetting.SRC_HOME, outFileN)
	else:
		cmd = 'cat %s/*/*%s.cn_gene.dat | /usr/bin/python %s/Integration/prepDB_xsq_cn.py > %s' % (mysetting.wxsCNADir,platform, mysetting.SRC_HOME, outFileN)
	os.system(cmd)
	if platform == 'SS':
		tableN = 'xsq_cn'
	elif platform == 'CS':
		tableN = 'cs_cn'
	else:
		sys.stderr.write('illegal platform name: %s' % platform)
		sys.exit(1)

	mymysql.reset_table(tableN=tableN, dataFileN=outFileN, user=mysetting.mysqlH[server]['user'],passwd=mysetting.mysqlH[server]['passwd'],db=dbN, host=mysetting.mysqlH[server]['host'])

	## add samp_id if missing
	(con, cursor) = mymysql.connectDB(user=mysetting.mysqlH[server]['user'], passwd=mysetting.mysqlH[server]['passwd'], db=dbN, host=mysetting.mysqlH[server]['host'])
	cursor.execute('SELECT DISTINCT samp_id FROM %s' % tableN)
	sIdL = [x for (x,) in cursor.fetchall()]
	cursor.execute('SELECT DISTINCT samp_id FROM sample_tag WHERE tag like "XSeq_%s%%"' % platform)
	refL = [x for (x,) in cursor.fetchall()]
	for sid in sIdL:
		if sid not in refL:
			pl = platform
			cursor.execute('INSERT INTO sample_tag SET samp_id="%s", tag="XSeq_%s"' % (sid, pl))
Пример #3
0
def post_xsq2mut_tmp(singleFileN, server='smc1', dbN='ircr1'):
    os.system(
        'cat /EQL3/pipeline/somatic_mutation/*/*vep.dat | python ~/JK1/Integration/prepDB_mutation_xsq2mut.py > %s'
        % singleFileN)
    mymysql.reset_table('mutation_normal_tmp',
                        singleFileN,
                        user=mysetting.mysqlH[server]['user'],
                        passwd=mysetting.mysqlH[server]['passwd'],
                        db=dbN,
                        host=mysetting.mysqlH[server]['host'])
Пример #4
0
def post_xsq2clonality(outFileN, server='smc1', dbN='ircr1'):
    cmd = '/usr/bin/python %s/Integration/prepDB_xsq_clonality.py > %s' % (
        mysetting.SRC_HOME, outFileN)
    os.system(cmd)
    mymysql.reset_table(tableN='xsq_clonality',
                        dataFileN=outFileN,
                        user=mysetting.mysqlH[server]['user'],
                        passwd=mysetting.mysqlH[server]['passwd'],
                        db=dbN,
                        host=mysetting.mysqlH[server]['host'])
Пример #5
0
def post_xsq2cn_corr(outFileN, server='smc1', dbN='ircr1'):
    cmd = 'cat %s/*/*corr.cn_gene.dat | /usr/bin/python %s/Integration/prepDB_xsq_cn.py > %s' % (
        mysetting.wxsCNAcorrDir, mysetting.SRC_HOME, outFileN)
    os.system(cmd)
    mymysql.reset_table(tableN='xsq_cn_corr',
                        dataFileN=outFileN,
                        user=mysetting.mysqlH[server]['user'],
                        passwd=mysetting.mysqlH[server]['passwd'],
                        db=dbN,
                        host=mysetting.mysqlH[server]['host'])
Пример #6
0
def main(singleFileN, somaticFileN, allFileN, server='smc1', dbN='ircr1'):
	if not os.path.isfile(singleFileN):
		prep_single(singleFileN, server, dbN)
		mymysql.reset_table(tableN='mutation', dataFileN=singleFileN, user=mysetting.mysqlH[server]['user'], passwd=mysetting.mysqlH[server]['passwd'], db=dbN, host=mysetting.mysqlH[server]['host'])

	if not os.path.isfile(somaticFileN):
#		prep_somatic(somaticFileN, server, dbN)
		prep_somatic_new(somaticFileN, server, dbN)
	
	if not os.path.isfile(allFileN):
		prepDB_mutation_normal.main(inTFileName=singleFileN, inNFileName=somaticFileN, geneList=[], outFileN=allFileN)
		load_mutation_all(allFileN, server, dbN)
		makeDB_mutation_rxsq.main(dbN)
Пример #7
0
def post_xsq2purity(outFileN, server='smc1', dbN='ircr1'):
	cmd = 'cat %s/*/*tumor_frac.txt | /usr/bin/python %s/Integration/prepDB_xsq_purity.py > %s' % (mysetting.wxsPurityDir, mysetting.SRC_HOME, outFileN)
	os.system(cmd)
	mymysql.reset_table(tableN='xsq_purity', dataFileN=outFileN, user=mysetting.mysqlH[server]['user'],passwd=mysetting.mysqlH[server]['passwd'],db=dbN, host=mysetting.mysqlH[server]['host'])
	# add normal if missed
	(con, cursor) = mymysql.connectDB(user=mysetting.mysqlH[server]['user'], passwd=mysetting.mysqlH[server]['passwd'], db=dbN, host=mysetting.mysqlH[server]['host'])
	cursor.execute('''SELECT DISTINCT samp_id FROM %s.xsq_purity''' % dbN)
	sIdL = [x for (x,) in cursor.fetchall()]
	cursor.execute('''SELECT DISTINCT samp_id FROM %s.sample_tag WHERE tag = "XSeq_SS"''' % dbN)
	refL = [x for (x,) in cursor.fetchall()]
	for sid in sIdL:
		if sid in refL:
			print sid
			cursor.execute('''UPDATE %s.sample_tag SET samp_id="%s", tag="XSeq_SS,N" WHERE samp_id="%s" and tag="XSeq_SS"''' % (dbN, sid, sid))
Пример #8
0
def main(datFileN, server='smc1', dbN='CancerSCAN'):
    mybasic.add_module_path(['NGS/mutation', 'Integration'])

    import vep_batch, makeDB_mutation_rxsq
    print mysetting.CSmutDir + '/*CS'
    vep_batch.main(glob(mysetting.CSmutDir + '/*CS'),
                   postfixL=[
                       '.mutect_filter.vcf', '.mutect_single_filter.vcf',
                       '.indels_filter.vcf', '.indels_single_filter.vcf'
                   ],
                   fork=True)

    os.system(
        'cat %s/*CS/*filter_vep.dat | /usr/bin/python %s/Integration/prepDB_mutation_cancerscan.py > %s'
        % (mysetting.CSmutDir, mysetting.SRC_HOME, datFileN))
    mymysql.reset_table(tableN='mutation_cs',
                        dataFileN=datFileN,
                        user=mysetting.mysqlH[server]['user'],
                        passwd=mysetting.mysqlH[server]['passwd'],
                        db=dbN,
                        host=mysetting.mysqlH[server]['host'])

    (con,
     cursor) = mymysql.connectDB(user=mysetting.mysqlH[server]['user'],
                                 passwd=mysetting.mysqlH[server]['passwd'],
                                 db=dbN,
                                 host=mysetting.mysqlH[server]['host'])
    sampNL = filter(lambda x: os.path.isdir(mysetting.CSmutDir + '/' + x),
                    os.listdir(mysetting.CSmutDir))
    for sampN in sampNL:
        id = '_'.join(sampN.split('_')[:-2])
        postfix = sampN.split('_')[-2]
        if postfix == 'B':
            continue
        if postfix != 'T':
            id = '%s_%s' % (id, postfix)
        cursor.execute(
            '''DELETE FROM sample_tag WHERE samp_id="%s" AND tag="XSeq_CS"''' %
            id)
        cursor.execute(
            '''INSERT INTO sample_tag SET samp_id="%s",tag="XSeq_CS"''' % id)
Пример #9
0
def post_xsq2cn(outFileN, platform='', server='smc1', dbN='ircr1'):
    if platform == 'CS':
        cmd = 'cat %s/*/*%s.cn_gene.dat | /usr/bin/python %s/Integration/prepDB_xsq_cn.py > %s' % (
            mysetting.CScnaDir, platform, mysetting.SRC_HOME, outFileN)
    else:
        cmd = 'cat %s/*/*%s.cn_gene.dat | /usr/bin/python %s/Integration/prepDB_xsq_cn.py > %s' % (
            mysetting.wxsCNADir, platform, mysetting.SRC_HOME, outFileN)
    os.system(cmd)
    if platform == 'SS':
        tableN = 'xsq_cn'
    elif platform == 'CS':
        tableN = 'cs_cn'
    else:
        sys.stderr.write('illegal platform name: %s' % platform)
        sys.exit(1)

    mymysql.reset_table(tableN=tableN,
                        dataFileN=outFileN,
                        user=mysetting.mysqlH[server]['user'],
                        passwd=mysetting.mysqlH[server]['passwd'],
                        db=dbN,
                        host=mysetting.mysqlH[server]['host'])

    ## add samp_id if missing
    (con,
     cursor) = mymysql.connectDB(user=mysetting.mysqlH[server]['user'],
                                 passwd=mysetting.mysqlH[server]['passwd'],
                                 db=dbN,
                                 host=mysetting.mysqlH[server]['host'])
    cursor.execute('SELECT DISTINCT samp_id FROM %s' % tableN)
    sIdL = [x for (x, ) in cursor.fetchall()]
    cursor.execute(
        'SELECT DISTINCT samp_id FROM sample_tag WHERE tag like "XSeq_%s%%"' %
        platform)
    refL = [x for (x, ) in cursor.fetchall()]
    for sid in sIdL:
        if sid not in refL:
            pl = platform
            cursor.execute(
                'INSERT INTO sample_tag SET samp_id="%s", tag="XSeq_%s"' %
                (sid, pl))
Пример #10
0
def main(singleFileN, somaticFileN, allFileN, server='smc1', dbN='ircr1'):
    if not os.path.isfile(singleFileN):
        prep_single(singleFileN, server, dbN)
        mymysql.reset_table(tableN='mutation',
                            dataFileN=singleFileN,
                            user=mysetting.mysqlH[server]['user'],
                            passwd=mysetting.mysqlH[server]['passwd'],
                            db=dbN,
                            host=mysetting.mysqlH[server]['host'])

    if not os.path.isfile(somaticFileN):
        #		prep_somatic(somaticFileN, server, dbN)
        prep_somatic_new(somaticFileN, server, dbN)

    if not os.path.isfile(allFileN):
        prepDB_mutation_normal.main(inTFileName=singleFileN,
                                    inNFileName=somaticFileN,
                                    geneList=[],
                                    outFileN=allFileN)
        load_mutation_all(allFileN, server, dbN)
        makeDB_mutation_rxsq.main(dbN)
Пример #11
0
def main(datFileN, server='smc1', dbN='CancerSCAN'):
	mybasic.add_module_path(['NGS/mutation','Integration'])

	import vep_batch, makeDB_mutation_rxsq
	print mysetting.CSmutDir+'/*CS'
	vep_batch.main(glob(mysetting.CSmutDir+'/*CS'), postfixL=['.mutect_filter.vcf','.mutect_single_filter.vcf','.indels_filter.vcf','.indels_single_filter.vcf'], fork=True)

	os.system('cat %s/*CS/*filter_vep.dat | /usr/bin/python %s/Integration/prepDB_mutation_cancerscan.py > %s' % (mysetting.CSmutDir, mysetting.SRC_HOME, datFileN))
	mymysql.reset_table(tableN='mutation_cs', dataFileN=datFileN, user=mysetting.mysqlH[server]['user'],passwd=mysetting.mysqlH[server]['passwd'],db=dbN,host=mysetting.mysqlH[server]['host'])

	(con, cursor) = mymysql.connectDB(user=mysetting.mysqlH[server]['user'],passwd=mysetting.mysqlH[server]['passwd'],db=dbN,host=mysetting.mysqlH[server]['host'])
	sampNL = filter(lambda x: os.path.isdir(mysetting.CSmutDir+'/'+x), os.listdir(mysetting.CSmutDir))
	for sampN in sampNL:
		id = '_'.join(sampN.split('_')[:-2])
		postfix = sampN.split('_')[-2]
		if postfix == 'B':
			continue
		if postfix != 'T':
			id = '%s_%s' % (id, postfix)
		cursor.execute('''DELETE FROM sample_tag WHERE samp_id="%s" AND tag="XSeq_CS"''' % id)
		cursor.execute('''INSERT INTO sample_tag SET samp_id="%s",tag="XSeq_CS"''' % id)
Пример #12
0
def post_xsq2clonality(outFileN, server='smc1', dbN='ircr1'):
	cmd = '/usr/bin/python %s/Integration/prepDB_xsq_clonality.py > %s' % (mysetting.SRC_HOME, outFileN)
	os.system(cmd)
	mymysql.reset_table(tableN='xsq_clonality', dataFileN=outFileN, user=mysetting.mysqlH[server]['user'],passwd=mysetting.mysqlH[server]['passwd'],db=dbN, host=mysetting.mysqlH[server]['host'])
Пример #13
0
def post_xsq2cn_corr(outFileN, server='smc1', dbN='ircr1'):
	cmd = 'cat %s/*/*corr.cn_gene.dat | /usr/bin/python %s/Integration/prepDB_xsq_cn.py > %s' % (mysetting.wxsCNAcorrDir, mysetting.SRC_HOME, outFileN)
	os.system(cmd)
	mymysql.reset_table(tableN='xsq_cn_corr', dataFileN=outFileN, user=mysetting.mysqlH[server]['user'],passwd=mysetting.mysqlH[server]['passwd'],db=dbN, host=mysetting.mysqlH[server]['host'])
Пример #14
0
def post_xsq2mut_tmp(singleFileN, server='smc1', dbN='ircr1'):
	os.system('cat /EQL3/pipeline/somatic_mutation/*/*vep.dat | python ~/JK1/Integration/prepDB_mutation_xsq2mut.py > %s' % singleFileN)
	mymysql.reset_table('mutation_normal_tmp', singleFileN, user=mysetting.mysqlH[server]['user'], passwd=mysetting.mysqlH[server]['passwd'], db=dbN, host=mysetting.mysqlH[server]['host'])
Пример #15
0
#!/usr/bin/python

import mymysql

#mymysql.reset_table('id_conversion', '/EQL1/NSL/clinical/id_conversion_20141027.dat', user='******', passwd='cancer', db='ircr1', host='localhost')
mymysql.reset_table('id_conversion',
                    '/EQL1/NSL/clinical/id_conversion_20150310.dat',
                    user='******',
                    passwd='cancer',
                    db='ircr1',
                    host='localhost')
Пример #16
0
#!/usr/bin/python

import mymysql

#mymysql.reset_table('id_conversion', '/EQL1/NSL/clinical/id_conversion_20141027.dat', user='******', passwd='cancer', db='ircr1', host='localhost')
mymysql.reset_table('id_conversion', '/EQL1/NSL/clinical/id_conversion_20150310.dat', user='******', passwd='cancer', db='ircr1', host='localhost')