def getToolDescription():
     '''
     Specifies a help text in HTML that is displayed below the tool.
     '''
     core = HtmlCore()
     core.paragraph(
         'This tool can be used to concatenate HyperBrowser analysis results '
         'from several different history elements into a single tabular file, '
         'providing a simple overview of many runs at once. The tool only works on '
         'history elements created by the tools "Analyze genomic tracks" and '
         '"Execute batch commands".')
     core.divider()
     core.paragraph(
         'In order to concatenate, you will need to select a single result statistic. '
         'The tool will then fetch the resulting values of this statistic '
         'from the different runs in the selected '
         'history elements. The tool supports concatenation of either global '
         'or local results. Several formatting options are also provided.')
     core.divider()
     core.paragraph(
         'The resulting table can easily be pasted into spreadsheet programs '
         'such as Microsoft Excel for further analysis. To look at the data in Excel '
         'you need to:')
     core.orderedList([
         'Click the eye icon of the new history element to look at the table',
         'Click somewhere in the table',
         'Select "Select All" from the "Edit" menu (or type cmd-A (Mac) or cltr-A (Windows))',
         'Copy the table (cmd/ctrl-C)', 'Switch to Excel',
         'Select "Paste special..." '
         'from the "Edit" menu.',
         'In the dialog box that opens, choose "Text"'
     ])
     return str(core)
 def createDescription(toolDescription=None, stepsToRunTool=None, toolResult=None, limitation=None):
     core = HtmlCore()
     
     if toolDescription!=None or stepsToRunTool!=None or toolResult!=None or limitation!=None:
         core.divBegin(divId='decription-page')
         core.divBegin(divClass='decription-section')
         core.header('Description')  
         
         #small description of tool (The resaon of creating the tool)
         if toolDescription!=None:
             core.divBegin(divClass='decription-section-main')
             core.paragraph(toolDescription)
             core.divEnd()
 
         #how to use tool
         if stepsToRunTool!=None:
             core.paragraph('To run the tool, follow these steps:')
             core.orderedList(stepsToRunTool)
 
         #what is the result of tool
         if toolDescription!=None:
             core.divBegin(divClass='decription-section-main')
             core.paragraph(toolResult)
             core.divEnd()
         
         #what are the limitation for tool
 #         if limitation:
 #             limits...
         
         
         core.divEnd()
         core.divEnd()
     
     return str(core)
    def getToolDescription(cls):
        '''
        Specifies a help text in HTML that is displayed below the tool.
        '''
        from proto.hyperbrowser.HtmlCore import HtmlCore
        from gold.gsuite.GSuiteConstants import URI_COL, FILE_FORMAT_COL, \
                                                TRACK_TYPE_COL, TITLE_COL

        core = HtmlCore()
        core.paragraph('This tool provides the option of filtering metadata columns '
                       'in a GSuite file, generating as output a GSuite file with the '
                       'same tracks (rows), but with only a subset of '
                       'metadata columns 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 metadata columns that should be kept',
                          'Click the "Execute" button'])

        core.divider()
        core.smallHeader('Note')
        core.paragraph('The standard metadata columns of a GSuite file cannot be '
                       'removed by this tool: ')
        core.unorderedList([URI_COL, FILE_FORMAT_COL, TRACK_TYPE_COL])
        core.paragraph('The exception to this rule is the "%s" column.' % TITLE_COL)

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

        return str(core)
        string = 'This tool provides the option of filtering track attributes in a GSuite file and generates a GSuite with the user selected attributes. It takes a GSuite file as an input, and displays all the included attributes in mutiple selections box. Upon the user selection, only the selected attributes will appear in the resulted GSuite.'
        return string
    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)
