コード例 #1
0
 def getOptionsBoxGenomeMismatchNote(cls, prevChoices):
     if cls._allowGenomeOverride(
             prevChoices
     ) and cls._getNumUniquelySpecifiedGenomes(prevChoices) > 1:
         core = HtmlCore()
         core.styleInfoBegin(styleClass="infomessagesmall")
         core.paragraph(cls.GENOME_MISMATCH_NOTE +
                        ', '.join(cls._getGsuiteGenomes(prevChoices)))
         core.styleInfoEnd()
         return '__rawstr__', str(core)
コード例 #2
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)
コード例 #3
0
 def _appendChrArmNoteIfNeeded(self, core):
     if self._kwArgs.get('forHypothesisTest'):
         core2 = HtmlCore()
         core2.styleInfoBegin(styleClass='infomessagesmall')
         core2.descriptionLine(
             'Note', 'For hypothesis tests where the positions of elements '
             'are randomized, the centromeres and other regions '
             'where the elements are never found should be removed '
             'from the analysis regions. In this case, use the '
             'chromosome arms as analysis regions, define specific '
             'bounding regions for the tracks, or use custom '
             'analysis regions. If this is not done, the resulting '
             'p-values are generally better than what they should '
             'have been.')
         core2.styleInfoEnd()
         core.paragraph(str(core2))
コード例 #4
0
    def helpTextForUserBinSource(self):
        core = HtmlCore()
        core.paragraph(
            str(HtmlCore().emphasize(
                'Use the bounding regions of the selected '
                'track(s), if defined. If more than one track '
                'is selected, the intersection of the bounding '
                'regions is used, i.e. where the bounding '
                'regions are overlapping.')))

        core2 = HtmlCore()
        core2.divBegin(divId='help_bounding_regions',
                       divClass='infomessagesmall help',
                       style='display: block;')
        core2.paragraph(
            'Bounding regions are the regions where a track is defined, e.g. where '
            'there theoretically may be data. This means that if there is no data in '
            'a bounding region, the absence of data is informative, i.e. that the lack '
            'of data is not just caused by not looking at the particular region. '
            'Hence, the bounding region for most tracks should be defined without '
            'for instance the centromeres. For tracks with no explicitly defined '
            'bounding regions, the bounding regions are implicitly defined as all '
            '(complete) chromosomes containing at least one track element.')
        core2.divEnd()
        core2.toggle('More information about bounding regions',
                     styleId='help_bounding_regions')
        core.paragraph(str(core2))

        core3 = HtmlCore()
        core3.styleInfoBegin(styleClass='infomessagesmall')
        core3.descriptionLine(
            'Note',
            'Intersecting bounding regions currently only supported for '
            'two tracks. If using a third track or an intensity track, '
            'only the bounding regions of the two first tracks are '
            'considered.')
        core3.styleInfoEnd()
        core.paragraph(str(core3))

        self._appendChrArmNoteIfNeeded(core)

        core.hideToggle(styleId='help_bounding_regions')
        return str(core)
