def main_json(config_path, in_metadata_path, out_metadata_path):
    """
    Main function.

    This function launches the app using configuration written in two json files: defineIO.json and input_metadata.json.

    :param config_path: path to a valid JSON file containing information on how the tool should be executed.
    :type config_path: str
    :param in_metadata_path: path to a valid JSON file containing information on tool inputs.
    :type in_metadata_path: str
    :param out_metadata_path: path to write the JSON file containing information on tool outputs.
    :type out_metadata_path: str
    :return: If result is True, execution finished successfully. False, otherwise.
    :rtype: bool
    """
    try:
        logger.info("1. Instantiate and launch the App")
        app = JSONApp()

        result = app.launch(process_WF_RUNNER, config_path, in_metadata_path, out_metadata_path)  # launch the app
        logger.info("2. App successfully launched; see " + out_metadata_path)
        return result

    except Exception as error:
        errstr = "App wasn't successfully launched. ERROR: {}".format(error)
        logger.error(errstr)
        raise Exception(errstr)
示例#2
0
def main_json(config, in_metadata, out_metadata):
    """
    Main function.

    This function launches the app using configuration written in two json files: config.json and input_metadata.json.

    :param config:
    :param in_metadata:
    :param out_metadata:
    :type config:
    :type in_metadata:
    :type out_metadata:
    :return: If result is True, execution finished successfully. False, otherwise.
    :rtype: bool
    """
    try:
        logger.info("1. Instantiate and launch the App")
        app = JSONApp()

        result = app.launch(process_WF_RUNNER, config, in_metadata, out_metadata)  # launch the app
        logger.info("2. App successfully launched; see " + out_metadata)
        return result

    except Exception as error:
        errstr = "App wasn't successfully launched. ERROR: {}".format(error)
        logger.error(errstr)
        raise Exception(errstr)
示例#3
0
def main_wrapper(config_path, in_metadata_path, out_metadata_path):
    """
    Main function.

    This function launches the tool using configuration written in two json files: config.json and in_metadata.json.

    :param config_path: Path to a valid VRE JSON file containing information on how the tool should be executed.
    :type config_path: str
    :param in_metadata_path: Path to a valid VRE JSON file containing information on tool inputs.
    :type in_metadata_path: str
    :param out_metadata_path: Path to write the VRE JSON file containing information on tool outputs.
    :type out_metadata_path: str
    :return: If result is True, execution finished successfully. False, otherwise.
    :rtype: bool
    """
    try:
        app = JSONApp()

        result = app.launch(Wrapper, config_path, in_metadata_path,
                            out_metadata_path)
        logger.progress("DpFrEP tool successfully executed; see {}".format(
            out_metadata_path))
        return result

    except Exception as error:
        errstr = "DpFrEP tool wasn't successfully executed. ERROR: {}.".format(
            error)
        logger.error(errstr)
        raise Exception(errstr)
def main_json(config, in_metadata, out_metadata):
    """
    Main function
    -------------

    This function launches the app using configuration written in
    two json files: config.json and input_metadata.json.
    """
    # 1. Instantiate and launch the App
    logger.info("1. Instantiate and launch the App")
    from apps.jsonapp import JSONApp
    app = JSONApp()

    # Fixing possible problems in the input metadata
    with open(in_metadata, "r") as in_metF:
        in_metaArr = json.load(in_metF)

    in_fixed = False
    for in_m in in_metaArr:
        if in_m.get('taxon_id', 0) == 0:
            in_m['taxon_id'] = -1
            in_fixed = True

    if in_fixed:
        with open(in_metadata, "w") as in_metF:
            json.dump(in_metaArr, in_metF)

    result = app.launch(process_WF_RUNNER, config, in_metadata, out_metadata)

    # 2. The App has finished
    logger.info("2. Execution finished; see " + out_metadata)

    return result
示例#5
0
def main_json(config, in_metadata, out_metadata):
    """
    Alternative main function
    -------------

    This function launches the app using configuration written in
    two json files: config.json and input_metadata.json.
    """
    # 1. Instantiate and launch the App
    logger.info("1. Instantiate and launch the App")
    from apps.jsonapp import JSONApp
    app = JSONApp()
    result = app.launch(process_bamqc, config, in_metadata, out_metadata)

    # 2. The App has finished
    logger.info("2. Execution finished; see " + out_metadata)

    return result
