本文整理汇总了C++中Param::setValue方法的典型用法代码示例。如果您正苦于以下问题:C++ Param::setValue方法的具体用法?C++ Param::setValue怎么用?C++ Param::setValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Param
的用法示例。
在下文中一共展示了Param::setValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: calibrateMapGlobally
void InternalCalibration::calibrateMapGlobally(const FeatureMap<> & feature_map, FeatureMap<> & calibrated_feature_map, std::vector<PeptideIdentification> & ref_ids, String trafo_file_name)
{
checkReferenceIds_(ref_ids);
calibrated_feature_map = feature_map;
// clear the ids
for (Size f = 0; f < calibrated_feature_map.size(); ++f)
{
calibrated_feature_map[f].getPeptideIdentifications().clear();
}
// map the reference ids onto the features
IDMapper mapper;
Param param;
param.setValue("rt_tolerance", (DoubleReal)param_.getValue("rt_tolerance"));
param.setValue("mz_tolerance", param_.getValue("mz_tolerance"));
param.setValue("mz_measure", param_.getValue("mz_tolerance_unit"));
mapper.setParameters(param);
std::vector<ProteinIdentification> vec;
mapper.annotate(calibrated_feature_map, ref_ids, vec);
// calibrate
calibrateMapGlobally(calibrated_feature_map, calibrated_feature_map, trafo_file_name);
// copy the old ids
calibrated_feature_map.setUnassignedPeptideIdentifications(feature_map.getUnassignedPeptideIdentifications());
for (Size f = 0; f < feature_map.size(); ++f)
{
calibrated_feature_map[f].getPeptideIdentifications().clear();
if (!feature_map[f].getPeptideIdentifications().empty())
{
calibrated_feature_map[f].setPeptideIdentifications(feature_map[f].getPeptideIdentifications());
}
}
}
示例2: getDefaultParameters
void TransformationModelBSpline::getDefaultParameters(Param & params)
{
params.clear();
params.setValue("num_breakpoints", 5, "Number of breakpoints of the cubic spline in the smoothing step. More breakpoints mean less smoothing. Reduce this number if the transformation has an unexpected shape.");
params.setMinInt("num_breakpoints", 2);
params.setValue("break_positions", "uniform", "How to distribute the breakpoints on the retention time scale. 'uniform': intervals of equal size; 'quantiles': equal number of data points per interval.");
params.setValidStrings("break_positions", StringList::create("uniform,quantiles"));
}
示例3: operator
double SpectrumAlignmentScore::operator()(const PeakSpectrum & s1, const PeakSpectrum & s2) const
{
const double tolerance = (double)param_.getValue("tolerance");
bool is_relative_tolerance = param_.getValue("is_relative_tolerance").toBool();
bool use_linear_factor = param_.getValue("use_linear_factor").toBool();
bool use_gaussian_factor = param_.getValue("use_gaussian_factor").toBool();
if (use_linear_factor && use_gaussian_factor)
{
cerr << "Warning: SpectrumAlignmentScore, use either 'use_linear_factor' or 'use_gaussian_factor'!" << endl;
}
SpectrumAlignment aligner;
Param p;
p.setValue("tolerance", tolerance);
p.setValue("is_relative_tolerance", (String)param_.getValue("is_relative_tolerance"));
aligner.setParameters(p);
vector<pair<Size, Size> > alignment;
aligner.getSpectrumAlignment(alignment, s1, s2);
double score(0), sum(0), sum1(0), sum2(0);
for (PeakSpectrum::ConstIterator it1 = s1.begin(); it1 != s1.end(); ++it1)
{
sum1 += it1->getIntensity() * it1->getIntensity();
}
for (PeakSpectrum::ConstIterator it1 = s2.begin(); it1 != s2.end(); ++it1)
{
sum2 += it1->getIntensity() * it1->getIntensity();
}
for (vector<pair<Size, Size> >::const_iterator it = alignment.begin(); it != alignment.end(); ++it)
{
//double factor(0.0);
//factor = (epsilon - fabs(s1[it->first].getPosition()[0] - s2[it->second].getPosition()[0])) / epsilon;
double mz_tolerance(tolerance);
if (is_relative_tolerance)
{
mz_tolerance = mz_tolerance * s1[it->first].getPosition()[0] / 1e6;
}
double mz_difference(fabs(s1[it->first].getPosition()[0] - s2[it->second].getPosition()[0]));
double factor = 1.0;
if (use_linear_factor || use_gaussian_factor)
{
factor = getFactor_(mz_tolerance, mz_difference, use_gaussian_factor);
}
sum += sqrt(s1[it->first].getIntensity() * s2[it->second].getIntensity() * factor);
}
score = sum / (sqrt(sum1 * sum2));
return score;
}
示例4: getDefaultParameters
void PeakIntegrator::getDefaultParameters(Param& params)
{
params.clear();
params.setValue("integration_type", INTEGRATION_TYPE_INTENSITYSUM, "The integration technique to use in integratePeak() and estimateBackground() which uses either the summed intensity, integration by Simpson's rule or trapezoidal integration.");
params.setValidStrings("integration_type", ListUtils::create<String>("intensity_sum,simpson,trapezoid"));
params.setValue("baseline_type", BASELINE_TYPE_BASETOBASE, "The baseline type to use in estimateBackground() based on the peak boundaries. A rectangular baseline shape is computed based either on the minimal intensity of the peak boundaries, the maximum intensity or the average intensity (base_to_base).");
params.setValidStrings("baseline_type", ListUtils::create<String>("base_to_base,vertical_division,vertical_division_min,vertical_division_max"));
params.setValue("fit_EMG", "false", "Fit the chromatogram/spectrum to the EMG peak model.");
params.setValidStrings("fit_EMG", ListUtils::create<String>("false,true"));
}
示例5: digestFeaturesMapSimVector_
void digestFeaturesMapSimVector_(SimTypes::FeatureMapSimVector& feature_maps)
{
// digest here
DigestSimulation digest_sim;
Param p;
p.setValue("model", "naive");
p.setValue("model_naive:missed_cleavages", 0);
digest_sim.setParameters(p);
std::cout << digest_sim.getParameters() << std::endl;
for(SimTypes::FeatureMapSimVector::iterator iter = feature_maps.begin() ; iter != feature_maps.end() ; ++iter)
{
digest_sim.digest((*iter));
}
}
示例6: main_
ExitCodes main_(int, const char **)
{
//-------------------------------------------------------------
// parameter handling
//-------------------------------------------------------------
String in_spectra = getStringOption_("in_spectra");
String in_identifications = getStringOption_("in_identifications");
String outfile = getStringOption_("model_output_file");
Int precursor_charge = getIntOption_("precursor_charge");
//-------------------------------------------------------------
// init SvmTheoreticalSpectrumGeneratorTrainer
//-------------------------------------------------------------
SvmTheoreticalSpectrumGeneratorTrainer trainer;
Param param = getParam_().copy("algorithm:", true);
String write_files = getFlag_("write_training_files") ? "true" : "false";
param.setValue("write_training_files", write_files);
trainer.setParameters(param);
//-------------------------------------------------------------
// loading input
//-------------------------------------------------------------
PeakMap map;
MzMLFile().load(in_spectra, map);
std::vector<PeptideIdentification> pep_ids;
std::vector<ProteinIdentification> prot_ids;
String tmp_str;
IdXMLFile().load(in_identifications, prot_ids, pep_ids, tmp_str);
IDMapper idmapper;
Param par;
par.setValue("rt_tolerance", 0.001);
par.setValue("mz_tolerance", 0.001);
idmapper.setParameters(par);
idmapper.annotate(map, pep_ids, prot_ids);
//generate vector of annotations
std::vector<AASequence> annotations;
PeakMap::iterator it;
for (it = map.begin(); it != map.end(); ++it)
{
annotations.push_back(it->getPeptideIdentifications()[0].getHits()[0].getSequence());
}
trainer.trainModel(map, annotations, outfile, precursor_charge);
return EXECUTION_OK;
}
示例7: getSubsectionDefaults_
Param getSubsectionDefaults_(const String & section) const
{
Param p;
if (section == "algorithm")
{
p.setValue("param1", "param1_value", "param1_description");
p.setValue("param2", "param2_value", "param2_description");
}
else
{
p.setValue("param3", "param3_value", "param3_description");
p.setValue("param4", "param4_value", "param4_description");
}
return p;
}
示例8: smoothData
void ElutionPeakDetection::smoothData(MassTrace& mt, int win_size) const
{
// alternative smoothing using SavitzkyGolay
// looking at the unit test, this method gives better fits than lowess smoothing
// reference paper uses lowess smoothing
MSSpectrum<PeakType> spectrum;
spectrum.insert(spectrum.begin(), mt.begin(), mt.end());
SavitzkyGolayFilter sg;
Param param;
param.setValue("polynomial_order", 2);
param.setValue("frame_length", std::max(3, win_size)); // frame length must be at least polynomial_order+1, otherwise SG will fail
sg.setParameters(param);
sg.filter(spectrum);
MSSpectrum<PeakType>::iterator iter = spectrum.begin();
std::vector<double> smoothed_intensities;
for (; iter != spectrum.end(); ++iter)
{
smoothed_intensities.push_back(iter->getIntensity());
}
mt.setSmoothedIntensities(smoothed_intensities);
//alternative end
// std::cout << "win_size elution: " << scan_time << " " << win_size << std::endl;
// if there is no previous FWHM estimation... do it now
// if (win_size == 0)
// {
// mt.estimateFWHM(false); // estimate FWHM
// win_size = mt.getFWHMScansNum();
// }
// use one global window size for all mass traces to smooth
// std::vector<double> rts, ints;
//
// for (MassTrace::const_iterator c_it = mt.begin(); c_it != mt.end(); ++c_it)
// {
// rts.push_back(c_it->getRT());
// ints.push_back(c_it->getIntensity());
// }
// LowessSmoothing lowess_smooth;
// Param lowess_params;
// lowess_params.setValue("window_size", win_size);
// lowess_smooth.setParameters(lowess_params);
// std::vector<double> smoothed_data;
// lowess_smooth.smoothData(rts, ints, smoothed_data);
// mt.setSmoothedIntensities(smoothed_data);
}
示例9: getSystemParameterDefaults_
Param File::getSystemParameterDefaults_()
{
Param p;
p.setValue("version", VersionInfo::getVersion());
p.setValue("home_dir", ""); // only active when user enters something in this value
p.setValue("temp_dir", ""); // only active when user enters something in this value
p.setValue("id_db_dir", ListUtils::create<String>(""),
String("Default directory for FASTA and psq files used as databased for id engines. ") + \
"This allows you to specify just the filename of the DB in the " + \
"respective TOPP tool, and the database will be searched in the directories specified here " + \
""); // only active when user enters something in this value
p.setValue("threads", 1);
// TODO: maybe we add -log, -debug.... or....
return p;
}
示例10: getParameters
Param MSSim::getParameters() const
{
Param tmp;
tmp.insert("", this->param_); // get non-labeling options
vector<String> products = Factory<BaseLabeler>::registeredProducts();
tmp.setValue("Labeling:type", "labelfree", "Select the labeling type you want for your experiment");
tmp.setValidStrings("Labeling:type", products);
for (vector<String>::iterator product_name = products.begin(); product_name != products.end(); ++product_name)
{
BaseLabeler* labeler = Factory<BaseLabeler>::create(*product_name);
if (labeler)
{
tmp.insert("Labeling:" + *product_name + ":", labeler->getDefaultParameters());
if (!tmp.copy("Labeling:" + *product_name).empty())
{
// if parameters of labeler are empty, the section will not exist and
// the command below would fail
tmp.setSectionDescription("Labeling:" + *product_name, labeler->getDescription());
}
delete(labeler);
}
else
{
throw Exception::InvalidValue(__FILE__, __LINE__, __PRETTY_FUNCTION__, "This labeler returned by the Factory is invalid!", product_name->c_str());
}
}
return tmp;
}
示例11: main
int main(int argc, const char** argv)
{
if (argc < 2) return 1;
// the path to the data should be given on the command line
String tutorial_data_path(argv[1]);
PeakMap exp_raw;
PeakMap exp_picked;
MzMLFile mzml_file;
mzml_file.load(tutorial_data_path + "/data/Tutorial_PeakPickerCWT.mzML", exp_raw);
PeakPickerCWT pp;
Param param;
param.setValue("peak_width", 0.1);
pp.setParameters(param);
pp.pickExperiment(exp_raw, exp_picked);
exp_picked.updateRanges();
cout << "\nMinimal fwhm of a mass spectrometric peak: " << (DoubleReal)param.getValue("peak_width")
<< "\n\nNumber of picked peaks " << exp_picked.getSize() << std::endl;
return 0;
} //end of main
示例12: getBYSeries
// for SWATH -- get the theoretical b and y series masses for a sequence
void getBYSeries(AASequence& a, //
std::vector<double>& bseries, //
std::vector<double>& yseries, //
UInt charge //
)
{
OPENMS_PRECONDITION(charge > 0, "Charge is a positive integer");
TheoreticalSpectrumGenerator generator;
Param p;
p.setValue("add_metainfo", "true",
"Adds the type of peaks as metainfo to the peaks, like y8+, [M-H2O+2H]++");
generator.setParameters(p);
RichPeakSpectrum rich_spec;
generator.addPeaks(rich_spec, a, Residue::BIon, charge);
generator.addPeaks(rich_spec, a, Residue::YIon, charge);
for (RichPeakSpectrum::iterator it = rich_spec.begin();
it != rich_spec.end(); ++it)
{
if (it->getMetaValue("IonName").toString()[0] == 'y')
{
yseries.push_back(it->getMZ());
}
else if (it->getMetaValue("IonName").toString()[0] == 'b')
{
bseries.push_back(it->getMZ());
}
}
} // end getBYSeries
示例13: getDefaultParameters
void TransformationModelLinear::getDefaultParameters(Param& params)
{
params.clear();
params.setValue("symmetric_regression", "false", "Perform linear regression"
" on 'y - x' vs. 'y + x', instead of on 'y' vs. 'x'.");
params.setValidStrings("symmetric_regression",
ListUtils::create<String>("true,false"));
}
示例14: getSubsectionDefaults_
Param getSubsectionDefaults_(const String & /*section*/) const
{
Param tmp;
tmp.insert("Extraction:", ItraqChannelExtractor(ItraqQuantifier::FOURPLEX).getParameters()); // type is irrelevant - ini is the same
tmp.insert("Quantification:", ItraqQuantifier(ItraqQuantifier::FOURPLEX).getParameters()); // type is irrelevant - ini is the same
tmp.setValue("MetaInformation:Program", "OpenMS::ITRAQAnalyzer", "", StringList::create("advanced"));
return tmp;
}
示例15: getSubsectionDefaults_
Param getSubsectionDefaults_(const String & /*section*/) const
{
Param tmp;
tmp.insert("Extraction:", ItraqChannelExtractor(ItraqQuantifier::TMT_SIXPLEX).getParameters());
tmp.insert("Quantification:", ItraqQuantifier(ItraqQuantifier::TMT_SIXPLEX).getParameters());
tmp.setValue("MetaInformation:Program", "OpenMS::TMTAnalyzer", "", ListUtils::create<String>("advanced"));
return tmp;
}