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)
예제 #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())
예제 #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())
예제 #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
예제 #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('.','')
예제 #8
0
 def extractFileSuffixFromGalaxyTN(galaxyTN,
                                   allowUnsupportedSuffixes=False):
     fileSuffixFilterList = None if allowUnsupportedSuffixes else getSupportedFileSuffixes(
     )
     return protoFunctions.extractFileSuffixFromDatasetInfo\
         (galaxyTN, fileSuffixFilterList=fileSuffixFilterList)