bio-reporting-jupyter-reports
Jupyter Reports with Papermill
Parameterized Notebooks
import 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
}
)
Creating Parameterized Templates
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
Batch Processing
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}
)
Converting to HTML/PDF
# 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
Best Practices
- Keep analysis code in cells, explanatory text in markdown
- Use parameters for all configurable values
- Include version information and timestamps
- Clear outputs before committing to version control
Related Skills
- reporting/quarto-reports - Alternative report format
- reporting/rmarkdown-reports - R-based reports
- workflows/rnaseq-to-de - Embed in workflows
More from gptomics/bioskills
bioskills
Installs 425 bioinformatics skills covering sequence analysis, RNA-seq, single-cell, variant calling, metagenomics, structural biology, and 56 more categories. Use when setting up bioinformatics capabilities or when a bioinformatics task requires specialized skills not yet installed.
100bio-single-cell-batch-integration
Integrate multiple scRNA-seq samples/batches using Harmony, scVI, Seurat anchors, and fastMNN. Remove technical variation while preserving biological differences. Use when integrating multiple scRNA-seq batches or datasets.
5bio-epitranscriptomics-merip-preprocessing
Align and QC MeRIP-seq IP and input samples for m6A analysis. Use when preparing MeRIP-seq data for peak calling or differential methylation analysis.
5bio-data-visualization-multipanel-figures
Combine multiple plots into publication-ready multi-panel figures using patchwork, cowplot, or matplotlib GridSpec with shared legends and panel labels. Use when combining multiple plots into publication figures.
5bio-data-visualization-specialized-omics-plots
Reusable plotting functions for common omics visualizations. Custom ggplot2/matplotlib implementations of volcano, MA, PCA, enrichment dotplots, boxplots, and survival curves. Use when creating volcano, MA, or enrichment plots.
5bio-read-qc-fastp-workflow
All-in-one read preprocessing with fastp including adapter trimming, quality filtering, deduplication, base correction, and HTML report generation. Use when preprocessing Illumina data and wanting a single fast tool instead of separate Cutadapt, Trimmomatic, and FastQC steps.
5