📄 molecule.cpp
字号:
GetAtom(atom, parentSet->showHideManager->OverlayConfEnsembles(), true); if (!atomCoord) return gray; AtomStyle style; if (!parentSet->styleManager->GetAtomStyle(residue, atom, atomCoord, &style)) return gray; return style.color;}int Molecule::GetAlphaCoords(int nResidues, const int *seqIndexes, const Vector * *coords) const{ const StructureObject *object; if (!GetParentOfType(&object)) return false; if (object->coordSets.size() != 1) { ERRORMSG("Can't align structures with multiple CoordSets"); return -1; } int nCoords = 0; for (int i=0; i<nResidues; ++i) { int rID = seqIndexes[i] + 1; // residueIDs start at 1 ResidueMap::const_iterator r = residues.find(rID); if (r == residues.end()) { ERRORMSG("Can't find residueID " << rID << " in " << identifier->pdbID << " chain '" << (char) identifier->pdbChain << "'"); return -1; } int aID = (r->second->alphaID); if (aID == Residue::NO_ALPHA_ID) { WARNINGMSG("No alpha atom in residueID " << rID << " from " << identifier->pdbID << " chain '" << (char) identifier->pdbChain << "'"); coords[i] = NULL; continue; } AtomPntr atom(id, rID, aID); const AtomCoord* atomCoord = object->coordSets.front()->atomSet->GetAtom(atom); if (!atomCoord) { WARNINGMSG("Can't get AtomCoord for (m" << id << ",r" << rID << ",a" << aID << ")"); coords[i] = NULL; continue; } coords[i] = &(atomCoord->site); ++nCoords; } return nCoords;}bool Molecule::DrawAllWithTerminiLabels(const AtomSet *atomSet) const{ // draw regular objects if (!DrawAll(atomSet)) return false; // add termini labels if ((IsProtein() || IsNucleotide()) && NResidues() >= 2 && parentSet->showHideManager->IsVisible(this)) { const StyleSettings& settings = parentSet->styleManager->GetGlobalStyle(); if ((IsProtein() && settings.proteinLabels.terminiOn) || (IsNucleotide() && settings.nucleotideLabels.terminiOn)) { // try to color labels to contrast with background static const Vector white(1,1,1), black(0,0,0); const Vector& labelColor = Colors::IsLightColor(settings.backgroundColor) ? black : white; // do start (N or 5') and end (C or 3') labels for (int startTerminus=1; startTerminus>=0; --startTerminus) { // determine color and location - assumes sequential residue id's (from 1) const Vector *alphaPos = NULL, *prevPos = NULL; int res = startTerminus ? 1 : residues.size(), resEnd = startTerminus ? residues.size() : 1, resInc = startTerminus ? 1 : -1; // find coordinates of two terminal alpha atoms const Residue *termRes = NULL; for (; res!=resEnd; res+=resInc) { const Residue *residue = residues.find(res)->second; if (residue->alphaID != Residue::NO_ALPHA_ID) { AtomPntr ap(id, res, residue->alphaID); const AtomCoord *atom = atomSet->GetAtom(ap, parentSet->showHideManager->OverlayConfEnsembles(), true); if (atom) { if (!alphaPos) { alphaPos = &(atom->site); termRes = residue; } else if (!prevPos) { prevPos = &(atom->site); break; } } } } if (!(alphaPos && prevPos)) { WARNINGMSG("Molecule::DrawAllWithTerminiLabels() - " << "can't get two terminal alpha coords"); continue; } if (!parentSet->showHideManager->IsVisible(termRes)) continue; Vector labelPosition = *alphaPos + 0.5 * (*alphaPos - *prevPos); // determine label text CNcbiOstrstream oss; if (IsProtein()) { if (startTerminus) oss << "N"; else oss << "C"; } else { if (startTerminus) oss << "5'"; else oss << "3'"; } if (identifier->pdbChain != MoleculeIdentifier::VALUE_NOT_SET && identifier->pdbChain != ' ') oss << " (" << (char) identifier->pdbChain << ')'; oss << '\0'; // draw label string labelText = oss.str(); delete oss.str(); parentSet->renderer->DrawLabel(labelText, labelPosition, labelColor); } } } return true;}END_SCOPE(Cn3D)/** ---------------------------------------------------------------------------* $Log: molecule.cpp,v $* Revision 1000.2 2004/06/01 18:28:41 gouriano* PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.43** Revision 1.43 2004/05/21 21:41:39 gorelenk* Added PCH ncbi_pch.hpp** Revision 1.42 2004/05/20 18:49:21 thiessen* don't do structure realignment if < 3 coords present** Revision 1.41 2004/03/15 17:34:03 thiessen* prefer prefix vs. postfix ++/-- operators** Revision 1.40 2004/02/19 17:04:57 thiessen* remove cn3d/ from include paths; add pragma to disable annoying msvc warning** Revision 1.39 2003/06/21 08:18:58 thiessen* show all atoms with coordinates, even if not in all coord sets** Revision 1.38 2003/02/03 19:20:04 thiessen* format changes: move CVS Log to bottom of file, remove std:: from .cpp files, and use new diagnostic macros** Revision 1.37 2002/04/19 17:34:03 thiessen* fix for alpha-only nucleotides** Revision 1.36 2002/02/01 13:55:31 thiessen* fix labeling bug when domain hidden** Revision 1.35 2002/02/01 00:41:21 thiessen* tweaks** Revision 1.34 2002/01/24 20:08:16 thiessen* fix local id problem** Revision 1.33 2001/12/12 14:04:13 thiessen* add missing object headers after object loader change** Revision 1.32 2001/10/16 21:49:07 thiessen* restructure MultiTextDialog; allow virtual bonds for alpha-only PDB's** Revision 1.31 2001/08/24 00:41:35 thiessen* tweak conservation colors and opengl font handling** Revision 1.30 2001/08/21 01:10:45 thiessen* add labeling** Revision 1.29 2001/08/09 19:07:13 thiessen* add temperature and hydrophobicity coloring** Revision 1.28 2001/07/16 15:35:37 thiessen* fix unaligned chain identifier ommission** Revision 1.27 2001/06/21 02:02:33 thiessen* major update to molecule identification and highlighting ; add toggle highlight (via alt)** Revision 1.26 2001/04/04 00:27:14 thiessen* major update - add merging, threader GUI controls** Revision 1.25 2001/03/23 23:31:56 thiessen* keep atom info around even if coords not all present; mainly for disulfide parsing in virtual models** Revision 1.24 2001/03/23 04:18:52 thiessen* parse and display disulfides** Revision 1.23 2001/02/09 20:17:32 thiessen* ignore atoms w/o alpha when doing structure realignment** Revision 1.22 2001/02/08 23:01:50 thiessen* hook up C-toolkit stuff for threading; working PSSM calculation** Revision 1.21 2000/12/15 15:51:47 thiessen* show/hide system installed** Revision 1.20 2000/12/01 19:35:57 thiessen* better domain assignment; basic show/hide mechanism** Revision 1.19 2000/11/30 15:49:39 thiessen* add show/hide rows; unpack sec. struc. and domain features** Revision 1.18 2000/11/13 18:06:53 thiessen* working structure re-superpositioning** Revision 1.17 2000/11/11 21:15:54 thiessen* create Seq-annot from BlockMultipleAlignment** Revision 1.16 2000/09/15 19:24:22 thiessen* allow repeated structures w/o different local id** Revision 1.15 2000/09/11 22:57:32 thiessen* working highlighting** Revision 1.14 2000/09/08 20:16:55 thiessen* working dynamic alignment views** Revision 1.13 2000/09/03 18:46:48 thiessen* working generalized sequence viewer** Revision 1.12 2000/08/28 23:47:18 thiessen* functional denseg and dendiag alignment parsing** Revision 1.11 2000/08/28 18:52:42 thiessen* start unpacking alignments** Revision 1.10 2000/08/27 18:52:21 thiessen* extract sequence information** Revision 1.9 2000/08/17 14:24:05 thiessen* added working StyleManager** Revision 1.8 2000/08/11 12:58:31 thiessen* added worm; get 3d-object coords from asn1** Revision 1.7 2000/08/04 22:49:03 thiessen* add backbone atom classification and selection feedback mechanism** Revision 1.6 2000/08/03 15:12:23 thiessen* add skeleton of style and show/hide managers** Revision 1.5 2000/07/27 13:30:51 thiessen* remove 'using namespace ...' from all headers** Revision 1.4 2000/07/18 02:41:33 thiessen* fix bug in virtual bonds and altConfs** Revision 1.3 2000/07/17 04:20:49 thiessen* now does correct structure alignment transformation** Revision 1.2 2000/07/16 23:19:11 thiessen* redo of drawing system** Revision 1.1 2000/07/11 13:45:30 thiessen* add modules to parse chemical graph; many improvements**/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -