Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
options = f_fmxl.getOptions()
options.setLoadConvexHull(False)
options.setLoadSubordinates(False)
f_fmxl.setOptions(options)
if align_features:
map_ref = pms.FeatureMap()
f_fxml_tmp = pms.FeatureXMLFile()
options = f_fmxl.getOptions()
options.setLoadConvexHull(False)
options.setLoadSubordinates(False)
f_fxml_tmp.setOptions(options)
f_fxml_tmp.load(file_, map_ref)
algorithm.setReference(map_ref)
else:
map_ref = pms.MSExperiment()
pms.MzMLFile().load(file_, map_ref)
algorithm.setReference(map_ref)
plog.startProgress(0, len(in_files), "Align input maps")
for i, in_file in enumerate(in_files):
trafo = pms.TransformationDescription()
if align_features:
map_ = pms.FeatureMap()
f_fxml_tmp = pms.FeatureXMLFile()
f_fxml_tmp.setOptions(f_fmxl.getOptions())
f_fxml_tmp.load(in_file, map_)
if in_file == file_:
trafo.fitModel("identity")
else:
algorithm.align(map_, trafo)
if out_files:
def addDataProcessing(obj, params, action):
if isinstance(obj, pms.MSExperiment):
result = pms.MSExperiment()
for spec in obj:
spec = _addDataProcessing(spec, params, action)
result.addSpectrum(spec)
else:
result = _addDataProcessing(obj, params, action)
return result
ok = run_mode or write_mode
if not ok:
parser.error("either specify -in, -out and -(dict)ini for running "
"the peakpicker\nor -write(dict)ini for creating std "
"ini file")
defaults = pms.PeakPickerHiRes().getDefaults()
write_requested = writeParamsIfRequested(args, defaults)
if not write_requested:
updateDefaults(args, defaults)
fh = pms.MzMLFile()
fh.setLogType(pms.LogType.CMD)
input_map = pms.MSExperiment()
fh.load(args.in_, input_map)
run_peak_picker(input_map, defaults, args.out)
def algorithm(chromatograms, targeted):
# Create empty files as input and finally as output
empty_swath = pyopenms.MSExperiment()
trafo = pyopenms.TransformationDescription()
output = pyopenms.FeatureMap();
# set up featurefinder and run
featurefinder = pyopenms.MRMFeatureFinderScoring()
# 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]
# load input
for infile in options.infiles:
exp = pyopenms.MSExperiment()
pyopenms.FileHandler().loadExperiment(infile, exp)
transition_exp_used = pyopenms.TargetedExperiment();
do_continue = True
if options.is_swath:
do_continue = pyopenms.OpenSwathHelper().checkSwathMapAndSelectTransitions(exp, targeted, transition_exp_used, options.min_upper_edge_dist)
else:
transition_exp_used = targeted
if do_continue:
# set up extractor and run
tmp_out = pyopenms.MSExperiment();
extractor = pyopenms.ChromatogramExtractor()
extractor.extractChromatograms(exp, tmp_out, targeted, options.extraction_window, options.ppm, trafo, options.rt_extraction_window, options.extraction_function)
# add all chromatograms to the output
for chrom in tmp_out.getChromatograms():
output.addChromatogram(chrom)
dp = pyopenms.DataProcessing()
pa = pyopenms.ProcessingAction().SMOOTHING
dp.setProcessingActions(set([pa]))
chromatograms = output.getChromatograms();
for chrom in chromatograms:
this_dp = chrom.getDataProcessing()
this_dp.append(dp)
chrom.setDataProcessing(this_dp)
def main(options):
precursor_tolerance = options.precursor_tolerance
product_tolerance = options.product_tolerance
out = options.outfile
chromat_in = options.infile
traml_in = options.traml_in
# precursor_tolerance = 0.05
# product_tolerance = 0.05
# out = "/tmp/out.mzML"
# chromat_in = "../source/TEST/TOPP/MRMMapping_input.chrom.mzML"
# traml_in = "../source/TEST/TOPP/MRMMapping_input.TraML"
ff = pyopenms.MRMFeatureFinderScoring()
chromatogram_map = pyopenms.MSExperiment()
fh = pyopenms.FileHandler()
fh.loadExperiment(chromat_in, chromatogram_map)
targeted = pyopenms.TargetedExperiment();
tramlfile = pyopenms.TraMLFile();
tramlfile.load(traml_in, targeted);
output = algorithm(chromatogram_map, targeted, precursor_tolerance, product_tolerance)
pyopenms.MzMLFile().store(out, output);
def algorithm(chromatograms, targeted):
# Create empty files as input and finally as output
empty_swath = pyopenms.MSExperiment()
trafo = pyopenms.TransformationDescription()
output = pyopenms.FeatureMap();
# set up featurefinder and run
featurefinder = pyopenms.MRMFeatureFinderScoring()
# 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]
def main(options):
# load chromatograms
chromatograms = pyopenms.MSExperiment()
fh = pyopenms.FileHandler()
fh.loadExperiment(options.infile, chromatograms)
# load TraML file
targeted = pyopenms.TargetedExperiment();
tramlfile = pyopenms.TraMLFile();
tramlfile.load(options.traml_in, targeted);
trafo_out = algorithm(chromatograms, targeted)
pyopenms.TransformationXMLFile().store(options.outfile, trafo_out);
def _acquisition_grid(self):
ms_experiment = ms.MSExperiment()
file_handler = ms.FileHandler()
file_handler.loadExperiment(self.ms_file_path, ms_experiment)
pixel_coords = [(spec.getRT(), 0.0) for spec in ms_experiment]
return {
ACQ_GEOMETRY_KEYS.AcqGridSection.REGULAR_GRID: False,
ACQ_GEOMETRY_KEYS.AcqGridSection.PIXEL_CORRD_LIST: pixel_coords
}
def main(options):
# load TraML file
targeted = pyopenms.TargetedExperiment();
pyopenms.TraMLFile().load(options.traml_in, targeted);
# Create empty files as input and finally as output
empty_swath = pyopenms.MSExperiment()
trafo = pyopenms.TransformationDescription()
output = pyopenms.MSExperiment();
# load input
for infile in options.infiles:
exp = pyopenms.MSExperiment()
pyopenms.FileHandler().loadExperiment(infile, exp)
transition_exp_used = pyopenms.TargetedExperiment();
do_continue = True
if options.is_swath:
do_continue = pyopenms.OpenSwathHelper().checkSwathMapAndSelectTransitions(exp, targeted, transition_exp_used, options.min_upper_edge_dist)
else:
transition_exp_used = targeted
if do_continue:
# set up extractor and run
tmp_out = pyopenms.MSExperiment();
extractor = pyopenms.ChromatogramExtractor()
extractor.extractChromatograms(exp, tmp_out, targeted, options.extraction_window, options.ppm, trafo, options.rt_extraction_window, options.extraction_function)
# add all chromatograms to the output