def _constructBins(regSpec, binSpec, genome, trackNames): # Construct and check bins try: from quick.application.GalaxyInterface import GalaxyInterface userBinSource = GalaxyInterface._getUserBinSource(regSpec, binSpec, genome, trackNames) return [None, userBinSource] except Exception, e: results = Results([], [], '') results.addError(InvalidRunSpecException('Error in specification of analysis region or binsize: ' + str(e))) logMessage('Error in specification of analysis region (' + regSpec +') or binsize: (' + binSpec + ')') if DebugConfig.PASS_ON_BATCH_EXCEPTIONS: raise return [results, None]
def _constructBins(regSpec, binSpec, genome, trackName1, trackName2): #Construct and check bins try: #userBinSource= UserBinSource(regSpec, binSpec) from quick.application.GalaxyInterface import GalaxyInterface # from config.Config import DEFAULT_GENOME userBinSource = GalaxyInterface._getUserBinSource(regSpec, binSpec, genome, trackName1, trackName2) return [None, userBinSource] except Exception, e: #results = Results(trackName1, trackName2, statClassName) results = Results([],[],'') results.addError(InvalidRunSpecException('Error in specification of analysis region or binsize: ' + str(e))) logMessage('Error in specification of analysis region (' + regSpec +') or binsize: (' + binSpec + ')') if DebugConfig.PASS_ON_BATCH_EXCEPTIONS: raise return [results, None]
def parseBatchLine(batchLine, genome, fullAccess): if batchLine[0] == '#' or batchLine.strip() == '': return from urllib import unquote #Split and check number of columns cols = [x for x in batchLine.strip().split(BATCH_COL_SEPARATOR)] if len(cols) != 6: results = Results(['N/A'], ['N/A'], 'N/A') #results.addResultComponent( 'Invalid',InvalidRunResultComponent('Error in batch specification. 6 columns are required, while '\ # + str(len(cols)) + ' are given.')) results.addError(InvalidRunSpecException('Error in batch specification. 6 columns are required, while '\ + str(len(cols)) + ' are given: ' + batchLine)) return results, None, None, None, None bc = BatchContents() bc.regSpec = cols[1] bc.binSpec = unquote(cols[2]) from quick.application.ExternalTrackManager import ExternalTrackManager if ExternalTrackManager.isGalaxyTrack(bc.binSpec.split(':')): bc.binSpec = ExternalTrackManager.extractFnFromGalaxyTN( bc.binSpec.split(':')) try: from quick.application.GalaxyInterface import GalaxyInterface bc.trackName1 = [unquote(x) for x in cols[3].split(':')] bc.trackName2 = [unquote(x) for x in cols[4].split(':')] bc.cleanedTrackName1, bc.cleanedTrackName2 = GalaxyInterface._cleanUpTracks( [bc.trackName1, bc.trackName2], genome, realPreProc=True) bc.cleanedTrackName1 = BatchRunner._inferTrackName( bc.cleanedTrackName1, genome, fullAccess) bc.cleanedTrackName2 = BatchRunner._inferTrackName( bc.cleanedTrackName2, genome, fullAccess) except (InvalidRunSpecException, IdenticalTrackNamesError), e: if DebugConfig.PASS_ON_BATCH_EXCEPTIONS: raise bc.errorResult = Results(['N/A'], ['N/A'], 'N/A') bc.errorResult.addError(e) return bc
def parseBatchLine(batchLine, genome, fullAccess): if batchLine[0] == '#' or batchLine.strip() == '': return from urllib import unquote # Split and check number of columns cols = [x for x in batchLine.strip().split(BATCH_COL_SEPARATOR)] if len(cols) != 6: results = Results(['N/A'], ['N/A'], 'N/A') results.addError(InvalidRunSpecException('Error in batch specification. 6 columns are required, while '\ + str(len(cols)) + ' are given: ' + batchLine)) return results, None, None, None, None bc = BatchContents() bc.regSpec = cols[1] bc.binSpec = unquote(cols[2]) from quick.application.ExternalTrackManager import ExternalTrackManager if ExternalTrackManager.isGalaxyTrack(bc.binSpec.split(':')): bc.binSpec = ExternalTrackManager.extractFnFromGalaxyTN(bc.binSpec.split(':')) bc.statClassName, bc.paramDict = BatchRunner._parseClassAndParams(cols[5]) bc.trackNames = [[unquote(x) for x in cols[i].split(':')] for i in [3, 4]] if 'trackNameIntensity' in bc.paramDict: bc.trackNames.append(convertTNstrToTNListFormat(bc.paramDict['trackNameIntensity'], doUnquoting=True)) from quick.application.GalaxyInterface import GalaxyInterface partlyCleanedTrackNames = GalaxyInterface._cleanUpTracks(bc.trackNames, genome, realPreProc=True) try: bc.cleanedTrackNames = BatchRunner._inferTrackNames(partlyCleanedTrackNames, genome, fullAccess) except (InvalidRunSpecException,IdenticalTrackNamesError), e: if DebugConfig.PASS_ON_BATCH_EXCEPTIONS: raise bc.errorResult = Results(['N/A'],['N/A'],'N/A') bc.errorResult.addError(e) return bc
def runJob(batchLine, genome, fullAccess): if batchLine[0] == '#' or batchLine.strip()=='': return from urllib import unquote #Split and check number of columns cols = [x for x in batchLine.strip().split(BATCH_COL_SEPARATOR)] if len(cols) != 6: results = Results(['N/A'],['N/A'],'N/A') #results.addResultComponent( 'Invalid',InvalidRunResultComponent('Error in batch specification. 6 columns are required, while '\ # + str(len(cols)) + ' are given.')) results.addError(InvalidRunSpecException('Error in batch specification. 6 columns are required, while '\ + str(len(cols)) + ' are given: ' + batchLine)) return results #print 'COL2: ',cols[2] cols[2] = unquote(cols[2]) #print 'COL2: ',cols[2] from quick.application.ExternalTrackManager import ExternalTrackManager if ExternalTrackManager.isGalaxyTrack(cols[2].split(':')): cols[2] = ExternalTrackManager.extractFnFromGalaxyTN(cols[2].split(':')) #print 'COL2: ',cols[2] try: from quick.application.GalaxyInterface import GalaxyInterface trackName1 = [unquote(x) for x in cols[3].split(':')] trackName2 = [unquote(x) for x in cols[4].split(':')] cleanedTrackName1, cleanedTrackName2 = GalaxyInterface._cleanUpTracks([trackName1, trackName2], genome, realPreProc=True) cleanedTrackName1 = BatchRunner._inferTrackName(':'.join(cleanedTrackName1), genome, fullAccess) cleanedTrackName2 = BatchRunner._inferTrackName(':'.join(cleanedTrackName2), genome, fullAccess) except (InvalidRunSpecException,IdenticalTrackNamesError), e: if DebugConfig.PASS_ON_BATCH_EXCEPTIONS: raise results = Results(['N/A'],['N/A'],'N/A') results.addError(e) return results