Skip to content

Commit

Permalink
Add support for reading DNA / RNA backbones
Browse files Browse the repository at this point in the history
Some render types need tweaking (e.g., cartoon) but it works

Signed-off-by: Geoff Hutchison <geoff.hutchison@gmail.com>
  • Loading branch information
ghutchis committed Nov 30, 2024
1 parent 1096cab commit 2ace4ec
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions avogadro/qtplugins/cartoons/cartoons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ map<size_t, AtomsPairList> Cartoons::getBackboneByResidues(
{
const auto& graph = molecule.graph();
map<size_t, AtomsPairList> result;
map<size_t, BackboneResidue> previousCA;
map<size_t, BackboneResidue> previousAtom;
for (const auto& residue : molecule.residues()) {
if (!residue.isHeterogen()) {
Atom caAtom = residue.getAtomByName("CA");
Expand All @@ -212,8 +212,18 @@ map<size_t, AtomsPairList> Cartoons::getBackboneByResidues(
m_layerManager.atomEnabled(layer, oAtom.index())) {
// get the group ID and check if it's initialized in the map
size_t group = graph.getConnectedID(caAtom.index());
addBackBone(result, previousCA, caAtom, residue.color(), group,
addBackBone(result, previousAtom, caAtom, residue.color(), group,
residue.secondaryStructure());
} else { // maybe DNA
Atom c3Atom = residue.getAtomByName("C3'");
Atom o3Atom = residue.getAtomByName("O3'");
if (c3Atom.isValid() && o3Atom.isValid() &&
m_layerManager.atomEnabled(layer, c3Atom.index()) &&
m_layerManager.atomEnabled(layer, o3Atom.index())) {
size_t group = graph.getConnectedID(c3Atom.index());
addBackBone(result, previousAtom, c3Atom, residue.color(), group,
residue.secondaryStructure());
}
}
}
}
Expand Down

0 comments on commit 2ace4ec

Please sign in to comment.