Package: pyppl-report
pyppl_reportA report generating system forPyPPLInstallationRequires pandoc 2.7+ (and wkhtmltopdf 0.12.4+ when creating PDF reports)pyppl_reportrequirespandoc/wkhtmltopdfto be installed in$PATHpipinstallpyppl_reportUsageSpecifiation of templatepPyClone.config.report_template="""# {{report.title}}PyClone[1] is a tool using Probabilistic model for inferring clonal populationstructure from deep NGS sequencing.![Similarity matrix]({{path.join(job.o.outdir, "plots/loci/similarity_matrix.svg")}})```tablecaption: Clustersfile: "{{path.join(job.o.outdir, "tables/cluster.tsv")}}"rows: 10```[1]: Roth, Andrew, et al. "PyClone: statistical inference of clonal population structure in cancer."Nature methods 11.4 (2014): 396."""# or use a template filepPyClone.config.report_template="file:/path/to/template.md"Generating reportPyPPL().start(pPyClone).run().report('/path/to/report',title='Clonality analysis using PyClone',template='bootstrap')# or save report in a directoryPyPPL(name='Awesome-pipeline').start(pPyClone).run().report('/path/to/')# report generated at ./Awesome-pipeline.report.htmlCommand line tool:>pypplreport
Description:ConvertaMarkdownfiletoreport.

Usage:pypplreport--in<LIST>[OPTIONS]Requiredoptions:-i,--in<LIST>-Theinputfile.

Optionaloptions:-o,--out<AUTO>-Theoutputfile.Default:<in>.html-n,--nonstand[BOOL]-Non-standalonemode.Savestaticfilesin<filenameof--out>.filesseparately.\Default:False--filter<LIST>-ThefiltersforpandocDefault:[]--toc<INT>-ThedepthofheadinglevelstoputinTOC.0todisable.Default:3--title<STR>-Thetitleofthedocument.IfthefirstelementofthedocumentisH1(#), this will be ignored \andthetextofH1willbeusedastitle.Ifthetitleisspecifiedas"# Title",thenatitlewillbeadded\anyway.Default:Untitleddocument--template<STR>-Thetemplatetouse.Eitherstandardtemplatenameorfullpathto\templatefile.Default:bootstrap-h,-H,--help-Showhelpmessageandexit.Extra data for renderingYou can generate atomlfile namedjob.report.data.tomlunder<job.outdir>with extra data to render the report template. Beyond that,procattributes andargscan also be used.For example:job.report.data.toml:description='A awesome report for job 1'Then in your template, you can use it:## {{jobs[0].description}}Built-in templatesCheck them to see features those templates support:LayuiBootstripSemanticHow does it work?Following figure demonstrates how the plugin works:Each process that you want to report, will need to have a template assigned withpXXX.config.report_template. Like scripts, you may prefice it withfile:, and then followed by an absolute path to the template or a relative one to where it's assigned. You may even assign a template using a direct string. A process with no template assign will be hidden from the report.You can use the data from the jobs or the process to render the template.The report for each process will then be assembled by the plugin, and converted using pandoc with a default template and some built-in filters. Finally, your report will be a standalone html file.For larget reports,non-standaonereports are recommended:.report(standalone=False, ...)EnvironmentsYou may pass values to process envs to control report content:pXXX.config.report_envs.foo="bar"Then in you can use it in the report template:pXXX.config.report_template="""The value of foo is "{{foo}}"."""Preserved envs variablesWe have 4 preserved variables underpXXX.envs:# Control the level of headings in thepXXX.config.report_envs.level=1# Content to add before the templatepXXX.config.report_envs.pre=''# Content to add after the templatepXXX.config.report_envs.post=''# The title of the process reportpXXX.config.report_envs.title=NoneProcess report levelsNo matter at which level you want to put this process report in the entire report, you need to each heading from level 1, then according topXXX.config.report_envs.level, the headings will be shifted to corresponding level. For example, withpXXX.config.report_envs.level = 2, following template# Section## Subsectioncontentwill be rendered into:## Section### SubsectioncontentIt will not affect comments in code blocks such as:```
## some comments
```Adding extra contents to process reportYou may add extra contents to the process report. For example, if you put the process report at level 2, then you probably need a level-1 heading. For previous example, if you havepXXX.config.report_envs.level = 2, without a level-2 heading, the entire report will look like:## Section### SubsectioncontentThen you missed a level-1 heading, which will make your report look wired. Here you can specify a level-1 heading withpXXX.config.report_envs.pre = '# I am H1':# I am H2## Section### SubsectioncontentYou may also append something to the process report withpXXX.config.report_envs.postHeadings added bypreandpostwillNOTbe adjusted bypXXX.config.report_envs.levelTitle of the process reportBy default, if not assigned or assigned withNone, the process description will be used as the title of the process report. Of course you can overwrite it withpXXX.config.report_envs.title.# by defaultpXXX=Proc(desc='Some analysis')# ... other necessary settingspXXX.report='# {{report.title}}'will be rendered as:# Some analysiswithpXXX.config.report_envs.title = 'An amazing analysis', we will have:# An amazing analysisMaking your report flexiableYou can interpolate some variables in the templates to make your report flexiable. For example, you may want to hide an image in some cases:# {{report title}}I have enough details.

{% if report.get('showimage') %}
![Image](./path/to/image)
{% endif %}Then you can show that image in the report only when you havepXXX.config.report_envs.showimage = True.Change logChange log