def execute(choices, galaxyFn=None, username=''):

        gsuite = getGSuiteFromGalaxyTN(choices.gsuite)
        bedRegions = choices.bedRegions

        rp = RP(gsuite)
        bedData = rp.openBedFile(bedRegions)
        chrOrder, chrLength = rp.sortChrDict()
        dataDict, dataDictLine, elementOrder, listResCopy, newDictRegions = rp.countMutations(
            chrLength, bedData)

        vg = visualizationGraphs()
        tName = gsuite.allTrackTitles()

        uniformDictList = OrderedDict()  # expected values
        observedDictList = OrderedDict()  # observed values
        seriesNameRegionUDL = OrderedDict()
        seriesNameRegionODL = OrderedDict()
        seriesNameRegion = OrderedDict()

        GenerateDistributionOfPointsOfInterestTool.countRegionsForDistribution(
            newDictRegions, observedDictList, rp, seriesNameRegion,
            seriesNameRegionODL, seriesNameRegionUDL, tName, uniformDictList)
        res = ''
        for elK in uniformDictList.keys():
            res += GenerateDistributionOfPointsOfInterestTool.drawDistribution(
                elK, observedDictList, seriesNameRegion, seriesNameRegionODL,
                seriesNameRegionUDL, uniformDictList, vg)

        htmlCore = HtmlCore()
        htmlCore.begin()
        htmlCore.line(res)
        htmlCore.end()
        htmlCore.hideToggle(styleClass='debug')
        print htmlCore
예제 #2
0
    def getToolDescription(cls):
        '''
        Specifies a help text in HTML that is displayed below the tool.
        '''
        from proto.hyperbrowser.HtmlCore import HtmlCore

        core = HtmlCore()
        core.paragraph(
            'This tool can be used to compile a GSuite file referring to a selection '
            'of files from the current Galaxy history. Selection of a genome build is optional.'
        )
        core.divider()
        core.smallHeader('Note')
        core.paragraph(
            'Even though this tool can be used to build GSuite compilations of any history elements, '
            'the resulting GSuite file will be more usable if the elements are somewhat homogeneous '
            'in file format and/or track type.')

        cls._addGSuiteFileDescription(
            core,
            outputLocation=cls.GSUITE_OUTPUT_LOCATION,
            outputFileFormat=cls.GSUITE_OUTPUT_FILE_FORMAT,
            outputTrackType=cls.GSUITE_OUTPUT_TRACK_TYPE)

        return str(core)
    def getToolDescription(cls):
        core = HtmlCore()

        core.paragraph('The tool provides screening of two track collections '
                       '(GSuite files) against each other. The input for the tool are '
                       'two GSuite files, a target and a reference one, that contain '
                       'one or more tracks each.')

        core.paragraph('To run the tool, follow these steps:')

        core.orderedList(['Select two track collections (GSuite files) from history.'
                          'Select the desired statistic that you want to be calculated '
                          'for each track pair.'
                          'Select the genome region for the anaysis',
                          'Click "Execute"'])

        core.paragraph('The results are presented in a sortable table and an interactive chart.')

        cls._addGSuiteFileDescription(core,
                                      allowedLocations=cls.GSUITE_ALLOWED_LOCATIONS,
                                      allowedFileFormats=cls.GSUITE_ALLOWED_FILE_FORMATS,
                                      allowedTrackTypes=cls.GSUITE_ALLOWED_TRACK_TYPES,
                                      disallowedGenomes=cls.GSUITE_DISALLOWED_GENOMES)

        return str(core)
