MMSplice¶
MMSplice¶
Modular modeling of the effects of genetic variants on splicing.
Disclaimer¶
This is an UNOFFICIAL implementation of the MMSplice: modular modeling improves the predictions of genetic variant effects on splicing by Jun Cheng et al.
The OFFICIAL repository of MMSplice is at gagneurlab/MMSplice_MTSplice.
Tip
The MultiMolecule team has confirmed that the provided model and checkpoints are producing the same intermediate representations as the original implementation.
The team releasing MMSplice did not write this model card for this model so this model card has been written by the MultiMolecule team.
Model Details¶
MMSplice is a modular neural network for predicting the effect of genetic variants on pre-mRNA splicing. It decomposes an exon together with its flanking introns into five regions and scores each region with an independent small convolutional sub-network. For variant-effect estimation, the model is run on both the reference and the alternative sequence, and the per-module score deltas are combined by a fixed linear model into a delta-logit-PSI splicing-effect score. Please refer to the Training Details section for more information on the training process.
Model Specification¶
| Num Modules | Num Parameters | FLOPs (M) | MACs (M) |
|---|---|---|---|
| 5 | 56,677 | 5.71 | 2.79 |
(FLOPs and MACs measured on a 220 bp exon-with-flanks input.)
Links¶
- Code: multimolecule.mmsplice
- Weights: multimolecule/mmsplice
- Data: Human splice-site and exon data with MPRA exon-skipping variant-effect measurements
- Paper: MMSplice: modular modeling improves the predictions of genetic variant effects on splicing
- Developed by: Jun Cheng, Thi Yen Duong Nguyen, Kamil J. Cygan, Muhammed Hasan Çelik, William G. Fairbrother, Žiga Avsec, Julien Gagneur
- Model type: Modular 1D CNN with five region-specific sub-networks for splice variant-effect prediction
- Original Repository: gagneurlab/MMSplice_MTSplice
Usage¶
The model file depends on the multimolecule library. You can install it using pip:
| Bash | |
|---|---|
Direct Use¶
Module Scores¶
Variant Effect¶
Interface¶
- Input length: exon sequence with 100 nt upstream intronic context + 100 nt downstream intronic context
- Tokenization: disable special tokens; the embedding layer maps
A/C/G/Tids to the four upstream channels and mapsN, padding, special, and unknown tokens to all-zero columns - Output (reference-only call,
input_ids/inputs_embeds): per-module score vectorlogitsof shape(batch_size, 5)
Variant Effect¶
- Reference + alternative call (also pass
alternative_input_ids/alternative_inputs_embeds): additionally returnsalternative_logitsand per-moduledelta_logits = alternative_logits - logits MmSpliceForSequencePrediction: requires both reference and alternative; returns the combined scalar delta-logit-PSI score of shape(batch_size, 1)
Training Details¶
MMSplice was trained as five independent modules on splicing data and the modules were combined with a linear model to predict variant effects on percent-spliced-in (PSI).
Training Data¶
The acceptor, donor, exon, and intron modules were trained on splice-site and exon data derived from human reference transcripts. The combining linear model was fit against a massively parallel reporter assay (MPRA) of exon-skipping variants.
Training Procedure¶
Pre-training¶
Each module was trained with a sequence-to-scalar objective scoring its region. The module scores (and their reference/alternative deltas) were then combined by a fixed linear model into a delta-logit-PSI splicing-effect score.
Citation¶
Note
The artifacts distributed in this repository are part of the MultiMolecule project. If you use MultiMolecule in your research, you must cite the MultiMolecule project as follows:
| BibTeX | |
|---|---|
Contact¶
Please use GitHub issues of MultiMolecule for any questions or comments on the model card.
Please contact the authors of the MMSplice paper for questions or comments on the paper/model.
License¶
This model implementation is licensed under the GNU Affero General Public License.
For additional terms and clarifications, please refer to our License FAQ.
| Text Only | |
|---|---|
multimolecule.models.mmsplice
¶
DnaTokenizer
¶
Bases: Tokenizer
Tokenizer for DNA sequences.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Alphabet | str | List[str] | None
|
alphabet to use for tokenization.
|
None
|
|
int
|
Size of kmer to tokenize. |
1
|
|
bool
|
Whether to tokenize into codons. |
False
|
|
bool
|
Whether to replace U with T. |
True
|
|
bool
|
Whether to convert input to uppercase. |
True
|
Examples:
Source code in multimolecule/tokenisers/dna/tokenization_dna.py
MmSpliceConfig
¶
Bases: PreTrainedConfig
This is the configuration class to store the configuration of a
MmSpliceModel. It is used to instantiate a MMSplice model according to the
specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a
configuration to that of the MMSplice
gagneurlab/MMSplice_MTSplice architecture.
Configuration objects inherit from PreTrainedConfig and can be used to
control the model outputs. Read the documentation from PreTrainedConfig
for more information.
MMSplice (Cheng et al. 2019, Genome Biology) is a modular model. Five
independent sub-networks (acceptor_intron, acceptor, exon,
donor, donor_intron) each score one region of the exon-with-flanking-
introns sequence. The five scalar scores form the module score vector. For
variant-effect estimation the model is run on the reference and the
alternative sequence and the per-module score deltas are combined by the
fixed upstream linear model into a delta-logit-PSI splicing-effect score.
The default module configurations replicate the upstream pretrained weights
exactly (see [MmSpliceModuleConfig]).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
int
|
Vocabulary size of the MMSplice model. Defines the number of feature
channels derived from the one-hot encoded |
4
|
|
dict | None
|
Per sub-module architecture configuration. A mapping from module name
to a [ |
None
|
|
dict | None
|
Alias used when loading serialized configs. Prefer |
None
|
|
int
|
Number of bp removed from the 3’ end of the acceptor intron (the part considered the acceptor site). |
6
|
|
int
|
Number of bp removed from the 5’ end of the donor intron (the part considered the donor site). |
6
|
|
int
|
Intron length consumed by the acceptor splice-site module. |
50
|
|
int
|
Exon flank length consumed by the acceptor splice-site module. |
3
|
|
int
|
Exon flank length consumed by the donor splice-site module. |
5
|
|
int
|
Intron length consumed by the donor splice-site module. |
13
|
|
int
|
Number of sequence-prediction labels. MMSplice emits one scalar delta-logit-PSI score, so this must be 1. |
1
|
|
HeadConfig | None
|
Loss configuration for [ |
None
|
Examples:
Source code in multimolecule/models/mmsplice/configuration_mmsplice.py
| Python | |
|---|---|
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 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | |
MmSpliceModuleConfig
¶
Bases: FlatDict
Configuration for a single MMSplice sub-module.
MMSplice is a modular model: each genomic region (the acceptor and donor
splice sites, the exon body, and the two flanking intron stubs) is scored by
an independent small network. The five upstream sub-networks
(gagneurlab/MMSplice_MTSplice)
do not share an architecture, so each is described by its own
MmSpliceModuleConfig.
Two architecture families exist:
conv(acceptor_intron,exon,donor_intron): a single length-preserving 1D convolution, optional batch-norm, ReLU, global average pooling over positions, then a linear projection to a scalar. Length-independent.dense(acceptor,donor): a fixed-length splice-site network. The region is one-hot encoded, optionally passed through one or more convolutions, flattened, and projected to a scalar with a stack of dense + batch-norm + ReLU blocks. A final sigmoid produces a probability that is converted to a logit score.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Either |
required | |
|
Fixed input length the module consumes. |
required | |
|
Output channels of the (first) convolution. |
required | |
|
Kernel size of the (first) convolution. |
required | |
|
Activation applied to the (first) convolution. |
required | |
|
Whether a batch-norm follows the (first) convolution. |
required | |
|
Whether global average pooling ignores all-zero input positions.
Upstream |
required | |
|
Output channels of the |
required | |
|
Output sizes of the dense blocks of a |
required | |
|
Whether a dropout is applied right after the flatten (before the
dense blocks). Upstream |
required | |
|
Dropout probability used by |
required | |
|
Epsilon of every batch-norm (upstream Keras default |
required |
Source code in multimolecule/models/mmsplice/configuration_mmsplice.py
MmSpliceForSequencePrediction
¶
Bases: MmSplicePreTrainedModel
MMSplice with a sequence-level prediction head.
The head consumes the per-module score deltas for a reference/alternative sequence pair and applies the fixed upstream linear combiner to produce the delta-logit-PSI splicing-effect score.
Examples:
Source code in multimolecule/models/mmsplice/modeling_mmsplice.py
MmSpliceModel
¶
Bases: MmSplicePreTrainedModel
The bare MMSplice modular backbone.
MMSplice scores the exon-with-flanking-introns sequence with five independent sub-networks. The backbone returns the per-module score vector. For variant effect prediction, pass both a reference and an alternative sequence; the backbone then also returns the per-module score deltas.
The five sub-networks do not share an architecture; each faithfully replicates the corresponding upstream gagneurlab/MMSplice_MTSplice Keras module (Cheng et al. 2019, Genome Biology).
Examples:
| Python Console Session | |
|---|---|
Source code in multimolecule/models/mmsplice/modeling_mmsplice.py
| Python | |
|---|---|
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 177 178 | |
MmSpliceModelOutput
dataclass
¶
Bases: ModelOutput
Base class for outputs of the MMSplice modular model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
`torch.FloatTensor` of shape `(batch_size, hidden_size)`
|
The per-module score vector for the (reference) input sequence. The
module order is |
None
|
|
`torch.FloatTensor` of shape `(batch_size, hidden_size)`, *optional*
|
The per-module score vector for the alternative sequence, returned when an alternative sequence is provided. |
None
|
|
`torch.FloatTensor` of shape `(batch_size, hidden_size)`, *optional*
|
|
None
|
Source code in multimolecule/models/mmsplice/modeling_mmsplice.py
MmSplicePreTrainedModel
¶
Bases: PreTrainedModel
An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained models.