diurnal.models.networks package

Submodules

diurnal.models.networks.cnn module

RNA secondary prediction models based on convolutional neural networks (CNN).

class diurnal.models.networks.cnn.Dot_Bracket(n: int)[source]

Bases: torch.nn.modules.module.Module

Simple 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 Module instance 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.Module

Neural network used to predict a contact matrix.

Input: Scalar matrix of potential pairings.

Output: Blurry contact matrix.

forward(input: torch._VariableFunctionsClass.tensor) torch._VariableFunctionsClass.tensor[source]

Forward propagation.

Parameters

input – Potential pairing matrix.

Returns: Blurry distance matrix.

class diurnal.models.networks.cnn.RNA_CNN(n: int)[source]

Bases: torch.nn.modules.module.Module

Neural 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 Module instance 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.Module

Neural 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.

forward(x, family)[source]

x: [[0, 1, 0, 0], …] 2 X 512 family: [0, 0, 0, 1, 0, 0] 1 X 512

class diurnal.models.networks.cnn.Shadow(n: int)[source]

Bases: torch.nn.modules.module.Module

Neural 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 Module instance 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.Module

Neural 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 Module instance 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.Module

Neural 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 Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

Module contents