/****************************************************************************
* Copyright (C) 2008 Peter Mortensen and Matthias Mann *
* This file is part of MSQuant. *
* *
* MSQuant is distributed under the terms of *
* the GNU General Public License. See src/COPYING.TXT or *
* <http://www.gnu.org/licenses/gpl.txt> for details. *
* *
* MSQuant 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 2 of the *
* License, or (at your option) any later version. *
* *
* MSQuant 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 MSQuant; if not, write to *
* the Free Software Foundation, Inc., 59 Temple *
* Place, Suite 330, Boston, MA 02111-1307 USA *
* *
* Purpose: Unit testing of isotope distributions calculations. *
* *
****************************************************************************/
/****************************************************************************
* CEBI *
* Software Development Group *
* Peter Mortensen *
* E-mail: NUKESPAMMERSdrmortensen@get2netZZZZZZ.dk *
* WWW: http://www.cebi.sdu.dk/ *
* *
* Program for post-processing of result from search in mass *
* spectrometric data. *
* *
* FILENAME: PILgeneralisedIonSeriesTests.cs *
* TYPE: CSHARP *
* *
* CREATED: PM 2008-05-20 Vrs 1.0. *
* UPDATED: PM 2008-xx-xx *
* *
* *
* *
****************************************************************************/
using NUnit.Framework;
using massSpectrometryBase; //For class PILgeneralisedIonSeries
using System.Collections.Generic; //For List
using massSpectrometryBase.quantitation; //For AAsetStructure
/****************************************************************************
* <placeholder for header> *
****************************************************************************/
namespace namespaceForIsotopeDistributionTests
{
/****************************************************************************
* <placeholder for header> *
****************************************************************************/
[TestFixture]
public class PILgeneralisedIonSeriesTests
{
/****************************************************************************
* <placeholder for header> *
****************************************************************************/
[Test]
public void backwardIons()
{
//Note: this test is no longer self-contained after the
// generalisation of ion fragment masses computation.
string pepseq = "ACD";
List<double> fragMasses;
int fragLastIndex;
List<List<AAsetStruct>> modificationsList =
new List<List<AAsetStruct>>();
PILgeneralisedIonSeries.backwardIonArray(
ref pepseq, out fragMasses, out fragLastIndex,
"", ref modificationsList, false);
double tol = 2.0E-5;
Assert.AreEqual(2, fragLastIndex, "Number of y ions");
Assert.AreEqual(134.04477976, fragMasses[0], tol, "y1");
Assert.AreEqual(294.07542396, fragMasses[1], tol, "y2");
//Test yN.
Assert.AreEqual(365.11253476, fragMasses[2], tol, "y3");
} //backwardIons
/****************************************************************************
* <placeholder for header> *
****************************************************************************/
[Test]
public void yIons_MS3()
{
} //yIons_MS3
/****************************************************************************
* <placeholder for header> *
****************************************************************************/
[Test]
public void forwardIons()
{
//Note: this test is no longer self-contained after the
// generalisation of ion fragment masses computation.
string pepseq = "EFGHIKLMNPQRSTVWYA";
// 123456789012345678
List<double> fragMasses;
int fragLastIndex;
List<List<AAsetStruct>> modificationsList =
new List<List<AAsetStruct>>();
PILgeneralisedIonSeries.forwardIonArray(
ref pepseq, out fragMasses, out fragLastIndex,
"", ref modificationsList);
Assert.AreEqual(
1.007276455, MSconstants.PROTON_MASS_2, 1e-9, "Proton mass");
double tol = 5.0E-5;
//Sequence length is 18. bN is not returned, in contrast to yN.
Assert.AreEqual(17, fragLastIndex, "Number of b ions");
//Changed PM_UNITTEST_PASS 2008-07-24
//Now uses expected value computed by PILGrinder and a spreadsheet.
//But was still bad. The application computed 2088.048377295.
//
//Real reason: CHNOS element is PILGrinder were
// not accurate enough...
//After change the value from PILGrinder is now 2088.048377295.
//Note: as PILGrinder and the spreadsheet uses exactly the
// same element masses the result, at least in this case,
// is exactly the same.
//
////Assert.AreEqual(2088.048295060, fragMasses[16], tol, "b17");
//Assert.AreEqual( 2088.048295055, fragMasses[16], tol, "b17");
Assert.AreEqual( 2088.048377295, fragMasses[16], tol, "b17");
//Test that bN actually works.
//Expected now from new PILGrinder (+spreadsheet).
//Assert.AreEqual(2159.085405855, fragMasses[17], tol, "bN/ b18");
Assert.AreEqual(2159.085491102, fragMasses[17], tol, "bN/ b18");
int peter2 = 2;
} //bIons
} //class PILgeneralisedIonSeriesTests
} //namespace namespaceForIsotopeDistributionTests
Generated by script codePublish.pl at 2009-01-05T15:20:59.