예제 #4
0
    def getToolDescription(cls):
        '''
        Specifies a help text in HTML that is displayed below the tool.
        '''
        from proto.hyperbrowser.HtmlCore import HtmlCore

        core = HtmlCore()
        core.paragraph(
            'This tool provides the option of filtering tracks in a GSuite file '
            'generating as output a GSuite file with the same columns, but '
            'with only a subset of tracks (rows) as selected by the user.')
        core.divider()
        core.paragraph('To filter a GSuite file, please follow these steps: ')
        core.orderedList([
            'Select the input GSuite file from history',
            'Select the tracks that should be kept (described in the list '
            'by its title, or by the whole uri if the title is not defined)',
            'Click the "Execute" button'
        ])

        cls._addGSuiteFileDescription(core,
                                      alwaysShowRequirements=True,
                                      alwaysShowOutputFile=True)

        return str(core)
    def getToolDescription(cls):
        from proto.hyperbrowser.HtmlCore import HtmlCore

        core = HtmlCore()

        core.paragraph(
            'The tool offers a set of thirteen analysis options on genome-wide '
            'datasets (tracks), divided in four categories. The analyses can be '
            'executed on multiple datasets (as opposed to single and pair-wise).'
        )

        core.paragraph(
            'The input of each analysis is a GSuite which contains three or more '
            'datasets in analysis ready format. To start using the tool, follow these steps:'
        )

        core.orderedList([
            'Select a GSuite file in history', 'Select an analysis option',
            'Select the genome region under analysis', 'Click "Execute"'
        ])

        core.paragraph(
            'The results are displayed in a result table corresponding to the '
            'selected analysis. Combinations of tracks are denoted in binary '
            'representation (e.g 1001 represents the combination of '
            'the first and last track from a 4-element dataset).')

        cls._addGSuiteFileDescription(
            core,
            allowedLocations=cls.GSUITE_ALLOWED_LOCATIONS,
            allowedFileFormats=cls.GSUITE_ALLOWED_FILE_FORMATS,
            allowedTrackTypes=cls.GSUITE_ALLOWED_TRACK_TYPES,
            disallowedGenomes=cls.GSUITE_DISALLOWED_GENOMES)

        return str(core)
    def mainInfo(self, printEmpty=False):
        core = HtmlCore()
        isDense = self._isDenseTrack()

        self._addDescriptionLineIfTrue(core, isDense, printEmpty,
                                       'description', self.description)
        self._addDescriptionLineIfTrue(core, isDense, printEmpty,
                                       'displayConvConf', self.displayConvConf)
        self._addDescriptionLineIfTrue(core, isDense, printEmpty, 'methods',
                                       self.methods)
        self._addDescriptionLineIfTrue(core, isDense, printEmpty, 'credits',
                                       self.credits)
        self._addDescriptionLineIfTrue(core, isDense, printEmpty, 'reference', self.reference, \
            lambda x: str( HtmlCore().link(x, x, True) ) if x.startswith('http://') else x)
        self._addDescriptionLineIfTrue(core, isDense, printEmpty,
                                       'restrictions', self.restrictions)
        self._addDescriptionLineIfTrue(core, isDense, printEmpty, 'version',
                                       self.version)
        self._addDescriptionLineIfTrue(core, isDense, printEmpty, 'quality',
                                       self.quality)
        self._addDescriptionLineIfTrue(core, isDense, printEmpty, 'cellType', \
            self.cellTypeSpecific and self.cellType)
        self._addDescriptionLineIfTrue(core, isDense, printEmpty, 'hbContact',
                                       self.hbContact)
        self._addDescriptionLineIfTrue(core, isDense, printEmpty,
                                       'trackFormatName', True)
        self._addDescriptionLineIfTrue(core, isDense, printEmpty, 'markType',
                                       self.markType)
        self._addDescriptionLineIfTrue(core, isDense, printEmpty, 'weightType',
                                       self.weightType)
        self._addDescriptionLineIfTrue(core, isDense, printEmpty, 'undirectedEdges', \
            self.undirectedEdges is not None and 'linked' in self.trackFormatName.lower())

        return unicode(core)
