本文整理汇总了C++中AASequence类的典型用法代码示例。如果您正苦于以下问题:C++ AASequence类的具体用法?C++ AASequence怎么用?C++ AASequence使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AASequence类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getWeight
double WeightWrapper::getWeight(const AASequence & aa) const
{
if (weight_mode_ == WeightWrapper::MONO)
return aa.getMonoWeight();
else
return aa.getAverageWeight();
}
示例2: main
int main()
{
// construct a AASequence object, query a residue
// and output some of its properties
AASequence aas = AASequence::fromString("DECIANGER");
cout << aas[2].getName() << " "
<< aas[2].getFormula().toString() << " "
<< aas[2].getModificationName() << " "
<< aas[2].getMonoWeight() << endl;
// find a modification in ModificationsDB
// and output some of its properties
// getInstance() returns a pointer to a ModsDB instance
ResidueModification mod = ModificationsDB::getInstance()->getModification("Carbamidomethyl (C)");
cout << mod.getOrigin() << " "
<< mod.getFullId() << " "
<< mod.getDiffMonoMass() << " "
<< mod.getMonoMass() << endl;
// set the modification on a residue of a peptide
// and output some of its properties (the formula and mass have changed)
// in this case ModificationsDB is used in the background
// to relate the name of the mod to its attributes
aas.setModification(2, "Carbamidomethyl (C)");
cout << aas[2].getName() << " "
<< aas[2].getFormula().toString() << " "
<< aas[2].getModificationName() << " "
<< aas[2].getMonoWeight() << endl;
return 0;
} //end of main
示例3: mergeFeatures_
Feature ICPLLabeler::mergeFeatures_(Feature& feature_to_merge, const AASequence& labeled_feature_sequence, Map<String, Feature>& feature_index) const
{
// merge with feature from first map (if it exists)
if (feature_index.count(labeled_feature_sequence.toString()) != 0)
{
// we only merge abundance and use feature from first map
Feature new_f = feature_index[labeled_feature_sequence.toString()];
new_f.setMetaValue(getChannelIntensityName(1), new_f.getIntensity());
new_f.setMetaValue(getChannelIntensityName(2), feature_to_merge.getIntensity());
new_f.setIntensity(new_f.getIntensity() + feature_to_merge.getIntensity());
mergeProteinAccessions_(new_f, feature_to_merge);
// remove feature from index
feature_index.erase(labeled_feature_sequence.toString());
return new_f;
}
else
{
// simply add feature from second channel, since we have no corresponding feature in the first channel
return feature_to_merge;
}
}
示例4: getUnmodifiedAASequence_
String ICPLLabeler::getUnmodifiedAASequence_(const Feature& feature, const String& label) const
{
AASequence unmodified = feature.getPeptideIdentifications()[0].getHits()[0].getSequence();
if (unmodified.getNTerminalModification() == label)
{
unmodified.setNTerminalModification(""); // remove terminal modification, if it is the channel specific one
}
return unmodified.toString();
}
示例5: getModifiedStringFromAASequence_
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;
}
示例6: getModifString_
String IBSpectraFile::getModifString_(const AASequence& sequence)
{
String modif = sequence.getNTerminalModification();
for (AASequence::ConstIterator aa_it = sequence.begin();
aa_it != sequence.end();
++aa_it)
{
modif += ":" + aa_it->getModification();
}
if (sequence.getCTerminalModification() != "")
{
modif += ":" + sequence.getCTerminalModification();
}
return modif;
}
示例7: digest
void EnzymaticDigestion::digest(const AASequence& protein, vector<AASequence>& output) const
{
// initialization
output.clear();
// naive cleavage sites
Size missed_cleavages = missed_cleavages_;
std::vector<Size> pep_positions = tokenize_(protein.toUnmodifiedString());
Size count = pep_positions.size();
Size begin = pep_positions[0];
for (Size i = 1; i < count; ++i)
{
output.push_back(protein.getSubsequence(begin, pep_positions[i] - begin));
begin = pep_positions[i];
}
output.push_back(protein.getSubsequence(begin, protein.size() - begin));
// missed cleavages
if (pep_positions.size() > 0 && missed_cleavages_ != 0) // there is at least one cleavage site!
{
// generate fragments with missed cleavages
for (Size i = 1; ((i <= missed_cleavages) && (count > i)); ++i)
{
begin = pep_positions[0];
for (Size j = 1; j < count - i; ++j)
{
output.push_back(protein.getSubsequence(begin, pep_positions[j + i] - begin));
begin = pep_positions[j];
}
output.push_back(protein.getSubsequence(begin, protein.size() - begin));
}
}
}
示例8: addLabelToProteinHits_
void ICPLLabeler::addLabelToProteinHits_(SimTypes::FeatureMapSim& features, const String& label) const
{
// check if proteinIdentification exists before accessing it
if (features.getProteinIdentifications().empty())
return;
for (std::vector<ProteinHit>::iterator protein_hit = features.getProteinIdentifications()[0].getHits().begin();
protein_hit != features.getProteinIdentifications()[0].getHits().end();
++protein_hit)
{
AASequence aa = AASequence::fromString(protein_hit->getSequence());
// modify only if the term is accessible
if (aa.getNTerminalModification() == "")
{
aa.setNTerminalModification(label);
protein_hit->setSequence(aa.toString());
}
}
}
示例9: peptideCount
Size ProteaseDigestion::peptideCount(const AASequence& protein)
{
// For unspecific cleavage every cutting position may be skipped. Thus, we get (n + 1) \choose 2 products.
if (enzyme_->getName() == UnspecificCleavage)
{
return (protein.size() + 1) * protein.size() / 2;
};
std::vector<int> pep_positions = tokenize_(protein.toUnmodifiedString());
Size count = pep_positions.size();
// missed cleavages
Size sum = count;
for (Size i = 1; i < count; ++i)
{
if (i > missed_cleavages_) break;
sum += count - i;
}
return sum;
}
示例10: addIsotopeCluster_
void TheoreticalSpectrumGenerator::addIsotopeCluster_(RichPeakSpectrum & spectrum, const AASequence & ion, Residue::ResidueType res_type, Int charge, double intensity) const
{
double pos = ion.getMonoWeight(res_type, charge) / (double)charge;
RichPeak1D p;
IsotopeDistribution dist = ion.getFormula(res_type, charge).getIsotopeDistribution(max_isotope_);
UInt j(0);
for (IsotopeDistribution::ConstIterator it = dist.begin(); it != dist.end(); ++it, ++j)
{
// TODO: this is usually dominated by 13C-12C mass shift which deviates a bit from neutron mass
p.setMZ((double)(pos + (double)j * Constants::NEUTRON_MASS_U) / (double)charge);
p.setIntensity(intensity * it->second);
if (add_metainfo_ && j == 0)
{
String ion_name = String(residueTypeToIonLetter_(res_type)) + String(ion.size()) + String(charge, '+');
p.setMetaValue("IonName", ion_name);
}
spectrum.push_back(p);
}
}
示例11: isValidProduct
bool ProteaseDigestion::isValidProduct(const AASequence& protein,
int pep_pos,
int pep_length,
bool ignore_missed_cleavages,
bool allow_nterm_protein_cleavage,
bool allow_random_asp_pro_cleavage) const
{
String seq = protein.toUnmodifiedString();
return isValidProduct_(seq, pep_pos, pep_length, ignore_missed_cleavages, allow_nterm_protein_cleavage, allow_random_asp_pro_cleavage);
}
示例12:
vector<Size> AScore::getSites_(const AASequence& without_phospho) const
{
vector<Size> tupel;
String unmodified = without_phospho.toUnmodifiedString();
for (Size i = 0; i < unmodified.size(); ++i)
{
if (unmodified[i] == 'Y' || unmodified[i] == 'T' || unmodified[i] == 'S')
{
tupel.push_back(i);
}
}
return tupel;
}
示例13: peptideCount
Size EnzymaticDigestion::peptideCount(const AASequence& protein)
{
std::vector<Size> pep_positions = tokenize_(protein.toUnmodifiedString());
Size count = pep_positions.size();
// missed cleavages
Size sum = count;
for (Size i = 1; i < count; ++i)
{
if (i > missed_cleavages_) break;
sum += count - i;
}
return sum;
}
示例14: compareChargeStates_
void ConsensusIDAlgorithm::compareChargeStates_(Int& recorded_charge,
Int new_charge,
const AASequence& peptide)
{
if (recorded_charge == 0) // update recorded charge
{
recorded_charge = new_charge;
}
else if ((new_charge != 0) && (recorded_charge != new_charge))
{ // maybe TODO: calculate correct charge from prec. m/z and peptide mass?
String msg = "Conflicting charge states found for peptide '" +
peptide.toString() + "': " + String(recorded_charge) + ", " +
String(new_charge);
throw Exception::InvalidValue(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
msg, String(new_charge));
}
}
示例15: applyLabelToProteinHit_
void SILACLabeler::applyLabelToProteinHit_(SimTypes::FeatureMapSim& channel, const String& arginine_label, const String& lysine_label) const
{
for (std::vector<ProteinHit>::iterator protein_hit = channel.getProteinIdentifications()[0].getHits().begin();
protein_hit != channel.getProteinIdentifications()[0].getHits().end();
++protein_hit)
{
AASequence aa = AASequence::fromString(protein_hit->getSequence());
for (AASequence::Iterator residue = aa.begin(); residue != aa.end(); ++residue)
{
if (*residue == 'R')
{
aa.setModification(residue - aa.begin(), arginine_label);
}
else if (*residue == 'K')
{
aa.setModification(residue - aa.begin(), lysine_label);
}
}
protein_hit->setSequence(aa.toString());
}
}