kb_python.report
¶
Module Contents¶
Functions¶
|
Convert a dictionary to a Plot.ly table of key-value pairs. |
|
Generate knee plot card. |
|
Generate genes detected plot card. |
|
Generate elbow plot card. |
|
Generate PCA plot card. |
|
Render the Jupyter notebook report with Jinja2. |
|
Execute the report and write the results as a Jupyter notebook and HTML. |
|
Render and execute the report. |
Attributes¶
- kb_python.report.REPORT_DIR¶
- kb_python.report.BASIC_TEMPLATE_PATH¶
- kb_python.report.MATRIX_TEMPLATE_PATH¶
- kb_python.report.MARGIN¶
- kb_python.report.dict_to_table(d: Dict[str, Any], column_ratio: List[int] = [3, 7], column_align: List[str] = ['right', 'left']) plotly.graph_objects.Figure ¶
Convert a dictionary to a Plot.ly table of key-value pairs.
- Parameters
d – Dictionary to convert
column_ratio – Relative column widths, represented as a ratio, defaults to [3, 7]
column_align – Column text alignments, defaults to [‘right’, ‘left’]
- Returns
Figure
- kb_python.report.knee_plot(n_counts: List[int]) plotly.graph_objects.Figure ¶
Generate knee plot card.
- Parameters
n_counts – List of UMI counts
- Returns
Figure
- kb_python.report.genes_detected_plot(n_counts: List[int], n_genes: List[int]) plotly.graph_objects.Figure ¶
Generate genes detected plot card.
- Parameters
n_counts – List of UMI counts
n_genes – List of gene counts
- Returns
Figure
- kb_python.report.elbow_plot(pca_variance_ratio: List[float]) plotly.graph_objects.Figure ¶
Generate elbow plot card.
- Parameters
pca_variance_ratio – List PCA variance ratios
- Returns
Figure
- kb_python.report.pca_plot(pc: numpy.ndarray) plotly.graph_objects.Figure ¶
Generate PCA plot card.
- Parameters
pc – Embeddings
- Returns
Figure
- kb_python.report.write_report(stats_path: str, info_path: str, inspect_path: str, out_path: str, matrix_path: Optional[str] = None, barcodes_path: Optional[str] = None, genes_path: Optional[str] = None, t2g_path: Optional[str] = None) str ¶
Render the Jupyter notebook report with Jinja2.
- Parameters
stats_path – Path to kb stats JSON
info_path – Path to run_info.json
inspect_path – Path to inspect.json
out_path – Path to Jupyter notebook to generate
matrix_path – Path to matrix
barcodes_path – List of paths to barcodes.txt
genes_path – Path to genes.txt, defaults to None
t2g_path – Path to transcript-to-gene mapping
- Returns
Path to notebook generated
- kb_python.report.execute_report(execute_path: str, nb_path: str, html_path: str) Tuple[str, str] ¶
Execute the report and write the results as a Jupyter notebook and HTML.
- Parameters
execute_path – Path to Jupyter notebook to execute
nb_path – Path to Jupyter notebook to generate
html_path – Path to HTML to generate
- Returns
Tuple containing executed notebook and HTML
- kb_python.report.render_report(stats_path: str, info_path: str, inspect_path: str, nb_path: str, html_path: str, matrix_path: Optional[str] = None, barcodes_path: Optional[str] = None, genes_path: Optional[str] = None, t2g_path: Optional[str] = None, temp_dir: str = 'tmp') Dict[str, str] ¶
Render and execute the report.
- Parameters
stats_path – Path to kb stats JSON
info_path – Path to run_info.json
inspect_path – Path to inspect.json
nb_path – Path to Jupyter notebook to generate
html_path – Path to HTML to generate
matrix_path – Path to matrix
barcodes_path – List of paths to barcodes.txt
genes_path – Path to genes.txt, defaults to None
t2g_path – Path to transcript-to-gene mapping
temp_dir – Path to temporary directory, defaults to tmp
- Returns
Dictionary containing notebook and HTML paths