DataVector DataTransformation::transform(const DataVector &input) const { checkInput(input); DataVector output = transform_(input); checkOutput(output); return output; }
std::string map_hostnames::map(std::string host_name, std::uint16_t port) const { if (host_name == "localhost") { // map local host to loopback ip address (that's a quick hack // which will be removed as soon as we figure out why name // resolution does not handle this anymore) if (debug_) { std::cerr << "resolved: 'localhost' to: 127.0.0.1" << std::endl; } return "127.0.0.1"; } if (!!transform_) { // If the transform is not empty host_name = transform_(host_name); if (debug_) { std::cerr << "host_name(transformed): " << host_name << std::endl; } } // do full host name resolution boost::asio::io_service io_service; boost::asio::ip::tcp::endpoint ep = util::resolve_hostname(prefix_ + host_name + suffix_, port, io_service); std::string resolved_addr(util::get_endpoint_name(ep)); if (debug_) { std::cerr << "resolved: '" << prefix_ + host_name + suffix_ << "' to: " << resolved_addr << std::endl; } return resolved_addr; }
void tdrop_button::set_label(const t_string& str) { set_use_markup(true); std::string s = transform_(str)["drop_button"]["label"]; super::set_label(s); }
Protein* PeptideBuilder::construct() { if (fragment_db_ == 0) { Log.warn() << "PeptideBuilder::construct(): no FragmengDB given!" << std::endl; return 0; } if (sequence_.empty()) { Log.warn() << "PeptideBuilder::construct(): no amino acid sequence specified." << std::endl; return 0; } int id = 1; Protein *protein = new Protein(proteinname_); Chain *chain = new Chain(chainname_); // create the first residue Residue* residue = createResidue_(sequence_[0].getType(), id); chain->insert(*residue); Residue* residueold = residue; std::vector<AminoAcidDescriptor>::iterator i = sequence_.begin(); ++id; // consistency check for empty sequences and sequences of length < 2!! // loop for the remaining residues ; for (++i; i != sequence_.end(); ++i) { // We have to take care of two special cases: // - the residue we are looking at is proline // - the last residue was proline String type = (i-1)->getType(); type.toUpper(); // special case: residue is a proline type = i->getType(); type.toUpper(); is_proline_ = (type == "PRO") ? true : false; Residue* residue2 = createResidue_(i->getType(), id); insert_(*residue2, *residueold); chain->insert(*residue2); // set the torsion angle transform_(i->getPhi(), (i-1)->getPsi(),*residueold, *residue2); peptide_(*residueold,*residue2); // set the peptide bond angle omega setOmega_(*residueold, *residue2, i->getOmega()); residueold=residue2; ++id; } protein->insert(*chain); // read the names for a unique nomenclature protein->apply(fragment_db_->normalize_names); // add missing bonds and atoms (including side chains!) ReconstructFragmentProcessor rfp(*fragment_db_); protein->apply(rfp); protein->apply(fragment_db_->build_bonds); return protein; }