The TopHatFilter removes signal structures in the raw data which are broader than the size of the structuring element.
The following example (Tutorial_TopHatFilter.C) shows how to instantiate a tophat filter, set the length of the structuring element and remove the base line in a raw LC-MS map.
Int main() { RawMap exp_raw; RawMap exp_filtered; MzDataFile mzdata_file; mzdata_file.load("../TEST/data/PeakPicker_test.mzData",exp_raw); TopHatFilter th; Param param; param.setValue("struc_elem_length",1.0); th.setParameters(param); th.filterExperiment(exp_raw,exp_filtered); return 0; } //end of main
We show in the following example (Tutorial_GaussFilter.C) how to smooth a raw data map. The gaussian kernel width is set to 1 m/z.
Int main() { RawMap exp_raw; RawMap exp_filtered; MzDataFile mzdata_file; mzdata_file.load("../TEST/data/PeakPicker_test.mzData",exp_raw); GaussFilter g; Param param; param.setValue("gaussian_width",1.0); g.setParameters(param); g.filterExperiment(exp_raw,exp_filtered); return 0; } //end of main
The following example (Tutorial_SavitzkyGolayFilter.C) shows how to use a SavitzkyGolaySVDFilter (the SavitzkyGolayQRFilter has the same interface) to smooth a single spectrum. The single raw data spectrum is loaded and resampled to uniform data with a spacing of 0.01 /m/z. The frame size of the Savitzky Golay filter is set to 21 data points and the polynomial order is set to 3. Afterwards the filter is applied to the resampled spectrum.
Int main() { RawSpectrum spec_raw; RawSpectrum spec_resampled; RawSpectrum spec_filtered; DTAFile dta_file; dta_file.load("../TEST/data/PeakTypeEstimator_rawTOF.dta",spec_raw); LinearResampler lr; Param param_lr; param_lr.setValue("spacing",0.01); lr.setParameters(param_lr); lr.raster(spec_raw,spec_resampled); SavitzkyGolayFilter sg; Param param_sg; param_sg.setValue("frame_length",21); param_sg.setValue("polynomial_order",3); sg.setParameters(param_sg); sg.filter(spec_resampled,spec_filtered); return 0; } //end of main
The following example (Tutorial_InternalCalibration.C) shows how to use the InternalCalibration for raw data. First the data and reference masses are loaded.
Int main() { InternalCalibration ic; RawMap exp_raw; MzDataFile mzdata_file; mzdata_file.load("../TEST/data/InternalCalibration_test.mzData",exp_raw); std::vector<double> ref_masses; ref_masses.push_back(1296.68476942); ref_masses.push_back(2465.19833942);
Then we set the important peak picking parameters and run the internal calibration:
Param param; param.setValue("PeakPicker:thresholds:peak_bound",800); param.setValue("PeakPicker:thresholds:fwhm_bound",0.1); param.setValue("PeakPicker:wavelet_transform:scale",0.12); ic.setParameters(param); ic.calibrate(exp_raw,ref_masses); return 0; } //end of main
The following example (Tutorial_TOFCalibration.C) shows how to use the TOFCalibration for raw data. First the spectra and reference masses are loaded.
Int main() { TOFCalibration ec; RawMap exp_raw,calib_exp; MzDataFile mzdata_file; mzdata_file.load("../TEST/data/TOFCalibration_test_calibrants.mzData",calib_exp); mzdata_file.load("../TEST/data/TOFCalibration_test.mzData",exp_raw); vector<DoubleReal> ref_masses; TextFile ref_file; ref_file.load("../TEST/data/TOFCalibration_test_calibrant_masses.txt",true); for(TextFile::Iterator iter = ref_file.begin(); iter != ref_file.end(); ++iter) { ref_masses.push_back(atof(iter->c_str())); }
Then we set the calibration constants for the calibrant spectra.
std::vector<DoubleReal> ml1; ml1.push_back(418327.924993827); std::vector<DoubleReal> ml2; ml2.push_back(253.645187196031); std::vector<DoubleReal> ml3; ml3.push_back(-0.0414243465397252); ec.setML1s(ml1); ec.setML2s(ml2); ec.setML3s(ml3);
Finally, we set the important peak picking parameters and run the external calibration:
Param param; param.setValue("PeakPicker:thresholds:peak_bound",800); param.setValue("PeakPicker:thresholds:fwhm_bound",0.1); param.setValue("PeakPicker:wavelet_transform:scale",0.12); ec.setParameters(param); ec.calibrate(calib_exp,exp_raw,ref_masses); return 0; } //end of main
Generated Tue Apr 1 15:36:40 2008 -- using doxygen 1.5.4 | OpenMS / TOPP 1.1 |