bool EnzymaticDigestionLogModel::isCleavageSite_( const AASequence& protein, const AASequence::ConstIterator& iterator) const { if (enzyme_.getName() != "Trypsin") // no cleavage { throw Exception::InvalidParameter(__FILE__, __LINE__, __PRETTY_FUNCTION__, String("EnzymaticDigestionLogModel: enzyme '") + enzyme_.getName() + " does not support logModel!"); } else { if ((!enzyme_.getRegEx().hasSubstring(iterator->getOneLetterCode())) || *iterator == 'P') // wait for R or K { return false; } SignedSize pos = distance(AASequence::ConstIterator(protein.begin()), iterator) - 4; // start position in sequence double score_cleave = 0, score_missed = 0; for (SignedSize i = 0; i < 9; ++i) { if ((pos + i >= 0) && (pos + i < (SignedSize)protein.size())) { BindingSite_ bs(i, protein[pos + i].getOneLetterCode()); Map<BindingSite_, CleavageModel_>::const_iterator pos_it = model_data_.find(bs); if (pos_it != model_data_.end()) // no data for non-std. amino acids { score_cleave += pos_it->second.p_cleave; score_missed += pos_it->second.p_miss; } } } return score_missed - score_cleave > log_model_threshold_; } }
String CompNovoIdentificationBase::getModifiedStringFromAASequence_(const AASequence & sequence) { String seq; for (AASequence::ConstIterator it = sequence.begin(); it != sequence.end(); ++it) { if (residue_to_name_.has(&*it)) { seq += residue_to_name_[&*it]; } else { seq += it->getOneLetterCode(); } } return seq; }
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; }
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; }