Beispiel #1
0
def view(ctx, host, port, debug, pattern, family_file, family_type,
         variant_source, variant_type, root, mode):
    """Visualize DNA variant resources.

    1. Look for variant source(s) to visualize and inst. the right plugin
    2.
    """

    if root is None:
        root = os.path.expanduser("~/.puzzle")

    if os.path.isfile(root):
        logger.error("'root' can't be a file")
        ctx.abort()

    logger.info("Root directory is: {}".format(root))

    db_path = os.path.join(root, 'puzzle_db.sqlite3')
    logger.info("db path is: {}".format(db_path))

    if variant_source is None:
        if not os.path.exists(db_path):
            logger.warn("database not initialized, run 'puzzle init'")
            ctx.abort()

        plugin = SqlStore(db_path)
        BaseConfig.STORE_ENABLED = True

    elif mode == 'vcf':
        logger.info("Initialzing VCF plugin")
        try:
            plugin = VcfPlugin(
                root_path=variant_source,
                case_lines=family_file,
                case_type=family_type,
                pattern=pattern,
                vtype=variant_type
            )
        except SyntaxError as e:
            logger.error(e.message)
            ctx.abort()

    elif mode == 'gemini':
        logger.info("Initialzing GEMINI plugin")
        try:
            plugin = GeminiPlugin(db=variant_source, vtype=variant_type)
        except NameError:
            logger.error("Need to have gemini installed to use gemini plugin")
            ctx.abort()
        except DatabaseError as e:
            logger.error("{0} is not a valid gemini db".format(variant_source))
            logger.info("variant-source has to point to a gemini databse")
            ctx.abort()

    logger.debug("Plugin setup was succesfull")

    BaseConfig.PUZZLE_BACKEND = plugin
    BaseConfig.ROOT_DIR = root
    BaseConfig.UPLOAD_DIR = os.path.join(root, 'resources')

    app = create_app(config_obj=BaseConfig)

    app.run(host=host, port=port, debug=debug)
Beispiel #2
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from flask.ext.script import Manager

from puzzle.factory import create_app
from puzzle.settings import DevConfig

app = create_app(config_obj=DevConfig)
manager = Manager(app)


if __name__ == '__main__':
    manager.run()
Beispiel #3
0
def app(request):
    app = create_app(config_obj=TestConfig)
    return app
Beispiel #4
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from flask.ext.script import Manager

from puzzle.factory import create_app
from puzzle.settings import DevConfig

app = create_app(config_obj=DevConfig)
manager = Manager(app)

if __name__ == '__main__':
    manager.run()