def createGalaxyTnFromExternalTn(cls, externalTN):
        # Hack to support ConvertPrimaryGsuiteToLocalPathsTool

        from config.Config import EXT_RESULTS_PATH
        assert externalTN[0] == 'external'
        assert len(externalTN) == 5

        resultsPathDirs = EXT_RESULTS_PATH.rstrip(os.path.sep).split(
            os.path.sep)
        assert resultsPathDirs[-1] == URL_PREFIX.strip('/')

        instance = externalTN[1]
        # Hack
        if instance == 'dev2':
            instance = 'developer'
        resultsPathDirs[-1] = instance
        extResultsFilesPath = os.path.sep.join(resultsPathDirs + ['files'])

        galaxyFn = protoFunctions.getGalaxyFnFromAnyDatasetId(
            externalTN[3], galaxyFilePath=extResultsFilesPath)
        filePath = protoFunctions.getGalaxyFilesFilename(
            galaxyFn, [externalTN[4]])
        if not os.path.exists(filePath):
            raise ValueError(
                'Original track file {} does not exist'.format(filePath))
        fileSuffix = getFileSuffix(filePath)
        return cls.constructGalaxyTnFromSuitedFn(filePath,
                                                 fileEnding=fileSuffix,
                                                 name=externalTN[4])
Пример #2
0
    def tableFromDictionary(self,
                            dataDict,
                            columnNames=None,
                            sortable=True,
                            tableId=None,
                            expandable=False,
                            visibleRows=6,
                            presorted=None,
                            **kwargs):
        """Render a table from data in dataDict. Each key in dataDict is a row title,
        each value is a list of values, each corresponding to the column given with columnNames.

        If presorted is set to a number and tableId != None and sortable == True, that column will be presorted (using a hacky solution using jquery.
        """

        from proto import CommonFunctions
        dataDictOfLists = CommonFunctions.convertToDictOfLists(dataDict)

        if presorted is not None and presorted > -1:
            assert isinstance(presorted, int), 'presorted must be int'
            from quick.util import CommonFunctions
            dataDictOfLists = CommonFunctions.smartSortDictOfLists(
                dataDictOfLists, sortColumnIndex=presorted)

        tableClass = 'colored bordered'
        if expandable:
            tableClass += ' expandable'

        self.tableHeader(headerRow=columnNames,
                         sortable=sortable,
                         tableId=tableId,
                         tableClass=tableClass,
                         **kwargs)

        for key, val in dataDictOfLists.iteritems():
            if isinstance(val, list):
                self.tableLine([key] + val, **kwargs)
            else:
                self.tableLine([key] + [val], **kwargs)

        self.tableFooter(expandable=expandable,
                         tableId=tableId,
                         numRows=len(dataDict),
                         visibleRows=visibleRows,
                         **kwargs)

        return self
Пример #3
0
 def getGalaxyFnFromEncodedDatasetId(encodedId):
     return protoFunctions.getGalaxyFnFromEncodedDatasetId(encodedId)
Пример #4
0
 def getEncodedDatasetIdFromPlainGalaxyId(plainId):
     return protoFunctions.getEncodedDatasetIdFromPlainGalaxyId(plainId)
Пример #5
0
 def getEncodedDatasetIdFromGalaxyFn(cls, galaxyFn):
     return protoFunctions.getEncodedDatasetIdFromGalaxyFn(galaxyFn)
Пример #6
0
 def extractIdFromGalaxyFn(fn):
     return protoFunctions.extractIdFromGalaxyFn(fn)
Пример #7
0
 def extractFnFromGalaxyTN(cls, galaxyTN):
     return protoFunctions.extractFnFromDatasetInfo(galaxyTN)
Пример #8
0
 def createGalaxyFilesFn(galaxyFn, filename):
     return protoFunctions.createGalaxyFilesFn(galaxyFn, filename)
Пример #9
0
 def getGalaxyFilesFilename(cls, galaxyFn, id):
     """
     id is the relative file hierarchy, encoded as a list of strings
     """
     return protoFunctions.getGalaxyFilesFilename(galaxyFn, id)
Пример #10
0
 def getGalaxyFilesDir(galaxyFn):
     return protoFunctions.getGalaxyFilesDir(galaxyFn)