Skip to content

Customizing Your Own Demo

Marcus Fedarko edited this page Aug 27, 2018 · 5 revisions

Background

As mentioned in MetagenomeScope's README, you can host the viewer interface and some .db files on a server. This will allow users to visualize these graphs (on the client side) simply by accessing your server through a web browser.

In order to make a collection of .db files selectable via the "Demo .db file" dialog in the viewer interface, you would need to modify the actual markup in viewer/index.html to include radio buttons in the demo dialog for selecting these exact files. Fortunately, we've created a script to do this for you!

This repository contains a script included with the viewer interface (viewer/populate_demo.py) that, when run, will create a version of the viewer interface with a customized demo dialog based on a directory of .db files created by MetagenomeScope's preprocessing script.

Usage

./populate_demo.py [-h] -d DBDIRECTORY [-l LISTFILE] -i INDEXFILE [-o OUTPUTINDEXFILE]

  -h, --help            show this help message and exit
  -d DBDIRECTORY, --dbdirectory DBDIRECTORY
                        directory containing all .db files that will be
                        referenced in the generated demo.
  -l LISTFILE, --listfile LISTFILE
                        optional file where each line defines a .db file to be
                        included in the generated demo. Each line is of the
                        format filename(tab)description where "filename" is
                        the name of a .db file located within the directory
                        specified by -d, "description" is an optional
                        description of the .db file specified on that line,
                        and "(tab)" is a tab character (only required if a
                        description is given). If this is not specified, then
                        all .db files in the directory specified by -d will be
                        included in the demo.
  -i INDEXFILE, --indexfile INDEXFILE
                        (non-minified) index.html file to use as a base for
                        the new index.html file. If no output index file is
                        specified via -o, then the demo information will be
                        inserted into this index file; if an output index file
                        is specified, though, then this file will not be
                        changed (unless you give the same file as the argument
                        to both -i and -o).
  -o OUTPUTINDEXFILE, --outputindexfile OUTPUTINDEXFILE
                        output index.html file containing the new demo
                        information; if this is not specified, then the new
                        index.html page containing the demo information will
                        be written to the index.html file specified by -i.