File: test_msrunreaderng.cpp

package info (click to toggle)
libpappsomspp 0.11.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 18,032 kB
  • sloc: cpp: 78,332; xml: 44,164; python: 668; sql: 186; sh: 33; makefile: 31
file content (123 lines) | stat: -rw-r--r-- 4,484 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123

/*******************************************************************************
 * Copyright (c) 2023 Olivier Langella <Olivier.Langella@u-psud.fr>.
 *
 * This file is part of the PAPPSOms++ library.
 *
 *     PAPPSOms++ is free software: you can redistribute it and/or modify
 *     it under the terms of the GNU General Public License as published by
 *     the Free Software Foundation, either version 3 of the License, or
 *     (at your option) any later version.
 *
 *     PAPPSOms++ is distributed in the hope that it will be useful,
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *     GNU General Public License for more details.
 *
 *     You should have received a copy of the GNU General Public License
 *     along with PAPPSOms++.  If not, see <http://www.gnu.org/licenses/>.
 *
 ******************************************************************************/

// cmake .. -DCMAKE_BUILD_TYPE=Debug  -DMAKE_TESTS=1  -DUSEPAPPSOTREE=1

//./tests/catch2-only-tests [MsRunReader] -s
//./tests/catch2-only-tests [MsRunReaderPerf] -s
//./tests/catch2-only-tests [MsRunReaderPerf] -s --benchmark-samples 5

#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do
                          // this in one cpp file

#define CATCH_CONFIG_ENABLE_BENCHMARKING

#include <catch2/catch_test_macros.hpp>
#include <catch2/benchmark/catch_benchmark.hpp>


#include <iostream>

#include <pappsomspp/core/pappsoexception.h>
#include <pappsomspp/core/exception/exceptionnotpossible.h>
#include <pappsomspp/core/msfile/msfileaccessor.h>
#include <pappsomspp/core/msrun/output/mzxmloutput.h>
#include <pappsomspp/core/processing/uimonitor/uimonitorvoid.h>
#include <pappsomspp/core/msrun/private/timsframesmsrunreader.h>
#include <QDebug>
#include <QtCore>
#include <QFile>
#include <QtConcurrent>
#include "tests/tests-config.h"
// #include "common.h"

using namespace std;


TEST_CASE("Test MsRunReader new API performance", "[MsRunReaderPerf]")
{

  // Set the debugging message formatting pattern.
  qSetMessagePattern(QString("%{file}@%{line}, %{function}(): %{message}"));

#if USEPAPPSOTREE == 1

  SECTION("..::  MsRunReader performance check ::..")
  {
    qDebug();
    pappso::MsFileAccessor file_access_A01(
      "/gorgone/pappso/versions_logiciels_pappso/bruker/"
      "200ngHeLaPASEF_2min_compressed.d",
      "");

    file_access_A01.setPreferredFileReaderType(pappso::Enums::MsDataFormat::brukerTims,
                                               pappso::Enums::FileReaderType::tims_frames);
    pappso::MsRunReaderSPtr msrunA01 = file_access_A01.getMsRunReaderSPtrByRunId("", "runa01");

    pappso::MsRunReadConfig config;
    // config.setRetentionTimeStartInSeconds(2490);
    // config.setRetentionTimeEndInSeconds(2600);
    config.setParameterValue(pappso::MsRunReadConfigParameter::TimsFrameIonMobScanIndexBegin, 100);
    config.setParameterValue(pappso::MsRunReadConfigParameter::TimsFrameIonMobScanIndexEnd, 200);
    config.setNeedPeakList(true);
    config.setMsLevels({1});

    // msrunA01.get()->setMonoThread(false);

    pappso::MsRunQualifiedSpectrumLoader spectrum_list_reader;
    BENCHMARK("without mz merge")
    {
      msrunA01.get()->readSpectrumCollection2(config, spectrum_list_reader);
    };

    // REQUIRE(spectrum_list_reader.getQualifiedMassSpectrumList().size() ==
    // 33);

    config.setParameterValue(pappso::MsRunReadConfigParameter::TimsFrameMzIndexMergeWindow, 7);
    BENCHMARK("with TimsFramesMsRunReader_mz_index_merge_window 7")
    {
      msrunA01.get()->readSpectrumCollection2(config, spectrum_list_reader);
    };

    config.setParameterValue(pappso::MsRunReadConfigParameter::TimsFrameMzIndexMergeWindow, 15);
    BENCHMARK("with TimsFramesMsRunReader_mz_index_merge_window 15")
    {
      msrunA01.get()->readSpectrumCollection2(config, spectrum_list_reader);
    };


    config.setParameterValue(pappso::MsRunReadConfigParameter::TimsFrameMzIndexMergeWindow, 30);
    BENCHMARK("with TimsFramesMsRunReader_mz_index_merge_window 30")
    {
      msrunA01.get()->readSpectrumCollection2(config, spectrum_list_reader);
    };


    config.setParameterValue(pappso::MsRunReadConfigParameter::TimsFrameMzIndexMergeWindow, 600);

    BENCHMARK("with TimsFramesMsRunReader_mz_index_merge_window 600")
    {
      msrunA01.get()->readSpectrumCollection2(config, spectrum_list_reader);
    };
  }

#endif
}