diurnal.models.networks package
Submodules
diurnal.models.networks.cnn module
RNA secondary prediction models based on convolutional neural networks (CNN).
Author: Vincent Therrien (therrien.vincent.2@courrier.uqam.ca)
Affiliation: Département d’informatique, UQÀM
File creation date: July 2023
License: MIT
- class diurnal.models.networks.cnn.Dot_Bracket(n: int)[source]
Bases:
torch.nn.modules.module.ModuleSimple CNN network to predict RNA secondary structures.
- Input: RNA sequence one-hot encoding represented as a 2D array.
Example: [[0, 0, 0, 1], [1, 0, 0, 0], …]
- Output: RNA secondary structure represented as a matrix whose
element are vectors of 3 terms that correspond to the probability of each class. Example: [[0, 0, 1], [0, 1, 0], [1, 0, 0]] in which [0, 0, 1] represents a nucleotide paired to a downstream nucleotide, [0, 1, 0], an unpaired nucleotide, and [1, 0, 0], a nucleotide paired with an upstream nucleotide.
- forward(x)[source]
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class diurnal.models.networks.cnn.MatrixToMatrixAutoencoder1(n: int)[source]
Bases:
torch.nn.modules.module.ModuleNeural network used to predict a contact matrix.
Input: Scalar matrix of potential pairings.
Output: Blurry contact matrix.
- class diurnal.models.networks.cnn.RNA_CNN(n: int)[source]
Bases:
torch.nn.modules.module.ModuleNeural network used to determine the secondary structure of a sequence.
Input: RNA sequence one-hot encoding represented as a 3D array.
- Output: RNA secondary structure represented as a vector.
Example: [1, 1, 1, 0 , 0, 0, -1, -1, -1] in which 1 represents a nucleotide paired to a downstream nucleotide, 0, an unpaired nucleotide, and -1, a nucleotide paired with an upstream nucleotide.
- forward(x)[source]
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class diurnal.models.networks.cnn.RNA_CNN_family_aware(n: int, n_families: int)[source]
Bases:
torch.nn.modules.module.ModuleNeural network used to determine the secondary structure of a sequence by considering the
- Input: RNA sequence one-hot encoding represented as a 2D array.
Example: [[0, 0, 0, 1], [1, 0, 0, 0], …]
- Output: RNA secondary structure represented as a matrix whose element
are vectors of 3 terms that correspond to the probabiliy of each class. Example: [[0, 0, 1], [0, 1, 0], [1, 0, 0]] in which [0, 0, 1] represents a nucleotide paired to a downstream nucleotide, [0, 1, 0], an unpaired nucleotide, and [1, 0, 0], a nucleotide paired with an upstream nucleotide.
- class diurnal.models.networks.cnn.Shadow(n: int)[source]
Bases:
torch.nn.modules.module.ModuleNeural network used to determine the shadow of a sequence.
- Input: RNA sequence one-hot encoding represented as a 2D array.
Example: [[0, 0, 0, 1], [1, 0, 0, 0], …]
- Output: RNA secondary structure shadow represented as a vector.
Example: [1, 1, 1, 0 , 0, 0, 1, 1, 1] in which 1 represents a paired nucleotide and 0, and unpaired nucleotide.
- forward(x)[source]
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
diurnal.models.networks.mlp module
- class diurnal.models.networks.mlp.RNA_MLP_classes(n: int)[source]
Bases:
torch.nn.modules.module.ModuleNeural network used to determine the secondary structure of a sequence.
- Input: RNA sequence one-hot encoding represented as a 2D array.
Example: [[0, 0, 0, 1], [1, 0, 0, 0], …]
- Output: RNA secondary structure represented as a matrix whose element
are vectors of 3 terms that correspond to the probabiliy of each class. Example: [[0, 0, 1], [0, 1, 0], [1, 0, 0]] in which [0, 0, 1] represents a nucleotide paired to a downstream nucleotide, [0, 1, 0], an unpaired nucleotide, and [1, 0, 0], a nucleotide paired with an upstream nucleotide.
- forward(x, f)[source]
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class diurnal.models.networks.mlp.RNA_MLP_classifier(rna_length: int, n_families: int)[source]
Bases:
torch.nn.modules.module.ModuleNeural network used to classify RNA families from their primary structure.
- Input: RNA sequence one-hot encoding represented as a 2D array.
Example: [[0, 0, 0, 1], [1, 0, 0, 0], …]
Output: 1D vector representing a one-hot encoding of the family.
- forward(x)[source]
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.