示例#5
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):
        '''
        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 subset of the tracks '
            'in the HyperBrowser repository. To use the tool, please follow these steps:'
        )
        core.orderedList([
            'Select the genome build',
            'Select the parent track, i.e. the top level in the track hierarchy that '
            'you are interested in. The tool will return all tracks that are found in the '
            'hierarchy underneath the selected parent track, descending into all sublevels.'
        ])
        core.divider()
        core.smallHeader('Note')
        core.paragraph(
            'Even though this tool can be used to build GSuite compilations of any tracks, '
            'the resulting GSuite file will be more usable if the track are somewhat homogeneous '
            'in 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):
        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 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)
    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 contains various operations for manipulating textual '
            'track files referred to in a GSuite file.')
        core.divider()
        core.smallHeader('Instructions')
        core.orderedList([
            'Select a GSuite file referring to local textual track files',
            'The first track referred to in the GSuite is automatically selected '
            'as an example track, with the beginning of the file shown in a '
            'text box. The example file is later used to show the results of the '
            'selected operation. If you want to use another file as the example track '
            'please select it in the selection box. ',
            'Select the required operation from the list of operations '
            '(click the info box if you need further description of each operation '
            'and its parameters):' + str(HtmlCore().unorderedList(
                [key for key in cls.ALL_OPERATIONS.keys()])),
            'Each parameter for the selected operation is shown in a selection box, '
            'with the default value indicated. If another value than the default is '
            'needed, please select the parameter and change its value. '
            'the order in which the parameters is selected is unimportant.',
            'The output of the selected operation with the selected parameter values '
            'on the beginning of the selected example track is shown in a text box.',
            'If the file format (e.g. "bed") of the track is changed as a result of '
            'carrying out the operation, please indicate the new file suffix. '
            'It is important for the tracks to have the correct file suffix for further '
            'analysis.'
        ])

        cls._addGSuiteFileDescription(
            core,
            allowedLocations=cls.GSUITE_ALLOWED_LOCATIONS,
            allowedFileFormats=cls.GSUITE_ALLOWED_FILE_FORMATS,
            outputLocation=cls.GSUITE_OUTPUT_LOCATION,
            outputFileFormat=cls.GSUITE_OUTPUT_FILE_FORMAT,
            outputTrackType=cls.GSUITE_OUTPUT_TRACK_TYPE,
            errorFile=True)

        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('The tool provides a structured search for genomic tracks stored in '
                       'the following repositories:')
        core.unorderedList(['ENCODE tracks which are located in both UCSC and Ensembl databases.',
#                            'Roadmap Epigenomics',
                            'Roadmap Epigenomics',
                            'Cancer Genome Atlas (TCGA)',
                            'FANTOM 5',
                            'International Cancer Genome Consortium (ICGC)',
                            'Ensembl BLUEPRINT epigenome project',
                            'NHGRI-EBI GWAS Catalog'])

        core.paragraph('The tool generates a metadata file in the GSuite format which contains '
                       'the URL and other metadata associated with each of the track files that '
                       'match the search criteria. To use the tool, please follow these steps:')
        core.orderedList(['Select an attribute from the attribute list to search with',
                          'Select the value associated with this attribute from the associated attribute list',
                          'Repeat steps 1 and 2 to filter using more attributes',
                          'Select whether to compile a GSuite using:' +
                          str(HtmlCore().unorderedList(['All rearch results',
                                                        'Present results as a file list and have '
                                                        'the option of selecting a subset of those '
                                                        'result to compile the GSuite'])),
                          'Specify  the format of the output (' + str(HtmlCore().highlight('gsuite')) +
                              ' for GSuite or ' + str(HtmlCore().highlight('HTML')) +
                              ' for a more human readable format)'])

        core.divider()
        core.smallHeader('Note')
        core.paragraph('Even though this tool can be used to build GSuite compilations of any files, '
                       'the resulting GSuite file will be more usable if the files 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):
        '''
        Specifies a help text in HTML that is displayed below the tool.
        '''
        from proto.hyperbrowser.HtmlCore import HtmlCore

        core = HtmlCore()

        core.paragraph('This tool computes the proportions of overlap between the segments '
                       'of a query track against each track in a collection of reference tracks '
                       'described in a GSuite file. The overlap proportions are output in a '
                       'BED file with the query segments, where each query segment is partitioned '
                       'and colored according to the overlap with each reference track.')

        core.divider()
        core.paragraph('To carry out the analysis, please follow these steps:')
        core.orderedList(['Select a genome build. Both the query track and the reference tracks'
                          'need to use the same genome build.',
                          'Select a query track from the HyperBrowser repository',
                          'Select a reference track collection as a GSuite file from history',
                          'Every track from the GSuite file is represented by a separate color, '
                          'presented to the user in a table.',
                          'Click "Execute"'])

        core.divider()
        core.paragraph('The resulting BED file can be visualized in external genome browsers. '
                       'To browse the segments, click the title of the resulting history element '
                       'and click "display at UCSC main". The UCSC Genome Browser will appear, '
                       'with the segments with color-coding imported as a track.')

        core.divider()
        core.smallHeader('Requirements for query track')
        core.descriptionLine('Track types', ', '.join(cls.TRACK_ALLOWED_TRACK_TYPES), emphasize=True)


        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)
示例#12
0
 def getToolDescription():
     '''
     Specifies a help text in HTML that is displayed below the tool.
     '''
     core = HtmlCore()
     core.divBegin()
     core.paragraph("""This tools implements a solution to the statistical question
                 'Are certain tracks of one suite coinciding particularly strongly with
                 certain tracks of another suite?'. To use the tool:""")
     core.orderedList(["Select the query GSuite (dataset collection of interest).",
                       "Select the reference GSuite (dataset collection to be screened against the query collection).",
                       "Select additional options (advanced mode only).",
                       "Execute the tool."])
     core.paragraph("""<br><br><b>Tool illustration.</b>
                 Coinciding tracks from two collections.<br>
                 Qi - Query track i (i = 1,..,m).<br>
                 Ri - Reference track i (i = 1,..,n).<br>
                 """)
     core.divEnd()
     return str(core)
示例#13
0
    def getToolDescription():
        '''
        Specifies a help text in HTML that is displayed below the tool.
        '''

        core = HtmlCore()
        core.divBegin()
        core.paragraph("""This tools implements a solution to the statistical question
            'Which tracks (in a suite) coincide most strongly with a separate single track?'. To use the tool:""")
        core.orderedList(["Select the query track (dataset of interest).",
                          "Select the reference GSuite (dataset collection to be screened against the query track).",
                          "Select additional options (advanced mode only).",
                          "Execute the tool."])
        core.paragraph("""<br><br><b>Tool illustration.</b>
            Tracks in a collection that coincide with a query track of interest.<br>
            Q - The query track.<br>
            Ri - Reference track i (i = 1,..,n).<br>
            """)
        core.divEnd()
        return str(core)
示例#14
0
 def getToolDescription():
     '''
     Specifies a help text in HTML that is displayed below the tool.
     '''
     core = HtmlCore()
     core.divBegin()
     core.paragraph(
         """This tools implements a solution to the statistical question
                 'Which tracks (in a suite) are most representative and most atypical'. To use the tool:"""
     )
     core.orderedList([
         "Select the GSuite (dataset collection of interest).",
         "Select additional options (advanced mode only).",
         "Execute the tool."
     ])
     core.paragraph("""<br><br><b>Tool illustration.</b>
                 Relatedness of tracks in a collection.<br>
                 Ri - Track i (i = 1,..,n).<br>
                 """)
     core.divEnd()
     return str(core)
    def getToolDescription():
        '''
        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 editing contents of medatata '
            'columns in a GSuite file where the user can edit the titles '
            'in the file.')
        core.divider()
        core.paragraph('To filter a GSuite file, please follow these steps: ')
        core.orderedList([
            'Select the input GSuite file from history',
            'Select the titles of the tracks that should be edited',
            'Edit the titles of the tracks', 'Click the Execute button'
        ])
        '''cls._addGSuiteFileDescription(core,
                                      alwaysShowRequirements=True,
                                      alwaysShowOutputFile=True)'''

        return str(core)