示例#6
0
def main_json(config, in_metadata, out_metadata):
    """
    Alternative main function

    This function launch the app using the configuration written
    in two json files: config_process_rmapBaitmap.json  and
    input_process_rmapBaitmap.json
    """
    #Instantiate and lauch the app
    print("1. Instantiate and launch the App")
    from apps.jsonapp import JSONApp
    app = JSONApp()
    results = app.launch(process_rmap, config, in_metadata, out_metadata)
    #2. The App has finished
    print("2. Execution finished: see " + out_metadata)
    print(results)

    return results
def main_json(config, in_metadata, out_metadata):
    """
    Main function.

    This function launches the app using configuration written in two json files: config.json and input_metadata.json.

    :param config:
    :param in_metadata:
    :param out_metadata:
    :type config:
    :type in_metadata:
    :type out_metadata:
    :return: If result is True, execution finished successfully. False, otherwise.
    :rtype: bool
    """
    try:
        logger.info("1. Instantiate and launch the App")
        from apps.jsonapp import JSONApp
        app = JSONApp()

        # Fixing possible problems in the input metadata
        with open(in_metadata, "r") as in_metF:
            in_metaArr = json.load(in_metF)

        in_fixed = False
        for in_m in in_metaArr:
            if in_m.get('taxon_id', 0) == 0:
                in_m['taxon_id'] = -1
                in_fixed = True

        if in_fixed:
            with open(in_metadata, "w") as in_metF:
                json.dump(in_metaArr, in_metF)

        result = app.launch(process_WF_RUNNER, config, in_metadata,
                            out_metadata)  # launch the app
        logger.info("2. App successfully launched; see " + out_metadata)
        return result

    except Exception as error:
        errstr = "App wasn't successfully launched. ERROR: {}".format(error)
        logger.error(errstr)
        raise Exception(errstr)
示例#8
0
def main_json():
    """
    Alternative main function
    -------------

    This function launches the app using configuration written in
    two json files: config.json and input_metadata.json.
    """
    # 1. Instantiate and launch the App
    logger.info("1. Instantiate and launch the App")
    from apps.jsonapp import JSONApp
    app = JSONApp()
    result = app.launch(SimpleWorkflow, "tools_demos/config.json",
                        "tools_demos/input_metadata.json", "/tmp/results.json")

    # 2. The App has finished
    logger.info("2. Execution finished; see /tmp/results.json")

    return result
def main_json(config, in_metadata, out_metadata):
    """
    Alternative main function

    This function launches the app using configuration written in
    two json files: config.json and metadata.json
    """

    # 1. Instantiate and launch the App
    print("1. Instantiate and launch the App")
    from apps.jsonapp import JSONApp
    app = JSONApp()
    results = app.launch(process_run_chicago, config, in_metadata,
                         out_metadata)

    # 2. The App has finished
    print("2. Execution finished; see " + out_metadata)
    print(results)

    return results
示例#10
0
def main_json(config, in_metadata, out_metadata):
    """
    Main function.

    This function launches the app using configuration written in two json files: config.json and input_metadata.json.

    :param config:
    :param in_metadata:
    :param out_metadata:
    :type config:
    :type in_metadata:
    :type out_metadata:
    :return: If result is True, execution finished successfully. False, otherwise.
    :rtype: bool
    """
    try:
        logger.info("1. Instantiate and launch the App")
        app = JSONApp()

        # Generating output files paths for images
        with open(in_metadata, "r") as in_meta:
            _in = json.load(in_meta)
            conf = json.load(open(config))
            conf['output_files'] = []
            
            new_file = {
                "name": "ml_summary",
                "required": True,
                "allow_multiple": False,
                "file": {
                    "file_type": "PDF",
                    "file_path": os.path.split(os.path.abspath(in_metadata[0]]['path'])),
                    "data_type": "tool_statistics",
                    "meta_data": {},
                }
            }