예제 #7
0
    def getPlotDimensions(self, resDictKey):
        tableData = self._getRawData(resDictKey)
        assert isinstance(tableData, TableData)

        colNames = tableData.columnNamesAsNumpyArray
        rowNames = tableData.rowNamesAsNumpyArray
        colClust = tableData.colClust
        rowClust = tableData.rowClust

        self._cex = 1.0 * self.LABEL_TEXT_SIZE / self.POINT_SIZE

        from proto.RSetup import r
        charWidthHeightRatio = r("par('cin')[1]/par('cin')[2]")
        marginBottom = int(colNames.dtype.itemsize * charWidthHeightRatio *
                           self.LABEL_TEXT_SIZE)
        marginRight = int(rowNames.dtype.itemsize * charWidthHeightRatio *
                          self.LABEL_TEXT_SIZE)

        self._marginBottom = self.RATIO_BOTTOM_RIGHT_MARGIN_ADJUST * marginBottom
        self._marginRight = self.RATIO_BOTTOM_RIGHT_MARGIN_ADJUST * marginRight

        blockSize = self.BLOCK_SIZE

        # maxRatio = self.MAX_RATIO_OF_HEATMAP_VS_BR_MARGIN
        # if blockSize * len(rowNames) < self._marginBottom * maxRatio:
        #     blockSize = 1.0 * self._marginBottom * maxRatio / len(rowNames)
        # if blockSize * len(colNames) < self._marginRight * maxRatio:
        #     blockSize = 1.0 * self._marginRight * maxRatio / len(colNames)

        self._mapHeight = blockSize * len(rowNames) + self._marginBottom
        self._mapWidth = blockSize * len(colNames) + self._marginRight

        smallestBottomRightMargin = min(self._marginBottom, self._marginRight)
        marginTop = self.RATIO_OF_TOP_LEFT_TO_SMALLEST_BR_MARGIN * smallestBottomRightMargin
        marginLeft = self.RATIO_OF_TOP_LEFT_TO_SMALLEST_BR_MARGIN * smallestBottomRightMargin

        marginTop = self._adjustMarginByDendSize(marginTop, colClust,
                                                 self._mapHeight)
        marginLeft = self._adjustMarginByDendSize(marginLeft, rowClust,
                                                  self._mapWidth)

        smallestTopLeftMargin = min(marginTop, marginLeft)
        topLeftMargin = max(smallestTopLeftMargin, self.MIN_TOP_LEFT_MARGIN)
        self._marginTop = topLeftMargin
        self._marginLeft = topLeftMargin

        ret = self._marginLeft + self._mapWidth, \
              self._marginTop + self._mapHeight

        if self._printDimensions:
            from proto.hyperbrowser.HtmlCore import HtmlCore
            print str(HtmlCore().styleInfoBegin(styleClass='debug'))

            print self._marginLeft, self._mapWidth, \
                  self._marginTop, self._mapHeight
            print ret

            print str(HtmlCore().styleInfoEnd())

        return ret
예제 #8
0
    def getReference(self, resDictKey):
        if self._getRawData(resDictKey) is None:
            return 'N/A'

        return str(HtmlCore().link('HTML', self._getRelativeURL(self._htmlFns[resDictKey]))) + \
                '&nbsp;/&nbsp;' + \
                str(HtmlCore().link('Raw&nbsp;text', self._getRelativeURL(self._rawFns[resDictKey])))
    def getToolDescription(cls):
        core = HtmlCore()

        core.paragraph(
            'The tool enables screening of a genome-wide dataset (track) '
            'agains a track collection (GSuite).')

        core.paragraph('To run the tool, follow these steps:')

        core.orderedList([
            'Select a single target track from history',
            'Select a reference track collection as a GSuite file from history',
            'Select the genome region for the anaysis', 'Click "Execute"'
        ])

        core.paragraph(
            'The results present several different statistics for the '
            'target dataset in reference to each dataset '
            'from the collection, organized in a sortable table.')

        cls._addGSuiteFileDescription(
            core,
            allowedLocations=cls.GSUITE_ALLOWED_LOCATIONS,
            allowedFileFormats=cls.GSUITE_ALLOWED_FILE_FORMATS,
            allowedTrackTypes=cls.GSUITE_ALLOWED_TRACK_TYPES,
            disallowedGenomes=cls.GSUITE_DISALLOWED_GENOMES)

        return str(core)
예제 #10
0
 def __init__(self, filPath, outFilePath):
     self.core = HtmlCore()
     self.specStr = open(filPath, 'r').read()
     self.outFilePath = outFilePath
     self.htmlMal = '<html><body>%s</body></html>'
     self.htmlStr = ''
     self.divCounter = 0
     self.fullContentTab = []