示例#16
0
 def getToolDescription():
     from proto.hyperbrowser.HtmlCore import HtmlCore
     core = HtmlCore()
     core.orderedList(['Choose a file from history were you previously have used the '\
                      '"Download Genome Tool". If you have not first used that tool no '\
                      'appropriate elements will appear in the list.',
                      'Rename the chromosome names found in the fasta files if needed. '\
                      'Do not delete or add lines! The standard way of naming chromosome in '\
                      'the Genomic HyperBrowser is "chr1, chr2, ..." and "chrM" '\
                      'for the mithocondrial DNA. Other chromosomes regain their usual name.',
                      'If you want to filter the chromosome names in a same manner for all chromosomes, '\
                      'type a regular expression for filtering. Use parenthesis to select '\
                      'groups to extract. The string matched by the groups will be returned, '\
                      'separated by the underscore character. '\
                      'If the groups are named, they will be presented in their sorted order. '\
                      'If no groups are defined, the whole match is returned. '\
                      'Note: You need to make sure that the pattern matches all chromosome names. '\
                      'Example: "(?P&lt;b&gt;.*)r(?P&lt;a&gt;.*)" return "34_12" for the string "12r34"',
                      'Choose which chromosomes to install.',
                      'Choose which chromosomes to install as "standard" (typically, chr1, chr2, chrX). '\
                      'The unchecked will be treated as "extended" and not usually included in tests '\
                      'in the HyperBrowser.'])
     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()
        desc = """This tool is a simplified version of the <b>Create a remote GSuite from a public repository</b> tool.
        Several categories of genomic tracks that can be found in the supported databases have been preselected and
        categorized to ease the search. Additionally the
        selected genomic tracks will be downloaded and preprocessed, i.e. prepared for analysis. Each intermediate step
        will be reported for transparency. This tool offers easier
        use at the exchange of the fine tuned search available in the more advanced tool."""
        core.paragraph(desc)

        core.paragraph('To use the tool, please follow these steps:')
        core.orderedList([
            'Select one of the predefined categories.',
            'Select the attribute of interest.',
            'Select either all or a preferred database.',
            'Select the preferred data type.', 'Execute the tool.'
        ])

        return str(core)  # + cls.getPlot()
