liveBook · Manning

Contact map

As explained in Build AI Drug Discovery Pipelines

A contact map is a representation indicating which pairs of residues or atoms in a biomolecule are spatially close or interacting.

A contact map records which parts of a biomolecule are spatially close. For a protein of length L, a residue contact map is an L × L binary matrix: entry C[i, j] is 1 when residues i and j are in contact and 0 otherwise. It compresses information about the folded protein into a form suitable for computation. section 11.3.1

One contact definition measures the distance between residues’ C-beta atoms, using C-alpha for glycine, and marks pairs within 8 angstroms. This empirically chosen cutoff captures potentially interacting residues without making the map overly dense. A contact indicates proximity, not proof of a specific interaction. Rotating or moving the protein does not change its contact map. section 11.3.1

Figure 11.5 Transforming a Protein's 3D Structure into a 2D Graph. Converting a protein's spatial information into a graph representation. (a) A simplified 3D protein structure with dashed lines connecting amino acid residues that are in close spatial proximity (a 'contact'). (b) Spatial information is translated into a contact map, which is a 2D matrix. A point at (i, j) is marked if residue i and residue j are in contact, serving as an adjacency matrix for the graph. (c) The contact map is used to construct a graph where the amino acid residues are the nodes and the contacts are the edges. This graph captures the key residue interactions in a format that is invariant to the protein's rotation and translation in 3D space.

Follow the conversion from a folded protein to a contact matrix and then to a residue graph. section 11.3.1

The contact matrix can serve as a graph’s adjacency matrix: residues become nodes, and contacts become edges. A graph neural network can use this representation when predicting drug–target affinity, alongside features describing each residue. section 11.3.1 section 11.3

Listing 11.3 Construct Protein Graph from Contact Map and Sequence
def target_to_graph(target_key, target_sequence, contact_dir, aln_dir):
    target_size = len(target_sequence)
    contact_file = os.path.join(contact_dir, target_key + '.npy')
    contact_map = np.load(contact_file)
    assert contact_map.shape[0] == target_size
    contact_map += np.eye(    #A
        contact_map.shape[0]    #A
    )    #A
 
    threshold = CONFIG['contact_map_threshold']    #B
    index_row, index_col = np.where(contact_map >= threshold)
    target_edge_index = []
    for i, j in zip(index_row, index_col):
        target_edge_index.append([i, j])
 
    aln_file = os.path.join(aln_dir, target_key + '.aln')
    target_feature = compute_target_feature(    #C
        aln_file, target_sequence    #C
    )   #C
    target_edge_index = np.array(    #C
        target_edge_index    #C
    )    #D
 
    return target_size, target_feature, target_edge_index

The graph-construction listing loads a contact map, adds self-connections, and selects entries at or above a configured threshold as edges; it also computes residue features. section 11.3.1

A map can be derived by thresholding distances in an experimental or predicted structure. When a structure is unavailable, a contact predictor can instead use sequence information. Multiple sequence alignments collect related sequences, where correlated mutations can provide evidence of spatial contacts; Pconsc4 uses this evolutionary signal to predict a map. section 11.3 section 11.3.1 section 11.8

Predicted maps are imperfect. Experimental structures also capture particular conformations and conditions and may omit flexible or ligand-dependent regions. The representation therefore trades structural detail against the availability and quality of its input data. section 11.3 section 11.8

Contacts in protein language models

Some ESM-2 attention heads track residues that are far apart in sequence but close in the folded protein. Logistic regression on these attention maps can recover a contact map reasonably well, suggesting that sequence-trained representations contain structural information. section 12.3.5

How Build AI Drug Discovery Pipelines covers it

How deep it goes
Defines a distance-based binary matrix and demonstrates graph construction, while noting the limits of predicted and experimental structural data.
Examples
Illustrates an 8-angstrom residue cutoff, a protein graph construction listing, and contact recovery from ESM-2 attention maps.
What you can do after
Evaluate how contact maps encode protein proximity and support residue-graph construction, including the limitations of their structural inputs.
How it connects
Connects contact maps to adjacency matrices, graph neural networks, multiple sequence alignments, evolutionary coupling, and protein language model attention.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build AI Drug Discovery Pipelines. The section links point to the parts of the book it draws on.