module adabmDCA.dca
function get_seqid
get_seqid(s1: Tensor, s2: Optional[Tensor] = None) → Tensor
Returns a tensor containing the sequence identities between two sets of one-hot encoded sequences. - If s2 is provided, computes the sequence identity between the corresponding sequences in s1 and s2. - If s2 is a single sequence (L, q), it computes the sequence identities between the dataset s1 and s2. - If s2 is none, computes the sequence identity between s1 and a permutation of s1.
Args:
s1(torch.Tensor): One-hot encoded sequence dataset 1 of shape (batch_size, L, q) or (L, q).s2(Optional[torch.Tensor]): One-hot encoded sequence dataset 2 of shape (batch_size, L, q) or (L, q). Defaults to None.
Returns:
torch.Tensor: Tensor of sequence identities.
function get_seqid_stats
get_seqid_stats(s1: Tensor, s2: Optional[Tensor] = None) → Tuple[Tensor, Tensor]
- If s2 is provided, computes the mean and the standard deviation of the mean sequence identity between two sets of one-hot encoded sequences.
- If s2 is a single sequence (L, q), it computes the mean and the standard deviation of the mean sequence identity between the dataset s1 and s2.
- If s2 is none, computes the mean and the standard deviation of the mean of the sequence identity between s1 and a permutation of s1.
Args:
s1(torch.Tensor): One-hot encoded sequence dataset 1 of shape (batch_size, L, q) or (L, q).s2(Optional[torch.Tensor]): One-hot encoded sequence dataset 2 of shape (batch_size, L, q) or (L, q). Defaults to None.
Returns: Tuple[torch.Tensor, torch.Tensor]: (torch.Tensor) Mean sequence identity (torch.Tensor) Standard deviation of the mean sequence identity.
function set_zerosum_gauge
set_zerosum_gauge(params: Dict[str, Tensor]) → Dict[str, Tensor]
Sets the zero-sum gauge on the coupling matrix.
Args:
params(Dict[str, torch.Tensor]): Parameters of the model.
Returns:
Dict[str, torch.Tensor]: New dictionary with modified coupling matrix."bias": torch.Tensor of shape (L, q)"coupling_matrix": torch.Tensor of shape (L, q, L, q)
function get_contact_map
get_contact_map(params: Dict[str, Tensor], tokens: str) → ndarray
Computes the contact map from the model coupling matrix.
Args:
params(Dict[str, torch.Tensor]): Model parameters. Should contain: - "coupling_matrix": torch.Tensor of shape (L, q, L, q) - "bias": torch.Tensor of shape (L, q)tokens(str): Alphabet to be used.
Returns:
np.ndarray: Contact map.
function get_mf_contact_map
get_mf_contact_map(
data: Tensor,
tokens: str,
weights: Optional[Tensor] = None
) → ndarray
Computes the contact map using mean-field approximation from the data.
Args:
data(torch.Tensor): Input one-hot data tensor.tokens(str): Alphabet to be used.weights(Optional[torch.Tensor]): Weights for the data points. Defaults to None.
Returns:
np.ndarray: Contact map.
This file was automatically generated via lazydocs.