Пример #1
0
String SILACLabeler::getUnmodifiedSequence_(const Feature& feature, const String& arginine_label, const String& lysine_label) const
{
    String unmodified_sequence = "";
    for (AASequence::ConstIterator residue = feature.getPeptideIdentifications()[0].getHits()[0].getSequence().begin();
            residue != feature.getPeptideIdentifications()[0].getHits()[0].getSequence().end();
            ++residue)
    {
        if (*residue == 'R' && residue->getModification() == arginine_label)
        {
            unmodified_sequence.append("R");
        }
        else if (*residue == 'K' && residue->getModification() == lysine_label)
        {
            unmodified_sequence.append("K");
        }
        else
        {
            unmodified_sequence.append(residue->getOneLetterCode());
        }
    }
    return unmodified_sequence;
}
Пример #2
0
bool ModificationDefinitionsSet::isCompatible(const AASequence & peptide) const
{
    set<String> var_names(getVariableModificationNames()), fixed_names(getFixedModificationNames());
    // no modifications present and needed
    if (fixed_names.empty() && !peptide.isModified())
    {
        return true;
    }

    // check whether the fixed modifications are fulfilled
    if (!fixed_names.empty())
    {
        for (set<String>::const_iterator it1 = fixed_names.begin(); it1 != fixed_names.end(); ++it1)
        {
            String origin = ModificationsDB::getInstance()->getModification(*it1).getOrigin();
            // only single 1lc amino acids are allowed
            if (origin.size() != 1)
            {
                continue;
            }
            for (AASequence::ConstIterator it2 = peptide.begin(); it2 != peptide.end(); ++it2)
            {
                if (origin == it2->getOneLetterCode())
                {
                    // check whether the residue is modified (has to be)
                    if (!it2->isModified())
                    {
                        return false;
                    }
                    // check whether the modification is the same
                    if (ModificationsDB::getInstance()->getModification(*it1).getId() != it2->getModification())
                    {
                        return false;
                    }
                }
            }
        }
    }

    // check wether other modifications than the variable are present
    for (AASequence::ConstIterator it = peptide.begin(); it != peptide.end(); ++it)
    {
        if (it->isModified())
        {
            String mod = ModificationsDB::getInstance()->getModification(it->getOneLetterCode(), it->getModification(), ResidueModification::ANYWHERE).getFullId();
            if (var_names.find(mod) == var_names.end() &&
                    fixed_names.find(mod) == fixed_names.end())
            {
                return false;
            }
        }
    }

    if (peptide.hasNTerminalModification())
    {
        String mod = ModificationsDB::getInstance()->getTerminalModification(peptide.getNTerminalModification(), ResidueModification::N_TERM).getFullId();
        if (var_names.find(mod) == var_names.end() &&
                fixed_names.find(mod) == fixed_names.end())
        {
            return false;
        }
    }

    if (peptide.hasCTerminalModification())
    {
        String mod = ModificationsDB::getInstance()->getTerminalModification(peptide.getCTerminalModification(), ResidueModification::C_TERM).getFullId();
        if (var_names.find(mod) == var_names.end() &&
                fixed_names.find(mod) == fixed_names.end())
        {
            return false;
        }
    }

    return true;
}