/**
 * \file tests/test_transformed_spectrum.cpp
 * \date 14/11/2023
 * \author Olivier Langella
 * \brief tests for peptide model
 */


/*
 * SpecGlobTool, Spectra to peptide alignment tool
 * Copyright (C) 2023  Olivier Langella
 * <olivier.langella@universite-paris-saclay.fr>
 *
 * This program 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.
 *
 * This program 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
 *   mp_parent-> along with this program.  If not, see
 * <http://www.gnu.org/licenses/>.
 *
 */
// ./tests/spoms/catch2-spoms-tests [transformed_spectrum] -s

#include <QDebug>
#include <QString>
#include <QTextStream>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_approx.hpp>
#include <catch2/matchers/catch_matchers_vector.hpp>
#include <cstdint>
#include <pappsomspp/core/processing/filters/filterresample.h>
#include <pappsomspp/core/processing/filters/filterpass.h>
#include <pappsomspp/core/massspectrum/qualifiedmassspectrum.h>
#include <pappsomspp/core/amino_acid/aacode.h>
#include <pappsomspp/core/types.h>
#include <qdebug.h>
#include <qlogging.h>
#include "../../src/core/spoms/transformedspectrum.h"
#include "../config.h"
#include "../common.h"

TEST_CASE("test for transformed_spectrum.", "[transformed_spectrum]")
{
  // Set the debugging message formatting pattern.
  qSetMessagePattern(QString("%{file}@%{line}, %{function}(): %{message}"));


  SECTION("check condition", "[transformed_spectrum]")
  {


    pappso::AaCode aa_code;
    aa_code.addAaModification('C',
                              pappso::AaModification::getInstance("MOD:00397"));


    pappso::QualifiedMassSpectrum spectrum_simple =
      readMgf(QString(CMAKE_SOURCE_DIR)
                .append("/tests/data/peaklists/peaklist_15046.mgf"));
    pappso::FilterGreatestY(60).filter(
      *(spectrum_simple.getMassSpectrumSPtr().get()));


    QualifiedMassSpectrumCstSPtr qmsp =
      spectrum_simple.makeQualifiedMassSpectrumCstSPtr();
    pappso::spoms::TransformedSpectrum tr_spectrum(aa_code, qmsp);

    auto tyrosine_pos = tr_spectrum.getAminoAcidsPositions()[aa_code.getAaCode(
      Enums::AminoAcidChar::tyrosine)];

    for(auto pos : tyrosine_pos)
      {
        qDebug() << "Y " << pos.toString() << " left:" << pos.getLeftColumn();
      }
    REQUIRE(tyrosine_pos.size() == 0);

    auto lysine_pos = tr_spectrum.getAminoAcidsPositions()[aa_code.getAaCode(
      Enums::AminoAcidChar::lysine)];

    for(auto pos : lysine_pos)
      {
        qDebug() << "K " << pos.toString() << " left:" << pos.getLeftColumn();
        /*
        [Thread-0] INFO main.Main - K: 12 6

        [Thread-0] INFO main.Main - (19,02 ,147,11)*10 left:-1
        [Thread-0] INFO main.Main - (87,04 ,215,14)1 left:0
        [Thread-0] INFO main.Main - (214,12 ,342,20)1 left:8
        [Thread-0] INFO main.Main - (915,53 ,1043,61)1 left:42
        [Thread-0] INFO main.Main - (1042,59 ,1170,68)*1000000000000 left:48
        [Thread-0] INFO main.Main - (1128,63 ,1256,72)*100 left:60
         */
      }
    REQUIRE(lysine_pos.at(0).getLeftColumn() == -1);
    REQUIRE(lysine_pos.at(1).getLeftColumn() == 0);
    REQUIRE(lysine_pos.at(2).getLeftColumn() == 8);

    auto serine_pos = tr_spectrum.getAminoAcidsPositions()[aa_code.getAaCode(
      Enums::AminoAcidChar::serine)];

    for(auto pos : serine_pos)
      {
        qDebug() << pos.toString() << " left:" << pos.getLeftColumn();
        /*
         * (184.129 ,271.176)1"  left: 6
         * (255.165 ,342.202)*10000"  left: 10
         * (427.213 ,514.246)*1001000"  left: 20
         * (428.217 ,515.248)*1000"  left: 21
         * (742.481 ,829.511)*1010000000"  left: 33
         * (743.482 ,830.515)*1000000000"  left: 34
         * (915.526 ,1002.56)1"  left: 42
         */
      }
    // REQUIRE(false);

    for(int i = 1; i < 20; i++)
      {
        qDebug() << i << " " << aa_code.getAa((uint8_t)i).toString()
                 << tr_spectrum.getAminoAcidsPositions().at(i).size();
        /*
         * [Thread-0] INFO main.Main - aa: G 10
         [Thread-0] INFO main.Main - aa: A 14
         [Thread-0] INFO main.Main - aa: S 8
         [Thread-0] INFO main.Main - aa: P 4
         [Thread-0] INFO main.Main - aa: V 6
         [Thread-0] INFO main.Main - aa: T 6
         [Thread-0] INFO main.Main - aa: C 0
         [Thread-0] INFO main.Main - aa: I 18
         [Thread-0] INFO main.Main - aa: L 18
         [Thread-0] INFO main.Main - aa: N 2
         [Thread-0] INFO main.Main - aa: D 10
         [Thread-0] INFO main.Main - aa: Q 4
         [Thread-0] INFO main.Main - aa: K 6
         [Thread-0] INFO main.Main - aa: E 2
         [Thread-0] INFO main.Main - aa: M 0
         [Thread-0] INFO main.Main - aa: H 2
         [Thread-0] INFO main.Main - aa: F 2
         [Thread-0] INFO main.Main - aa: R 1
         [Thread-0] INFO main.Main - aa: Y 0
         [Thread-0] INFO main.Main - aa: W 6
         [Thread-0] INFO main.Main - aa: U 0
         [Thread-0] INFO main.Main - aa: O 7
         */
        /*
         *
         /home/langella/developpement/git/peptidoms/specpeptidoms/tests/spoms/test_transformed_spectrum.cpp@78,
         CATCH2_INTERNAL_TEST_0(): 1   "G" 10
         /home/langella/developpement/git/peptidoms/specpeptidoms/tests/spoms/test_transformed_spectrum.cpp@78,
         CATCH2_INTERNAL_TEST_0(): 2   "A" 14
         /home/langella/developpement/git/peptidoms/specpeptidoms/tests/spoms/test_transformed_spectrum.cpp@78,
         CATCH2_INTERNAL_TEST_0(): 3   "S" 8
         /home/langella/developpement/git/peptidoms/specpeptidoms/tests/spoms/test_transformed_spectrum.cpp@78,
         CATCH2_INTERNAL_TEST_0(): 4   "P" 4
         /home/langella/developpement/git/peptidoms/specpeptidoms/tests/spoms/test_transformed_spectrum.cpp@78,
         CATCH2_INTERNAL_TEST_0(): 5   "V" 6
         /home/langella/developpement/git/peptidoms/specpeptidoms/tests/spoms/test_transformed_spectrum.cpp@78,
         CATCH2_INTERNAL_TEST_0(): 6   "T" 6
         /home/langella/developpement/git/peptidoms/specpeptidoms/tests/spoms/test_transformed_spectrum.cpp@78,
         CATCH2_INTERNAL_TEST_0(): 7   "I" 18
         /home/langella/developpement/git/peptidoms/specpeptidoms/tests/spoms/test_transformed_spectrum.cpp@78,
         CATCH2_INTERNAL_TEST_0(): 8   "N" 2
         /home/langella/developpement/git/peptidoms/specpeptidoms/tests/spoms/test_transformed_spectrum.cpp@78,
         CATCH2_INTERNAL_TEST_0(): 9   "D" 10
         /home/langella/developpement/git/peptidoms/specpeptidoms/tests/spoms/test_transformed_spectrum.cpp@78,
         CATCH2_INTERNAL_TEST_0(): 10   "Q" 4
         /home/langella/developpement/git/peptidoms/specpeptidoms/tests/spoms/test_transformed_spectrum.cpp@78,
         CATCH2_INTERNAL_TEST_0(): 11   "K" 6
         /home/langella/developpement/git/peptidoms/specpeptidoms/tests/spoms/test_transformed_spectrum.cpp@78,
         CATCH2_INTERNAL_TEST_0(): 12   "E" 2
         /home/langella/developpement/git/peptidoms/specpeptidoms/tests/spoms/test_transformed_spectrum.cpp@78,
         CATCH2_INTERNAL_TEST_0(): 13   "M" 0
         /home/langella/developpement/git/peptidoms/specpeptidoms/tests/spoms/test_transformed_spectrum.cpp@78,
         CATCH2_INTERNAL_TEST_0(): 14   "H" 2
         /home/langella/developpement/git/peptidoms/specpeptidoms/tests/spoms/test_transformed_spectrum.cpp@78,
         CATCH2_INTERNAL_TEST_0(): 15   "F" 2
         /home/langella/developpement/git/peptidoms/specpeptidoms/tests/spoms/test_transformed_spectrum.cpp@78,
         CATCH2_INTERNAL_TEST_0(): 16   "R" 1
         /home/langella/developpement/git/peptidoms/specpeptidoms/tests/spoms/test_transformed_spectrum.cpp@78,
         CATCH2_INTERNAL_TEST_0(): 17   "C(MOD:00397)" 0
         /home/langella/developpement/git/peptidoms/specpeptidoms/tests/spoms/test_transformed_spectrum.cpp@78,
         CATCH2_INTERNAL_TEST_0(): 18   "Y" 0[Thread-0] INFO main.Main - aa: G
         10 [Thread-0] INFO main.Main - aa: A 14 [Thread-0] INFO main.Main - aa:
         S 8 [Thread-0] INFO main.Main - aa: P 4 [Thread-0] INFO main.Main - aa:
         V 6 [Thread-0] INFO main.Main - aa: T 6 [Thread-0] INFO main.Main - aa:
         C 0 [Thread-0] INFO main.Main - aa: I 18 [Thread-0] INFO main.Main -
         aa: L 18 [Thread-0] INFO main.Main - aa: N 2 [Thread-0] INFO main.Main
         - aa: D 10 [Thread-0] INFO main.Main - aa: Q 4 [Thread-0] INFO
         main.Main - aa: K 6 [Thread-0] INFO main.Main - aa: E 2 [Thread-0] INFO
         main.Main - aa: M 0 [Thread-0] INFO main.Main - aa: H 2 [Thread-0] INFO
         main.Main - aa: F 2 [Thread-0] INFO main.Main - aa: R 1 [Thread-0] INFO
         main.Main - aa: Y 0 [Thread-0] INFO main.Main - aa: W 6 [Thread-0] INFO
         main.Main - aa: U 0 [Thread-0] INFO main.Main - aa: O 7
         */
      }

    REQUIRE(tr_spectrum.getColumnMass(0) ==
            Catch::Approx(pappso::MASSH2O + pappso::MHPLUS));
    REQUIRE(tr_spectrum.getColumnMass(1) == Catch::Approx(120.08078));
    for(int i = 0; i < tr_spectrum.getColumnCount(); i++)
      {
        // 402.290344 disapears
        qDebug() << i << " " << tr_spectrum.getColumnMass(i);
      }
    // REQUIRE(tr_spectrum.getColumnMass(70) ==
    // Catch::Approx(1170.6837620000001)); REQUIRE(tr_spectrum.getColumnMass(71)
    // == Catch::Approx(1256.7210035331211));
    /*
     * [Thread-0] INFO main.Main - i:0 false 19.017841150921
     [Thread-0] INFO main.Main - i:1 false 120.08078
     [Thread-0] INFO main.Main - i:2 false 147.112473
     [Thread-0] INFO main.Main - i:3 false 158.091949
     [Thread-0] INFO main.Main - i:4 false 158.137009
     [Thread-0] INFO main.Main - i:5 false 159.091446
     [Thread-0] INFO main.Main - i:6 false 175.118683
     [Thread-0] INFO main.Main - i:7 false 186.12265
     [Thread-0] INFO main.Main - i:8 false 201.123016
     [Thread-0] INFO main.Main - i:9 false 215.138428
     [Thread-0] INFO main.Main - i:10 false 229.117401
     [Thread-0] INFO main.Main - i:11 false 255.16486400000002
     [Thread-0] INFO main.Main - i:12 false 256.16736699999996
     [Thread-0] INFO main.Main - i:13 false 271.175751
     [Thread-0] INFO main.Main - i:14 false 288.202057
     [Thread-0] INFO main.Main - i:15 false 308.188263
     [Thread-0] INFO main.Main - i:16 false 330.169708
     [Thread-0] INFO main.Main - i:17 false 342.202484
     [Thread-0] INFO main.Main - i:18 false 370.19019399999996
     [Thread-0] INFO main.Main - i:19 false 371.19367299999993
     [Thread-0] INFO main.Main - i:20 false 401.286804
     [Thread-0] INFO main.Main - i:21 false 402.290344
     [Thread-0] INFO main.Main - i:22 false 427.213326
     [Thread-0] INFO main.Main - i:23 false 428.216927
     [Thread-0] INFO main.Main - i:24 false 428.269226
     [Thread-0] INFO main.Main - i:25 false 514.246285
     [Thread-0] INFO main.Main - i:26 false 515.247628
     [Thread-0] INFO main.Main - i:27 false 516.313049
     [Thread-0] INFO main.Main - i:28 false 517.317139
     [Thread-0] INFO main.Main - i:29 false 614.3131799999999
     [Thread-0] INFO main.Main - i:30 false 627.3224569999999
     [Thread-0] INFO main.Main - i:31 false 628.331063
     [Thread-0] INFO main.Main - i:32 false 629.397217
     [Thread-0] INFO main.Main - i:33 false 630.405823
     [Thread-0] INFO main.Main - i:34 false 740.4111409999999
     [Thread-0] INFO main.Main - i:35 false 741.415231
     [Thread-0] INFO main.Main - i:36 false 742.480652
     [Thread-0] INFO main.Main - i:37 false 743.481995
     [Thread-0] INFO main.Main - i:38 false 829.511353
     [Thread-0] INFO main.Main - i:39 false 830.514954
     [Thread-0] INFO main.Main - i:40 false 843.513977
     [Thread-0] INFO main.Main - i:41 false 855.4379359999999
     [Thread-0] INFO main.Main - i:42 false 856.4414759999999
     [Thread-0] INFO main.Main - i:43 false 886.534607
     [Thread-0] INFO main.Main - i:44 false 887.538086
     [Thread-0] INFO main.Main - i:45 false 927.5585719999999
     [Thread-0] INFO main.Main - i:46 false 969.526223
     [Thread-0] INFO main.Main - i:47 false 986.5525289999999
     [Thread-0] INFO main.Main - i:48 false 1001.560913
     [Thread-0] INFO main.Main - i:49 false 1002.563416
     [Thread-0] INFO main.Main - i:50 false 1028.610879
     [Thread-0] INFO main.Main - i:51 false 1042.589852
     [Thread-0] INFO main.Main - i:52 true 1043.610024
     [Thread-0] INFO main.Main - i:53 false 1056.605264
     [Thread-0] INFO main.Main - i:54 true 1072.600106
     [Thread-0] INFO main.Main - i:55 false 1073.599487
     [Thread-0] INFO main.Main - i:56 false 1074.615701
     [Thread-0] INFO main.Main - i:57 false 1082.6095970000001
     [Thread-0] INFO main.Main - i:58 false 1084.599801
     [Thread-0] INFO main.Main - i:59 false 1086.6157620000001
     [Thread-0] INFO main.Main - i:60 false 1099.636331
     [Thread-0] INFO main.Main - i:61 false 1100.5949640000001
     [Thread-0] INFO main.Main - i:62 false 1110.6158070000001
     [Thread-0] INFO main.Main - i:63 false 1114.610619
     [Thread-0] INFO main.Main - i:64 false 1127.6421440000001
     [Thread-0] INFO main.Main - i:65 false 1128.6262140000001
     [Thread-0] INFO main.Main - i:66 false 1155.6730890000001
     [Thread-0] INFO main.Main - i:67 false 1156.657258
     [Thread-0] INFO main.Main - i:68 false 1168.6681760000001
     [Thread-0] INFO main.Main - i:69 false 1170.6281820000002
     [Thread-0] INFO main.Main - i:70 false 1170.6837620000001
     [Thread-0] INFO main.Main - i:71 false 1256.7210035331211
     */
    REQUIRE(tr_spectrum.getColumnCount() ==
            68); // 72 in orignal Java because there are rare amino acids (O)
    /*
     * /home/langella/developpement/git/peptidoms/specpeptidoms/src/core/spoms/transformedspectrum.cpp@190, pappso::spoms::TransformedSpectrum::TransformedSpectrum(): "i:0_0 i:1_0 i:2_0 i:3_0 i:4_0 i:5_1 i:6_1 i:7_0 i:8_0 i:9_0 i:10_0 i:11_1 i:12_0 i:13_0 i:14_0 i:15_1 i:16_0 i:17_0 i:18_1 i:19_0 i:20_1 i:21_0 i:22_0 i:23_1 i:24_1 i:25_0 i:26_1 i:27_1 i:28_1 i:29_1 i:30_1 i:31_1 i:32_0 i:33_1 i:34_1 i:35_1 i:36_1 i:37_1 i:38_0 i:39_1 i:40_1 i:41_0 i:42_1 i:43_1 i:44_1 i:45_1 i:46_1 i:47_1 i:48_0 i:49_1 i:50_1 i:51_1 i:52_1 i:53_0 i:54_1 i:55_1 i:56_1 i:57_0 i:58_0 i:59_0 i:60_0 i:61_1 i:62_0 i:63_1 i:64_0 i:65_0 i:66_1 i:67_1 i:68_1 i:69_0 i:70_0 i:71_1 i:72_0 i:73_0 i:74_1 i:75_1 i:76_0 i:77_1 i:78_0 i:79_1 i:80_1 i:81_1 i:82_0 i:83_0 i:84_1 i:85_1 i:86_0 i:87_0 i:88_1 i:89_1 i:90_1 i:91_1 i:92_1 i:93_1 i:94_0 i:95_1 i:96_1 i:97_1 i:98_1 i:99_1 i:100_0 i:101_1 i:102_1 i:103_1 i:104_1 i:105_1 i:106_1 i:107_1 i:108_0 i:109_1 i:110_1 i:111_1 i:112_0 i:113_0 i:114_1 i:115_1 i:116_1 i:117_1 i:118_0"
     /home/langella/developpement/git/peptidoms/specpeptidoms/src/core/spoms/transformedspectrum.cpp@191,
     pappso::spoms::TransformedSpectrum::TransformedSpectrum(): 74
     */

    REQUIRE(tr_spectrum.getMiddlePeak() == 45);
    //[Thread-0] INFO main.Main - (19,02 ,175,12)*10
    REQUIRE(tr_spectrum
              .getAminoAcidsPositions()[aa_code.getAaCode(
                Enums::AminoAcidChar::arginine)]
              .at(0)
              .toString()
              .toStdString() == "(19.0178 ,175.119)*10");


    auto leucine_pos = tr_spectrum.getAminoAcidsPositions()[aa_code.getAaCode(
      Enums::AminoAcidChar::leucine)];

    for(auto pos : leucine_pos)
      {
        qDebug() << pos.toString();
        /*
"(102.055 ,215.138)1"
"(158.092 ,271.176)*11000"
"(175.119 ,288.202)*1000000000000000000"
"(229.117 ,342.202)*1000000010000"
"(288.202 ,401.287)*1000000000"
"(514.246 ,627.322)*100000"
"(515.248 ,628.331)*100100000"
"(516.313 ,629.397)*100000000000"
"(517.317 ,630.406)*100000000000"
"(627.322 ,740.411)*1000000000"
"(628.331 ,741.415)*1000000000"
"(629.397 ,742.481)*1000000000"
"(630.406 ,743.482)*1000000000"
"(856.441 ,969.526)*100000000000"
"(915.526 ,1028.61)1"
"(969.526 ,1082.61)*1000000000"
"(986.553 ,1099.64)*10000"
"(1042.59 ,1155.67)*100000000000"
         */
      }

    REQUIRE(leucine_pos.size() == 18);
    REQUIRE(leucine_pos.at(0).toString().toStdString() ==
            "(102.055 ,215.138)1");
    REQUIRE(leucine_pos.at(1).toString().toStdString() ==
            "(158.092 ,271.176)*11000");
    REQUIRE(leucine_pos.at(2).toString().toStdString() ==
            "(175.119 ,288.202)*1000000000000000000");
    REQUIRE(leucine_pos.at(3).toString().toStdString() ==
            "(229.117 ,342.202)*1000000010000");
    REQUIRE(leucine_pos.at(4).toString().toStdString() ==
            "(288.202 ,401.287)*1000000000");
    REQUIRE(leucine_pos.at(5).toString().toStdString() ==
            "(514.246 ,627.322)*100000");
    REQUIRE(leucine_pos.at(6).toString().toStdString() ==
            "(515.248 ,628.331)*100100000");
    REQUIRE(leucine_pos.at(7).toString().toStdString() ==
            "(516.313 ,629.397)*100000000000");

    /*

    [Thread-0] INFO main.Main - L: 8 1
    [Thread-0] INFO main.Main - (102,06 ,215,14)1
    [Thread-0] INFO main.Main - (158,09 ,271,18)*1100
    [Thread-0] INFO main.Main - (175,12 ,288,20)*10000000000000000000
    [Thread-0] INFO main.Main - (229,12 ,342,20)*10000000001000
    [Thread-0] INFO main.Main - (288,20 ,401,29)*11000000000
    [Thread-0] INFO main.Main - (514,25 ,627,32)*10000
    [Thread-0] INFO main.Main - (515,25 ,628,33)*10010000
    [Thread-0] INFO main.Main - (516,31 ,629,40)*1000000000000
    [Thread-0] INFO main.Main - (517,32 ,630,41)*1000000000000
    [Thread-0] INFO main.Main - (627,32 ,740,41)*11000000000
    [Thread-0] INFO main.Main - (628,33 ,741,42)*11000000000
    [Thread-0] INFO main.Main - (629,40 ,742,48)*11000000000
    [Thread-0] INFO main.Main - (630,41 ,743,48)*11000000000
    [Thread-0] INFO main.Main - (856,44 ,969,53)*1000000000000
    [Thread-0] INFO main.Main - (915,53 ,1028,61)1
    [Thread-0] INFO main.Main - (969,53 ,1082,61)*11000000000
    [Thread-0] INFO main.Main - (986,55 ,1099,64)*1000
    [Thread-0] INFO main.Main - (1042,59 ,1155,67)*1000000000000
     *
     */
  }

  SECTION("check column is double", "[transformed_spectrum]")
  {


    pappso::AaCode aa_code;
    aa_code.addAaModification('C',
                              pappso::AaModification::getInstance("MOD:00397"));


    pappso::QualifiedMassSpectrum spectrum_simple =
      readMgf(QString(CMAKE_SOURCE_DIR)
                .append("/tests/data/peaklists/peaklist_15046.mgf"));
    pappso::FilterGreatestY(60).filter(
      *(spectrum_simple.getMassSpectrumSPtr().get()));


    QualifiedMassSpectrumCstSPtr qmsp =
      spectrum_simple.makeQualifiedMassSpectrumCstSPtr();
    pappso::spoms::TransformedSpectrum tr_spectrum(aa_code, qmsp);


    REQUIRE(tr_spectrum.isDoubleColumn(50) == true); // should be 52 and 54
    REQUIRE(tr_spectrum.isDoubleColumn(51) == false);
    REQUIRE(tr_spectrum.isDoubleColumn(52) == true);
    REQUIRE(tr_spectrum.isDoubleColumn(53) == false);
    REQUIRE(tr_spectrum.isDoubleColumn(54) == false);
    // REQUIRE(tr_spectrum.getColumnCount() == 70);
    /*
    [Thread - 0] INFO main.Main - i: 0 false[Thread - 0] INFO main.Main -
    i: 1 false[Thread - 0] INFO main.Main -
    i: 2 false[Thread - 0] INFO main.Main -
    i: 3 false[Thread - 0] INFO main.Main -
    i: 4 false[Thread - 0] INFO main.Main -
    i: 5 false[Thread - 0] INFO main.Main -
    i: 6 false[Thread - 0] INFO main.Main -
    i: 7 false[Thread - 0] INFO main.Main -
    i: 8 false[Thread - 0] INFO main.Main -
    i: 9 false[Thread - 0] INFO main.Main -
    i: 10 false[Thread - 0] INFO main.Main -
    i: 11 false[Thread - 0] INFO main.Main -
    i: 12 false[Thread - 0] INFO main.Main -
    i: 13 false[Thread - 0] INFO main.Main -
    i: 14 false[Thread - 0] INFO main.Main -
    i: 15 false[Thread - 0] INFO main.Main -
    i: 16 false[Thread - 0] INFO main.Main -
    i: 17 false[Thread - 0] INFO main.Main -
    i: 18 false[Thread - 0] INFO main.Main -
    i: 19 false[Thread - 0] INFO main.Main -
    i: 20 false[Thread - 0] INFO main.Main -
    i: 21 false[Thread - 0] INFO main.Main -
    i: 22 false[Thread - 0] INFO main.Main -
    i: 23 false[Thread - 0] INFO main.Main -
    i: 24 false[Thread - 0] INFO main.Main -
    i: 25 false[Thread - 0] INFO main.Main -
    i: 26 false[Thread - 0] INFO main.Main -
    i: 27 false[Thread - 0] INFO main.Main -
    i: 28 false[Thread - 0] INFO main.Main -
    i: 29 false[Thread - 0] INFO main.Main -
    i: 30 false[Thread - 0] INFO main.Main -
    i: 31 false[Thread - 0] INFO main.Main -
    i: 32 false[Thread - 0] INFO main.Main -
    i: 33 false[Thread - 0] INFO main.Main -
    i: 34 false[Thread - 0] INFO main.Main -
    i: 35 false[Thread - 0] INFO main.Main -
    i: 36 false[Thread - 0] INFO main.Main -
    i: 37 false[Thread - 0] INFO main.Main -
    i: 38 false[Thread - 0] INFO main.Main -
    i: 39 false[Thread - 0] INFO main.Main -
    i: 40 false[Thread - 0] INFO main.Main -
    i: 41 false[Thread - 0] INFO main.Main -
    i: 42 false[Thread - 0] INFO main.Main -
    i: 43 false[Thread - 0] INFO main.Main -
    i: 44 false[Thread - 0] INFO main.Main -
    i: 45 false[Thread - 0] INFO main.Main -
    i: 46 false[Thread - 0] INFO main.Main -
    i: 47 false[Thread - 0] INFO main.Main -
    i: 48 false[Thread - 0] INFO main.Main -
    i: 49 false[Thread - 0] INFO main.Main -
    i: 50 false[Thread - 0] INFO main.Main -
    i: 51 false[Thread - 0] INFO main.Main -
    i: 52 true[Thread - 0] INFO main.Main -
    i: 53 false[Thread - 0] INFO main.Main -
    i: 54 true[Thread - 0] INFO main.Main -
    i: 55 false[Thread - 0] INFO main.Main -
    i: 56 false[Thread - 0] INFO main.Main -
    i: 57 false[Thread - 0] INFO main.Main -
    i: 58 false[Thread - 0] INFO main.Main -
    i: 59 false[Thread - 0] INFO main.Main -
    i: 60 false[Thread - 0] INFO main.Main -
    i: 61 false[Thread - 0] INFO main.Main -
    i: 62 false[Thread - 0] INFO main.Main -
    i: 63 false[Thread - 0] INFO main.Main -
    i: 64 false[Thread - 0] INFO main.Main -
    i: 65 false[Thread - 0] INFO main.Main -
    i: 66 false[Thread - 0] INFO main.Main -
    i: 67 false[Thread - 0] INFO main.Main -
    i: 68 false[Thread - 0] INFO main.Main -
    i: 69 false[Thread - 0] INFO main.Main -
    i: 70 false[Thread - 0] INFO main.Main -
    i: 71 false
    */
  }

  SECTION("check complementary peak", "[transformed_spectrum2]")
  {


    pappso::AaCode aa_code;
    aa_code.addAaModification('C',
                              pappso::AaModification::getInstance("MOD:00397"));


    pappso::QualifiedMassSpectrum spectrum_simple =
      readMgf(QString(CMAKE_SOURCE_DIR)
                .append("/tests/data/peaklists/peaklist_15046.mgf"));
    pappso::FilterGreatestY(60).filter(
      *(spectrum_simple.getMassSpectrumSPtr().get()));


    QualifiedMassSpectrumCstSPtr qmsp =
      spectrum_simple.makeQualifiedMassSpectrumCstSPtr();
    pappso::spoms::TransformedSpectrum tr_spectrum(aa_code, qmsp);

    REQUIRE(tr_spectrum.getComplementaryPeaks().size() == 118);
    REQUIRE(tr_spectrum.isDoubleColumn(0) == false);

    REQUIRE(tr_spectrum.getComplementaryPeaks()[0].get_mass() ==
            Catch::Approx(pappso::MASSH2O + pappso::MHPLUS));
    REQUIRE(tr_spectrum.getComplementaryPeaks()[26].get_mass() ==
            Catch::Approx(185.1281740));

    REQUIRE(tr_spectrum.getComplementaryPeaks()[1].get_mass() ==
            Catch::Approx(87.0445179));
    REQUIRE(tr_spectrum.getComplementaryPeaks()[1].isDouble() == false);
    REQUIRE(tr_spectrum.getComplementaryPeaks()[1].getNativePeak() == 1);

    REQUIRE(tr_spectrum.getComplementaryPeaks()[2].get_mass() ==
            Catch::Approx(87.10));

    REQUIRE(tr_spectrum.getComplementaryPeaks()[26].get_mass() ==
            Catch::Approx(185.13));
    REQUIRE(tr_spectrum.getComplementaryPeaks()[26].isDouble() == true);
    // REQUIRE(tr_spectrum.getComplementaryPeaks()[90].isDouble() == true);
    REQUIRE(tr_spectrum.getComplementaryPeaks()[91].get_mass() +
              tr_spectrum.getComplementaryPeaks()[26].get_mass() ==
            Catch::Approx(qmsp.get()->getPrecursorMass() + (2 * MHPLUS)));
    REQUIRE(tr_spectrum.getComplementaryPeaks()[85].get_mass() +
              tr_spectrum.getComplementaryPeaks()[32].get_mass() ==
            Catch::Approx(qmsp.get()->getPrecursorMass() + (2 * MHPLUS)));

    REQUIRE(tr_spectrum.getComplementaryPeaks()[32].get_mass() ==
            Catch::Approx(214.11825));
    // REQUIRE(tr_spectrum.isDoubleColumn(32) == true);
    REQUIRE(tr_spectrum.getComplementaryPeaks()[32].isDouble() == true);
    // REQUIRE(tr_spectrum.isDoubleColumn(26) == true);
    REQUIRE(tr_spectrum.getComplementaryPeaks()[26].isDouble() == true);

    // - i:85 mass:1043,61 is_double:true native_peak:31
    // REQUIRE(tr_spectrum.isDoubleColumn(85) == true);
    REQUIRE(tr_spectrum.getComplementaryPeaks()[85].isDouble() == true);
    // 91 mass:1072,60 is_double:true native_peak:25
    // REQUIRE(tr_spectrum.isDoubleColumn(91) == true);
    // REQUIRE(tr_spectrum.isDoubleColumn(54) == true);
    REQUIRE(tr_spectrum.getComplementaryPeaks()[91].isDouble() == true);

    REQUIRE(tr_spectrum.getComplementaryPeaks()[117].get_mass() ==
            Catch::Approx(1256.721));
    REQUIRE(tr_spectrum.getComplementaryPeaks()[117].isDouble() == false);
    REQUIRE(tr_spectrum.getComplementaryPeaks()[117].getNativePeak() == 61);

    /*
     *[Thread-0] INFO main.Main - i:0 mass:19,02 is_double:false native_peak:0
     [Thread-0] INFO main.Main - i:1 mass:87,04 is_double:false native_peak:1
     [Thread-0] INFO main.Main - i:2 mass:87,10 is_double:false native_peak:2
     [Thread-0] INFO main.Main - i:3 mass:89,06 is_double:false native_peak:3
     [Thread-0] INFO main.Main - i:4 mass:101,07 is_double:false native_peak:4
     [Thread-0] INFO main.Main - i:5 mass:102,06 is_double:false native_peak:5
     [Thread-0] INFO main.Main - i:6 mass:103,04 is_double:false native_peak:6
     [Thread-0] INFO main.Main - i:7 mass:110,07 is_double:false native_peak:7
     [Thread-0] INFO main.Main - i:8 mass:120,08 is_double:false native_peak:8
     [Thread-0] INFO main.Main - i:9 mass:129,10 is_double:false native_peak:9
     [Thread-0] INFO main.Main - i:10 mass:130,09 is_double:false native_peak:10
     [Thread-0] INFO main.Main - i:11 mass:133,09 is_double:false native_peak:11
     [Thread-0] INFO main.Main - i:12 mass:136,08 is_double:false native_peak:12
     [Thread-0] INFO main.Main - i:13 mass:141,10 is_double:false native_peak:13
     [Thread-0] INFO main.Main - i:14 mass:143,12 is_double:false native_peak:14
     [Thread-0] INFO main.Main - i:15 mass:147,11 is_double:false native_peak:15
     [Thread-0] INFO main.Main - i:16 mass:157,13 is_double:false native_peak:16
     [Thread-0] INFO main.Main - i:17 mass:158,09 is_double:false native_peak:17
     [Thread-0] INFO main.Main - i:18 mass:158,14 is_double:false native_peak:18
     [Thread-0] INFO main.Main - i:19 mass:159,09 is_double:false native_peak:19
     [Thread-0] INFO main.Main - i:20 mass:169,10 is_double:false native_peak:20
     [Thread-0] INFO main.Main - i:21 mass:171,11 is_double:false native_peak:21
     [Thread-0] INFO main.Main - i:22 mass:173,13 is_double:false native_peak:22
     [Thread-0] INFO main.Main - i:23 mass:175,12 is_double:false native_peak:23
     [Thread-0] INFO main.Main - i:24 mass:183,11 is_double:false native_peak:24
     [Thread-0] INFO main.Main - i:25 mass:184,13 is_double:false native_peak:60
     [Thread-0] INFO main.Main - i:26 mass:185,13 is_double:true native_peak:25
     [Thread-0] INFO main.Main - i:27 mass:185,16 is_double:false native_peak:26
     [Thread-0] INFO main.Main - i:28 mass:186,12 is_double:false native_peak:27
     [Thread-0] INFO main.Main - i:29 mass:197,13 is_double:false native_peak:28
     [Thread-0] INFO main.Main - i:30 mass:199,18 is_double:false native_peak:29
     [Thread-0] INFO main.Main - i:31 mass:201,12 is_double:false native_peak:30
     [Thread-0] INFO main.Main - i:32 mass:214,12 is_double:true native_peak:31
     [Thread-0] INFO main.Main - i:33 mass:215,14 is_double:false native_peak:32
     [Thread-0] INFO main.Main - i:34 mass:229,12 is_double:false native_peak:33
     [Thread-0] INFO main.Main - i:35 mass:255,16 is_double:false native_peak:57
     [Thread-0] INFO main.Main - i:36 mass:256,17 is_double:false native_peak:56
     [Thread-0] INFO main.Main - i:37 mass:271,18 is_double:false native_peak:34
     [Thread-0] INFO main.Main - i:38 mass:288,20 is_double:false native_peak:35
     [Thread-0] INFO main.Main - i:39 mass:308,19 is_double:false native_peak:36
     [Thread-0] INFO main.Main - i:40 mass:309,19 is_double:false native_peak:37
     [Thread-0] INFO main.Main - i:41 mass:330,17 is_double:false native_peak:38
     [Thread-0] INFO main.Main - i:42 mass:342,20 is_double:false native_peak:39
     [Thread-0] INFO main.Main - i:43 mass:370,19 is_double:false native_peak:55
     [Thread-0] INFO main.Main - i:44 mass:371,19 is_double:false native_peak:54
     [Thread-0] INFO main.Main - i:45 mass:401,29 is_double:false native_peak:40
     [Thread-0] INFO main.Main - i:46 mass:402,29 is_double:false native_peak:41
     [Thread-0] INFO main.Main - i:47 mass:414,21 is_double:false native_peak:53
     [Thread-0] INFO main.Main - i:48 mass:427,21 is_double:false native_peak:52
     [Thread-0] INFO main.Main - i:49 mass:428,22 is_double:false native_peak:51
     [Thread-0] INFO main.Main - i:50 mass:428,27 is_double:false native_peak:42
     [Thread-0] INFO main.Main - i:51 mass:473,96 is_double:false native_peak:43
     [Thread-0] INFO main.Main - i:52 mass:514,25 is_double:false native_peak:50
     [Thread-0] INFO main.Main - i:53 mass:515,25 is_double:false native_peak:49
     [Thread-0] INFO main.Main - i:54 mass:516,31 is_double:false native_peak:44
     [Thread-0] INFO main.Main - i:55 mass:517,32 is_double:false native_peak:45
     [Thread-0] INFO main.Main - i:56 mass:614,31 is_double:false native_peak:48
     [Thread-0] INFO main.Main - i:57 mass:627,32 is_double:false native_peak:47
     [Thread-0] INFO main.Main - i:58 mass:628,33 is_double:false native_peak:46
     [Thread-0] INFO main.Main - i:59 mass:629,40 is_double:false native_peak:46
     [Thread-0] INFO main.Main - i:60 mass:630,41 is_double:false native_peak:47
     [Thread-0] INFO main.Main - i:61 mass:643,42 is_double:false native_peak:48
     [Thread-0] INFO main.Main - i:62 mass:740,41 is_double:false native_peak:45
     [Thread-0] INFO main.Main - i:63 mass:741,42 is_double:false native_peak:44
     [Thread-0] INFO main.Main - i:64 mass:742,48 is_double:false native_peak:49
     [Thread-0] INFO main.Main - i:65 mass:743,48 is_double:false native_peak:50
     [Thread-0] INFO main.Main - i:66 mass:783,76 is_double:false native_peak:43
     [Thread-0] INFO main.Main - i:67 mass:829,46 is_double:false native_peak:42
     [Thread-0] INFO main.Main - i:68 mass:829,51 is_double:false native_peak:51
     [Thread-0] INFO main.Main - i:69 mass:830,51 is_double:false native_peak:52
     [Thread-0] INFO main.Main - i:70 mass:843,51 is_double:false native_peak:53
     [Thread-0] INFO main.Main - i:71 mass:855,44 is_double:false native_peak:41
     [Thread-0] INFO main.Main - i:72 mass:856,44 is_double:false native_peak:40
     [Thread-0] INFO main.Main - i:73 mass:886,53 is_double:false native_peak:54
     [Thread-0] INFO main.Main - i:74 mass:887,54 is_double:false native_peak:55
     [Thread-0] INFO main.Main - i:75 mass:915,53 is_double:false native_peak:39
     [Thread-0] INFO main.Main - i:76 mass:927,56 is_double:false native_peak:38
     [Thread-0] INFO main.Main - i:77 mass:948,54 is_double:false native_peak:37
     [Thread-0] INFO main.Main - i:78 mass:949,54 is_double:false native_peak:36
     [Thread-0] INFO main.Main - i:79 mass:969,53 is_double:false native_peak:35
     [Thread-0] INFO main.Main - i:80 mass:986,55 is_double:false native_peak:34
     [Thread-0] INFO main.Main - i:81 mass:1001,56 is_double:false
     native_peak:56
     [Thread-0] INFO main.Main - i:82 mass:1002,56
     is_double:false native_peak:57
     [Thread-0] INFO main.Main - i:83
     mass:1028,61 is_double:false native_peak:33
     [Thread-0] INFO main.Main -
     i:84 mass:1042,59 is_double:false native_peak:32
     [Thread-0] INFO main.Main
     - i:85 mass:1043,61 is_double:true native_peak:31
     [Thread-0] INFO main.Main
     - i:86 mass:1056,61 is_double:false native_peak:30
     [Thread-0] INFO
     main.Main - i:87 mass:1058,55 is_double:false native_peak:29
     [Thread-0]
     INFO main.Main - i:88 mass:1060,60 is_double:false native_peak:28
     [Thread-0] INFO main.Main - i:89 mass:1071,61 is_double:false
     native_peak:27
     [Thread-0] INFO main.Main - i:90 mass:1072,56
     is_double:false native_peak:26
     [Thread-0] INFO main.Main - i:91
     mass:1072,60 is_double:true native_peak:25
     [Thread-0] INFO main.Main - i:92
     mass:1073,60 is_double:false native_peak:60
     [Thread-0] INFO main.Main -
     i:93 mass:1074,62 is_double:false native_peak:24
     [Thread-0] INFO main.Main
     - i:94 mass:1082,61 is_double:false native_peak:23
     [Thread-0] INFO
     main.Main - i:95 mass:1084,60 is_double:false native_peak:22
     [Thread-0]
     INFO main.Main - i:96 mass:1086,62 is_double:false native_peak:21
     [Thread-0] INFO main.Main - i:97 mass:1088,63 is_double:false
     native_peak:20
     [Thread-0] INFO main.Main - i:98 mass:1098,64
     is_double:false native_peak:19
     [Thread-0] INFO main.Main - i:99
     mass:1099,59 is_double:false native_peak:18
     [Thread-0] INFO main.Main -
     i:100 mass:1099,64 is_double:false native_peak:17
     [Thread-0] INFO main.Main
     - i:101 mass:1100,59 is_double:false native_peak:16
     [Thread-0] INFO
     main.Main - i:102 mass:1110,62 is_double:false native_peak:15
     [Thread-0]
     INFO main.Main - i:103 mass:1114,61 is_double:false native_peak:14
     [Thread-0] INFO main.Main - i:104 mass:1116,63 is_double:false
     native_peak:13
     [Thread-0] INFO main.Main - i:105 mass:1121,65
     is_double:false native_peak:12
     [Thread-0] INFO main.Main - i:106
     mass:1124,64 is_double:false native_peak:11
     [Thread-0] INFO main.Main -
     i:107 mass:1127,64 is_double:false native_peak:10
     [Thread-0] INFO main.Main
     - i:108 mass:1128,63 is_double:false native_peak:9
     [Thread-0] INFO
     main.Main - i:109 mass:1137,65 is_double:false native_peak:8
     [Thread-0]
     INFO main.Main - i:110 mass:1147,66 is_double:false native_peak:7
     [Thread-0] INFO main.Main - i:111 mass:1154,69 is_double:false
     native_peak:6
     [Thread-0] INFO main.Main - i:112 mass:1155,67
     is_double:false native_peak:5
     [Thread-0] INFO main.Main - i:113
     mass:1156,66 is_double:false native_peak:4
     [Thread-0] INFO main.Main -
     i:114 mass:1168,67 is_double:false native_peak:3
     [Thread-0] INFO main.Main
     - i:115 mass:1170,63 is_double:false native_peak:2
     [Thread-0] INFO
     main.Main - i:116 mass:1170,68 is_double:false native_peak:1
     [Thread-0]
     INFO main.Main - i:117 mass:1256,72 is_double:false native_peak:61
     [Thread-0] INFO main.Main - i:118 mass:0,00 is_double:false native_peak:0
     [Thread-0] INFO main.Main - i:119 mass:0,00 is_double:false native_peak:0
     [Thread-0] INFO main.Main - i:120 mass:0,00 is_double:false native_peak:0
     [Thread-0] INFO main.Main - i:121 mass:0,00 is_double:false native_peak:0
     */

    REQUIRE(tr_spectrum.getColumnCount() == 68);
    REQUIRE(tr_spectrum
              .getAminoAcidsPositions()[aa_code.getAaCode(
                Enums::AminoAcidChar::methionine)]
              .size() == 0);
    REQUIRE(tr_spectrum
              .getAminoAcidsPositions()[aa_code.getAaCode(
                Enums::AminoAcidChar::tyrosine)]
              .size() == 0);
    REQUIRE(tr_spectrum
              .getAminoAcidsPositions()[aa_code.getAaCode(
                Enums::AminoAcidChar::arginine)]
              .size() == 1);
    // INFO main.Main - (19,02 ,175,12)*
    REQUIRE(tr_spectrum
              .getAminoAcidsPositions()[aa_code.getAaCode(
                Enums::AminoAcidChar::arginine)]
              .at(0)
              .toString()
              .toStdString() == "(19.0178 ,175.119)*10");
    // REQUIRE(false);
  }

  SECTION("check bitwise operation deisotope_60", "[transformed_spectrum]")
  {


    pappso::AaCode aa_code;
    aa_code.addAaModification('C',
                              pappso::AaModification::getInstance("MOD:00397"));


    pappso::QualifiedMassSpectrum spectrum_simple = readMgf(
      QString(CMAKE_SOURCE_DIR)
        .append("/tests/data/scans/"
                "20120906_balliau_extract_1_A01_urnb-1_4291_deisotope_60.mgf"));


    REQUIRE(spectrum_simple.size() == 60);


    /*

        QFile
       mgf_out("20120906_balliau_extract_1_A01_urnb-1_4291_deisotope_60.mgf");
        mgf_out.open(QFile::WriteOnly);

        pappso::MgfOutput mgf_writer(&mgf_out);

        mgf_writer.write(spectrum_simple);
        */


    pappso::QualifiedMassSpectrumCstSPtr qmsp =
      spectrum_simple.makeQualifiedMassSpectrumCstSPtr();
    pappso::spoms::TransformedSpectrum tr_spectrum(aa_code, qmsp);


    const std::vector<spoms::AAPosition> spectrum_M_pos =
      tr_spectrum.getAminoAcidsPositions()[aa_code.getAaCode(
        pappso::Enums::AminoAcidChar::methionine)];
    REQUIRE(spectrum_M_pos.size() == 0);

    std::vector<spoms::AAPosition> spectrum_Y_pos =
      tr_spectrum.getAminoAcidsPositions()[18];

    REQUIRE(aa_code.getAaCode(pappso::Enums::AminoAcidChar::tyrosine) == 18);
    REQUIRE(spectrum_Y_pos.size() == 8);
    REQUIRE(spectrum_Y_pos.at(0).toString().toStdString() ==
            "(175.119 ,338.182)*1000000000000000000");

    REQUIRE(spectrum_Y_pos.at(1).toString().toStdString() ==
            "(257.124 ,420.191)*10000");
    REQUIRE(spectrum_Y_pos.at(2).toString().toStdString() ==
            "(493.221 ,656.285)*100000");
    REQUIRE(spectrum_Y_pos.at(3).toString().toStdString() ==
            "(496.262 ,659.318)*10000000001000000");
    REQUIRE(spectrum_Y_pos.at(4).toString().toStdString() ==
            "(656.285 ,819.342)*110000000000000000000");

    REQUIRE(spectrum_Y_pos.at(5).toString().toStdString() ==
            "(659.318 ,822.382)*101000000000000001000");

    REQUIRE(spectrum_Y_pos.at(6).toString().toStdString() ==
            "(895.413 ,1058.48)1");

    REQUIRE(spectrum_Y_pos.at(7).toString().toStdString() ==
            "(977.422 ,1140.48)1");
    /*
    * [Thread-0] INFO main.Main - Y: 18 8
[Thread-0] INFO main.Main - (175,12 ,338,18)*
[Thread-0] INFO main.Main - (257,12 ,420,19)*
[Thread-0] INFO main.Main - (493,22 ,656,29)*
[Thread-0] INFO main.Main - (496,26 ,659,32)*
[Thread-0] INFO main.Main - (656,29 ,819,34)*
[Thread-0] INFO main.Main - (659,32 ,822,38)*
[Thread-0] INFO main.Main - (895,41 ,1058,48)
[Thread-0] INFO main.Main - (977,42 ,1140,48)
*/


    auto spectrum_R_pos =
      tr_spectrum.getAminoAcidsPositions()[aa_code.getAaCode(
        pappso::Enums::AminoAcidChar::arginine)];

    REQUIRE(spectrum_R_pos.size() == 8);
    /*
 * [Thread-0] INFO main.Main - R: 17 8
[Thread-0] INFO main.Main - (19,02 ,175,12)*
[Thread-0] INFO main.Main - (83,02 ,239,11)
[Thread-0] INFO main.Main - (485,22 ,641,30)*
[Thread-0] INFO main.Main - (503,23 ,659,32)*
[Thread-0] INFO main.Main - (656,29 ,812,37)*
[Thread-0] INFO main.Main - (674,30 ,830,39)
[Thread-0] INFO main.Main - (1076,49 ,1232,58)*
[Thread-0] INFO main.Main - (1140,48 ,1296,59)*
*/

    REQUIRE(spectrum_R_pos.at(0).toString().toStdString() ==
            "(19.0178 ,175.119)*10");
    REQUIRE(spectrum_R_pos.at(1).toString().toStdString() ==
            "(83.019 ,239.113)1");
    REQUIRE(spectrum_R_pos.at(2).toString().toStdString() ==
            "(485.215 ,641.304)*100010000000000");
    REQUIRE(spectrum_R_pos.at(3).toString().toStdString() ==
            "(503.229 ,659.318)*1000000");
    REQUIRE(spectrum_R_pos.at(4).toString().toStdString() ==
            "(656.285 ,812.375)*110000000000000000000");
    REQUIRE(spectrum_R_pos.at(5).toString().toStdString() ==
            "(674.299 ,830.388)1");
    REQUIRE(spectrum_R_pos.at(6).toString().toStdString() ==
            "(1076.49 ,1232.58)*10000000");
    REQUIRE(spectrum_R_pos.at(7).toString().toStdString() ==
            "(1140.48 ,1296.59)*100000100000000000000");

    REQUIRE((spectrum_R_pos.at(5).getRightMass() -
             spectrum_R_pos.at(5).getLeftMass()) ==
            Catch::Approx(aa_code.getMass(aa_code.getAaCode(
                            pappso::Enums::AminoAcidChar::arginine)))
              .margin(0.02));
    /*

        int i = 0;
        for(auto complement : tr_spectrum.getComplementaryPeaks())
          {
            qDebug() << i << " " << complement.toString();
            i++;
          }*/
    /*
        REQUIRE(aa_code.getMass(
                  aa_code.getAaCode(pappso::Enums::AminoAcidChar::arginine)) ==
       0); //156.10111102565201691 REQUIRE(1296.586107 - 1140.484772 == 0); //
       156.10133500000006279
        */
  }
}