예제 #11
0
 def protoBinSpecHelpTextForUserBinSource(cls):
     core = HtmlCore()
     core.emphasize(
         'Allowed values: any number (integer). The selected regions are divided '
         'into bins of this size. "k" and "m" denotes thousand and million bps, '
         'respectively. "*" means the whole region / chromosome. '
         'Example: "100k"')
     return str(core)
 def getInfoForOptionsBoxCompareIn(cls, prevChoices):
     core = HtmlCore()
     core.paragraph(
         'Select the region(s) of the genome in which to analyze and '
         'possibly how the analysis regions should be divided into bins. '
         'First select the main category, and if needed, provide further '
         'details in the subsequent fields.')
     return str(core)
예제 #13
0
 def getToolDescription(cls):
     '''
     Specifies a help text in HTML that is displayed below the tool.
     '''
     from proto.hyperbrowser.HtmlCore import HtmlCore
     core = HtmlCore()
     core.descriptionLine('R-code', cls._exampleText(cls.rCode))
     return str(core)
예제 #14
0
    def getOptionsBoxPrev(prevChoices):
        #return repr(prevChoices),3,True
        from proto.hyperbrowser.HtmlCore import HtmlCore

        core = HtmlCore()
        core.link('Download', 'ftp://something.com/')
        from collections import OrderedDict
        return [['a','b','c'], [str(core),'2','3'],\
                ['x','y','z']]
 def getReference(self, resDictKey):
     fn = self._getFn(resDictKey)
     self._writeContent(resDictKey, fn)
     if not os.path.exists(fn):
         return HtmlCore().textWithHelp('N/A', 'A %s file is not available for this type of data.' % self._getSuffix())
     
     genome = self._results.getGenome()
     galaxyDataType = self._getSuffix()
     return HtmlCore().link('Load', getLoadToGalaxyHistoryURL(fn, genome, galaxyDataType)) 
예제 #16
0
 def protoRegSpecHelpTextForUserBinSource(cls):
     core = HtmlCore()
     core.emphasize(
         'Allowed values: region specification as in UCSC Genome browser '
         '(with 1 as the first position). "*" means the '
         'whole genome, and "k" and "m" denotes thousand and million bps, '
         'respectively. Several regions may be specified if separated by comma. '
         'If the end position is omitted, it is set equal to the end of the '
         'chromosome. Example: "chr1:1-20m, chr2:10m-"')
     return str(core)
    def getToolDescription(cls):
        '''
        Specifies a help text in HTML that is displayed below the tool.
        '''
        from proto.hyperbrowser.HtmlCore import HtmlCore

        core = HtmlCore()
        core.paragraph(
            'Converts a preprocessed GSuite into a primary GSuite with local file paths'
        )

        core.divider()
        core.paragraph(
            str(HtmlCore().highlight(
                'NOTE: SHOULD NOT BE MADE PUBLIC FOR SECURITY '
                'REASONS.')))

        cls._addGSuiteFileDescription(
            core,
            allowedLocations=cls.GSUITE_ALLOWED_LOCATIONS,
            allowedFileFormats=cls.GSUITE_ALLOWED_FILE_FORMATS,
            allowedTrackTypes=cls.GSUITE_ALLOWED_TRACK_TYPES,
            outputLocation=cls.GSUITE_OUTPUT_LOCATION,
            outputFileFormat=cls.GSUITE_OUTPUT_FILE_FORMAT,
            outputTrackType=cls.GSUITE_OUTPUT_TRACK_TYPE,
            errorFile=False,
            minTrackCount=cls.GSUITE_MIN_TRACK_COUNT)

        return str(core)
