<filename>SLpackage/private/pacbio/pythonpkgs/pbreports/lib/python2.7/site-packages/pbreports/report/mapping_stats_hgap.py

"""
Separate wrapper for HGAP version of mapping stats report.
"""

import logging
import os.path
import sys

from pbcommand.models import FileTypes
from pbcommand.cli import pbparser_runner
from pbcommand.utils import setup_log

from pbreports.report import mapping_stats
from pbreports.io.specs import load_spec

__version__ = "0.3.1"
log = logging.getLogger(__name__)


class Constants(mapping_stats.Constants):
    TOOL_ID = "pbreports.tasks.mapping_stats_hgap"
    DRIVER_EXE = "python -m pbreports.report.mapping_stats_hgap --resolved-tool-contract"
    R_ID = "mapping_stats_hgap"
    VERSION = __version__
    DOC = __doc__


spec = load_spec(Constants.R_ID)


def to_report(alignment_file, subreads_in, report_json, nproc=1):
    return mapping_stats.to_report(alignment_file,
                                   report_json,
                                   nproc,
                                   use_spec=spec,
                                   subreads_in=subreads_in,
                                   report_id=Constants.R_ID)


def _args_runner(args):
    return to_report(args.alignment_file,
                     args.subreads_file,
                     os.path.abspath(args.report_json),
                     args.nproc)


def _rtc_runner(rtc):
    return to_report(rtc.task.input_files[0],
                     rtc.task.input_files[1],
                     rtc.task.output_files[0],
                     nproc=rtc.task.nproc)


def _get_parser():
    parser = mapping_stats.get_parser(Constants)
    parser.tool_contract_parser.add_input_file_type(
        FileTypes.DS_SUBREADS, "subreads_file",
        "Subreads XML DataSet",
        "Unmapped BAM or Subreads DataSet")
    return parser


def main(argv=sys.argv):  # pragma: no cover
    return pbparser_runner(argv[1:],
                           _get_parser(),
                           _args_runner,
                           _rtc_runner,
                           log,
                           setup_log)


if __name__ == '__main__':
    sys.exit(main(sys.argv))

<filename>SLpackage/private/pacbio/pythonpkgs/pbreports/lib/python2.7/site-packages/pbreports/report/mapping_stats_hgap.py

"""
Separate wrapper for HGAP version of mapping stats report.
"""

import logging
import os.path
import sys

from pbcommand.models import FileTypes
from pbcommand.cli import pbparser_runner
from pbcommand.utils import setup_log

from pbreports.report import mapping_stats
from pbreports.io.specs import load_spec

__version__ = "0.3.1"
log = logging.getLogger(__name__)


class Constants(mapping_stats.Constants):
    TOOL_ID = "pbreports.tasks.mapping_stats_hgap"
    DRIVER_EXE = "python -m pbreports.report.mapping_stats_hgap --resolved-tool-contract"
    R_ID = "mapping_stats_hgap"
    VERSION = __version__
    DOC = __doc__


spec = load_spec(Constants.R_ID)


def to_report(alignment_file, subreads_in, report_json, nproc=1):
    return mapping_stats.to_report(alignment_file,
                                   report_json,
                                   nproc,
                                   use_spec=spec,
                                   subreads_in=subreads_in,
                                   report_id=Constants.R_ID)


def _args_runner(args):
    return to_report(args.alignment_file,
                     args.subreads_file,
                     os.path.abspath(args.report_json),
                     args.nproc)


def _rtc_runner(rtc):
    return to_report(rtc.task.input_files[0],
                     rtc.task.input_files[1],
                     rtc.task.output_files[0],
                     nproc=rtc.task.nproc)


def _get_parser():
    parser = mapping_stats.get_parser(Constants)
    parser.tool_contract_parser.add_input_file_type(
        FileTypes.DS_SUBREADS, "subreads_file",
        "Subreads XML DataSet",
        "Unmapped BAM or Subreads DataSet")
    return parser


def main(argv=sys.argv):  # pragma: no cover
    return pbparser_runner(argv[1:],
                           _get_parser(),
                           _args_runner,
                           _rtc_runner,
                           log,
                           setup_log)


if __name__ == '__main__':
    sys.exit(main(sys.argv))

Separate wrapper for HGAP version of mapping stats report. # pragma: no cover