int main() { LinkedList list; list.insertHead(45); list.insertHead(23); list.print(); list.insertTail(456); list.insertTail(234); list.insertTail(34); list.print(); cout << list.remove(456) << endl; list.print(); list.removeHead(); list.removeTail(); list.print(); cout << endl; DoubleList dlist; dlist.push_back(45); dlist.push_back(3456); dlist.push_front(12); dlist.push_front(2); cout << dlist.front() << ' ' << dlist.back() << endl; dlist.print(); dlist.pop_back(); dlist.pop_front(); dlist.print(); return 0; }
void IDMapper::getIDDetails_(const PeptideIdentification & id, DoubleReal & rt_pep, DoubleList & mz_values, IntList & charges, bool use_avg_mass) const { mz_values.clear(); charges.clear(); rt_pep = id.getMetaValue("RT"); // collect m/z values of pepId if (param_.getValue("mz_reference") == "precursor") // use precursor m/z of pepId { mz_values.push_back(id.getMetaValue("MZ")); } for (vector<PeptideHit>::const_iterator hit_it = id.getHits().begin(); hit_it != id.getHits().end(); ++hit_it) { Int charge = hit_it->getCharge(); charges.push_back(charge); if (param_.getValue("mz_reference") == "peptide") // use mass of each pepHit (assuming H+ adducts) { DoubleReal mass = use_avg_mass ? hit_it->getSequence().getAverageWeight(Residue::Full, charge) : hit_it->getSequence().getMonoWeight(Residue::Full, charge); mz_values.push_back( mass / (DoubleReal) charge); } } }
void ProteinResolver::computeIntensityOfMSD_(vector<MSDGroup> & msd_groups) { // iteriert ueber alles msd gruppe for (vector<MSDGroup>::iterator group = msd_groups.begin(); group != msd_groups.end(); ++group) { DoubleList intensities; // iterierere ueber peptide entry (peptide identification), intensitaet (summe der einzelintensitaeten) for (list<PeptideEntry *>::iterator pep = group->peptides.begin(); pep != group->peptides.end(); ++pep) { intensities.push_back((*pep)->intensity); } // median von der list ist itensity der msd group group->intensity = Math::median(intensities.begin(), intensities.end()); } }
bool Pattern::Match(const DoubleTimeList::const_iterator& current, const DoubleTimeList::const_iterator& end) const { DoubleTimeList points; size_t positionCount = Size(); auto cit = current; size_t i = 0; while(i < positionCount && cit != end) { points.push_back(DoubleTimePoint((*cit).value, i++)); cit++; } if (i < positionCount) { // points not enough for matching return false; } // sort the points by value struct PointCompare { bool operator() (DoubleTimePoint p1,DoubleTimePoint p2) { return p1.value < p2.value; } } compareObj; std::sort(points.begin(), points.end(), compareObj); // check each groups auto gcit = groups_.begin(); auto pcit = points.begin(); double max_in_last_group = -DBL_MAX; while(gcit != groups_.end() && pcit != points.end()) { PointsGroup group = *gcit; DoubleList values; // check fixed delta double delta = std::fabs(((*pcit).value - max_in_last_group) / ((*pcit).value + max_in_last_group)); if (delta < fixed_delta_) return false; // make sure points in the group size_t i = 0; size_t group_size = group.Size(); while (i < group_size && pcit != points.end()) { if (!group.In((int)(*pcit).position)) return false; values.push_back((*pcit).value); pcit++; i++; } // check adjacent for AdjacentGroup if (group.IsAdjacentGroup()) { if (!group.CheckAdjacence(&values)) return false; } max_in_last_group = values[values.size() - 1]; gcit++; } return true; }