예제 #18
0
    def getTrackFileList(self,
                         category,
                         subCategory,
                         source='All',
                         dataTypes=[]):
        fileList = []

        if source.find('HyperBrowser') > -1:
            HBGsuite = getSubtracksAsGSuite(
                'hg19',
                ['Sample data', 'Chromatin catalog', category, subCategory])
            for track in HBGsuite.allTracks():
                fileList.append((track.title, True))
            return OrderedDict(fileList)

        items = self.getItems(category, subCategory)
        source = source.strip()
        sourceTool = 'None'

        for key, value in self.SOURCE.items():
            if source == value:
                sourceTool = key

        allRows = []
        i = 0
        htmlDict = {}
        for item in items:
            if not 'All' in source and item.sourceTool != sourceTool:
                continue

            try:
                rows = self.getRows(item)
            except Exception as e:
                print item
                raise e

            ##selectedRows = self.filterRowsByFileTypes(rows,fileTypes)
            selectedRows = self.filterRowsByDataTypes(rows, dataTypes)
            #allRows.extend(selectedRows)
            for row in selectedRows:
                filename = row[0].split('/')[-1]
                fileList.append((str(i) + ' - ' + filename, True))
                htmlDict[filename] = unicode(HtmlCore().link(filename, row[0]))
                #fileList.append((str(i) + ' - ' + str(HtmlCore().link(filename, row[0])),True))
                #fileList.append((str(i) + ' - ' +self.SOURCE[item.sourceTool]+' - '+ filename,True))
                #fileList.append(('< a href = "'+row[0]+'">' +filename+'</a>',True))
                i += 1

        #for row in allRows:
        #    filename = row[0].split('/')[-1]
        #    fileList.append((str(i) + ' - ' + filename+'\t'+,True))
        #    i+=1
        html = HtmlCore()
        #return html.tableFromDictionary(htmlDict)
        return OrderedDict(fileList)
예제 #19
0
 def protoBinSpecHelpTextForUserBinSource(cls):
     core = HtmlCore()
     core.emphasize(
         'Allowed values: comma separated list of Ensembl gene ids. '
         '"*" means all genes. Example: "ENSG00000208234, ENSG00000199674"')
     core.styleInfoBegin(styleClass='infomessagesmall')
     core.descriptionLine(
         'Note', 'all overlapping gene isoforms have been merged to form '
         '"supergenes" with positions from the start of the gene '
         'located most upstream, to the end of the gene located '
         'most downstream.')
     core.styleInfoEnd()
     return str(core)
예제 #20
0
    def getToolDescription(cls):
        '''
        Specifies a help text in HTML that is displayed below the tool.
        '''
        from proto.hyperbrowser.HtmlCore import HtmlCore

        core = HtmlCore()
        core.paragraph(
            'This tools takes a single track as input. The user then'
            'selects one of the attributes of the track (typically a column).'
            'The tools creates a range of separate output track files, '
            'one for each of the different unique values for the selected '
            'attribute (column) thar are present in the track. The tool thens '
            'directs each track element (typically each line) into the '
            'relevant output track, thus splitting all lines with a '
            'particular value into a separate output track file. '
            'The output track files are collected in a output GSuite file.')
        core.paragraph('In addition, the tool supports:')
        core.unorderedList([
            'Summary statistics of the selected attribute (column)',
            'Conversion from the input file format into other supported '
            'file formats (collected in the output GSuite)'
        ])

        cls._addGSuiteFileDescription(
            core,
            outputLocation=cls.GSUITE_OUTPUT_LOCATION,
            outputFileFormat=cls.GSUITE_OUTPUT_FILE_FORMAT,
            outputTrackType=cls.GSUITE_OUTPUT_TRACK_TYPE,
            errorFile=False)

        return str(core)
