leafletfa.differential_splicing
leafletfa.differential_splicing
analyze_all_factors_psi(psi_samples, top_junctions, min_effect_size=0.1, fdr_threshold=0.05)
Analyze differential splicing for all factors using PSI values only. Identifies top differentially spliced (DS) junctions.
Returns:
| Type | Description |
|---|---|
Dict[int, Tuple[Dict[str, ndarray], DataFrame]]
|
Dictionary mapping factor index to (results_dict, results_df) tuple. |
calculate_silhouette_score(assign_post, cell_types)
Calculates silhouette score for the factor assignments.
compute_differential_splicing_groups(adata, psi_samples, phi_samples, junction_idx, group_1, group_2=None, groupby_column='cell_type_grouped', min_effect_size=0.1)
Computes the effect size for a given junction between two groups (e.g., cell types or age groups).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adata
|
AnnData
|
The AnnData object containing cell metadata. |
required |
psi_samples
|
Tensor
|
Tensor of shape [S, K, J] representing sample-factor-junction usage. |
required |
phi_samples
|
Tensor
|
Tensor of shape [S, C, K] representing sample-cell-factor assignments. |
required |
junction_idx
|
int
|
Index of the junction to analyze. |
required |
group_1
|
str
|
First group to compare (e.g., a specific cell type or age group). |
required |
group_2
|
str
|
Second group to compare. If None, compares group_1 against all others. |
None
|
groupby_column
|
str
|
Column in |
'cell_type_grouped'
|
min_effect_size
|
float
|
Threshold for significance. Default is 0.1. |
0.1
|
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Summary statistics of effect size for the given junction. |
compute_junctions_significance_groups(effect_sizes, fdr_threshold=0.05, min_effect_size=0.1)
Computes significant junctions based on effect size probabilities and false discovery rate (FDR).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
effect_sizes
|
DataFrame
|
DataFrame containing results from compute_junction_effect_size. |
required |
fdr_threshold
|
float
|
False discovery rate threshold. |
0.05
|
min_effect_size
|
float
|
Minimum effect size threshold for significance. Default is 0.1. |
0.1
|
Returns:
| Type | Description |
|---|---|
|
pd.DataFrame: DataFrame containing significant junctions and FDR calculations. |
compute_junctions_significance_psi(effect_sizes, fdr_threshold, min_effect_size=0.1)
Computes significant junctions based on PSI effect size probabilities and false discovery rate (FDR).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
effect_sizes
|
DataFrame
|
DataFrame containing results from compute_psi_effect_size. |
required |
fdr_threshold
|
float
|
False discovery rate threshold. |
required |
min_effect_size
|
float
|
Minimum effect size threshold for significance. Default is 0.1. |
0.1
|
Returns:
| Type | Description |
|---|---|
|
pd.DataFrame: DataFrame containing significant junctions and FDR calculations. |
compute_psi_effect_size(psi_samples, factor_idx, junction_idx, min_effect_size=0.1)
Computes the effect size for a given junction based on PSI values without weighting by factor usage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
psi_samples
|
Tensor
|
Tensor of shape [S, K, J] representing sample-factor-junction usage. |
required |
factor_idx
|
int
|
Index of the factor of interest. |
required |
junction_idx
|
int
|
Index of the junction of interest. |
required |
min_effect_size
|
float
|
Threshold for significance. Default is 0.1. |
0.1
|
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Summary statistics of effect size for the given junction. |