def getStdTrackNameFromGalaxyTN(cls, galaxyTN): assert(galaxyTN[0].lower() == 'galaxy') assert(galaxyTN[1].lower() in getSupportedFileSuffixes()) fn = cls.extractFnFromGalaxyTN(galaxyTN) id = cls.extractIdFromGalaxyFn(fn) name = galaxyTN[-1] return ExternalTrackManager.createStdTrackName(id, name)
def getOptionsBoxTrack(prevChoices): # Alternatively: getOptionsBox2() ''' See getOptionsBoxFirstKey(). prevChoices is a namedtuple of selections made by the user in the previous input boxes (that is, a namedtuple containing only one element in this case). The elements can accessed either by index, e.g. prevChoices[0] for the result of input box 1, or by key, e.g. prevChoices.key (case 2). ''' if prevChoices.genome: return GeneralGuiTool.getHistorySelectionElement( *getSupportedFileSuffixes())
def getStdTrackNameFromGalaxyTN(cls, galaxyTN, allowUnsupportedSuffixes=False): if isinstance(galaxyTN, basestring): galaxyTN = galaxyTN.split(':') assert galaxyTN[0].lower() == 'galaxy', str(galaxyTN) if not allowUnsupportedSuffixes and not galaxyTN[1].lower( ) in getSupportedFileSuffixes(): raise InvalidFormatError('File type "%s" is not supported.' % galaxyTN[1].lower()) fn = cls.extractFnFromGalaxyTN(galaxyTN) id = cls.extractIdFromGalaxyFn(fn) name = galaxyTN[-1] return ExternalTrackManager.createStdTrackName(id, name)
def extractFileSuffixFromGalaxyTN(galaxyTN): suffix = galaxyTN[1] if not suffix in getSupportedFileSuffixes(): raise ShouldNotOccurError('Filetype ' + suffix + ' not supported.') return suffix
def getOptionsBoxHistory(prevChoices): if prevChoices.trackSource == 'history': from gold.application.DataTypes import getSupportedFileSuffixes return tuple(['__history__'] + getSupportedFileSuffixes())
def _allTracksHasOriginalFormat(cls, gSuite, genome): for track in gSuite.allTracks(): if not TrackInfo(genome, track.trackName).fileType in \ getSupportedFileSuffixes(): return False return True
def getFileSuffix(fn): from gold.application.DataTypes import getSupportedFileSuffixes for suffix in getSupportedFileSuffixes(): if '.' in suffix and fn.endswith('.' + suffix): return suffix return os.path.splitext(fn)[1].replace('.','')
def extractFileSuffixFromGalaxyTN(galaxyTN, allowUnsupportedSuffixes=False): fileSuffixFilterList = None if allowUnsupportedSuffixes else getSupportedFileSuffixes( ) return protoFunctions.extractFileSuffixFromDatasetInfo\ (galaxyTN, fileSuffixFilterList=fileSuffixFilterList)