예제 #21
0
    def execute(choices, galaxyFn=None, username=''):
        '''
        Is called when execute-button is pushed by web-user. Should print
        output as HTML to standard out, which will be directed to a results page
        in Galaxy history. If getOutputFormat is anything else than HTML, the
        output should be written to the file with path galaxyFn. If needed,
        StaticFile can be used to get a path where additional files can be put
        (e.g. generated image files). choices is a list of selections made by
        web-user in each options box.
        '''

        gSuite = getGSuiteFromGalaxyTN(choices.gSuite)
        regSpec, binSpec = UserBinMixin.getRegsAndBinsSpec(choices)
        analysisBins = GalaxyInterface._getUserBinSource(regSpec,
                                                         binSpec,
                                                         genome=gSuite.genome)
        gSuiteOverview = GSuiteOverview(gSuite)
        coreHtml = HtmlCore()
        coreHtml.begin()
        coreHtml.append(
            str(
                getGSuiteOverviewHtmlCore(
                    gSuiteOverview.getGSuiteOverviewData(
                        analysisBins=analysisBins))))
        coreHtml.end()
        print coreHtml
    def getOptionsBoxResultsTable(
            cls, prevChoices):  #To display results in HTML table

        if not prevChoices.source or prevChoices.transfer == 'Yes' or prevChoices.source.find('HyperBrowser') == -1 \
        and not prevChoices.dataType:
            #and len([x for x,selected in prevChoices.dataType.iteritems() if selected]) == 0:
            return

        gsm = TrackGlobalSearchModule(cls.useSqlite)
        source = prevChoices.source.split('[')[0].strip()
        #dataTypes = [x.split('[')[0].strip() for x,selected in prevChoices.dataType.iteritems() if selected]
        dataTypes = [prevChoices.dataType.split('[')[0].strip()]
        rowDicts = None
        if prevChoices.outputType in [
                None, 'select 10 random tracks', 'select 50 random tracks'
        ]:
            return
        elif 'all tracks' in prevChoices.outputType:
            rowDicts = gsm.getRowsDicts(prevChoices.search,prevChoices.subCategory,source,dataTypes,\
                                        filterFileSuffix = True)
        elif prevChoices.outputType == 'Select tracks manually':
            rowDicts = gsm.getRowsDicts(prevChoices.search,prevChoices.subCategory,source,dataTypes,\
                                        selectedFileIDs = prevChoices.results, filterFileSuffix = True)

        htmlTableDict = {}
        if rowDicts:
            for row in rowDicts:
                if 'url' in row:
                    filename = row['url'].split('/')[-1]
                elif 'uri' in row:
                    filename = row['uri'].split('/')[-1]
                elif '_url' in row:
                    filename = row['_url'].split('/')[-1]
                else:
                    filename = '<No filename>'
                rowList = []
                for attr in cls.RESULT_COLS:
                    if attr in row:
                        rowList.append(unicode(row[attr]))

                htmlTableDict[filename] = rowList

        if len(htmlTableDict) == 0:
            return
        html = HtmlCore()
        html.tableFromDictionary(htmlTableDict, columnNames = ['File name'] + cls.RESULT_COLS_HEADER,\
                                 tableId='t1', expandable=True)

        return '__rawstr__', unicode(html)
예제 #23
0
 def getOptionsBoxExplainOutput(prevChoices):
     core = HtmlCore()
     core.divBegin(divClass='input-explanation')
     core.paragraph(
         """Select 'gsuite' for output to get a new GSuite with the results as a metadata column
     <br> or select 'html' to view a simple table of the results.""")
     core.divEnd()
     return '__rawstr__', str(core)
예제 #24
0
    def mainInfo(self, printEmpty=False):
        core = HtmlCore()
        if printEmpty or self.species:
            core.descriptionLine(
                'Species',
                str(HtmlCore().link(self.species, self.speciesTaxonomyUrl)))
        if printEmpty or self.genomeBuildName:
            core.descriptionLine('Genome build', self.genomeBuildName + \
                                 (' (%s)' % self.genomeBuildSource if self.genomeBuildSource else ''))

        core.descriptionLine('Short name', self.genome)
        return str(core)
예제 #25
0
    def getToolDescription(cls):
        '''
        Specifies a help text in HTML that is displayed below the tool.
        '''
        from proto.hyperbrowser.HtmlCore import HtmlCore
        core = HtmlCore()
        core.paragraph('''
Visualizing track elements along a line, such as in the UCSC Genome Browser or
the tool "Visualize track elements relative to anchor region", can necessarily only offer a global
overview at a very limited resolution. This tool instead uses a fractal layout
of the genome line (similar to a Hilbert curve) to map genome locations to
individual pixels in a matrix instead of along a line, effectively increasing
the resolution quadratically. Although the interpretation requires a certain
effort, this form of visualization can potentially be very informative.''')
        cls._additionalToolDescription(core)
        return str(core)
    def getInfoForOptionsBoxOperation(cls, prevChoices):
        '''
        If not None, defines the string content of an clickable info box beside
        the corresponding input box. HTML is allowed.
        '''
        if prevChoices.operation and prevChoices.operation != cls.NO_OPERATION_TEXT:
            from quick.extra.StandardizeTrackFiles import getParserClassDocString
            from proto.hyperbrowser.HtmlCore import HtmlCore

            docString = getParserClassDocString(cls.ALL_OPERATIONS[prevChoices.operation])

            core = HtmlCore()
            for line in docString.split(os.linesep):
                core.line(line)

            return str(core)
