dirJob = sys.argv[1] N = int(sys.argv[2]) temp_age_folder = sys.argv[3] temp_OS_folder = sys.argv[4] from collections import defaultdict # Running on rnuuspr66 server # temporary folder to store qsub job related files if not os.path.exists(dirJob): os.mkdir(dirJob) fusion = getallfusion() fusion = list(fusion) # randomly partition the fusion list into N nearly equal parts fusionPartition = randompartition(fusion,N) for i in range(N): name = 'Job' + str(i) + '_datafile' filename = os.path.join(dirJob,name) ofile = open(filename,'w') fp = fusionPartition[i] for f in fp: line = '\t'.join([f[0],f[1],f[2]]) ofile.write(line+'\n') ofile.close() for i in range(N): name = 'Job' + str(i) + '_datafile' filename = os.path.join(dirJob,name) qsubString = '''#!/bin/sh #PBS -N AgeOSJob%d
temp_OS_folder = sys.argv[4] from collections import defaultdict # Running on rnuuspr66 server # temporary folder to store qsub job related files if not os.path.exists(dirJob): os.mkdir(dirJob) fusion = getallfusion() fusion = list(fusion) # randomly partition the fusion list into N nearly equal parts fDict = defaultdict(list) for cancer,g5p,g3p in fusion: fDict[(cancer,g3p)].append(g5p) fusionPartition = randompartition(fDict.keys(),N) for i in range(N): name = 'Job' + str(i) + '_datafile' filename = os.path.join(dirJob,name) ofile = open(filename,'w') fp = fusionPartition[i] for f in fp: g5p = fDict[f] if len(g5p)==1: gene5p = g5p[0] else: gene5p = ','.join(g5p) line = '\t'.join([f[0],gene5p,f[1]]) ofile.write(line+'\n') ofile.close()