void UnimodXMLFile::load(const String& filename, vector<ResidueModification*> & modifications) { String file = File::find(filename); Internal::UnimodXMLHandler handler(modifications, file); parse_(file, &handler); }
// ========================================================================== StatusCode parse ( std::vector<Gaudi::XYZPoint>& result , const std::string& input ) { result.clear() ; return parse_(result, input); }
blargg_err_t M3u_Playlist::parse() { blargg_err_t err = parse_(); if ( err ) clear_(); return err; }
void tcp_connection::handle_read(const boost::system::error_code &error, size_t bytes_transferred) { if (!socket_.is_open() && !flags.eof) { set_eof(); } if (flags.eof) return; if (error) { set_eof(); do_close(); } else if (bytes_transferred == 0) { set_eof(); do_close(); } else { rdata_size += bytes_transferred; if (parse_) parse_((pointer)this->shared_from_this()); RFIFOFLUSH(this); start_read(); } }
blargg_err_t M3u_Playlist::parse() { blargg_err_t err = parse_(); if ( err ) { entries.clear(); data.clear(); } return err; }
void MzMLFile::loadSize(const String& filename, Size& scount, Size& ccount) { PeakMap dummy; bool size_only_before_ = options_.getSizeOnly(); options_.setSizeOnly(true); Internal::MzMLHandler handler(dummy, filename, getVersion(), *this); handler.setOptions(options_); // TODO catch errors as above ? parse_(filename, &handler); handler.getCounts(scount, ccount); options_.setSizeOnly(size_only_before_); }
wgraph_s *gparse (const unsigned char *file) { wgraph_s *g; unsigned char *buf; buf = read_gfile (file); if (!buf) return NULL; if (!lex_ (buf)) return NULL; g = parse_(); if (!g) return NULL; return g; }
void CVMappingFile::load(const String & filename, CVMappings & cv_mappings, bool strip_namespaces) { //File name for error messages in XMLHandler file_ = filename; strip_namespaces_ = strip_namespaces; parse_(filename, this); cv_mappings.setCVReferences(cv_references_); cv_mappings.setMappingRules(rules_); cv_references_.clear(); rules_.clear(); return; }
void ProtXMLFile::load(const String& filename, ProteinIdentification& protein_ids, PeptideIdentification& peptide_ids) { //Filename for error messages in XMLHandler file_ = filename; resetMembers_(); // reset incoming data protein_ids = ProteinIdentification(); peptide_ids = PeptideIdentification(); // remember data link while parsing prot_id_ = &protein_ids; pep_id_ = &peptide_ids; parse_(filename, this); }
/* Function invoked for parsing a graph file. @param file Name of file containing graph data. @return Returns a graph data structure. */ wgraph_s *gparse (const unsigned char *file) { wgraph_s *g; unsigned char *buf; buf = read_gfile (file); if (!buf) return NULL; if (!lex (buf)) { perror("Parsing Graph Failed"); exit(EXIT_FAILURE); } free(buf); g = parse_(); if (!g) return NULL; return g; }
void MzMLFile::safeParse_(const String& filename, Internal::XMLHandler* handler) { try { parse_(filename, handler); } catch (Exception::BaseException& e) { std::string expr; expr.append(e.getFile()); expr.append("@"); std::stringstream ss; ss << e.getLine(); // we need c++11!! maybe in 2012? expr.append(ss.str()); expr.append("-"); expr.append(e.getFunction()); std::string mess = "- due to that error of type "; mess.append(e.getName()); throw Exception::ParseError(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, expr, mess); } }
void operator()(char const* str, boost::optional<int>& result) const { parse_(str, str + strlen(str), result); }
void operator()(std::string const& str, boost::optional<int>& result) const { parse_(str.begin(), str.end(), result); }
void XTandemInfile::load(const String& filename) { Internal::XTandemInfileXMLHandler handler(filename, notes_, this); parse_(filename, &handler); }
StatusCode parse(Gaudi::XYZPoint& result, const std::string& input ) { return parse_(result, input); }
void ToolDescriptionFile::load(const String & filename, std::vector<Internal::ToolDescription> & tds) { Internal::ToolDescriptionHandler handler(filename, schema_version_); parse_(filename, &handler); tds = handler.getToolDescriptions(); }
StatusCode parse(Gaudi::LorentzVector& result, const std::string& input) { return parse_(result, input); }
void game_() { /* Local variables */ logical f; integer i; /* START UP, DESCRIBE CURRENT LOCATION. */ rspeak_(1); /* !WELCOME ABOARD. */ f = rmdesc_(3); /* !START GAME. */ /* NOW LOOP, READING AND EXECUTING COMMANDS. */ L100: play_1.winner = aindex_1.player; /* !PLAYER MOVING. */ play_1.telflg = FALSE_; /* !ASSUME NOTHING TOLD. */ if (prsvec_1.prscon <= 1) { rdline_(input_1.inbuf, 1); } #ifdef ALLOW_GDT if (strcmp(input_1.inbuf + prsvec_1.prscon - 1, "GDT") == 0) { /* !CALL ON GDT? */ gdt_(); /* !YES, INVOKE. */ goto L100; /* !ONWARD. */ } #endif /* ALLOW_GDT */ ++state_1.moves; prsvec_1.prswon = parse_(input_1.inbuf, 1); if (! prsvec_1.prswon) { goto L400; } /* !PARSE LOSES? */ if (xvehic_(1)) { goto L400; } /* !VEHICLE HANDLE? */ if (prsvec_1.prsa == vindex_1.tellw) { goto L2000; } /* !TELL? */ L300: if (prsvec_1.prso == oindex_1.valua || prsvec_1.prso == oindex_1.every) { goto L900; } if (! vappli_(prsvec_1.prsa)) { goto L400; } /* !VERB OK? */ L350: if (! findex_1.echof && play_1.here == rindex_1.echor) { goto L1000; } f = rappli_(rooms_1.ractio[play_1.here - 1]); L400: xendmv_(play_1.telflg); /* !DO END OF MOVE. */ if (! lit_(play_1.here)) { prsvec_1.prscon = 1; } goto L100; L900: valuac_(oindex_1.valua); goto L350; /* GAME, PAGE 3 */ /* SPECIAL CASE-- ECHO ROOM. */ /* IF INPUT IS NOT 'ECHO' OR A DIRECTION, JUST ECHO. */ L1000: rdline_(input_1.inbuf, 0); ++state_1.moves; /* !CHARGE FOR MOVES. */ if (strcmp(input_1.inbuf, "ECHO") != 0) goto L1300; rspeak_(571); /* !KILL THE ECHO. */ findex_1.echof = TRUE_; objcts_1.oflag2[oindex_1.bar - 1] &= ~ SCRDBT; prsvec_1.prswon = TRUE_; /* !FAKE OUT PARSER. */ prsvec_1.prscon = 1; /* !FORCE NEW INPUT. */ goto L400; L1300: prsvec_1.prswon = parse_(input_1.inbuf, 0); if (! prsvec_1.prswon || prsvec_1.prsa != vindex_1.walkw) { goto L1400; } if (findxt_(prsvec_1.prso, play_1.here)) { goto L300; } /* !VALID EXIT? */ L1400: more_output(input_1.inbuf); play_1.telflg = TRUE_; /* !INDICATE OUTPUT. */ goto L1000; /* !MORE ECHO ROOM. */ /* GAME, PAGE 4 */ /* SPECIAL CASE-- TELL <ACTOR>, NEW COMMAND */ /* NOTE THAT WE CANNOT BE IN THE ECHO ROOM. */ L2000: if ((objcts_1.oflag2[prsvec_1.prso - 1] & ACTRBT) != 0) { goto L2100; } rspeak_(602); /* !CANT DO IT. */ goto L350; /* !VAPPLI SUCCEEDS. */ L2100: play_1.winner = oactor_(prsvec_1.prso); /* !NEW PLAYER. */ play_1.here = advs_1.aroom[play_1.winner - 1]; /* !NEW LOCATION. */ if (prsvec_1.prscon <= 1) { goto L2700; } /* !ANY INPUT? */ if (parse_(input_1.inbuf, 1)) { goto L2150; } L2700: i = 341; /* !FAILS. */ if (play_1.telflg) { i = 604; } /* !GIVE RESPONSE. */ rspeak_(i); L2600: play_1.winner = aindex_1.player; /* !RESTORE STATE. */ play_1.here = advs_1.aroom[play_1.winner - 1]; goto L350; L2150: if (aappli_(advs_1.aactio[play_1.winner - 1])) { goto L2400; } /* !ACTOR HANDLE? */ if (xvehic_(1)) { goto L2400; } /* !VEHICLE HANDLE? */ if (prsvec_1.prso == oindex_1.valua || prsvec_1.prso == oindex_1.every) { goto L2900; } if (! vappli_(prsvec_1.prsa)) { goto L2400; } /* !VERB HANDLE? */ /* L2350: */ f = rappli_(rooms_1.ractio[play_1.here - 1]); L2400: xendmv_(play_1.telflg); /* !DO END OF MOVE. */ goto L2600; /* !DONE. */ L2900: valuac_(oindex_1.valua); /* !ALL OR VALUABLES. */ goto L350; } /* game_ */
void MzQuantMLFile::load(const String & filename, MSQuantifications & msq) { Internal::MzQuantMLHandler handler(msq, filename, schema_version_, *this); parse_(filename, &handler); }
void TraMLFile::load(const String & filename, TargetedExperiment & exp) { Internal::TraMLHandler handler(exp, filename, schema_version_, *this); parse_(filename, &handler); }
void MascotXMLFile::load(const String& filename, ProteinIdentification& protein_identification, vector<PeptideIdentification>& id_data, map<String, vector<AASequence> >& peptides, const SpectrumMetaDataLookup& lookup) { //clear protein_identification = ProteinIdentification(); id_data.clear(); Internal::MascotXMLHandler handler(protein_identification, id_data, filename, peptides, lookup); parse_(filename, &handler); // since the Mascot XML can contain "peptides" without sequences, // the identifications without any real peptide hit are removed vector<PeptideIdentification> filtered_hits; filtered_hits.reserve(id_data.size()); Size missing_sequence = 0; // counter for (vector<PeptideIdentification>::iterator id_it = id_data.begin(); id_it != id_data.end(); ++id_it) { const vector<PeptideHit>& peptide_hits = id_it->getHits(); if (!peptide_hits.empty() && (peptide_hits.size() > 1 || !peptide_hits[0].getSequence().empty())) { filtered_hits.push_back(*id_it); } else if (!id_it->empty()) ++missing_sequence; } if (missing_sequence) { LOG_WARN << "Warning: Removed " << missing_sequence << " peptide identifications without sequence." << endl; } id_data.swap(filtered_hits); // check if we have (some) RT information: Size no_rt_count = 0; for (vector<PeptideIdentification>::iterator id_it = id_data.begin(); id_it != id_data.end(); ++id_it) { if (!id_it->hasRT()) ++no_rt_count; } if (no_rt_count) { LOG_WARN << "Warning: " << no_rt_count << " (of " << id_data.size() << ") peptide identifications have no retention time value." << endl; } // if we have a mapping, but couldn't find any RT values, that's an error: if (!lookup.empty() && (no_rt_count == id_data.size())) { throw Exception::MissingInformation( __FILE__, __LINE__, __PRETTY_FUNCTION__, "No retention time information for peptide identifications found"); } // argh! Mascot 2.2 tends to repeat the first hit (yes it appears twice), // so we delete one of them for (vector<PeptideIdentification>::iterator it = id_data.begin(); it != id_data.end(); ++it) { vector<PeptideHit> peptide_hits = it->getHits(); // check if equal, except for rank if (peptide_hits.size() > 1 && peptide_hits[0].getScore() == peptide_hits[1].getScore() && peptide_hits[0].getSequence() == peptide_hits[1].getSequence() && peptide_hits[0].getCharge() == peptide_hits[1].getCharge()) { // erase first hit peptide_hits.erase(peptide_hits.begin() + 1); it->setHits(peptide_hits); } } }