Creates reproducible Jupyter notebooks for bioinformatics analysis with parameterization using papermill. Use when generating automated analysis reports, running notebook-based pipelines, or creating shareable computational notebooks.
Reference examples tested with: jupyter 1.0+, papermill 2.5+
Before using code patterns, verify installed versions match. If versions differ:
pip show <package> then help(module.function) to check signatures<tool> --version then <tool> --help to confirm flagsIf code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying.
"Generate reproducible analysis reports" → Execute parameterized Jupyter notebooks programmatically and export as HTML/PDF reports.
papermill.execute_notebook(input, output, parameters={...})jupyter nbconvert --to html notebook.ipynbimport papermill as pm
# Execute notebook with parameters
pm.execute_notebook(
'analysis_template.ipynb',
'output_report.ipynb',
parameters={
'input_file': 'data/counts.csv',
'condition_col': 'treatment',
'fdr_threshold': 0.05
}
)
Mark a cell with the parameters tag in Jupyter:
# Parameters (tag this cell as "parameters")
input_file = 'default.csv'
output_dir = 'results/'
fdr_threshold = 0.05
import papermill as pm
from pathlib import Path
samples = ['sample1', 'sample2', 'sample3']
for sample in samples:
pm.execute_notebook(
'qc_template.ipynb',
f'reports/{sample}_qc.ipynb',
parameters={'sample_id': sample}
)
# Single notebook
jupyter nbconvert --to html report.ipynb
# With execution
jupyter nbconvert --execute --to html report.ipynb
# PDF (requires pandoc + LaTeX)
jupyter nbconvert --to pdf report.ipynb