templates

templates

Template files for CCBR Tools.

Templates

  • submit_slurm.sh – slurm submission script template

Quarto extensions

fnl

Quarto HTML format with FNL branding guidelines

First run ccbr_tools quarto-add fnl, then modify your _quarto.yml file with the following:

website:
...
page-footer:
    background: black
    foreground: white
    left: |
    [![](/_extensions/fnl/fnl-logo-dark.png){height=70px}](https://frederick.cancer.gov/research/science-areas/bioinformatics-and-computational-science/advanced-biomedical-computational-science)
    center: |
    Created by the
    [CCR Collaborative Bioinformatics Resource](https://github.com/CCBR)

format: fnl-html

Functions

Name Description
get_quarto_extensions List quarto extensions in this package
read_template Read a template file
use_quarto_ext Use a Quarto extension
use_template Uses a template, formats variables, and writes it to a file.

get_quarto_extensions

templates.get_quarto_extensions()

List quarto extensions in this package

Returns

Name Type Description
extensions list List of quarto extension names to use with use_quarto_ext

Examples

Code
from ccbr_tools.templates import get_quarto_extensions
get_quarto_extensions()
['fnl']

read_template

templates.read_template(template_name)

Read a template file

Parameters

Name Type Description Default
template_name str Name of the template file required

Returns

Name Type Description
template str Contents of the template file

Examples

>>> read_template("submit_slurm.sh")

use_quarto_ext

templates.use_quarto_ext(ext_name)

Use a Quarto extension

Parameters

Name Type Description Default
ext_name str The name of the extension in ccbr_tools required

Examples

>>> use_quarto_ext("fnl")

use_template

templates.use_template(template_name, output_filepath=None, **kwargs)

Uses a template, formats variables, and writes it to a file.

Parameters

Name Type Description Default
template_name str The name of the template to use. required
output_filepath str The filepath to save the output file. If not provided, it will be written to template_name in the current working directory. None
**kwargs str Keyword arguments to fill in the template variables. {}

Raises

Name Type Description
FileNotFoundError If the template file is not found.
IOError If there is an error writing the output file.

Examples

>>> use_template("submit_slurm.sh", output_filepath="./submit_slurm.sh", PIPELINE="CCBR_nxf", MODULES="ccbrpipeliner nextflow", ENV_VARS="", RUN_COMMAND="nextflow run main.nf -stub")