#!/usr/bin/env python """Create workflow report.""" import json from pathlib import Path import pickle from bokeh.models import HoverTool, Range1d from bokeh.models.tickers import AdaptiveTicker from dominate.tags import li, ul from dominate.util import raw import ezcharts as ezc from ezcharts.components import fastcat from ezcharts.components.ezchart import EZChart from ezcharts.components.reports.labs import LabsReport from ezcharts.components.theme import LAB_head_resources from ezcharts.layout.snippets import DataTable, Grid, Tabs from ezcharts.plots.categorical import barplot from ezcharts.util import get_named_logger import pandas as pd from . import de_plots # noqa: ABS101 from .util import wf_parser # noqa: ABS101 def argparser(): """Argument parser for entrypoint.""" parser = wf_parser("report") parser.add_argument("--report", help="Report output file") parser.add_argument( "--metadata", default='metadata.json', required=True, help="sample metadata") parser.add_argument( "--stats", nargs='+', help="Fastcat per-read stats, ordered as per entries in --metadata.") parser.add_argument( "--versions", required=True, help="directory containing CSVs containing name,version.") parser.add_argument( "--params", default=None, required=True, help="A JSON file containing the workflow parameter key/values") parser.add_argument( "--wf_version", default='unknown', help="version of the executed workflow") parser.add_argument( "--alignment_stats", required=False, default=None, type=Path, help="TSV summary file of alignment statistics") parser.add_argument( "--gff_annotation", required=False, type=Path, help="transcriptome annotation gff file") parser.add_argument( "--gffcompare_dir", required=False, default=None, type=Path, help="gffcompare outout dir") parser.add_argument( "--pychop_report", required=False, default=None, type=Path, help="TSV summary file of pychopper statistics") parser.add_argument( "--isoform_table", required=False, type=Path, help="Path to directory of TSV files with isoform summaries") parser.add_argument( "--isoform_table_nrows", required=False, type=int, default=5000, help="Maximum rows to display in isoforms table") parser.add_argument( "--transcriptome_summary", required=False, type=Path, help="Path to dir containing transcriptome summary results ") parser.add_argument( "--de_report", required=False, type=Path, default=None, help="Differential expression report optional") parser.add_argument( "--de_stats", required=False, type=Path, default=None, help="Differential expression report optional") parser.add_argument( "--pval_threshold", required=False, type=float, default=0.01, help=( "pvalue theshold for inclusion of differentially expressed genes" " transcripts in plots ")) return parser def gff_compare_plots(report, gffcompare_outdirs): """Create various sections and plots in a WfReport. :param gffcompare_outdirs: List of output directories from run_gffcompare :return: None """ # Plot overview panel: with report.add_section("Annotation summary", "Annotation"): raw("""The following plots summarize some of the output from gffcompare """) raw("""