示例#18
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 computes the proportions of overlap between the segments '
                       'of a query track against each track in a collection of reference tracks '
                       'described in a GSuite file. The overlap proportions are output in an '
                       'interactive heatmap, where each cell is colored according to the '
                       'overlap between each query segment (column) with each reference '
                       'track (row).')

        core.divider()
        core.paragraph('To carry out the analysis, please follow these steps:')
        core.orderedList(['Select a genome build. Both the query track and the reference tracks'
                          'need to use the same genome build.',
                          'Select a query track from the HyperBrowser repository',
                          'Select a reference track collection as a GSuite file from history',
                          'Select the color map, going from no overlap to full overlap.',
                          'Click "Execute"'])

        core.divider()
        core.smallHeader('Requirements for query track')
        core.descriptionLine('Track types', ', '.join(cls.TRACK_ALLOWED_TRACK_TYPES), emphasize=True)


        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)
示例#19
0
    def validateAndReturnErrors(cls, choices):
        """
        Should validate the selected input parameters. If the parameters are not
        valid, an error text explaining the problem should be returned. The GUI
        then shows this text to the user (if not empty) and greys out the
        execute button (even if the text is empty). If all parameters are valid,
        the method should return None, which enables the execute button.
        :param choices:  Dict holding all current selections
        """
        from quick.toolguide.controller.ToolGuide import ToolGuideController
        from quick.toolguide import ToolGuideConfig

        if not choices.queryTrack and not choices.gsuite:
            return ToolGuideController.getHtml(cls.toolId, [ToolGuideConfig.TRACK_INPUT, ToolGuideConfig.GSUITE_INPUT],
                                               choices.isBasic)
        if not choices.queryTrack:
            return ToolGuideController.getHtml(cls.toolId, [ToolGuideConfig.TRACK_INPUT], choices.isBasic)
        if not choices.gsuite:
            return ToolGuideController.getHtml(cls.toolId, [ToolGuideConfig.GSUITE_INPUT], choices.isBasic)

        errorString = cls._checkGSuiteFile(choices.gsuite)
        if errorString:
            return errorString

        errorString = cls._validateGenome(choices)
        if errorString:
            return errorString

        errorString = cls._checkTrack(choices, 'queryTrack', 'genome')
        if errorString:
            return errorString

        gsuite = getGSuiteFromGalaxyTN(choices.gsuite)

        errorString = cls._checkGSuiteRequirements \
            (gsuite,
             cls.GSUITE_ALLOWED_FILE_FORMATS,
             cls.GSUITE_ALLOWED_LOCATIONS,
             cls.GSUITE_ALLOWED_TRACK_TYPES,
             cls.GSUITE_DISALLOWED_GENOMES)

        if errorString:
            return errorString

        errorString = cls._checkGSuiteTrackListSize(gsuite)
        if errorString:
            return errorString

        if choices.randStrat in [RAND_BY_UNIVERSE_TEXT]:
            errorString = cls._checkTrack(choices, 'intensityTrack', 'genome')
            if errorString:
                return errorString

            if choices.queryTrack and choices.intensityTrack:
                basicTFQuery = cls._getBasicTrackFormat(choices, 'queryTrack')[-1]
                basicTFIntensity = cls._getBasicTrackFormat(choices, 'intensityTrack')[-1]

                if not all(_ == 'points' for _ in [basicTFQuery, basicTFIntensity]):
                    core = HtmlCore()
                    core.paragraph('The selected randomization strategy requires the query and '
                                   'the universe track to both be of type "Points". One or both '
                                   'of these tracks have the incorrect track type.')
                    core.descriptionLine('Current track type of query track', basicTFQuery)
                    core.descriptionLine('Current track type of universe track', basicTFIntensity)
                    core.paragraph('The only file formats (Galaxy datatypes) that '
                                   'support the "Points" track type is "gtrack" and "bed.points". '
                                   'To fix your input track(s), do as follows:')
                    core.orderedList([
                        'If you currently have a segment track (with segment lengths > 1), '
                        'please convert it into points tracks by using the tool "Expand or '
                        'contract points/segments" under the "Customize tracks" submenu.',
                        'If you currently have a "bed" file where all segments have '
                        'length one, possibly as the result of step 1, you will need to '
                        'change the Galaxy datatype to "point.bed". To do this, click the '
                        '"pencil" icon of the history element, select the "Datatypes" tab '
                        'and select "point.bed".'])
                    return str(core)

        errorString = cls.validateUserBins(choices)
        if errorString:
            return errorString
    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)
    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)