Skip to content

Commit

Permalink
do not require external arguments to Tutorial data path
Browse files Browse the repository at this point in the history
  • Loading branch information
cbielow committed Mar 18, 2024
1 parent f3afaeb commit a929d59
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 16 deletions.
14 changes: 6 additions & 8 deletions doc/code_examples/Tutorial_Precursor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,25 @@

//! [doxygen_snippet_Precursor]

#include <OpenMS/CONCEPT/Exception.h>
#include <OpenMS/FORMAT/FileHandler.h>
#include <OpenMS/KERNEL/MSExperiment.h>
#include <OpenMS/METADATA/Precursor.h>
#include <OpenMS/FORMAT/FileHandler.h>
#include <OpenMS/CONCEPT/Exception.h>
#include <OpenMS/openms_data_path.h> // exotic header for path to tutorial data

#include <iostream>

using namespace OpenMS;
using namespace std;

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]);
auto file_mzML = OPENMS_DOC_PATH + String("/code_examples/data/Tutorial_GaussFilter.mzML");

MSExperiment spectra;

// load mzML from code examples folder
FileHandler().loadExperiment(tutorial_data_path + "/data/Tutorial_GaussFilter.mzML", spectra);
FileHandler().loadExperiment(file_mzML, spectra);

// iterate over map and output MS2 precursor information
for (auto s_it = spectra.begin(); s_it != spectra.end(); ++s_it)
Expand Down
9 changes: 4 additions & 5 deletions doc/code_examples/Tutorial_SavitzkyGolayFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,24 @@
// SPDX-License-Identifier: BSD-3-Clause
//

#include <OpenMS/FILTERING/TRANSFORMERS/LinearResampler.h>
#include <OpenMS/FILTERING/SMOOTHING/SavitzkyGolayFilter.h>
#include <OpenMS/FILTERING/TRANSFORMERS/LinearResampler.h>
#include <OpenMS/FORMAT/FileHandler.h>
#include <OpenMS/KERNEL/StandardTypes.h>
#include <OpenMS/openms_data_path.h> // exotic header for path to tutorial data
#include <iostream>

using namespace OpenMS;
using namespace std;

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]);
auto file_dta = OPENMS_DOC_PATH + String("/code_examples/data/Tutorial_SavitzkyGolayFilter.dta");

// A DTA file always has exactly one Spectrum, so we get that
MSSpectrum spectrum;
// Load the dta file into the spectrum
FileHandler().loadSpectrum(tutorial_data_path + "/data/Tutorial_SavitzkyGolayFilter.dta", spectrum);
FileHandler().loadSpectrum(file_dta, spectrum);

LinearResampler lr;
Param param_lr;
Expand Down
5 changes: 2 additions & 3 deletions doc/code_examples/Tutorial_Unlabeled.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@

#include <OpenMS/ANALYSIS/MAPMATCHING/FeatureGroupingAlgorithmUnlabeled.h>
#include <OpenMS/FORMAT/FileHandler.h>
#include <OpenMS/openms_data_path.h> // exotic header for path to tutorial data

using namespace OpenMS;
using namespace std;

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]);
auto tutorial_data_path = OPENMS_DOC_PATH + String("/code_examples/");

vector<FeatureMap > maps;
maps.resize(2);
Expand Down

0 comments on commit a929d59

Please sign in to comment.