-
Notifications
You must be signed in to change notification settings - Fork 0
3. Analysis
RiSPICE provides several downstream analysis utilities to help interpret variant scores. These workflows can be used to rank candidate variants, examine their predicted chromatin changes, and perform in silico saturation mutagenesis to identify influential nucleotides within a genomic region.
The available analyses are:
- Rank by Overall Score
- Analyze Per-Feature Scores
- In Silico Saturation Mutagenesis
Tip: Append
--helpto any RiSPICE command to display its usage, available options, and descriptions of each argument.
Ranks variants according to their Overall Score, allowing candidate variants with the largest predicted chromatin changes to be identified.
python -m scripts.analysis.prioritization.rank \
--scores path/to/scores.tsv \
--snp_list path/to/snp_list.tsv \
-o path/to/output_directoryUse the
--topflag to output only the top N variants (e.g.--top 20). When specified, the results are saved astop{N}_variants.tsv.
Generate a bar plot of the ranked variants.
python -m scripts.analysis.visualize.prioritization.top_variants \
-i path/to/top20_variants.tsv \
-o path/to/top20_variants.png \
--title "Overall Scores of the Top 20 Variants"Adjust the figure width as needed depending on the number of variants being displayed. The default width (
6) is recommended for approximately 20 variants.
Generates a matrix of Per-Feature Scores sorted by Overall Score. Chromatin features are ordered according to their average predicted impact across all input variants, making the most affected features easier to identify.
python -m scripts.analysis.prioritization.per_feature_scores \
--scores path/to/scores.tsv \
--snp_list path/to/snp_list.tsv \
-o path/to/output_directory \
--top 20Use the
--topflag to output only the top N variants (e.g.--top 20). When specified, the results are saved asper_feature_scores_top{N}.tsv.
Generate a heatmap of the Per-Feature Scores.
python -m scripts.analysis.visualize.prioritization.per_feature_scores \
-i path/to/per_feature_scores_top20.tsv \
-o path/to/per_feature_scores_top20.png \
--threshold_dir path/to/per_feature_thresholds \
-t "Per-Feature Scores of the Top 20 Variants"Adjust the figure height as needed depending on the number of variants being displayed. The default height (
12) is recommended for approximately 20 variants.Specify
--threshold_dirto annotate statistically significant Per-Feature Scores. This directory should point to the extractedper_feature/folder from the downloaded empirical background distribution, which contains the significance threshold (*.tsv) files for all chromatin features.
In Silico Saturation Mutagenesis evaluates the predicted effect of every possible single-nucleotide substitution within a genomic interval.
To begin, generate a snp_list.tsv containing all possible A/C/G/T substitutions across the region of interest. RiSPICE provides a helper script for this.
python -m scripts.snp.range_to_snp_list \
--chrom 4 \
--start 19884636 \
--end 19884735 \
--fasta genome.fna \
--output_dir output/The script:
- extracts the specified interval from the reference genome.
- determines the reference nucleotide at each position, and
- generates every possible single-base substitution in
snp_list.tsv.
Once the list has been generated, process it through the standard Prediction Pipeline to obtain scores.tsv.
Convert the predicted scores into a mutation matrix suitable for downstream analysis.
python -m scripts.analysis.prioritization.mutagenesis \
--scores scores.tsv \
--snp_list snp_list.tsv \
--output matrix.tsvThe resulting matrix.tsv contains the predicted score for every possible nucleotide substitution at each genomic position.
Annotate each mutation using the precomputed empirical significance thresholds.
python -m scripts.analysis.prioritization.genomewide_sig \
--input matrix.tsv \
--thresholds thresholds.tsv \
--output_dir output/This script produces:
-
significant_matrix.tsv, a boolean matrix indicating whether each mutation is statistically significant, and -
significant_positions.tsv, a table containing positions within the genomic interval that has significant mutations.
Specify the
--thresholdsfile containing the empirical significance thresholds. If you downloaded the empirical background distribution, use the correspondingthresholds.tsvfile for your selected model.
Visualize the mutagenesis matrix as a heatmap.
python -m scripts.analysis.visualize.prioritization.mutagenesis_heatmap \
--input matrix.tsv \
--significance significant_matrix.tsv \
--output heatmap.png \
--title "In Silico Saturation Mutagenesis"The heatmap displays the predicted score for every possible nucleotide substitution at each position. Statistically significant mutations are annotated using significant_matrix.tsv.
Generate a line plot showing the maximum predicted score at each genomic position.
python -m scripts.analysis.visualize.prioritization.mutagenesis_max_effect \
--input matrix.tsv \
--thresholds thresholds.tsv \
--output max_effect.png \
--title "Maximum Score per Position"The plot displays the maximum predicted score at each genomic position. A horizontal red line indicates the genome-wide significance threshold, making it easy to identify mutation hotspots with statistically significant effects.