예제 #27
0
    def __str__(self):
        if self._str is not None:
            return self._str

        if self._results.isEmpty():
            if len(self._results.getAllErrors()) > 0:
                return str(self._generateErrorText(HtmlCore))
            else:
                return str(HtmlCore().line(
                    'This analysis gave no results (might be due to too limited data). '
                ))

        self._results.inferAdjustedPvalues()
        self._presenters = []
        if len(self._results.getAllRegionKeys()) > 0:
            self._addAllPresenters()
        #print self._generateHeader()
        #print self._generateErrorText()
        #print self._generateTable(presenters)

        hideTable = False
        coreCls = HtmlCore

        try:
            if self._results.isSignificanceTesting():
                startText = self._generateAnswerText(coreCls)
                hideTable = True
            else:
                startText = self._generateHeader(coreCls)
        except Exception, e:
            startText = self._generateHeader(coreCls)
            logException(e, message='Error producing autogenerated result')
            logException(e, message='Error in auto-generated answer')
예제 #28
0
    def getToolDescription():

        htmlCore = HtmlCore()

        htmlCore.paragraph(
            'The tool is used to generate frequency of dataset and rainfall plots.'
        )

        htmlCore.divider()

        htmlCore.paragraph(
            'The input for tool is a GSuite file contains one or more datasets.'
        )
        htmlCore.paragraph('The output for tool is a plot.')

        return str(htmlCore)
예제 #29
0
    def _compute(self):
        vals = self._children[0].getResult()
        #print 'DEBUG INFO - nr of marks from stat %s is: %s' % (self._marksStat, len(vals))
        minVal, maxVal = [
            self._children[1].getResult()[x] for x in ['min', 'max']
        ]
        if maxVal != minVal:
            step = 1.0 * (maxVal - minVal) / self._numDiscreteVals
            #             from gold.statistic.BpIntensityStat import BpIntensityStatUnsplittable
            #if BpIntensityStatUnsplittable.VERBOSE_INTENSITY_CREATION or IS_EXPERIMENTAL_INSTALLATION:
            #    print '<br>'
            #    print 'Discretizing with marksStat: ', self._marksStat, ' in region: ', self._region
            #    print '<br>In discretization, using steps: ',\
            #          ','.join([str(minVal+i*step) for i in range(self._numDiscreteVals)] )
            #    print '<br>'
            if self._printIntervals:
                from proto.hyperbrowser.HtmlCore import HtmlCore
                steps = [
                    minVal + i * step for i in range(self._numDiscreteVals)
                ]
                row = [str(self._region)] + [
                    '%.1e:%.1e' % (steps[i - 1], steps[i])
                    for i in range(1, len(steps))
                ] + ['%.1e-' % steps[-1]]
                print HtmlCore().tableHeader(row, firstRow=False)

        else:
            step = 1.0 / self._numDiscreteVals

        res = ((vals - minVal) / step).astype('int32')
        res[res == self.
            _numDiscreteVals] = self._numDiscreteVals - 1  #because our max is an inclusive max of the allowed interval..
        return res
예제 #30
0
 def getToolDescription(cls):
     core = HtmlCore()
     core.paragraph(
         "This is a simple tool for preprocessing track files in the HyperBrowser track repository. "
         "Please select a track directory from the standarized tracks file tree. "
     )
     core.divider()
     core.descriptionLine(
         "Recursion",
         "Directories can be selected at any level. The preprocessor will recursively visit all "
         "sub-directories of the selected directory")
     core.descriptionLine(
         "Track file merge",
         "All track files within a directory will be merged together as one track (under the "
         "assumption that all files are of the same track type).")
     return str(core)