from gusPyCode.defs.JamesDefs import DotDict if len(sys.argv) != 3: exit('USAGE: python %s inFile outFile' % (sys.argv[0].split('/')[-1])) lines = open(sys.argv[1],'rU').readlines() outLines = [] groupedLines = groupByField_silent(lines,0,sep=' : ') groupedLines.sort(key=lambda x: x[0][0]) for miR in groupedLines: data = DotDict({'name':miR[0][0], 'orthoTypes':[], 'numTot':[None]*4, 'FDRTot':[None]*4, 'm3_to_m8_fdr':[None]*4, 'm2_to_m7_fdr':[None]*4, 'A1_to_m7_fdr':[None]*4, 'm2_to_m8_fdr':[None]*4, 'A1_to_m8_fdr':[None]*4}) for line in miR: if line[1].startswith("allPassedSeedsFor_"): orthoType = int(line[1][-1]) data.orthoTypes.append(orthoType) data.numTot[orthoType] = line[2] data.FDRTot[orthoType] = line[3] for i in miR: if i[2].startswith('orthoType_%s' % (orthoType)): if i[1]+'_fdr' in data: data[i[1]+'_fdr'][orthoType] = i[4]
rSet.add(i) return sorted(list(rSet)) lines = open(sys.argv[1],'rU').readlines() outLines = [] groupedLines = groupByField_silent(lines,0,sep=' : ') groupedLines.sort(key=lambda x: x[0][0]) for miR in groupedLines: data = DotDict({'name':miR[0][0], 'orthoTypes':[], 'numTot':[None]*4, 'FDRTot':[None]*4, 'm3_to_m8_fdr':[None]*4, 'm2_to_m7_fdr':[None]*4, 'A1_to_m7_fdr':[None]*4, 'm2_to_m8_fdr':[None]*4, 'A1_to_m8_fdr':[None]*4}) for line in miR: if line[1].startswith("allPassedSeedsFor_"): orthoType = int(line[1][-1]) data.orthoTypes.append(orthoType) data.numTot[orthoType] = len(getAGAPList(line[5])) data.FDRTot[orthoType] = line[3] for i in miR: if i[2].startswith('orthoType_%s' % (orthoType)): if i[1]+'_fdr' in data: data[i[1]+'_fdr'][orthoType] = i[4]
rSet.add(i) return rSet lines = open(sys.argv[1],'rU').readlines() outLines = [] groupedLines = groupByField_silent(lines,0,sep=' : ') groupedLines.sort(key=lambda x: x[0][0]) mirDict = Bag() for miR in groupedLines: data = DotDict({'name':miR[0][0], 'orthoTypes':[], 'numTot':[None]*4, 'AGAPgenes':[None]*4}) for line in miR: if line[1].startswith("allPassedSeedsFor_"): orthoType = int(line[1][-1]) data.orthoTypes.append(orthoType) data.numTot[orthoType] = len(getAGAP(line[5])) data.AGAPgenes[orthoType] = getAGAP(line[5]) #for i in miR: #if i[2].startswith('orthoType_%s' % (orthoType)): #if i[1]+'_fdr' in data: #data[i[1]+'_fdr'][orthoType] = i[4] mirDict[data.name] = data