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. ''' genome = choices[1] if choices[0] == 'Yes' else None if genome == '': return 'Please select a genome build.' from gold.origdata.GtrackGenomeElementSource import GtrackGenomeElementSource errorStr = GeneralGuiTool._checkHistoryTrack(choices, 2, GtrackGenomeElementSource, genome, 'first GTrack') if errorStr: return errorStr errorStr = GeneralGuiTool._checkHistoryTrack(choices, 3, GtrackGenomeElementSource, genome, 'second GTrack') if errorStr: return errorStr if choices[2] == choices[3]: return 'Please select two different GTrack files.' if len(choices[4]) == 0: return 'Error: the GTrack files do not contain common intersecting factors (positional information or "id" column).'
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. ''' genome = choices[1] if choices[0] == 'Yes' else None if genome == '': return 'Please select a genome build.' errorStr = GeneralGuiTool._checkHistoryTrack(choices, 2, genome, 'first GTrack') if errorStr: return errorStr errorStr = GeneralGuiTool._checkHistoryTrack(choices, 3, genome, 'second GTrack') if errorStr: return errorStr if choices[2] == choices[3]: return 'Please select two different GTrack files.' if len(choices[4]) == 0: return 'Error: the GTrack files do not contain common intersecting factors (positional information or "id" column).'
def validateAndReturnErrors(choices): if choices.source == 'Tabular file from history': if choices.history in [None, '']: return 'Error: Please select a tabular file from your history. You may need to change the format of your history items to "tabular" or other tabular formats.' else: if choices.input == '': return 'Please type or paste the contents of a tabular file into the input box.' if choices.numSkipLines is not None: try: int(choices.numSkipLines.strip()) except: return 'Error: please type a correct number of lines to skip ("%s")' % choices.numSkipLines.strip() fileContentsInfo = TabularToGtrackTool._getFileContentsInfo(choices) if fileContentsInfo and fileContentsInfo.error is not None: return fileContentsInfo.error if choices.selectGenome == 'Yes': genome = choices.genome if genome in [None, '']: return 'Please select a genome build.' else: genome = None if choices.handleSeqId == 'Yes, auto-correct to the best match in the genome build': if choices.selectGenome != 'Yes': return 'To auto-correct the sequence ids, you need to specify a genome build.' if choices.cropCrossingSegments == 'Yes': if choices.selectGenome != 'Yes': return 'To crop segments crossing sequence ends, you need to specify a genome build.' if choices.columnSelection == 'Base columns on existing GTrack file': return GeneralGuiTool._checkHistoryTrack(choices, 'colSpecFile', genome, 'GTrack') headers = TabularToGtrackTool._getHeaders(choices) if not 'seqid' in headers: return "Error: the 'seqid' column is mandatory but is missing." if 'edges' in headers and not 'id' in choices: return "Error: the 'id' column is missing, but is mandatory since the 'edges' column has been selected." if choices.createDense == 'Yes' and not 'start' in headers: return 'The start column must be defined in order to create dense track types.' if choices.trackType is None: return 'Error: the columns selected do not define a GTrack track type. Please refer to the GTrack specification for more information.' elif any(x in choices.trackType.lower() for x in ['function', 'partition', 'base pairs']) and choices.createDense == 'No': denseTracksBasis = {'Function (F)': 'Valued Points (VP)', 'Step Function (SF)': 'Valued Segments (VS)', 'Genome Partition (GP)': 'Segments (S)', 'Linked Base Pairs (LBP)': 'Points (P)'} trackType, trackTypeBasis = choices.trackType, denseTracksBasis[choices.trackType] return 'Error: to create track type "%s", you must use select columns corresponing to track type "%s" and ' % (trackType, trackTypeBasis) + \ 'select "Yes" for "Create dense track type". For linked track types, select the appropriate "linked" or "edges" columns.' 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. ''' genome = choices[1] if choices[0] == 'Yes' else None if genome == '': return 'Please select a genome build.' return GeneralGuiTool._checkHistoryTrack(choices, 2, genome, 'GTrack')
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. ''' genome = choices[1] if choices[0] == 'Yes' else None if genome == '': return 'Please select a genome build.' from gold.origdata.GtrackGenomeElementSource import GtrackGenomeElementSource return GeneralGuiTool._checkHistoryTrack(choices, 2, GtrackGenomeElementSource, genome, 'GTrack')
def validateAndReturnErrors(choices): genome = choices.genome if choices.selectGenome == 'Yes' else None if genome == '': return 'Please select a genome build.' error = GeneralGuiTool._checkHistoryTrack(choices, 'history', GenomeElementSource, genome) if error: return error if choices.conversion is None: suffix = ExternalTrackManager.extractFileSuffixFromGalaxyTN(choices.history.split(':')) return 'No conversions available for the selected file. Please make ' \ 'sure that the file type is correct. Current file type: %s' % suffix
def validateAndReturnErrors(choices): genome = choices.genome if choices.selectGenome == 'Yes' else None if genome == '': return 'Please select a genome build.' error = GeneralGuiTool._checkHistoryTrack(choices, 'history', genome) if error: return error if choices.conversion is None: suffix = ExternalTrackManager.extractFileSuffixFromGalaxyTN( choices.history.split(':')) return 'No conversions available for the selected file. Please make ' \ 'sure that the file type is correct. Current file type: %s' % suffix
def validateAndReturnErrors(choices): if choices.source == 'Tabular file from history': if choices.history is None: return 'Error: The history does not contain any tabular files. You may need to change the format of your history items to "tabular" or other tabular formats.' else: if choices.input == '': return 'Please type or paste the contents of a tabular file into the input box.' if choices.numSkipLines is not None: try: int(choices.numSkipLines.strip()) except: return 'Error: please type a correct number of lines to skip ("%s")' % choices.numSkipLines.strip() fileContentsInfo = TabularToGtrackTool._getFileContentsInfo(choices) if fileContentsInfo.error is not None: return fileContentsInfo.error genome = choices.genome if choices.selectGenome == 'Yes' else None if genome == '': return 'Please select a genome build.' if choices.handleSeqId == 'Yes, auto-correct to the best match in the genome build': if choices.selectGenome != 'Yes': return 'To auto-correct the sequence ids, you need to specify a genome build.' if choices.columnSelection == 'Base columns on existing GTrack file': from gold.origdata.GtrackGenomeElementSource import GtrackGenomeElementSource return GeneralGuiTool._checkHistoryTrack(choices, 'colSpecFile', GtrackGenomeElementSource, genome, 'GTrack') headers = TabularToGtrackTool._getHeaders(choices) if not 'seqid' in headers: return "Error: the 'seqid' column is mandatory but is missing." if 'edges' in headers and not 'id' in choices: return "Error: the 'id' column is missing, but is mandatory since the 'edges' column has been selected." if choices.trackType is None: return 'Error: the columns selected do not define a GTrack track type. Please refer to the GTrack specification for more information.' elif any(x in choices.trackType.lower() for x in ['function', 'partition', 'base pairs']): from gold.application.LogSetup import logLackOfSupport logLackOfSupport('Track type "%s" is not yet supported by TabularToGtrackTool.' % choices.trackType) return 'Error: the track type "%s" is not yet fully supported by this tool.' % choices.trackType 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. ''' genome = choices.genome if choices.selectGenome == 'Yes' else None if genome == '': return 'Please select a genome build.' if choices.source == 'Tabular file from history': return GeneralGuiTool._checkHistoryTrack(choices, 'history', genome, 'GTrack') else: if choices.input == '': return 'Please type or paste a GTrack file into the input box.'