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 124 125 126 127 128 129 130 131 132
|
//
// File: test_isotope_with_spectrum.cpp
// Created by: Olivier Langella
// Created on: 13/3/2015
//
/*******************************************************************************
* Copyright (c) 2015 Olivier Langella <Olivier.Langella@moulon.inra.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/>.
*
* Contributors:
* Olivier Langella <Olivier.Langella@moulon.inra.fr> - initial API and
*implementation
******************************************************************************/
// ./tests/catch2-only-tests [spectrumisotope] -s
#include <catch2/catch_test_macros.hpp>
#include <pappsomspp/core/mzrange.h>
#include <pappsomspp/core/peptide/peptidenaturalisotopelist.h>
#include <pappsomspp/core/peptide/peptidefragmentionlistbase.h>
#include <iostream>
#include <QDebug>
#include <QString>
#include "tests/tests-config.h"
#include "common.h"
using namespace pappso;
using namespace std;
TEST_CASE("Enums::Isotope with spectrum test suite.", "[spectrumisotope]")
{
// Set the debugging message formatting pattern.
qSetMessagePattern(QString("%{file}@%{line}, %{function}(): %{message}"));
SECTION("..:: MassSpectrum ::..", "[spectrumisotope]")
{
// 20120906_balliau_extract_1_A01_urnb-1
// http://pappso.inra.fr/protic/proticprod/angular/#/peptide_hits/947252
MassSpectrum spectrum = readMgf(
QString(CMAKE_SOURCE_DIR).append("/tests/data/peaklist_15046.mgf"));
std::cout << "spectrum size:" << spectrum.size() << std::endl;
Peptide peptide("AIADGSLLDLLR");
std::list<Enums::PeptideIon> cid_ion = PeptideFragmentIonListBase::getCIDionList();
PeptideFragmentIonListBase frag_cid(peptide.makePeptideSp(), cid_ion);
PeptideFragmentIonSp pep_frag_ion_sp =
frag_cid.getPeptideFragmentIonSp(Enums::PeptideIon::y, 8);
PeptideNaturalIsotopeList isotopeListFrag(pep_frag_ion_sp);
std::map<unsigned int, pappso_double> map_isotope_number =
isotopeListFrag.getIntensityRatioPerIsotopeNumber();
std::map<unsigned int, pappso_double> map_isotope_number2real(
map_isotope_number);
// iterate through the m/z-intensity pairs
// for (vector<MZIntensityPair>::const_iterator it=pairs.begin(),
// end=pairs.end(); it!=end; ++it)
for(auto peak : spectrum)
{
for(auto isotope : isotopeListFrag)
{
if(MzRange(isotope.get()->getMz(1),
PrecisionFactory::getPpmInstance(100))
.contains(peak.x))
{
std::cout << std::endl
<< isotope.get()->getIsotopeNumber() << "..:: "
<< isotope.get()->getFormula(1).toStdString()
<< " mz1=" << isotope.get()->getMz(1)
<< " ratio=" << isotope.get()->getIntensityRatio(1)
<< " ::.." << std::endl;
std::cout << " real mz=" << peak.x << " real intensity"
<< peak.y << std::endl;
}
}
}
map_isotope_number = isotopeListFrag.getIntensityRatioPerIsotopeNumber();
std::cout << "isotope levels" << std::endl;
for(unsigned int i = 0; i < map_isotope_number.size(); i++)
{
std::cout << "frag isotope " << i << " " << map_isotope_number[i]
<< std::endl;
}
/*
0..:: C39H70O11N11S0 C13(0) H2(0) O17(0) O18(0) N15(0) S34(0) mz1=886.536
ratio=0.599391 ::.. 7: real mz=886.535 real intensity75443.3 7: 7: 1..::
C39H70O11N11S0 C13(1) H2(0) O17(0) O18(0) N15(0) S34(0) mz1=887.539
ratio=0.261863 ::.. 7: real mz=887.538 real intensity41018.6 7: 7: 1..::
C39H70O11N11S0 C13(0) H2(1) O17(0) O18(0) N15(0) S34(0) mz1=887.542
ratio=0.00653545 ::.. 7: real mz=887.538 real intensity41018.6 7: 7: 1..::
C39H70O11N11S0 C13(0) H2(0) O17(0) O18(0) N15(1) S34(0) mz1=887.533
ratio=0.02424 ::.. 7: real mz=887.538 real intensity41018.6
*/
/*
0..:: C39H70O11N11S0 C13(0) H2(0) O17(0) O18(0) N15(0) S34(0) mz1=886.536
ratio=0.599391 ::.. 7: real mz=886.535 real intensity75443.3 7: 7: 1..::
C39H70O11N11S0 C13(1) H2(0) O17(0) O18(0) N15(0) S34(0) mz1=887.539
ratio=0.261863 ::.. 7: real mz=887.538 real intensity41018.6 7: 7: 1..::
C39H70O11N11S0 C13(0) H2(1) O17(0) O18(0) N15(0) S34(0) mz1=887.542
ratio=0.00653545 ::.. 7: real mz=887.538 real intensity41018.6 7: 7: 1..::
C39H70O11N11S0 C13(0) H2(0) O17(0) O18(0) N15(1) S34(0) mz1=887.533
ratio=0.02424 ::.. 7: real mz=887.538 real intensity41018.6
*/
// SUCCESS
}
}
|