当前位置: 首页>>代码示例>>C++>>正文


C++ Chain::countResidues方法代码示例

本文整理汇总了C++中Chain::countResidues方法的典型用法代码示例。如果您正苦于以下问题:C++ Chain::countResidues方法的具体用法?C++ Chain::countResidues怎么用?C++ Chain::countResidues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Chain的用法示例。


在下文中一共展示了Chain::countResidues方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: optimizeCapPosition

void PeptideCapProcessor::optimizeCapPosition(Chain& chain, bool start)
{
    Vector3 translation;
    Atom* axis   = NULL;
    Residue* cap = NULL;
    std::vector<Atom*> a;
    std::vector<Atom*> b;

    Size nr = chain.countResidues();

    // cap at the beginning of a peptide
    if (start)
    {
        // put ACE-C to the center
        for (AtomIterator it = chain.getResidue(1)->beginAtom(); +it; ++it)
        {
            if (it->getName() == "N")
            {
                translation = it->getPosition();
            }

            b.push_back(&*it);
        }

        cap = chain.getResidue(0);
        for (AtomIterator it = cap->beginAtom(); +it; ++it)
        {
            a.push_back(&*it);
            if (it->getName() == "C")
            {
            axis = &*it;
        }
    }
}
//cap at the end of a peptide
else
{
    for (AtomIterator it = chain.getResidue(nr-2)->beginAtom(); +it; ++it)
    {
        if (it->getName() == "C")
        {
            translation = it->getPosition();
        }

        b.push_back(&*it);
    }

    cap = chain.getResidue(nr-1);
    for (AtomIterator it = cap->beginAtom(); +it; ++it)
    {
        a.push_back(&*it);
        if (it->getName() == "N")
        {
            axis = &*it;
        }
    }
}

//translate the anchor to origin
TranslationProcessor tlp;
tlp.setTranslation(translation*-1.0);
chain.apply(tlp);

//try all torsions
float largest_distance = 0.0;
float tmp_distance = 0.0;
float torsion      = 0.0;
float step         = 2.0;

TransformationProcessor tfp;
Matrix4x4 m;
m.setRotation( Angle(step, false), axis->getPosition());
tfp.setTransformation(m);

for (Position r = step; r <= 360; r+=step)
{
    cap->apply(tfp);

    tmp_distance = computeDistance(a,b);

    if (largest_distance < tmp_distance)
    {
        largest_distance = tmp_distance;
        torsion = r;
    }
}

//apply best rotation angle
m.setRotation( Angle(torsion, false), axis->getPosition());
tfp.setTransformation(m);
cap->apply(tfp);

//now translate the protein back
tlp.setTranslation(translation);
chain.apply(tlp);
}
开发者ID:pbrach,项目名称:ball,代码行数:96,代码来源:peptideCapProcessor.C

示例2: operator


//.........这里部分代码省略.........

    //insert ACE-Cap into chain
    chain.insertBefore(*ace_residue,*chain.getResidue(0));

    //Add Bond between ACE-Cap and Helix
    n_atom = chain.getResidue(1)->beginAtom();
    while (+n_atom)
    {
        if (n_atom->getName() == "N")
        {
            Bond* new_bond = cAtom->createBond(*n_atom);
            new_bond->setOrder(Bond::ORDER__SINGLE);
            break;
        }
        ++n_atom;
    }

    //back translation
    tlp.setTranslation(nAtom);
    chain.apply(tlp);

    //remove old hydrogens
    for (Position a = 0; a < to_remove.size(); ++a)
    {
        delete to_remove[a];
    }

    //torsional optimzation of ACE
    optimizeCapPosition(chain, true);
}

//##################################################################

add_cap = (chain.getResidue(chain.countResidues()-1)->getName() != "NME");

if (add_cap)
{
    //create NME-Cap
    nme_residue = new Residue("NME");
    nme_residue->setProperty(Residue::PROPERTY__AMINO_ACID);
    nme_residue->apply(reconstruct);
    nme_residue->apply(fragment_db.normalize_names);
    nme_residue->apply(fragment_db.build_bonds);

    Residue* last_residue = chain.getResidue(chain.countResidues()-1);

    //####################################################

    Atom* nAtom = NULL;
    Atom* ch3Atom = NULL;
    Atom* hAtom = NULL;

    AtomIterator nme_atom = nme_residue->beginAtom();
    while (+nme_atom)
    {
        if (nme_atom->getName() == "N")
            nAtom = &*nme_atom;
        else if (nme_atom->getName() == "CH3")
            ch3Atom = &*nme_atom;
        else if (nme_atom->getName() == "H")
            hAtom = &*nme_atom;
        ++nme_atom;
    }

    Vector3 anchor((  (hAtom->getPosition()-nAtom->getPosition()).normalize()
                      + (ch3Atom->getPosition()-nAtom->getPosition()).normalize()).normalize()*-1.335);
开发者ID:pbrach,项目名称:ball,代码行数:67,代码来源:peptideCapProcessor.C


注:本文中的Chain::countResidues方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。