示例#1
0
文件: post_xsq2mut.py 项目: SMC1/JK1
def prep_somatic_new(outFileN, server='smc1', dbN='ircr1'):
	## run VEP
	vep_batch.main(glob('/EQL3/pipeline/somatic_mutation/*S'), postfixL=['.mutect_rerun_filter.vcf','.mutect_filter.vcf','.mutect_pair_filter.vcf','.indels_pair_filter.vcf'], fork=True)

	## make table
	DIR='/EQL3/pipeline/somatic_mutation'
	cmd = 'cat %s/*/*filter_vep.dat | /usr/bin/python %s/Integration/prepDB_mutation_xsq2mut_tmp.py > %s' % (DIR, mysetting.SRC_HOME, outFileN)
	os.system(cmd)

	## update tag
	sidL = map(lambda x: x.rstrip(), os.popen('cut -f 1 %s | sort | uniq' % outFileN).readlines())
	(con, cursor) = mymysql.connectDB(user=mysetting.mysqlH[server]['user'],passwd=mysetting.mysqlH[server]['passwd'],db=dbN,host=mysetting.mysqlH[server]['host'])
	for sid in sidL:
		cursor.execute('SELECT samp_id,tag FROM sample_tag WHERE samp_id="%s" AND tag LIKE "XSeq_%%"' % sid)
		results = cursor.fetchall()
		if len(results)>0:
			if len(results)>1:
				sys.stderr.write('Duplication in sample_tag: %s\n' % sid)
				sys.exit(1)
			else:
				old_tag = results[0][1]
				new_tag = '%s,N' % old_tag
				cursor.execute('UPDATE sample_tag SET samp_id="%s", tag="%s" WHERE samp_id="%s" AND tag="%s"' % (sid,new_tag, sid,old_tag))
		else:
			cursor.execute('INSERT INTO sample_tag SET samp_id="%s", tag="XSeq_SS,N"' % sid)
示例#2
0
def prep_somatic_new(outFileN, server='smc1', dbN='ircr1'):
    ## run VEP
    vep_batch.main(glob('/EQL3/pipeline/somatic_mutation/*S'),
                   postfixL=[
                       '.mutect_rerun_filter.vcf', '.mutect_filter.vcf',
                       '.mutect_pair_filter.vcf', '.indels_pair_filter.vcf'
                   ],
                   fork=True)

    ## make table
    DIR = '/EQL3/pipeline/somatic_mutation'
    cmd = 'cat %s/*/*filter_vep.dat | /usr/bin/python %s/Integration/prepDB_mutation_xsq2mut_tmp.py > %s' % (
        DIR, mysetting.SRC_HOME, outFileN)
    os.system(cmd)

    ## update tag
    sidL = map(lambda x: x.rstrip(),
               os.popen('cut -f 1 %s | sort | uniq' % outFileN).readlines())
    (con,
     cursor) = mymysql.connectDB(user=mysetting.mysqlH[server]['user'],
                                 passwd=mysetting.mysqlH[server]['passwd'],
                                 db=dbN,
                                 host=mysetting.mysqlH[server]['host'])
    for sid in sidL:
        cursor.execute(
            'SELECT samp_id,tag FROM sample_tag WHERE samp_id="%s" AND tag LIKE "XSeq_%%"'
            % sid)
        results = cursor.fetchall()
        if len(results) > 0:
            if len(results) > 1:
                sys.stderr.write('Duplication in sample_tag: %s\n' % sid)
                sys.exit(1)
            else:
                old_tag = results[0][1]
                new_tag = '%s,N' % old_tag
                cursor.execute(
                    'UPDATE sample_tag SET samp_id="%s", tag="%s" WHERE samp_id="%s" AND tag="%s"'
                    % (sid, new_tag, sid, old_tag))
        else:
            cursor.execute(
                'INSERT INTO sample_tag SET samp_id="%s", tag="XSeq_SS,N"' %
                sid)
示例#3
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)
示例#4
0
文件: post_cs2mut.py 项目: SMC1/JK1
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)