Skip to content

Commit

Permalink
Filter directly to relevant atoms
Browse files Browse the repository at this point in the history
  • Loading branch information
padix-key committed Apr 1, 2024
1 parent f8a6f70 commit ea93a00
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions doc/examples/scripts/structure/glycan_visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,13 @@

pdbx_file = pdbx.BinaryCIFFile.read(rcsb.fetch(PDB_ID, "bcif"))
structure = pdbx.get_structure(pdbx_file, model=1, include_bonds=True)
# We are not interested in water, ions, etc.
structure = structure[
struc.filter_carbohydrates(structure) | struc.filter_amino_acids(structure)
]

# Create masks identifying whether an atom is part of a glycan...
is_glycan = np.isin(structure.res_name, list(SACCHARIDE_NAMES.keys()))
# Recreate masks after atom selection for later use
is_glycan = struc.filter_carbohydrates(structure)
# ... or part of an amino acid
is_amino_acid = struc.filter_amino_acids(structure)

Expand All @@ -196,8 +200,7 @@
# respective residue later.
# The residue ID is not sufficient here, because the same residue ID
# might appear in conjunction with different chain IDs.

########################################################################
#
# To determine which residues (including the saccharides) are connected
# with each other, we will use a graph representation:
# The nodes are residues, the edges indicate which residues are
Expand Down Expand Up @@ -237,7 +240,6 @@
########################################################################
# So far, so good. We can already see glycans (red) on the long peptide
# chain (blue).
# The surrounding single nodes belong to water, ions etc.
# In the final plot only the glycans should be highlighted.
# For this purpose the edges between all non-saccharides will be
# removed.
Expand Down

0 comments on commit ea93a00

Please sign in to comment.