scsplice.pp¶
Preprocessing functions. Event-level filters and selection methods applied before dimensionality reduction.
pp
¶
scsplice.pp — preprocessing (per-event filters, HVE selection).
highly_variable_events
¶
highly_variable_events(adata: AnnData, *, min_row_sum: float = 50.0, n_top: int | None = None, n_threads: int = 1, sample_key: str = 'sample_id', key_added: str = 'highly_variable', inplace: bool = True) -> AnnData | None
Identify highly variable splicing events via ratio binomial deviance.
For every event, compute the per-library deviance of the (M1, M2) ratio
against its library-aggregate p_hat, then sum across libraries. Events
that fail the row-sum filter (M1.sum > min_row_sum AND M2.sum > min_row_sum)
receive NaN deviance and are excluded from the top-N selection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adata
|
AnnData
|
Splicing AnnData with |
required |
min_row_sum
|
float
|
Minimum row sum required on both M1 and M2 (computed on the full data, before per-library splitting). Events failing the filter are excluded from deviance computation entirely. |
50.0
|
n_top
|
int | None
|
If set, mark the top-N events by |
None
|
n_threads
|
int
|
OpenMP thread count. Per-row work is independent so output is bit-identical regardless of n_threads. |
1
|
sample_key
|
str
|
|
'sample_id'
|
key_added
|
str
|
Boolean column in |
'highly_variable'
|
inplace
|
bool
|
Mutate |
True
|
Returns:
| Type | Description |
|---|---|
``None`` when ``inplace=True``; otherwise a copy.
|
|
Notes
Writes var['sum_deviance'] (float64, NaN for filtered-out events)
and var[key_added] (bool). Stores call params under
uns['scsplice']['params']['highly_variable_events'].
Source code in src/scsplice/pp/_hve.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | |