smftools.plotting.preprocess_plotting#
Functions
|
Plot read-span mask and base quality clustermaps side by side. |
- smftools.plotting.preprocess_plotting.plot_read_span_quality_clustermaps(adata, sample_col='Sample_Names', reference_col='Reference_strand', quality_layer='base_quality_scores', read_span_layer='read_span_mask', quality_cmap='viridis', read_span_color='#2ca25f', sort_method='hierarchical', pca_n_components=20, pca_sort_component=0, max_nan_fraction=None, min_quality=None, min_length=None, min_mapped_length_to_reference_length_ratio=None, demux_types=('single', 'double', 'already'), max_reads=None, xtick_step=None, xtick_rotation=90, xtick_fontsize=9, show_position_axis=False, position_axis_tick_target=25, save_path=None, n_jobs=1, index_col_suffix=None)#
Plot read-span mask and base quality clustermaps side by side.
Clustering is performed using the base-quality layer ordering, which is then applied to the read-span mask to keep the two panels aligned.
- Parameters:
adata -- AnnData with read-span and base-quality layers.
sample_col (
str(default:'Sample_Names')) -- Column inadata.obsthat identifies samples.reference_col (
str(default:'Reference_strand')) -- Column inadata.obsthat identifies references.quality_layer (
str(default:'base_quality_scores')) -- Layer name containing base-quality scores.read_span_layer (
str(default:'read_span_mask')) -- Layer name containing read-span masks.quality_cmap (
str(default:'viridis')) -- Colormap for base-quality scores.read_span_color (
str(default:'#2ca25f')) -- Color for read-span mask (1-values); 0-values are white.sort_method (
str(default:'hierarchical')) -- Row ordering strategy ("pca" or "hierarchical").pca_n_components (
int|None(default:20)) -- Number of PCA components to compute for ordering. IfNone, usesmin(n_reads, n_positions).pca_sort_component (
int(default:0)) -- Zero-based PCA component index to sort by (ascending).max_nan_fraction (
float|None(default:None)) -- Optional maximum fraction of NaNs allowed per position; positions above this threshold are excluded.min_quality (
float|None(default:None)) -- Optional minimum read quality filter.min_length (
int|None(default:None)) -- Optional minimum mapped length filter.min_mapped_length_to_reference_length_ratio (
float|None(default:None)) -- Optional min length ratio filter.demux_types (
Sequence[str] (default:('single', 'double', 'already'))) -- Alloweddemux_typevalues, if present inadata.obs.max_reads (
int|None(default:None)) -- Optional maximum number of reads to plot per sample/reference.xtick_step (
int|None(default:None)) -- Spacing between x-axis tick labels (None = no labels).xtick_rotation (
int(default:90)) -- Rotation for x-axis tick labels.xtick_fontsize (
int(default:9)) -- Font size for x-axis tick labels.show_position_axis (
bool(default:False)) -- Whether to draw a position axis with tick labels.position_axis_tick_target (
int(default:25)) -- Approximate number of ticks to show when auto-sizing.save_path (
str|Path|None(default:None)) -- Optional output directory for saving plots.n_jobs (
int(default:1)) -- Number of parallel worker processes.-1uses all available CPUs. Parallelism is only applied whensave_pathis set (interactive display is always serial).index_col_suffix (
str|None(default:None)) -- If set, useadata.var[f"{ref}_{index_col_suffix}"]for tick labels and column order instead ofvar_names(e.g."reindexed"), matching the HMM/spatial clustermaps.
- Return type:
- Returns:
List of dictionaries with per-plot metadata and output paths.