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)
Exemplo n.º 2
0
    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())
Exemplo n.º 3
0
    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())
Exemplo n.º 6
0
 def _allTracksHasOriginalFormat(cls, gSuite, genome):
     for track in gSuite.allTracks():
         if not TrackInfo(genome, track.trackName).fileType in \
                 getSupportedFileSuffixes():
             return False
     return True
Exemplo n.º 7
0
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('.','')
Exemplo n.º 8
0
 def extractFileSuffixFromGalaxyTN(galaxyTN,
                                   allowUnsupportedSuffixes=False):
     fileSuffixFilterList = None if allowUnsupportedSuffixes else getSupportedFileSuffixes(
     )
     return protoFunctions.extractFileSuffixFromDatasetInfo\
         (galaxyTN, fileSuffixFilterList=fileSuffixFilterList)