def validateAndReturnErrors(cls, choices): ''' Should validate the selected input parameters. If the parameters are not valid, an error text explaining the problem should be returned. The GUI then shows this text to the user (if not empty) and greys out the execute button (even if the text is empty). If all parameters are valid, the method should return None, which enables the execute button. ''' from quick.toolguide.controller.ToolGuide import ToolGuideController from quick.toolguide import ToolGuideConfig if not (choices.queryGSuite and choices.refGSuite): return ToolGuideController.getHtml(cls.toolId, [ToolGuideConfig.GSUITE_INPUT], choices.isBasic) errorString = GeneralGuiTool._checkGSuiteFile(choices.queryGSuite) if errorString: return errorString errorString = GeneralGuiTool._checkGSuiteFile(choices.refGSuite) if errorString: return errorString qGSuite = getGSuiteFromGalaxyTN(choices.queryGSuite) errorString = GeneralGuiTool._checkGSuiteRequirements \ (qGSuite, cls.GSUITE_ALLOWED_FILE_FORMATS, cls.GSUITE_ALLOWED_LOCATIONS, cls.GSUITE_ALLOWED_TRACK_TYPES, cls.GSUITE_DISALLOWED_GENOMES) if errorString: return errorString errorString = GeneralGuiTool._checkGSuiteTrackListSize(qGSuite) if errorString: return errorString refGSuite = getGSuiteFromGalaxyTN(choices.refGSuite) errorString = GeneralGuiTool._checkGSuiteRequirements \ (refGSuite, cls.GSUITE_ALLOWED_FILE_FORMATS, cls.GSUITE_ALLOWED_LOCATIONS, cls.GSUITE_ALLOWED_TRACK_TYPES, cls.GSUITE_DISALLOWED_GENOMES) if errorString: return errorString errorString = GeneralGuiTool._checkGSuiteTrackListSize(refGSuite) if errorString: return errorString errorString = cls._validateGenome(choices) if errorString: return errorString errorString = cls.validateUserBins(choices) if errorString: return errorString
def validateAndReturnErrors(choices): ''' Should validate the selected input parameters. If the parameters are not valid, an error text explaining the problem should be returned. The GUI then shows this text to the user (if not empty) and greys out the execute button (even if the text is empty). If all parameters are valid, the method should return None, which enables the execute button. ''' from gold.gsuite.GSuiteConstants import UNKNOWN, MULTIPLE errorStr = GeneralGuiTool._checkGSuiteFile(choices.history) if errorStr: return errorStr from quick.multitrack.MultiTrackCommon import getGSuiteFromGalaxyTN gSuite = getGSuiteFromGalaxyTN(choices.history) if gSuite.numTracks() == 0: return 'Please select a GSuite file with at least one track' if not gSuite.isPreprocessed(): return 'Selected GSuite file is not preprocess. Please preprocess ' \ 'the GSuite file before continuing the analysis.' if gSuite.trackType in [UNKNOWN]: return 'The track type of the GSuite file is not known. The track type ' \ 'is needed for doing analysis.' if gSuite.trackType in [MULTIPLE]: return 'All tracks in the GSuite file needs to be of the same track ' \ 'type. Multiple track types are not supported.'
def validateAndReturnErrors(cls, choices): ''' Should validate the selected input parameters. If the parameters are not valid, an error text explaining the problem should be returned. The GUI then shows this text to the user (if not empty) and greys out the execute button (even if the text is empty). If all parameters are valid, the method should return None, which enables the execute button. ''' errorString = GeneralGuiTool._checkGSuiteFile(choices.gsuite) if errorString: return errorString gSuite = getGSuiteFromGalaxyTN(choices.gsuite) errorString = GeneralGuiTool._checkGSuiteRequirements \ (gSuite, allowedLocations=GSuiteExportToHistoryTool.GSUITE_ALLOWED_LOCATIONS, allowedFileFormats=GSuiteExportToHistoryTool.GSUITE_ALLOWED_FILE_FORMATS, allowedTrackTypes=GSuiteExportToHistoryTool.GSUITE_ALLOWED_TRACK_TYPES) if errorString: return errorString if choices.changeFormat == cls.OUTPUT_FORMAT_CONVERT and choices.outputFormat is None: return 'There are no common supported file formats that all selected tracks can be converted to.'
def validateAndReturnErrors(cls, choices): ''' Should validate the selected input parameters. If the parameters are not valid, an error text explaining the problem should be returned. The GUI then shows this text to the user (if not empty) and greys out the execute button (even if the text is empty). If all parameters are valid, the method should return None, which enables the execute button. ''' errorStr = GeneralGuiTool._checkGSuiteFile(choices.history) if errorStr: return errorStr gSuite = getGSuiteFromGalaxyTN(choices.history) if choices.rowIndices: try: selectedIndices = CommonFunctionsForTools.processIndicesString( choices.rowIndices) maxIndex = max(selectedIndices) if maxIndex > (gSuite.numTracks()): return 'Selected row index %i is too high. GSuite contains %i tracks.' % ( maxIndex, gSuite.numTracks()) except: return 'Please enter valid indices string (e.g. 1-10, 12, 14)' if gSuite.numTracks() == 0: return 'GSuite file contains no tracks'
def validateAndReturnErrors(cls, choices): ''' Should validate the selected input parameters. If the parameters are not valid, an error text explaining the problem should be returned. The GUI then shows this text to the user (if not empty) and greys out the execute button (even if the text is empty). If all parameters are valid, the method should return None, which enables the execute button. ''' errorString = GeneralGuiTool._checkGSuiteFile(choices.gsuite) if errorString: return errorString gSuite = getGSuiteFromGalaxyTN(choices.gsuite) errorString = GeneralGuiTool._checkGSuiteRequirements( gSuite, allowedLocations=cls.GSUITE_ALLOWED_LOCATIONS, allowedFileFormats=cls.GSUITE_ALLOWED_FILE_TYPES, allowedTrackTypes=cls.GSUITE_ALLOWED_TRACK_TYPES) if errorString: return errorString if choices.genome: errorString = cls.validateUserBins(choices) if errorString: return errorString return None
def validateAndReturnErrors(cls, choices): errMessage = GeneralGuiTool._checkGSuiteFile(choices.gsuite) if errMessage: return errMessage gSuite = getGSuiteFromGalaxyTN(choices.gsuite) errorString = GeneralGuiTool._checkGSuiteRequirements \ (gSuite, cls.GSUITE_ALLOWED_FILE_FORMATS, cls.GSUITE_ALLOWED_LOCATIONS, cls.GSUITE_ALLOWED_TRACK_TYPES, cls.GSUITE_DISALLOWED_GENOMES) if errorString: return errorString errorStr = cls._validateGenome(choices) if errorStr: return errorStr errorString = cls.validateUserBins(choices) if errorString: return errorString errorString = cls._checkGSuiteTrackListSize(gSuite=gSuite, minSize=2) if errorString: return errorString
def validateAndReturnErrors(cls, choices): ''' Should validate the selected input parameters. If the parameters are not valid, an error text explaining the problem should be returned. The GUI then shows this text to the user (if not empty) and greys out the execute button (even if the text is empty). If all parameters are valid, the method should return None, which enables the execute button. ''' from quick.multitrack.MultiTrackCommon import getGSuiteFromGalaxyTN errorString = GeneralGuiTool._checkGSuiteFile(choices.history) if errorString: return errorString gSuite = getGSuiteFromGalaxyTN(choices.history) errorString = cls._validateGenome(choices) if errorString: return errorString errorString = GeneralGuiTool._checkGSuiteRequirements( gSuite, allowedLocations=cls.GSUITE_ALLOWED_LOCATIONS) if errorString: return errorString errorString = GeneralGuiTool._checkGSuiteTrackListSize(gSuite, minSize=1) if errorString: return errorString
def validateAndReturnErrors(cls, choices): ''' Should validate the selected input parameters. If the parameters are not valid, an error text explaining the problem should be returned. The GUI then shows this text to the user (if not empty) and greys out the execute button (even if the text is empty). If all parameters are valid, the method should return None, which enables the execute button. ''' errorStr = GeneralGuiTool._checkGSuiteFile(choices.history) if errorStr: return errorStr from quick.multitrack.MultiTrackCommon import getGSuiteFromGalaxyTN gSuite = getGSuiteFromGalaxyTN(choices.history) if gSuite.location == GSuiteConstants.REMOTE: return 'All tracks in GSuite file are remote. ' \ 'Please download the tracks of the GSuite file before preprocessing.' errorStr = cls._validateGenome(choices) if errorStr: return errorStr errorStr = cls._checkGSuiteRequirements( gSuite, allowedFileFormats=cls.GSUITE_ALLOWED_FILE_FORMATS, allowedLocations=cls.GSUITE_ALLOWED_LOCATIONS) if errorStr: return errorStr
def validateAndReturnErrors(cls, choices): ''' Should validate the selected input parameters. If the parameters are not valid, an error text explaining the problem should be returned. The GUI then shows this text to the user (if not empty) and greys out the execute button (even if the text is empty). If all parameters are valid, the method should return None, which enables the execute button. ''' errorStr = GeneralGuiTool._checkGSuiteFile(choices.history) if errorStr: return errorStr gSuite = getGSuiteFromGalaxyTN(choices.history) if gSuite.numTracks() == 0: return 'Please select a GSuite file with at least one track' errorStr = cls._checkGSuiteRequirements( gSuite, allowedFileFormats = cls.GSUITE_ALLOWED_FILE_FORMATS, allowedLocations = cls.GSUITE_ALLOWED_LOCATIONS) if errorStr: return errorStr if choices.operation: if choices.operation == cls.NO_OPERATION_TEXT: return 'Please select an operation to perform on the input tracks' else: try: cls._runOperationOnExampleDataAndReturnOutput(choices) except Exception as e: return 'An error occured testing operation "%s": ' % choices.operation + str(e) if choices.changeSuffix == 'Yes' and choices.suffix.strip() == '': return 'Please select a file suffix'
def validateAndReturnErrors(cls, choices): genome = choices.genome genomicRegionsSource = choices.genomicRegionsSource genomicRegions = choices.genomicRegions sourceTfs = choices.sourceTfs tfTracks = choices.tfTracks # Check genome if genome == cls.SELECT: return 'Please select a genome build.' # Check that all boxes have data: if genomicRegionsSource == AllTargetsOfTfs.SELECT: return 'Please select a genomic region source.' if not genomicRegions: return 'Please select a genomic region.' # Check tracks for Genomic Regions-History: if genomicRegionsSource == 'History (user-defined)': if len(genomicRegions.split(":")) > 1: if genomicRegions.split(":")[1] == "gsuite": errorString = GeneralGuiTool._checkGSuiteFile( genomicRegions) if errorString: return errorString else: gSuite = getGSuiteFromGalaxyTN(genomicRegions) sizeErrorString = GeneralGuiTool._checkGSuiteTrackListSize( gSuite, 1, 1000) if sizeErrorString: return sizeErrorString else: reqErrorString = GeneralGuiTool._checkGSuiteRequirements \ (gSuite, AllTargetsOfTfs.GSUITE_ALLOWED_FILE_FORMATS, AllTargetsOfTfs.GSUITE_ALLOWED_LOCATIONS, AllTargetsOfTfs.GSUITE_ALLOWED_TRACK_TYPES, AllTargetsOfTfs.GSUITE_DISALLOWED_GENOMES) if reqErrorString: return reqErrorString else: errorString = GeneralGuiTool._checkTrack( choices, 'genomicRegions', 'genome') if errorString: return errorString if sourceTfs == AllTargetsOfTfs.SELECT: return 'Please select a TF source.' if not tfTracks: return 'Please select a TF track.' # Check tracks for TFs-History: if sourceTfs == 'History (user-defined)': tfErrorString = GeneralGuiTool._checkTrack(choices, 'tfTracks', 'genome') if tfErrorString: return tfErrorString return None
def getOptionsBoxTfTracks(cls, prevChoices): if prevChoices.sourceTfsDetails != cls.SELECT: genome = prevChoices.genome sourceTfs = prevChoices.sourceTfs sourceTfsDetails = prevChoices.sourceTfsDetails if sourceTfs == cls.SELECT: return elif sourceTfs == 'Hyperbrowser repository': tfSourceTN = TfTrackNameMappings.getTfTrackNameMappings( prevChoices.genome)[sourceTfsDetails] subtypes = ProcTrackOptions.getSubtypes( prevChoices.genome, tfSourceTN, True) falses = ['False'] * len(subtypes) return OrderedDict(zip(subtypes, falses)) elif sourceTfs == cls.REGIONS_FROM_HISTORY: if isinstance(sourceTfsDetails, basestring): galaxyTN = sourceTfsDetails.split(':') if galaxyTN[ 1] == "gsuite": #ExternalTrackManager.extractFileSuffixFromGalaxyTN(prevChoices.sourceTfsDetails, allowUnsupportedSuffixes=True) == "gsuite" errorString = GeneralGuiTool._checkGSuiteFile( sourceTfsDetails) if not errorString: gSuite = getGSuiteFromGalaxyTN(sourceTfsDetails) sizeErrorString = GeneralGuiTool._checkGSuiteTrackListSize( gSuite, 1, 1000) if not sizeErrorString: reqErrorString = GeneralGuiTool._checkGSuiteRequirements \ (gSuite, AllTfsOfRegions.GSUITE_ALLOWED_FILE_FORMATS, AllTfsOfRegions.GSUITE_ALLOWED_LOCATIONS, AllTfsOfRegions.GSUITE_ALLOWED_TRACK_TYPES, AllTfsOfRegions.GSUITE_DISALLOWED_GENOMES) if not reqErrorString: validity = 'Valid' else: return else: return else: return if validity == 'Valid': selectedTrackNames = [] gSuite = getGSuiteFromGalaxyTN(sourceTfsDetails) for track in gSuite.allTracks(): selectedTrackNames.append(':'.join( track.trackName)) falses = ['False'] * len(selectedTrackNames) return OrderedDict(zip(selectedTrackNames, falses)) else: tfTrackName = ExternalTrackManager.getPreProcessedTrackFromGalaxyTN( genome, galaxyTN) return [':'.join(tfTrackName)] else: return else: return else: return
def validateAndReturnErrors(cls, choices): ''' Should validate the selected input parameters. If the parameters are not valid, an error text explaining the problem should be returned. The GUI then shows this text to the user (if not empty) and greys out the execute button (even if the text is empty). If all parameters are valid, the method should return None, which enables the execute button. ''' from quick.toolguide.controller.ToolGuide import ToolGuideController from quick.toolguide import ToolGuideConfig if not choices.histElement: return ToolGuideController.getHtml(cls.toolId, [ToolGuideConfig.GSUITE_INPUT], choices.isBasic) errorString = GeneralGuiTool._checkGSuiteFile(choices.histElement) if errorString: return errorString gSuite = getGSuiteFromGalaxyTN(choices.histElement) if choices.Analysis in ( MultiTrackAnalysisTool.LBL_FACTORS_OBSERVED_VS_EXPECTED, MultiTrackAnalysisTool.LBL_HYPOTHESIS_TESTING_MULTI): errorString = GeneralGuiTool._checkGSuiteTrackListSize(gSuite, minSize=3, maxSize=3) if errorString: return errorString errorString = GeneralGuiTool._checkGSuiteRequirements \ (gSuite, MultiTrackAnalysisTool.GSUITE_ALLOWED_FILE_FORMATS, MultiTrackAnalysisTool.GSUITE_ALLOWED_LOCATIONS, MultiTrackAnalysisTool.GSUITE_ALLOWED_TRACK_TYPES, MultiTrackAnalysisTool.GSUITE_DISALLOWED_GENOMES) if errorString: return errorString errorString = cls.validateUserBins(choices) if errorString: return errorString # regSpec, binSpec = UserBinSelector.getRegsAndBinsSpec(choices) # if regSpec.strip() is '' or binSpec.strip() is '': # return 'Region and bin must be specified' # ubSource = GalaxyInterface._getUserBinSource(regSpec, binSpec, gSuite.genome) # # hasBins = False # for bin in ubSource: # hasBins = True # break # # if not hasBins: # return 'Zero analysis bins specified. This may be caused by entering an incorrect filtering condition, e.g. a mistyped chromosome.' # return None
def validateAndReturnErrors(choices): ''' Should validate the selected input parameters. If the parameters are not valid, an error text explaining the problem should be returned. The GUI then shows this text to the user (if not empty) and greys out the execute button (even if the text is empty). If all parameters are valid, the method should return None, which enables the execute button. ''' if choices[0] == 'From GSuite': if not choices[1]: return 'Please select a GSuite from history' if choices[0] == 'From GSuite': errorString = GeneralGuiTool._checkGSuiteFile(choices[1]) if errorString: return errorString gSuite = getGSuiteFromGalaxyTN(choices[1]) errorString = GeneralGuiTool._checkGSuiteTrackListSize(gSuite, minSize=2) if errorString: return errorString errorString = GeneralGuiTool._checkGSuiteRequirements \ (gSuite, CreateBpsVennDIagram.GSUITE_ALLOWED_FILE_FORMATS, CreateBpsVennDIagram.GSUITE_ALLOWED_LOCATIONS, CreateBpsVennDIagram.GSUITE_ALLOWED_TRACK_TYPES, CreateBpsVennDIagram.GSUITE_DISALLOWED_GENOMES) if errorString: return errorString genome, trackNames = CreateBpsVennDIagram.getTrackNamesFromFormParameters( choices) ret = '' # ret += 'coiches='+str(choices) + '<br/>' # ret += 'genome='+genome+'<br/>' # ret += 'trackNames='+str(trackNames)+'<br/><br/>' if choices[3] != 'Several bed files' and choices[ 0] == 'From repository': if len(list(trackNames)) == 0: return ret + 'Need one category.bed file as input' if len(list(trackNames)) > 1: return ret + 'Need just one category.bed file as input' if len(list(trackNames)) > len( CreateBpsVennDIagram.getPrimeList()): return ret + 'To many files for tool, max number of files is ' + len( CreateBpsVennDIagram.getPrimeList()) else: if len(list(trackNames)) < 2: return ret + 'Need at least two tracks (or bed files) as input' # if ret: # return ret return None
def validateAndReturnErrors(choices): ''' Should validate the selected input parameters. If the parameters are not valid, an error text explaining the problem should be returned. The GUI then shows this text to the user (if not empty) and greys out the execute button (even if the text is empty). If all parameters are valid, the method should return None, which enables the execute button. ''' errorStr = GeneralGuiTool._checkGSuiteFile(choices.gsuite) if errorStr: return errorStr
def validateAndReturnErrors(cls, choices): ''' Should validate the selected input parameters. If the parameters are not valid, an error text explaining the problem should be returned. The GUI then shows this text to the user (if not empty) and greys out the execute button (even if the text is empty). If all parameters are valid, the method should return None, which enables the execute button. ''' if cls.exception: return cls.exception #check track errorString = GeneralGuiTool._checkTrack(choices, 'targetTrack', 'targetTrackGenome') if errorString: return errorString genome, tn, tf = GeneralGuiTool._getBasicTrackFormat(choices, 'targetTrack', 'targetTrackGenome') errorString = '' from os import linesep if tf not in SegmentsOverlapVisualizationTool.TRACK_ALLOWED_TRACK_TYPES: errorString += '%s is not a supported track type for this tool. Supported track types are ' %tf errorString += str(SegmentsOverlapVisualizationTool.TRACK_ALLOWED_TRACK_TYPES) + linesep return errorString if choices.refTrackCollection is not None: targetTrackGenome = choices.targetTrackGenome errorString = GeneralGuiTool._checkGSuiteFile(choices.refTrackCollection) if errorString: return errorString refGSuite = getGSuiteFromGalaxyTN(choices.refTrackCollection) #check genome errorString = GeneralGuiTool._checkGenomeEquality(targetTrackGenome, refGSuite.genome) if errorString: return errorString errorString = GeneralGuiTool._checkGSuiteRequirements \ (refGSuite, SegmentsOverlapVisualizationTool.GSUITE_ALLOWED_FILE_FORMATS, SegmentsOverlapVisualizationTool.GSUITE_ALLOWED_LOCATIONS, SegmentsOverlapVisualizationTool.GSUITE_ALLOWED_TRACK_TYPES, SegmentsOverlapVisualizationTool.GSUITE_DISALLOWED_GENOMES) if errorString: return errorString #number of tracks errorString = GeneralGuiTool._checkGSuiteTrackListSize(refGSuite, maxSize=10) if errorString: return errorString else: return None
def validateAndReturnErrors(cls, choices): errorString = GeneralGuiTool._checkGSuiteFile(choices.gsuite) if errorString: return errorString gSuite = getGSuiteFromGalaxyTN(choices.gsuite) errorString = GeneralGuiTool._checkGSuiteRequirements( gSuite, allowedLocations=cls.GSUITE_ALLOWED_LOCATIONS, allowedFileFormats=cls.GSUITE_ALLOWED_FILE_FORMATS, allowedTrackTypes=cls.GSUITE_ALLOWED_TRACK_TYPES) if errorString: return errorString
def validateAndReturnErrors(cls, choices): ''' Should validate the selected input parameters. If the parameters are not valid, an error text explaining the problem should be returned. The GUI then shows this text to the user (if not empty) and greys out the execute button (even if the text is empty). If all parameters are valid, the method should return None, which enables the execute button. ''' errorStr = GeneralGuiTool._checkGSuiteFile(choices.history) if errorStr: return errorStr if not choices.selectColumns is None and len(choices.selectColumns) == 0: return 'GSuite file contains only standard columns'
def validateAndReturnErrors(cls, choices=None): errorStr = GeneralGuiTool._checkGSuiteFile(choices.gSuite) if errorStr: return errorStr gSuite = getGSuiteFromGalaxyTN(choices.gSuite) if gSuite.numTracks() == 0: return 'Please select a GSuite file with at least one track' errorStr = cls._checkGSuiteRequirements( gSuite, allowedFileFormats=cls.GSUITE_ALLOWED_FILE_FORMATS, allowedLocations=cls.GSUITE_ALLOWED_LOCATIONS ) if errorStr: return errorStr
def validateAndReturnErrors(cls, choices): errorString = GeneralGuiTool._checkGSuiteFile(choices.gSuite) if errorString: return errorString gSuite = getGSuiteFromGalaxyTN(choices.gSuite) errorString = GeneralGuiTool._checkGSuiteRequirements \ (gSuite) if errorString: return errorString columnY = choices.columnY if isinstance(columnY, dict): if not True in columnY.values(): errorString = 'Check at least one value for y-Axis' return errorString
def validateAndReturnErrors(cls, choices): errorStr = GeneralGuiTool._checkGSuiteFile(choices.history) if errorStr: return errorStr gSuite = getGSuiteFromGalaxyTN(choices.history) if choices.rowIndices: try: selectedIndices = CommonFunctionsForTools.processIndicesString( choices.rowIndices) maxIndex = max(selectedIndices) if maxIndex >= len(gSuite): return 'Selected row index %i is too high. GSuite contains %i tracks.' % ( maxIndex, gSuite.numTracks()) except: return 'Please enter valid indices string (e.g. 1-10, 12, 14)' if len(gSuite) == 0: return 'GSuite file contains no tracks'
def validateAndReturnErrors(cls, choices): ''' Should validate the selected input parameters. If the parameters are not valid, an error text explaining the problem should be returned. The GUI then shows this text to the user (if not empty) and greys out the execute button (even if the text is empty). If all parameters are valid, the method should return None, which enables the execute button. ''' if not choices.gSuite: from quick.toolguide.controller.ToolGuide import ToolGuideController from quick.toolguide import ToolGuideConfig return ToolGuideController.getHtml(cls.toolId, [ToolGuideConfig.GSUITE_INPUT], choices.isBasic) errorString = GeneralGuiTool._checkGSuiteFile(choices.gSuite) if errorString: return errorString gSuite = getGSuiteFromGalaxyTN(choices.gSuite) errorString = GeneralGuiTool._checkGSuiteRequirements \ (gSuite, cls.GSUITE_ALLOWED_FILE_FORMATS, cls.GSUITE_ALLOWED_LOCATIONS, cls.GSUITE_ALLOWED_TRACK_TYPES, cls.GSUITE_DISALLOWED_GENOMES) if errorString: return errorString if choices.similarityTech == cls.SIMILARITY_RELATIONS_TO_OTHER \ or choices.similarityTech == cls.REGIONS_CLUSTERING: if not choices.gSuiteRef: from quick.toolguide.controller.ToolGuide import ToolGuideController from quick.toolguide import ToolGuideConfig return ToolGuideController.getHtml( cls.toolId, [ToolGuideConfig.GSUITE_INPUT], choices.isBasic) errorString = GeneralGuiTool._checkGSuiteFile(choices.gSuiteRef) if errorString: return errorString gSuiteRef = getGSuiteFromGalaxyTN(choices.gSuiteRef) errorString = GeneralGuiTool._checkGSuiteRequirements \ (gSuiteRef, cls.GSUITE_ALLOWED_FILE_FORMATS, cls.GSUITE_ALLOWED_LOCATIONS, cls.GSUITE_ALLOWED_TRACK_TYPES, cls.GSUITE_DISALLOWED_GENOMES) if errorString: return errorString if choices.similarityTech in [ cls.SIMILARITY_POSITIONAL, cls.SIMILARITY_RELATIONS_TO_OTHER ]: if not choices.featureSelection: return 'Feature for similarity calculation has not been selected. ' \ 'If no features are available for selection, the track types ' \ 'if the clustering and reference tracks are too inconsistent. ' \ 'Please remove the inconsistent tracks from the GSuite.' errorString = cls._validateGenome(choices) if errorString: return errorString errorString = cls.validateUserBins(choices) if errorString: return errorString
def validateAndReturnErrors(cls, choices): genome = choices.genome genomicRegions = choices.genomicRegions genomicRegionsTracks = choices.genomicRegionsTracks sourceTfs = choices.sourceTfs sourceTfsDetails = choices.sourceTfsDetails tfTracks = choices.tfTracks # Check genome if genome == cls.SELECT: return 'Please select a genome build.' # Check that all region boxes have data: if genomicRegions == AllTfsOfRegions.SELECT: return 'Please select a genomic region.' if genomicRegionsTracks == AllTfsOfRegions.SELECT: return 'Please select a genomic region track.' # Check tracks for Genomic Regions-History: if genomicRegions == AllTfsOfRegions.REGIONS_FROM_HISTORY: errorString = GeneralGuiTool._checkTrack(choices, 'genomicRegionsTracks', 'genome') if errorString: return errorString # Check that TF box has data: if sourceTfs == AllTfsOfRegions.SELECT: return 'Please select a TF source.' # Check tracks for TFs-History: if sourceTfs == AllTfsOfRegions.REGIONS_FROM_HISTORY: if sourceTfsDetails == AllTfsOfRegions.SELECT: return 'Please select a TF track.' else: if isinstance(sourceTfsDetails, basestring): trackType = sourceTfsDetails.split(':')[1] if trackType == "gsuite": errorString = GeneralGuiTool._checkGSuiteFile( sourceTfsDetails) if errorString: return errorString gSuite = getGSuiteFromGalaxyTN(sourceTfsDetails) sizeErrorString = GeneralGuiTool._checkGSuiteTrackListSize( gSuite, 1, 1000) if sizeErrorString: return sizeErrorString reqErrorString = GeneralGuiTool._checkGSuiteRequirements \ (gSuite, AllTfsOfRegions.GSUITE_ALLOWED_FILE_FORMATS, AllTfsOfRegions.GSUITE_ALLOWED_LOCATIONS, AllTfsOfRegions.GSUITE_ALLOWED_TRACK_TYPES, AllTfsOfRegions.GSUITE_DISALLOWED_GENOMES) if reqErrorString: return reqErrorString else: errorString = GeneralGuiTool._checkTrack( choices, 'sourceTfsDetails', 'genome') if errorString: return errorString return None