Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# set the correct rt use values
scoring_params = pyopenms.MRMFeatureFinderScoring().getDefaults();
scoring_params.setValue("Scores:use_rt_score",'false', '')
featurefinder.setParameters(scoring_params);
featurefinder.pickExperiment(chromatograms, output, targeted, trafo, empty_swath)
# get the pairs
pairs=[]
simple_find_best_feature(output, pairs, targeted)
pairs_corrected = pyopenms.MRMRTNormalizer().rm_outliers( pairs, 0.95, 0.6)
pairs_corrected = [ list(p) for p in pairs_corrected]
# // store transformation, using a linear model as default
trafo_out = pyopenms.TransformationDescription()
trafo_out.setDataPoints(pairs_corrected);
model_params = pyopenms.Param()
model_params.setValue("symmetric_regression", 'false', '');
model_type = "linear";
trafo_out.fitModel(model_type, model_params);
return trafo_out
# set the correct rt use values
scoring_params = pyopenms.MRMFeatureFinderScoring().getDefaults();
scoring_params.setValue("Scores:use_rt_score",'false', '')
featurefinder.setParameters(scoring_params);
featurefinder.pickExperiment(chromatograms, output, targeted, trafo, empty_swath)
# get the pairs
pairs=[]
simple_find_best_feature(output, pairs, targeted)
pairs_corrected = pyopenms.MRMRTNormalizer().rm_outliers( pairs, 0.95, 0.6)
pairs_corrected = [ list(p) for p in pairs_corrected]
# // store transformation, using a linear model as default
trafo_out = pyopenms.TransformationDescription()
trafo_out.setDataPoints(pairs_corrected);
model_params = pyopenms.Param()
model_params.setValue("symmetric_regression", 'false', '');
model_type = "linear";
trafo_out.fitModel(model_type, model_params);
return trafo_out
def getModelDefaults(default_model):
params = pms.Param()
params.setValue("type", default_model, "Type of model")
model_types = [ "linear", "interpolated"]
if default_model not in model_types:
model_types.insert(0, default_model)
params.setValidStrings("type", model_types)
model_params = pms.Param()
pms.TransformationModelLinear.getDefaultParameters(model_params)
params.insert("linear:", model_params)
params.setSectionDescription("linear", "Parameters for 'linear' model")
pms.TransformationModelInterpolated.getDefaultParameters(model_params)
entry = model_params.getEntry("interpolation_type")
interpolation_types = entry.valid_strings
model_params.setValidStrings("interpolation_type", interpolation_types)
def getModelDefaults(default_model):
params = pms.Param()
params.setValue("type", default_model, "Type of model")
model_types = [ "linear", "interpolated"]
if default_model not in model_types:
model_types.insert(0, default_model)
params.setValidStrings("type", model_types)
model_params = pms.Param()
pms.TransformationModelLinear.getDefaultParameters(model_params)
params.insert("linear:", model_params)
params.setSectionDescription("linear", "Parameters for 'linear' model")
pms.TransformationModelInterpolated.getDefaultParameters(model_params)
entry = model_params.getEntry("interpolation_type")
interpolation_types = entry.valid_strings
model_params.setValidStrings("interpolation_type", interpolation_types)
params.insert("interpolated:", model_params)
params.setSectionDescription("interpolated", "Parameters for 'interpolated' model")
return params
# Only report the top 5 features
scoring_params.setValue("stop_report_after_feature", 5, '')
scoring_params.setValue("rt_normalization_factor", rt_normalization_factor, '')
scorer.setParameters(scoring_params);
chromatograms = pyopenms.MSExperiment()
fh = pyopenms.FileHandler()
fh.loadExperiment(chromat_in, chromatograms)
targeted = pyopenms.TargetedExperiment();
tramlfile = pyopenms.TraMLFile();
tramlfile.load(traml_in, targeted);
trafoxml = pyopenms.TransformationXMLFile()
trafo = pyopenms.TransformationDescription()
if trafo_in is not None:
model_params = pyopenms.Param()
model_params.setValue("symmetric_regression", "false", "", [])
model_type = "linear"
trafoxml.load(trafo_in, trafo, True)
trafo.fitModel(model_type, model_params);
light_targeted = pyopenms.LightTargetedExperiment();
pyopenms.OpenSwathDataAccessHelper().convertTargetedExp(targeted, light_targeted)
output = algorithm(chromatograms, light_targeted, pp, scorer, trafo)
pyopenms.FeatureXMLFile().store(out, output);