module adabmDCA.api.contacts
High-level contact-prediction operations.
function predict_contacts
predict_contacts(
model: 'DCAModel | str | Path | None' = None,
fasta_path: 'AlignmentInput | None' = None,
alphabet: 'str | None' = None,
pseudocount: 'float' = 0.5,
device: 'str' = 'auto',
dtype: 'str' = 'float32'
) → ContactMapResult
Predict residue contacts from a DCA model or directly from an alignment.
With model, scores are the average-product-corrected (APC) Frobenius norms of the zero-sum-gauge couplings, excluding the gap state. With fasta_path, a mean-field DCA model is inferred from the reweighted alignment and scored the same way. Larger scores mean likelier contacts.
Args:
model: ADCAModel, or a path to a parameter file or PTT archive.fasta_path: Aligned sequences (path,Alignmentor sequence strings) for mean-field prediction. Provide exactly one ofmodelandfasta_path.alphabet:"protein","rna","dna"or an ordered custom token string, for the alignment or a text parameter file.Nonereads it from a PTT archive and otherwise means"protein". Ignored whenmodelis already aDCAModel. Must contain"-".pseudocount: Mean-field only: pseudocount in[0, 1]that regularizes the covariance matrix before inversion.device:"auto"(CUDA when available, else CPU),"cpu","cuda"or"mps". Ignored for an in-memory model.dtype:"float32"or"float64"for loaded parameters. Ignored for an in-memory model.
Returns:
A ContactMapResult whose scores is a symmetric (L, L) array with a zero diagonal.
Raises:
InputValidationError: If both or neither ofmodelandfasta_pathare given, the alphabet lacks the"-"gap token, or the pseudocount is outside[0, 1].
Example:
result = predict_contacts(model="params.dat.gz", alphabet="rna")
top = result.to_long_dataframe().nlargest(20, "score") # 0-based positions
function compute_contact_map
compute_contact_map(
model: 'DCAModel | str | Path | None' = None,
fasta_path: 'AlignmentInput | None' = None,
alphabet: 'str | None' = None,
pseudocount: 'float' = 0.5,
device: 'str' = 'auto',
dtype: 'str' = 'float32'
) → ndarray
Return only the (L, L) contact-score matrix of predict_contacts.
Takes the same arguments as predict_contacts; see it for details.
Returns: A symmetric NumPy array of APC-corrected scores with a zero diagonal.
This file was automatically generated via lazydocs.