コード例 #5
0
    def execute(cls, 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.gtr
        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.
        '''

        fnSource = ExternalTrackManager.extractFnFromGalaxyTN(
            choices[2].split(':'))

        core = HtmlCore()
        core.begin()

        valid = False
        try:
            core.header('Validating GTrack headers')
            core.styleInfoBegin(styleClass='debug')

            print str(core)
            core = HtmlCore()

            gtrackSource = GtrackGenomeElementSource(
                fnSource,
                choices[1] if choices[0] == 'Yes' else None,
                printWarnings=True)

            core.append('Done')
            core.styleInfoEnd()
            core.header('Validating complete GTrack file')
            core.styleInfoBegin(styleClass='debug')

            print str(core)
            core = HtmlCore()

            try:
                for ge in gtrackSource:
                    pass
            except Exception, e:
                raise
            else:
コード例 #6
0
    def execute(cls, choices, galaxyFn=None, username=''):
        cls._setDebugModeIfSelected(choices, galaxyFn)

        with stdout_redirector(open(galaxyFn, "w", 0)):
            core = HtmlCore()
            core.append(GalaxyInterface.getHtmlBeginForRuns(galaxyFn))
            core.append(
                GalaxyInterface.getHtmlForToggles(withRunDescription=False))
            core.styleInfoBegin(styleClass='debug')
            core.paragraph(
                'GalaxyInterface.startPreProcessing({}, {}, {})'.format(
                    choices.genome, choices.track, username))
            print core

            if choices.parsingError == cls.MOVE_TO_PARSING_ERROR_CHOICE:
                finished = False
                while not finished:
                    DebugConfig.PASS_ON_PREPROCESS_EXCEPTIONS = True
                    try:
                        GalaxyInterface.startPreProcessing(
                            choices.genome, choices.track, username)
                        finished = True
                    except (PreprocessWarning, PreprocessError) as e:
                        print e
                        match = re.search("trackName=\"([^\"]+)\"", str(e))
                        if match:
                            trackName = match.group(1).split(':')
                            PlainMover().parseFiles(choices.genome,
                                                    trackName,
                                                    direction='std_to_error')
            else:  # cls.DO_NOTHING_CHOICE
                GalaxyInterface.startPreProcessing(choices.genome,
                                                   choices.track, username)

            core = HtmlCore()
            core.styleInfoEnd()
            core.script('done = true;')
            core.end()
            print core
コード例 #7
0
    def getOptionsBoxHistoryElementsInfo(cls, prevChoices):
        if not prevChoices.dataType:
            return

        desc = prevChoices.subCategory

        core = HtmlCore()
        core.styleInfoBegin(styleClass='infomessagesmall')
        core.paragraph(
            'This tool will create seven history elements (one of which is hidden):'
        )
        descriptionList = \
            [('%s' % getGSuiteHistoryOutputName('storage', desc),
              'hidden history element containing the actual downloaded track data. Should '
              'in most cases be ignored'),
             ('%s' % getGSuiteHistoryOutputName('preprocessed', desc),
              'use this in the analysis tool of choice'),
             ('%s' % getGSuiteHistoryOutputName('nopreprocessed', desc),
              'preprocessing fails due to some issues with the track data. Some '
              'manipulation is probably needed before one tries preprocessing again'),
             ('%s' % getGSuiteHistoryOutputName('primary', desc),
              'use this if you need to manipulate the raw track data using a manipulation '
              'tool. The GSuite resulting from manipulation needs to be preprocessed '
              'before analysis'),
             ('%s' % getGSuiteHistoryOutputName('nodownload', desc),
              'in some cases the downloading of tracks fails, but might work if one tries again'),
             ('%s' % getGSuiteHistoryOutputName('remote', desc),
              'this refers to the original files available at a remote server. Use this '
              'if one for some reason needs to re-download all the tracks'),
             ('%s' % getGSuiteHistoryOutputName('progress', desc),
              'click the eye icon of this element to show the progress of the import')]
        for label, description in descriptionList:
            core.descriptionLine(label, description)
        core.styleInfoEnd()

        return '__rawstr__', unicode(core)
コード例 #8
0
    def getToolDescription():
        core = HtmlCore()
        core.paragraph(
            'This tool is used to complement the data of a GTrack '
            'file with additional columns from another GTrack file. '
            'Note that all data lines of the first GTrack file is '
            'retained, but the contents of the second is only used if '
            'the tool finds a match.')
        core.divider()
        core.smallHeader('Genome')
        core.paragraph(
            'Some GTrack files require a specified genome to be valid, e.g. if bounding regions '
            'are specified without explicit end coordinates.')

        core.divider()
        core.smallHeader('Intersecting factor')
        core.paragraph('This choice governs how a the data lines of the two '
                       'GTrack files are matched.')
        core.descriptionLine('Element ID', 'the data lines are matched on the ' +\
                             str(HtmlCore().emphasize('id')) + ' column.', emphasize=True)
        core.descriptionLine('Positional information', \
                             'the matching is done using any of the ' + \
                             '%s, %s, %s, and %s columns ' % \
                             tuple(str(HtmlCore().emphasize(x)) for x in \
                              ['genome', 'seqid', 'start', 'end']) +\
                             'that are defined in both ' +\
                             'GTrack files. Note that the match must be complete, ' +\
                             'e.g. matching both start and end if both are ' +\
                             'defined for one of the GTrack files.', emphasize=True)
        core.divider()
        core.smallHeader('Example')
        core.paragraph('File 1:')

        core.styleInfoBegin(styleClass='debug')
        core.append('''##track type: valued segments
###seqid  start  end  value  id
chrM      100    120  2.5    A
chrM      200    220  1.2    B''')
        core.styleInfoEnd()

        core.paragraph('File 2:')

        core.styleInfoBegin(styleClass='debug')
        core.append('''##track type: points
###seqid  start  strand  sth  other  id
chrM      300    +       b    yes    B
chrM      400    -       c    yes    C
chrM      500    -       a    no     A''')
        core.styleInfoEnd()

        core.paragraph('Complementing on "Element ID" and choosing the ' +\
                        'additional columns %s and %s, gives:' % \
                        tuple(str(HtmlCore().emphasize(x)) for x in ('strand', 'other')))

        core.styleInfoBegin(styleClass='debug')
        core.append('''##gtrack version: 1.0
##track type: valued segments
##uninterrupted data lines: true
##sorted elements: true
##no overlapping elements: true
###seqid  start  end  value  strand  id  other
chrM      100    120  2.5    -       A   no
chrM      200    220  1.2    +       B   yes''')
        core.styleInfoEnd()

        return str(core)
コード例 #9
0
    def getRunDescription(genome, trackNames, analysisDef, ubSource,
                          revEngBatchLine, urlForTrackAutoSelection, **kwArgs):
        # genome = ubSource.genome
        assert len(trackNames) == 3
        core = HtmlCore()

        analysis = Analysis(analysisDef, genome, trackNames[0], trackNames[1],
                            **kwArgs)

        core.header('GENOME')
        core.append(GenomeInfo(genome).mainInfo(printEmpty=False))
        core.divider()

        formatChoices = analysis.getFormatConverterChoicesAsText().items()
        tr1FormatChoice, tr2FormatChoice = formatChoices if len(
            formatChoices) == 2 else (None, None)

        first = True
        for tn,label,formatChoice in zip(trackNames, \
                                         ['TRACK 1', 'TRACK 2', 'INTENSITY TRACK'], \
                                         [tr1FormatChoice, tr2FormatChoice, None]):
            if tn in [None, []]:
                continue

            if not first:
                core.divider()

            core.header(label)
            trackInfo = TrackInfo(genome, tn)
            trackText = ''
            if ExternalTrackManager.isHistoryTrack(tn):
                assert len(
                    tn) >= 4, 'Length of external track name < 4: %s' % str(tn)
                core.descriptionLine(
                    'Name',
                    ExternalTrackManager.extractNameFromHistoryTN(tn) +
                    ' (from history)' + os.linesep)
            else:
                core.descriptionLine('Name', ':'.join(tn) + os.linesep)
            core.append(trackInfo.mainInfo(printEmpty=False))

            if formatChoice is not None:
                core.descriptionLine('Treated as', formatChoice[1])

            first = False

        core.divider()
        core.header('ANALYSIS')
        core.paragraph(''.join(str(analysis).split(':')[1:]))

        first = True
        for label, choice in analysis.getInterfaceChoicesAsText().items():
            if first:
                core.divider()
                core.header('OPTIONS')

            core.descriptionLine(label, choice)
            first = False

        h0 = analysis.getH0()
        if h0 is not None:
            core.divider()
            core.header('NULL HYPOTHESIS')
            core.paragraph(h0)

        h1 = analysis.getH1()
        if h1 is not None:
            core.divider()
            core.header('ALTERNATIVE HYPOTHESIS')
            core.paragraph(h1)

        core.divider()
        core.header('ANALYSIS REGIONS')
        if hasattr(ubSource, 'description'):
            core.paragraph(ubSource.description)

        core.divider()
        core.header('SOLUTION')

        statClass = analysis.getStat()
        #One alternative is to put getDescription in MagicStatFactory-hierarchy as class-method, and get real class behind partial-object.
        #if isinstance(statClass, functools.partial):
        #statClass = statClass.func
        #core.paragraph( statClass.getDescription() )

        #Chosen alternative is to Instantiate an object, which will automatically give object of real class..
        #and then use the following two lines, which will get class in Statistic-hierarchy instead of MagicStatFactory-hierarchy ..
        try:
            reg = ubSource.__iter__().next()
        except:
            core.paragraph(
                'Solution not relevant, as there are no specified analysis regions..'
            )
        else:
            track1, track2 = analysis.getTracks()
            if statClass is None:
                core.paragraph(
                    'Solution not available, due to currently invalid analysis'
                )
                logMessage('Solution not available, with params: ' +
                           str([trackNames[0], trackNames[1], analysisDef]),
                           level=logging.WARN)
            else:
                statObj = statClass(reg, track1, track2)
                statDescr = statObj.getDescription()
                replPat = '<a href=' + os.sep.join(
                    [STATIC_REL_PATH, 'notes', 'stats', '']) + r'\1>note</a>'
                statDescr = re.sub('<note>(.*)</note>', replPat, statDescr)

                core.paragraph(statDescr)

        core.divider()
        core.header('TIME OF ANALYSIS')
        core.paragraph('Analysis initiated at time: ' +
                       str(datetime.datetime.now()))

        if urlForTrackAutoSelection not in [None, '']:
            core.divider()
            core.header('URL FOR TRACK AUTOSELECTION')
            #urlOptions = '&'.join(['track1=' + quote(':'.join(trackName1)), 'track2=' + quote(':'.join(trackName2))])
            #core.paragraph(URL_PREFIX + '/hyper?' + urlOptions)
            core.styleInfoBegin(styleClass='break-word')
            core.paragraph(urlForTrackAutoSelection)
            core.styleInfoEnd()

        if revEngBatchLine not in [None, '']:
            core.divider()
            core.header('CORRESPONDING BATCH COMMAND LINE')
            #if any(ExternalTrackManager.isRedirectOrExternalTrack(tn) for tn in [trackName1, trackName2]):
            #core.paragraph('Batch-run line not available with tracks from history')
            #else:
            core.styleInfoBegin(styleClass='break-word')
            core.paragraph(revEngBatchLine)
            core.styleInfoEnd()

        core.divider()
        core.header('REFERENCES')
        core.paragraph(
            'The HyperBrowser system is described in:<br>"Sandve et al., <a href="http://genomebiology.com/2010/11/12/R121/">The Genomic HyperBrowser: inferential genomics at the sequence level</a>, Genome Biol. 2010;11(12):R121'
        )
        from gold.statistic.RandomizationManagerStat import RandomizationManagerStat
        if statClass is not None and RandomizationManagerStat.getMcSamplingScheme(
                statClass.keywords) == 'MCFDR':
            core.paragraph('The p-values of this analysis were computed using the MCFDR scheme for Monte Carlo based p-value computation'+\
                           ', described in:<br>Sandve et al., <a href="http://bioinformatics.oxfordjournals.org/content/early/2011/10/13/bioinformatics.btr568.long">Sequential Monte Carlo multiple testing</a>, Bioinformatics 2011')

#        description = \
#'''
#Run descriptions will be introduced in the next version of HB. <br>
#Below is an example run description, which is a static text unconnected to your choices. The purpose is to get feedback from you on what this should look like:<br>
#Track1 (refseg:genes): Unmarked points (converted from unmarked segments, taking midpoints)<br>
#Track2 (DNA melting:meltmap): Function<br>
#Bins: Chr1, divided into bins of 10 megabases<br>
#Question: Are track1-points occurring with different frequency inside track2-segment than outside?<br>
#Analysis:<br>
#The main result is a p-value resulting from a statistical test connected to the question.<br>
#The null-hypothesis assumes that the track1-points are randomly distributed according to a poisson-distribution, with the same number of points as in the original data. Track2-segment are assumed fixed as they are in the original data. This can be answered by a binomial test. The alternative hypothesis is then that the count of points inside segments has resulted from a different distribution of points, where the points are then either distributed more or less inside segments versus outside. See the note on this question in the user guide for further info.<br>
#'''
        return str(core)
    def getToolDescription():
        core = HtmlCore()
        core.paragraph('The GTrack format permits the use of variable column names and order, and '
                       'correspondingly, variable track types. This variation comes at a price, '
                       'increasing the complexity of parsing GTrack files. All GTrack files can, '
                       'however, be represented as the same track type: Linked Valued Segments (LVS). '
                       'This tool converts all GTrack files to the same standardized version of the GTrack format.')
        core.divider()
        
        core.smallHeader('Specification of the standardized GTrack format')
        core.paragraph('The following columns are always present, in the following order:')
        core.orderedList(['seqid ' + str(HtmlCore().emphasize('(sequence ID)')),
                          'start',
                          'end',
                          'value',
                          'strand',
                          'id',
                          'edges'])
        core.paragraph('Any additional columns will then follow, in the order specified in the original GTrack file.')
        core.paragraph('The following header lines are also changed to standardized settings:')
        core.unorderedList(['Track type: linked valued segments', \
                            'Uninterrupted data lines: true ' + \
                                str(HtmlCore().emphasize('(any bounding specification lines are thus removed)')), \
                            '0-indexed: false', \
                            'end inclusive: false'])
        
        core.divider()
        
        core.smallHeader('Genome')
        core.paragraph('Some GTrack files require a specified genome to be valid, e.g. if bounding regions '
                       'are specified without explicit end coordinates.')
        core.divider()
        
        core.smallHeader('Notice')
        core.paragraph('The "value type", "value dimension", "edge weights", "edge weight type" and "edge weight dimension" '
                       'header lines are not standardized. The "value" and "edges" columns may therefore contain all types '
                       'of values supported by the GTrack format. It is, however, simple to assert particular configurations '
                       'of these header lines in specialized parsers.')
        
        core.divider()
        
        core.smallHeader('Example')
        core.paragraph('Input file')
        core.styleInfoBegin(styleClass='debug')
        core.append(
'''##gtrack version: 1.0
##track type: linked genome partition
##edge weights: true
##edge weight type: binary
##1-indexed: true
##end inclusive: true
###end  id      edges
####seqid=chrM; end=500
200     aaa     aab=0;aac=1
500     aab     aaa=0
####seqid=chr21; end=300
200     aac     .
300     aad     aaa=1
####seqid=chr21; start=302; end=400
400     aae     aad=0''')
        core.styleInfoEnd()
        
        core.paragraph('Output file')
        core.styleInfoBegin(styleClass='debug')
        core.append(
'''##gtrack version: 1.0
##track type: linked valued segments
##edge weights: true
##edge weight type: binary
##uninterrupted data lines: true
##no overlapping elements: true
###seqid        start   end     value   strand  id      edges
chrM    0       200     .       .       aaa     aab=0;aac=1
chrM    200     500     .       .       aab     aaa=0
chr21   0       200     .       .       aac     .
chr21   200     300     .       .       aad     aaa=1
chr21   301     400     .       .       aae     aad=0''')
        core.styleInfoEnd()
        
        return str(core)
コード例 #11
0
                core = HtmlCore()

                if gtrackSource.getHeaderDict(
                )['no overlapping elements'] and sortedGeSourceHasOverlappingRegions(
                        gtrackSource):
                    raise InvalidFormatError(
                        "Error: genome elements are overlapping while header variable 'no overlapping elements' is True."
                    )

                core.append('Done')
                valid = True
        except Exception, e:
            core.append(str(e))
            valid = False

        core.styleInfoEnd()

        core.divider()
        core.header('Conclusion:')
        core.styleInfoBegin(
            styleClass='donemessage' if valid else 'errormessage')
        core.highlight('The GTrack file has %s syntax' %
                       ('valid' if valid else 'invalid'))
        core.styleInfoEnd()

        core.end()
        print str(core)

    @staticmethod
    def validateAndReturnErrors(choices):
        '''
コード例 #12
0
    def getToolDescription(cls):
        '''
        Specifies a help text in HTML that is displayed below the tool.
        '''

        core = HtmlCore()
        core.paragraph('This tool is used to specify a set of analyses to be run in sequence, defined via a set of ' + \
                       str(HtmlCore().emphasize('batch command lines')) + '.')
        core.paragraph('Batch command lines can be found by ' +\
                       'clicking the "Inspect parameters of this analysis" link, either from the "Analyze genomic tracks" tool ' +\
                       'interface, or from the history element of previously run analyses. These batch run lines can then ' +\
                       'be copied to this tool and duplicated or modified if needed.')
        core.paragraph('The batch command lines are executed in sequence, that is, ' +\
                       'each batch command line is started only after the previous line has been fully executed.')

        core.divider()
        core.smallHeader('Batch command line format')
        core.styleInfoBegin(styleClass='debug')
        core.append('genome|regions|binsize|track1|track2|statistic')
        core.styleInfoEnd()
        core.descriptionLine('genome', 'The short name of the reference genome for the analysis (can be found in ' +\
                                        'the genome info box of the "Analyze genomic tracks" tool)', emphasize=True)
        core.descriptionLine('regions', 'The regions where the analysis should be performed, in the following format:' +\
                                        cls._exampleText('seqid[:start-[end]],seqid[:start-[end]],...') +\
                                        str(HtmlCore().descriptionLine('seqid', 'The sequence id of the region, e.g. "chr1" for chromosome 1', \
                                                                       emphasize=True)) +\
                                        str(HtmlCore().descriptionLine('start', 'The start position of the region. If the start position ' +\
                                                                                'is omitted, the region starts at posision 1.', emphasize=True)) +\
                                        str(HtmlCore().descriptionLine('seqid', 'The end position of the region. If the end position is ' +\
                                                                                'omitted, the region ends at the end of the specified ' +\
                                                                                'sequence (e.g. chromosome 1).', emphasize=True)) +\
                                        'Note:' + str(HtmlCore().unorderedList( \
                                            ['All positions are 1-based, and end-inclusive (i.e. the first base pair ' +\
                                                'of the sequence has position 1, and the end position is included in the region). ', \
                                             str(HtmlCore().emphasize('k')) + ' and ' + str(HtmlCore().emphasize('m')) +\
                                                ' can be used for specifying thousand (kilo) and million (mega) base pairs, ' +\
                                                'respectively (e.g. "chr1:1k-2k" corresponds to "chr1:1001-2000").', \
                                             '* denotes all (standard) sequences of the reference genome, e.g. all chromosomes'])) +\
                                        'Examples: ' +\
                                        cls._exampleText('chr1,chr2\nchr1:1001-1500\nchr2:1m-2m,chr2:3m-\n*'), emphasize=True)
        core.descriptionLine('binsize', 'The regions are further divided into smaller bins of this size. ' +\
                                        str(HtmlCore().indent( \
                                        'Note:' + str(HtmlCore().unorderedList( \
                                            [str(HtmlCore().emphasize('k')) + ' and ' + str(HtmlCore().emphasize('m')) +\
                                                ' denotes thousand and million base pairs, respectively', \
                                             '* denotes that the regions are not subdivided.'])) +\
                                        'Examples: ' +\
                                        cls._exampleText('5000\n100k\n*'))), emphasize=True)
        core.descriptionLine('track1', 'The first track of the analysis. ' +\
                                        str(HtmlCore().indent( \
                                        'Note:' + str(HtmlCore().unorderedList( \
                                            ['Colon, ":", is used to separate the different levels of the track hierarchy', \
                                             str(HtmlCore().link('URL-encoding', 'http://www.w3schools.com/tags/ref_urlencode.asp')) + \
                                                ' is supported, as non-ASCII characters will not work', \
                                            'A special format, starting with "galaxy", is used to represent a track from history'])) +\
                                        'Examples: ' +\
                                        cls._exampleText('Genes and gene subsets:Genes:CCDS\n' +\
                                                                  'Sequence:Repeating%20elements:SINE\ngalaxy:bed:%2Fusit%2Finvitro' +\
                                                                  '%2Fdata%2Fgalaxy%2Fgalaxy-dist-hg-stable%2Fdatabase%2Ffiles%2F028' +\
                                                                  '%2Fdataset_28276.dat:3%20-%20Extract%20track'))), emphasize=True)
        core.descriptionLine('track2', 'The second track of the analysis, specified in the same way as the first track. ' +\
                                        'If only a single track is to be analyzed, this field should be left empty', emphasize=True)
        core.descriptionLine('statistic', 'The specification of the analysis to run, and its parameters, in the following format:' +
                                        str(HtmlCore().indent( \
                                        cls._exampleText('statisticClass(paramA=valueA,paramB=valueB,...)') +\
                                        'The exact specification possibilities, with different statistic classes and parameter values, ' +\
                                        'are diverse and extensive. However, one may easily find a particular specification by ' +\
                                        'specifying the analysis and parameters in the "Analyze genomic tracks" tool and clicking the ' +\
                                        '"Inspect parameters of this analysis" link.')), emphasize=True)

        core.divider()
        core.smallHeader('Region specification variants')
        core.paragraph(
            'Other specifications of analysis regions are also supported, using both "regions" and "binsize" fields, as follows:'
        )
        core.tableHeader([
            'regions',
            'binsize (example)',
            'description',
        ])
        core.tableLine([cls._exampleText('__brs__'), cls._exampleText(''), \
            'Use the bounding region of the track if only one track is specified, else use the intersection '
            'of the bounding regions of the two tracks'])
        core.tableLine([cls._exampleText('__chrs__'), cls._exampleText('chr1,chr2'), \
            'List of complete sequence ids of the reference genome, e.g. chromosome names'])
        core.tableLine([cls._exampleText('__chrArms__'), cls._exampleText('chr1q,chr2p'), \
            'List of chromosome arm names. (Note: not supported for all reference genomes)'])
        core.tableLine([cls._exampleText('__genes__'), cls._exampleText('ENSG00000208234,ENSG00000199674'), \
            'List of Ensembl gene ids. (Note: not supported for all reference genomes)'])
        core.tableLine([''.join([cls._exampleText(x) for x in ['bed','gff','wig','bedgraph','gtrack']]), \
                        cls._exampleText('/usit/invitro/data/galaxy/galaxy-dist-hg-stable/database/files/028/dataset_28276.dat'), \
                        'Internal path to a file of the specified format, containing custom regions'])
        core.tableFooter()

        core.divider()
        core.smallHeader('Multiple run expansion')
        core.paragraph('The batch command line format supports two options for automatic expansion of a single batch ' +\
                       'command line into multiple batch lines, thus supporting multiple analyses from a single line:')
        core.orderedList(['Multiple values of the ' + str(HtmlCore().emphasize('track1')) + ', ' + str(HtmlCore().emphasize('track2')) + ', and' +\
                          str(HtmlCore().emphasize('statistic')) + ' fields can be specified using the slash character, "/", as ' +\
                          'separator. If more than one field is specified this way, all combinations of the values are expanded and ' +\
                          'executed. Example expansion:' + \
                          cls._exampleText('hg18|*|*|Genes and gene subsets:Genes:CCDS/Genes and gene subsets:Genes:Refseq||ProportionCountStat()/CountPointAllowingOverlapStat()') + \
                          'This expands to the following lines internally:' + \
                          cls._exampleText('hg18|*|*|Genes and gene subsets:Genes:CCDS||ProportionCountStat()\n' +\
                                                    'hg18|*|*|Genes and gene subsets:Genes:CCDS||CountPointAllowingOverlapStat()\n' +\
                                                    'hg18|*|*|Genes and gene subsets:Genes:Refseq||ProportionCountStat()\n' +\
                                                    'hg18|*|*|Genes and gene subsets:Genes:Refseq||CountPointAllowingOverlapStat()'),
                          'All tracks under a specific hierarchy can be specified using the "*" character. This works for ' +\
                          'values of the ' + str(HtmlCore().emphasize('track1')) + ' and ' + str(HtmlCore().emphasize('track2')) +\
                          ' fields. This expansion is also combinatorical, in the same manner as with the "/" character, and can ' +\
                          'be freely combined with such notation. Example:' + \
                          cls._exampleText('hg19|*|*|Genes and gene subsets:Genes:*|Chromatin:Chromatin State Segmentation:wgEncodeBroadHmmK562HMM:*|DerivedOverlapStat()') +\
                          'This batch command line will result in 30 analyses (2 gene tracks * 15 chromatin tracks).'])
        core.divider()
        core.smallHeader('Defining variables')
        core.paragraph('The batch command line format allows definition of variables using the following format:' +\
                       cls._exampleText('@variable=value') +\
                       'To use a variable, simply enter the variable name with a starting "@" character in a batch ' +\
                       'command line. Example:' +\
                       cls._exampleText('@trackname=Genes and gene subsets:Genes:CCDS\nhg18|*|*|@trackname||ProportionCountStat()') +\
                       'Nested variable declarations, i.e. defining a variable using previously defined variables, are also allowed. Example:' +\
                       cls._exampleText('@TN1=Genes and gene subsets:Genes:CCDS\n' +\
                                  '@TN2=Genes and gene subsets:Genes:Refseq\n' +\
                                  '@TNs=@TN1/@TN2\n' +\
                                  'hg18|*|*|@TNs||ProportionCountStat()/CountPointAllowingOverlapStat()') +\
                       'Note:' +\
                        str(HtmlCore().unorderedList(['The variable names are case sensitive', \
                                                      '"=" characters are allowed in variable values'])))

        return str(core)
コード例 #13
0
    def getToolDescription():
        core = HtmlCore()
        core.paragraph(
            'The GTrack format requires a set of header lines to be a valid GTrack file. '
            '(See the "Show GTrack specification" tool for the specification of the format.) '
            'This tools tries to generate missing GTrack header lines based on the contents '
            'of the GTrack file selected. The "fixed" GTrack file is returned as a new '
            'history element.')
        core.divider()

        core.smallHeader(
            'The following header lines are affected by this tool')
        core.paragraph(
            'Header lines that are guaranteed to be properly generated:')
        core.unorderedList([x.capitalize() for x in EXPANDABLE_HEADERS])
        core.paragraph(
            'Header lines that are generated, but not guaranteed to get the correct value:'
        )
        core.unorderedList(
            [x.capitalize() for x in NOT_GUARANTEED_EXPANDABLE_HEADERS])
        core.paragraph(
            'Header lines that may change as part of the expansion (but are part of the '
            'extended GTrack definition, and thus superfluous):')
        core.unorderedList([x.capitalize() for x in VALUE_NOT_KEPT_HEADERS])
        core.divider()

        core.smallHeader('GTrack subtypes')
        core.paragraph(
            'If the header "subtype url" is specified, the corresponding subtype '
            'is read and the headers defined by the subtype are explicitly included. '
            'Also if the input file contains any headers from the extended specification, '
            'GTrack subtype information may be added to the output file. '
            'The following GTrack subtypes are automatically detected '
            'from the contents of the input file: ')

        from gold.origdata.GtrackComposer import StdGtrackComposer
        core.unorderedList(
            str(HtmlCore().link(x, x))
            for x in StdGtrackComposer.GTRACK_PRIORITIZED_SUBTYPE_LIST)
        core.divider()

        core.smallHeader('Genome')
        core.paragraph(
            'Some GTrack files require a specified genome to be valid, e.g. if bounding regions '
            'are specified without explicit end coordinates.')
        core.divider()

        core.smallHeader('Notice')
        core.paragraph(
            'This tool requires that the GTrack file already has a column specification '
            'line. If your file does not have this, please use the "Convert tabular file to '
            'GTrack" tool, where you can specify the column specification line. That tool '
            'also carries out the same header expansion as this tool.')
        core.divider()

        core.smallHeader('Example')
        core.paragraph('Input file')
        core.styleInfoBegin(styleClass='debug')
        core.append('''##1-indexed: true
##end inclusive: true
###seqid  start  end   value
chrM      100    165   0
chrM      200    2900  1
chrM      3000   3900  1''')
        core.styleInfoEnd()

        core.paragraph('Output file (with only non-default headers)')
        core.styleInfoBegin(styleClass='debug')
        core.append('''##gtrack version: 1.0
##track type: valued segments
##value type: binary
##uninterrupted data lines: true
##sorted elements: true
##no overlapping elements: true
##1-indexed: true
##end inclusive: true
###seqid  start  end   value
chrM      100    165   0
chrM      200    2900  1
chrM      3000   3900  1''')
        core.styleInfoEnd()

        core.paragraph('Output file (with all headers)')
        core.styleInfoBegin(styleClass='debug')
        core.append('''##gtrack version: 1.0
##track type: valued segments
##value type: binary
##value dimension: scalar
##undirected edges: false
##edge weights: false
##edge weight type: number
##edge weight dimension: scalar
##uninterrupted data lines: true
##sorted elements: true
##no overlapping elements: true
##circular elements: false
##1-indexed: true
##end inclusive: true
###seqid  start  end   value
chrM      100    165   0
chrM      200    2900  1
chrM      3000   3900  1''')
        core.styleInfoEnd()

        return str(core)
コード例 #14
0
    def execute(cls, choices, galaxyFn=None, username=''):
        path = str(URL_PREFIX)
        dataset = choices.dataset
        genome = choices.genome
        text = choices.newtrack
        secondDataset = choices.newdataset
        inputFile = open(ExternalTrackManager.extractFnFromGalaxyTN(dataset),
                         'r')
        with inputFile as f:
            data = [x for x in f.readlines()]
        silenceRWarnings()
        binSourceParam = '*'
        regSourceParam = '*'
        trackNamePrep = cls.preprocessTrack(genome, dataset)

        if text == 'No':

            figUrl = ''
            if (len(data) > 30000):

                core = HtmlCore()
                core.styleInfoBegin(styleClass='debug')
                figImage = GalaxyRunSpecificFile(['VizTrackOnGenome.png'],
                                                 galaxyFn)
                analysisDef = ' [normalizeRows=%s] [centerRows=%s]  -> RawVisualizationDataStat'

                res = GalaxyInterface.runManual([trackNamePrep],
                                                analysisDef,
                                                regSourceParam,
                                                binSourceParam,
                                                genome,
                                                username=username,
                                                printResults=False,
                                                printHtmlWarningMsgs=False)
                core.styleInfoEnd()
                core.line('')
                core.tableHeader(None)
                rScript = VisualizeTrackPresenceOnGenome.customRExecution(
                    res, figImage.getDiskPath(ensurePath=True), '')
                figUrl = figImage.getURL()
                print GalaxyInterface.getHtmlEndForRuns()
                binSourceParam = '10m'
                regSourceParam = '*'
                cls.resultPrintGeneric(genome, binSourceParam, regSourceParam,
                                       figUrl, path, trackNamePrep)

            else:
                if isinstance(trackNamePrep[0], (list, )):
                    numTracks = len(trackNamePrep[0])
                    firstTrack = cls.prepareTracknameForURL(trackNamePrep[0])
                    trackTitle = json.dumps(trackNamePrep[1])
                    cls.resultPrintGSuite(genome, binSourceParam,
                                          regSourceParam, figUrl, path,
                                          firstTrack, trackTitle, numTracks)
                else:
                    firstTrack = cls.prepareTracknameForURL(trackNamePrep)
                    cls.resultPrintGeneric(genome, binSourceParam,
                                           regSourceParam, figUrl, path,
                                           firstTrack)
        else:
            trackName2 = cls.preprocessTrack(genome, secondDataset)
            firstTrack = cls.prepareTracknameForURL(trackNamePrep)
            secondTrack = cls.prepareTracknameForURL(trackName2)
            cls.resultPrintOverlap(genome, binSourceParam, regSourceParam,
                                   path, firstTrack, secondTrack)
コード例 #15
0
    def getToolDescription():
        core = HtmlCore()
        core.paragraph('This tool is used to create GTrack files from any tabular input file. The '
                       'user must select the column names for the table, enabling the GTrack '
                       'header expander to automatically expand the headers, effectively converting '
                       'the file to a GTrack file. Custom column names are also supported.')
        core.divider()

        core.smallHeader('The following column names are part of the GTrack specification')
        core.descriptionLine('seqid', "An identifier of the underlying sequence of "
                                      "the track element (i.e. the row). Example: 'chr1'", emphasize=True)
        core.descriptionLine('start', 'The start position of the track element', emphasize=True)
        core.descriptionLine('end', 'The end position of the track element', emphasize=True)
        core.descriptionLine('value', 'A value associated to the track element. '
                                      'The value type is automatically found by the tool.', emphasize=True)
        core.descriptionLine('strand', "The strand of the track element, either '+', '-' or '.'", emphasize=True)
        core.descriptionLine('id', "An unique identifier of the track element, e.g. 'a'", emphasize=True)
        core.descriptionLine('edges', "A semicolon-separated list of id's, representing "
                                      "edges from this track element to other elements. "
                                      "Weights may also be specified. Example: 'a=1.0;b=0.9'", emphasize=True)
        core.paragraph("See the 'Show GTrack specification' tool for more information.")
        core.divider()

        core.smallHeader('Column selection method')
        core.paragraph('The tool supports two ways of selecting column names. First, you can select '
                       'the column names manually. The other option is to select a GTrack file in the '
                       'the history. The tool will then use the same column names (only using the first '
                       'columns if the number of columns in the current tabular file is less than in the '
                       'GTrack file.')
        core.divider()

        core.smallHeader('Genome')
        core.paragraph("Some GTrack files require a specified genome to be valid, e.g. if bounding regions "
                       "are specified without explicit end coordinates. A genome build must thus be selected if "
                       "such a GTrack file is to be used as template file for column specification. "
                       "Also, auto-correction of the sequence id ('seqid') column requires the selection of a "
                       "genome build. The resulting GTrack file in the history will be associated with the "
                       "selected genome.")
        core.divider()

        core.smallHeader('Track type')
        core.paragraph('According to the columns selected, the tool automatically finds the '
                       'corresponding track type according to the GTrack specification. '
                       'Note that dense track types are noe supported yet byt this tool.')
        core.divider()

        core.smallHeader('Indexing standard')
        core.paragraph('Two common standards of coordinate indexing are common in bioinformatics. A track '
                       'element covering the first 10 base pairs of chr1 are represented in two ways:' )
        core.descriptionLine('0-indexed, end exclusive', "seqid=chr1, start=0, end=10", emphasize=True)
        core.descriptionLine('1-indexed, end inclusive', "seqid=chr1, start=1, end=10", emphasize=True)
        core.paragraph('The GTrack format supports both standards, but the user must inform the system '
                       'which standard is used for each particular case.')
        core.divider()

        core.smallHeader('Auto-correction of sequence id')
        core.paragraph("The tool supports auto-correction of the sequence id ('seqid') column. "
                       "If this is selected, a search is carried out on the sequence id's defined "
                       "for the current genome build. The nearest match, if unique, is inserted in "
                       "the new GTrack file. If no unique match is found, the original value is "
                       "used. The algorithm also handles roman numbers. Example: 'IV' -> 'chr4'")
        core.divider()

        core.smallHeader('Example')
        core.paragraph('Input table')
        core.tableHeader(['start','','id','something','seqid'])
        core.tableLine(['100','.','a','yes','chr1'])
        core.tableLine(['250','.','b','yes','chr1'])
        core.tableLine(['120','.','c','no','chr2'])
        core.tableFooter()

        core.paragraph('Output file')
        core.styleInfoBegin(styleClass='debug')
        core.append(
'''##gtrack version: 1.0
##track type: points
##uninterrupted data lines: true
##sorted elements: true
##no overlapping elements: true
###seqid  start  id	 something
chr1	  100	 a	 yes
chr1	  250	 b	 yes
chr2	  120	 c	 no''')
        core.styleInfoEnd()

        return str(core)
    def getToolDescription():
        '''
        Specifies a help text in HTML that is displayed below the tool.
        '''
        core = HtmlCore()
        core.paragraph('''
This tool extracts segments from an existing track that has floating point
values associated with the genome coordinates. The segments are extracted
according to a threshold value.''')
        core.divider()
        core.smallHeader('Input track')
        core.paragraph('''
The input track can be fetched either from the history or from the HyperBrowser
repository. The only requirement is that each track elements has an associated
floating point value. The track type thus has to be one of "Valued Points",
"Valued Segments", "Step Function", "Function", or one of the linked variants of
these. Note that tracks of type "Function" will work, but will be very slow.'''
                       )

        core.divider()
        core.smallHeader('Threshold and rule')
        core.paragraph('''
Type in a floating point value as the threshold and select an associated rule.
When the rule is true, the corresponding segment will be written to the output
file.''')

        core.divider()
        core.smallHeader('Merge adjacent segments')
        core.paragraph('''
If "Merge adjacent segments" is set to "Yes", any resulting segments that are
adjacent (''' + str(HtmlCore().emphasize('i.e.')) +
                       ''' that have no gaps between
them), are merged into the same segment.''')

        core.divider()
        core.smallHeader('Output format')
        core.paragraph('''
Several output file formats are available. These are all file formats that can
represent segment tracks.''')

        core.divider()
        core.smallHeader('Example')
        core.paragraph('Input file:')
        core.styleInfoBegin(styleClass='debug')
        core.append('''track type=bedGraph
chr21	10042712	10080194	-0.3655
chr21	10042712	10080194	0.2621
chr21	10079666	10080197	-1.047
chr21	13664826	13665788	-0.1566
chr21	13904368	13935777	1.396
chr21	13973462	13975927	0.007720
chr21	14403007	14439210	-1.021
chr21	14406599	14407013	2.022
chr21	14438228	14438658	-0.2405
chr21	14510257	14522024	-0.1010''')
        core.styleInfoEnd()

        core.paragraph('Output file:')
        core.styleInfoBegin(styleClass='debug')
        core.append('''chr21	10042712	10080194
chr21	13904368	13935777
chr21	13973462	13975927
chr21	14406599	14407013''')
        core.styleInfoEnd()
        return str(core)
コード例 #17
0
    def getToolDescription():
        core = HtmlCore()
        core.paragraph(
            'This tool converts files between the following file formats:')
        core.descriptionLine('GTrack',
                             "See the 'Show GTrack specification' tool",
                             emphasize=True)
        core.descriptionLine('BED', str(HtmlCore().link('BED specification', \
                                        'http://genome.ucsc.edu/FAQ/FAQformat.html')), emphasize=True)
        core.descriptionLine('WIG', str(HtmlCore().link('WIG specification', \
                                        'http://genome.ucsc.edu/goldenPath/help/wiggle.html')), emphasize=True)
        core.descriptionLine('bedGraph', str(HtmlCore().link('bedGraph specification', \
                                            'http://genome.ucsc.edu/goldenPath/help/bedgraph.html')), emphasize=True)
        core.descriptionLine('GFF', str(HtmlCore().link('GFF version 3 specification', \
                                            'http://www.sequenceontology.org/gff3.shtml')), emphasize=True)
        core.descriptionLine('FASTA', str(HtmlCore().link('bedGraph specification', \
                                            'http://www.ncbi.nlm.nih.gov/BLAST/blastcgihelp.shtml')), emphasize=True)
        core.paragraph(
            'The input data type is defined by the format field of the history element of the data. '
            'The available conversions for the selected format are automatically '
            'shown in the conversion selection box')

        core.divider()

        core.smallHeader('Genome')
        core.paragraph(
            'Some GTrack files require a specified genome to be valid, e.g. if bounding regions '
            'are specified without explicit end coordinates.')

        core.divider()

        core.smallHeader('GTrack subtypes')
        core.paragraph(
            'If the conversion to extended GTrack is selected, GTrack subtype information may be '
            'added to the output file. The following GTrack subtypes are automatically detected from '
            'the contents of the input file:')

        from gold.origdata.GtrackComposer import StdGtrackComposer
        core.unorderedList(
            str(HtmlCore().link(x, x))
            for x in StdGtrackComposer.GTRACK_PRIORITIZED_SUBTYPE_LIST)
        core.divider()

        core.smallHeader('Notice')
        core.paragraph(
            "The GFF support is somewhat preliminary. For conversions between BED and GFF, we "
            "recommend the specialized Galaxy tools: 'BED-to-GFF converter' and 'GFF-to-BED converter'."
        )

        core.divider()

        core.smallHeader('Example 1')
        core.paragraph('Input file (BED)')
        core.styleInfoBegin(styleClass='debug')
        core.append(
            '''chrM    71      82      A       1000    +       71      79      0,0,255 2       4,4,    0,8
chrM    103     105     B       800     .       103     105     0,255,0 1       2       0
chr21   3       13      C       645     -       3       13      255,0,0 3       2,2,2   0,5,8'''
        )
        core.styleInfoEnd()

        core.paragraph('Output file (Extended GTrack)')
        core.styleInfoBegin(styleClass='debug')
        core.append('''##gtrack version: 1.0
##track type: valued segments
##uninterrupted data lines: true
###seqid	start	end	value	strand	name	thickstart	thickend	itemrgb	blockcount	blocksizes	blockstarts
chrM	71	82	1000	+	A	71	79	0,0,255	2	4,4,	0,8
chrM	103	105	800	.	B	103	105	0,255,0	1	2	0
chr21	3	13	645	-	C	3	13	255,0,0	3	2,2,2	0,5,8''')
        core.styleInfoEnd()

        core.divider()

        core.smallHeader('Example 2')
        core.paragraph('Input file (WIG)')
        core.styleInfoBegin(styleClass='debug')
        core.append('''track type=wiggle_0
fixedStep chrom=chrM start=11 step=10 span=5
4.500
-3.700
fixedStep chrom=chrM start=1013 step=10 span=5
2.100
11.00
fixedStep chrom=chr21 start=201 step=10 span=5
21.10''')
        core.styleInfoEnd()

        core.paragraph('Output file (bedGraph)')
        core.styleInfoBegin(styleClass='debug')
        core.append('''track type=bedGraph
chrM	10	15	4.500
chrM	20	25	-3.700
chrM	1012	1017	2.100
chrM	1022	1027	11.00
chr21	200	205	21.10''')
        core.styleInfoEnd()

        core.paragraph('Output file (GTrack)')
        core.styleInfoBegin(styleClass='debug')
        core.append('''##gtrack version: 1.0
##track type: valued segments
##1-indexed: true
##end inclusive: true
##fixed length: 5
##fixed gap size: 5
##gtrack subtype: wig fixedstep
##subtype url: http://gtrack.no/wig_fixedstep.gtrack
##subtype adherence: strict
###value
####seqid=chrM; start=11; end=25
4.5
-3.7
####seqid=chrM; start=1013; end=1027
2.1
11.0
####seqid=chr21; start=201; end=205
21.1''')
        core.styleInfoEnd()
        return str(core)
コード例 #18
0
    def execute(cls, 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.
        '''

        genome = choices[0]
        regSpec = '__chrs__'
        binSpec = '*'
        if choices[6] == 'Chromosome arms':
            regSpec = '__chrArms__'
        elif choices[6] == 'Track from history...':
            #put in history bins support here
            #print choices[4:]
            regSpec = ExternalTrackManager.extractFileSuffixFromGalaxyTN(choices[7].split(':'))
            binSpec = ExternalTrackManager.extractFnFromGalaxyTN(choices[7].split(':'))
            #print 'regSpec, binSpec,', regSpec, binSpec
            lineList, counter, tooManyBins = [], 0, False
            for line in open(binSpec):
                if line.strip() !='':
                    if counter == cls.MAX_NUM_ROWS:
                        tooManyBins = True
                        break
                    lineList.append(line)
                    counter+= 1 if line.strip()[0] !='#' else 0

            if tooManyBins:
                newHist = GalaxyRunSpecificFile(['newHistFile.%s' % regSpec], galaxyFn)
                binSpec = newHist.getDiskPath(ensurePath=True)
                open(binSpec, 'w').write(''.join(lineList))

        print GalaxyInterface.getHtmlBeginForRuns(galaxyFn)
        print GalaxyInterface.getHtmlForToggles(withRunDescription=False)

        core = HtmlCore()
        core.styleInfoBegin(styleClass='debug')

        figImage = GalaxyRunSpecificFile(['VizTrackOnGenome.png'], galaxyFn)
        #StaticImage(['VizTrackOnGenome.png'])
        analysisDef = ' [normalizeRows=%s] [centerRows=%s]  -> RawVisualizationDataStat' % \
            (choices[4] == 'Scale to same size', choices[5] == 'Center')

        if choices[1] == 'HyperBrowser repository':
            trackName = choices[2].split(':')
        else:
            trackName = ExternalTrackManager.getPreProcessedTrackFromGalaxyTN(genome, choices[3].split(':'))

        res = GalaxyInterface.runManual([trackName], analysisDef, regSpec, binSpec, genome, username=username, printResults=False, printHtmlWarningMsgs=False)

        core.styleInfoEnd()
        core.line('')

        core.tableHeader(None)
        #visPresenter = RawVisualizationPresenter(res, galaxyFn,'')#os.path.split()[0]
        #htmlStreng = visPresenter.getReference('Result', fullImage=True)
        rScript = cls.customRExecution(res, figImage.getDiskPath(ensurePath=True), '')

        figUrl = figImage.getURL()
        figLinkText ='<img src="%s" alt="Figure" height="%i" width="800"/>' % (figUrl, 20 *min(cls.MAX_NUM_ROWS, len(res)))
        core.tableLine([figImage.getLink(figLinkText)])

        rScriptGalaxyFile = GalaxyRunSpecificFile(['RScript.R'], galaxyFn)
        with open(rScriptGalaxyFile.getDiskPath(ensurePath=True), 'w') as rScriptFile:
            rScriptFile.write(rScript)

        core.tableLine([rScriptGalaxyFile.getLink('R script')])

        core.tableFooter()

        print core
        print GalaxyInterface.getHtmlEndForRuns()