/****************************************************************************
* 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: for now protein related stuff. *
* Perhaps later: class for representing a protein with associated *
* operations/data *
* *
****************************************************************************/
/****************************************************************************
* 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: PILprotein.cs *
* TYPE: CSHARP *
* *
* CREATED: PM 2008-10-30 Vrs 1.0. Moved central protein data structure *
* definition from clsMolShrStruct.vb to here. * *
* UPDATED: PM 2008-xx-xx *
* *
* *
* *
****************************************************************************/
//Future:
// 1. Move fields above functions (e.g. readFromStream2() and addToStream2())
//
//using System;
//using System.Collections.Generic;
//using System.Text;
using System.Collections.Generic; //For List and Dictionary.
using System.Runtime.Serialization; //For ISerializable and [Serializable()].
using System.Diagnostics; //For Trace. And its Assert.
using SimmoTech.Utils.Serialization; //For SerializationReader
// and SerializationWriter.
//Main data structure is:
// public struct ProteinHitStructure
/****************************************************************************
* <placeholder for header> *
****************************************************************************/
namespace MolecularSharedStructures //For now: as before. Use massSpectrometryBase instead?
{
//Perhaps later...
class PILprotein
{
} //class PILprotein
//Changed PM_REFACTOR 2006-10-09
//****************************************************************************
//* <placeholder for header> *
//****************************************************************************
//[Serializable]
public struct protSILACresultStructure //: ISerializable
{
//Note: if fields are added readFromStream2() and
// addToStream2() should be updated!!!
//Changed PM_FAST_SERIALISATION 2006-12-15
public double averageRatioToBase;
public double stdDevAverageRatioToBase;
public double inv_averageRatioToBase;
public double inv_stdDevAverageRatioToBase;
//Future: n, number of samples to compute the above.
//Changed PM_FAST_SERIALISATION_READ 2007-01-03
//****************************************************************************
//* For protSILACresultStructure. *
//****************************************************************************
public static protSILACresultStructure readFromStream2(
ref SerializationReader anInReader, int aMBfileVersion)
{
//Changed PM_REFACTOR 2008-10-30. Generated by VB to C# converted.
//Disable it for now to stay faithful to the original.
//protSILACresultStructure toReturn = default(protSILACresultStructure);
protSILACresultStructure toReturn;
toReturn.averageRatioToBase = anInReader.ReadDouble();
toReturn.stdDevAverageRatioToBase = anInReader.ReadDouble();
toReturn.inv_averageRatioToBase = anInReader.ReadDouble();
toReturn.inv_stdDevAverageRatioToBase = anInReader.ReadDouble();
return toReturn;
} //readFromStream2(). For protSILACresultStructure.
//Changed PM_FAST_SERIALISATION_AVOID_DOTNET 2006-12-28
//****************************************************************************
//* For protSILACresultStructure. *
//****************************************************************************
public void addToStream2(
ref SerializationWriter anInOutWriter, int aMBfileVersion)
{
//aVersion: e.g. 300 for MB3, 400 for MB4.
//SERMARK15. A marker. Keep it.
anInOutWriter.Write(averageRatioToBase);
anInOutWriter.Write(stdDevAverageRatioToBase);
anInOutWriter.Write(inv_averageRatioToBase);
anInOutWriter.Write(inv_stdDevAverageRatioToBase);
} //addToStream2(). For protSILACresultStructure.
} //protSILACresultStructure
//Changed PM_REFACTOR 2008-10-30. Moved from file clsMolShrStruct.vb.
//****************************************************************************
//* <placeholder for header> *
//****************************************************************************
//[Serializable()]
public struct oneDishResultStructure //: ISerializable
{
//Note: if fields are added readFromStream2() and
// addToStream2() should be updated!!!
//Changed PM_TYPESAFE 2006-11-08
//Dim quantRes As Hashtable 'Key is file ID number, Integer.
//' Value type is: protSILACresultStructure
public Dictionary<int, protSILACresultStructure> quantRes2;
//Number of peptides used in the calculation. Use
public int n;
//Changed PM_FAST_SERIALISATION_READ 2007-01-03
//****************************************************************************
//* For oneDishResultStructure. *
//****************************************************************************
public static oneDishResultStructure readFromStream2(
ref SerializationReader anInReader, int aMBfileVersion)
{
//Changed PM_REFACTOR 2008-10-30. Generated by VB to C# converted.
//Disable it for now to stay faithful to the original.
//oneDishResultStructure toReturn = default(oneDishResultStructure);
oneDishResultStructure toReturn;
toReturn.quantRes2 = null;
//Out here to keep compiler silent... If
// it is inside the block then it claims oneDishResultStructure is
// not initialised.
//Hash/Dictionary
{
int items = anInReader.ReadOptimizedInt32();
if (items > 0)
{
Trace.Assert(
items >= 2,
"PIL ASSERT. Deserialisation of oneDishResultStructure, " +
"number of items in quantRes2 are too few: " +
items + ".");
toReturn.quantRes2 =
new Dictionary<int, protSILACresultStructure>(items);
int lastIndex = items - 1;
int j = 0;
for (j = 0; j <= lastIndex; j++)
{
int curKey = anInReader.ReadInt32();
protSILACresultStructure curValue =
protSILACresultStructure.readFromStream2(
ref anInReader, aMBfileVersion);
toReturn.quantRes2.Add(curKey, curValue);
}
}
else
{
//Nothing. Can happen... See comments in addToStream2().
int peter2 = 2;
}
} //Block. Reading hash.
toReturn.n = anInReader.ReadInt32();
return toReturn;
} //readFromStream2(). For oneDishResultStructure.
//Changed PM_FAST_SERIALISATION_AVOID_DOTNET 2006-12-20
//****************************************************************************
//* For oneDishResultStructure. *
//****************************************************************************
public void addToStream2(
ref SerializationWriter anInOutWriter, int aMBfileVersion)
{
//aVersion: e.g. 300 for MB3, 400 for MB4.
//SERMARK16. A marker. Keep it.
//Changed PM_FAST_SERIALISATION_AVOID_DOTNET 2006-12-28.
//Loop on the client side. Avoid invoking the .NET
//serialisation (BinaryFormatter).
//
//Encode by storing (key,value) pairs, one at a time. Do
//it here on the client side to avoid invoking the .NET
//serialisation (BinaryFormatter).
//
//'writer.Write(quantRes2) uses the Dictionary function. But fails
//'for Nothing.
//anInOutWriter.WriteObject(quantRes2) 'Is Dictionary(Of
// Integer, protSILACresultStructure).
//' Can be Nothing.
{ //Block. Writing hash.
//Changed PM_FAST_SERIALISATION_BUG_FOR_NO_QUANTRESULT 2007-01-05.
// Check needed, see comment below in else part.
if (quantRes2 != null)
{
//ASSERT for non-zero?? We do it while reading...
//This is our own encoding.
int items = quantRes2.Count;
anInOutWriter.WriteOptimized(items);
Dictionary<int, protSILACresultStructure>.Enumerator
hashEnumerator2 = quantRes2.GetEnumerator();
while ((hashEnumerator2.MoveNext()))
{
int curKey = hashEnumerator2.Current.Key;
protSILACresultStructure curValue =
hashEnumerator2.Current.Value;
anInOutWriter.Write(curKey);
curValue.addToStream2(ref anInOutWriter, aMBfileVersion);
} //Hash iteration.
}
else
{
//Note: this can happen if there is no quant result.
//E.g. if a protein C-terminal peptide is the
//only surviving peptide for quantitation.
int items = 0;
//Encode nothing as zero length.
anInOutWriter.WriteOptimized(items);
}
} //Block. Delimiting one hash.
anInOutWriter.Write(n);
} //addToStream2(). For oneDishResultStructure.
} //oneDishResultStructure
//Changed PM_EXTENDED_CONSENSUSSCORE 2008-11-27
//****************************************************************************
//* <placeholder for header> *
//****************************************************************************
public struct consensusScoreStruct
{
//Note: if fields are added readFromStream2() and
// addToStream2() should be updated!!!
public double consensusScore;
public int nonZeroPoints; //Points in the profile that are
// not identical zero.
public int pointsWithInConsensus; //Points in the profile that are
// not too far away from the consensus profile (e.g. less
// than 5% deviation).
//****************************************************************************
//* For consensusScoreStruct. *
//****************************************************************************
public static consensusScoreStruct readFromStream2(
ref SerializationReader anInReader, int aMBfileVersion)
{
consensusScoreStruct toReturn =
default(consensusScoreStruct);
//Implement!
Trace.Assert(false,
"Stop!",
"PIL ASSERT. Internal/development assert for stopping execution......");
return toReturn;
} //readFromStream2(). For consensusScoreStruct.
//****************************************************************************
//* For consensusScoreStruct. *
//****************************************************************************
public void addToStream2(
ref SerializationWriter anInOutWriter, int aMBfileVersion)
{
//aVersion: e.g. 300 for MB3, 400 for MB4.
//SERMARK25. A marker. Keep it.
//Implement!
Trace.Assert(false,
"Stop!",
"PIL ASSERT. Internal/development assert for stopping execution......");
} //addToStream2(). For consensusScoreStruct.
} //consensusScoreStruct
//Protein Hit Structure encapsulates all information about a matched
//protein from the protein table. There are typically 1000 of these
//objects
//****************************************************************************
//* <placeholder for header> *
//****************************************************************************
//[Serializable()]
public struct ProteinHitStructure //: ISerializable
{
//Note: if fields are added readFromStream2() and
// addToStream2() should be updated!!!
public int hitNumber;
//Should be renamed. "protein" is superfluous.
//Change to "hasBeenChecked", when appropriate.
public bool proteinHasBeenChecked;
//Should be renamed. "protein" is superfluous.
//Change to "hasBeenQuantified", when appropriate.
public bool proteinHasBeenQuantified;
public string accNum;
//Changed PM_NATURAL_TYPE 2006-12-30
//Dim MascotTotalScore As Integer
public double MascotTotalScore;
public int MascotTotalPepts;
//Changed PM_REFACTOR 2006-10-09
//Dim protName As String
public string description3;
//It is directly from Mascot.
public double monoIsotopicMass;
// It seems Mascot computes the neutral monoisotopic mass. This
// is in contrast to most databases. They state the average mass.
// Sample:
// ACS2L_HUMAN
// (Q9NUB1) Acetyl-coenzyme A synthetase 2-like, mitochondrial
// precursor (EC 6.2.1.1) (Acetate--CoA ligase 2) (Acetyl-CoA
// synthetase 2) (Acyl-CoA synthetase short-chain family member1)
//
// Mascot computes: 75664 Da
//
// Computed from sequence (PILgrinder v. 0.04):
// Mono:
// 75664.311878 Da
// Average
// 75712.50474 Da
//Sums peptides in categories A,B and C
public int peptsInABC;
//Changed PM_NATURAL_TYPE 2006-12-30
//Dim scoreInABC As Integer 'Sums peptide scores in A,B and C
//Sums peptide scores in A,B and C
public double scoreInABC;
public int numPeptsInA;
public int numPeptsInB;
public int numPeptsInC;
//Dim quantRatio As Double 'added 23Oct2002 for quantitation
// to isotope labeled counterpart
//Dim quantRatioStDev As Double 'added 23Oct2002 for
// quantitation by stable isotope
//Removed 2003-07-30 by LF. PM & LF agreed that the two
// variables do not appear to be used anywhere.
//Changed PM_REFACTOR 2006-03-15
//Dim pepts As ArrayList 'List of PeptideHitStructure objects.
public massSpectrometryBase.PILpeptides peptides;
//Changed PM_EDWIN_ALLPEPTIDES_EXPORT 2003-04-16
public string resultFilePath3; //We actually use it...
//Changed PM_REFACTOR 2006-10-10
// 'Changed PM_PROTEINRATIO_FOR_EACH_RAWFILE 2006-02-27
// ' 'Changed PM_PROTEIN_RATIOS 2003-06-27
// ' Dim averageIsotopeWT_ratio As Double
// ' Dim stdDevAverageIsotopeWT_ratio As Double
// '
// ' Dim averageEvenHigherIsotopeWT_ratio As Double
// ' Dim stdDevAverageEvenHigherIsotopeWT_ratio As Double
// '
// 'In addition to the values for the whole protein, we now also compute
// 'the same for subsets of peptides, in the first instance for
// 'each raw file.
// Dim quantResults As Hashtable 'Key is file ID number, Integer.
// ' Value type is: proteinQuantitatinResultStructure2
public List<oneDishResultStructure> quantResults3;
//Changed PM_PEPTIDE_FILTER 2006-03-20
//To use until we get the
public int effectivePeptideCount;
// protein list protected.
//Changed PM_MARKER_FOR_MB4 2008-04-14
public string sequence;
//Of verified peptides.
public double sequenceCoverage;
//Changed PM_EXTENDED_CONSENSUSSCORE 2008-11-27
//public List<double> consensusScore2;
public List<consensusScoreStruct> consensusScore3; //Change name?
//Changed PM_FAST_SERIALISATION 2006-12-30
//****************************************************************************
//* For ProteinHitStructure. *
//****************************************************************************
public static ProteinHitStructure readFromStream2(
ref SerializationReader anInReader, int aMBfileVersion)
{
//Changed PM_MB4_VERSIONING 2008-11-12
//Detect uninitialised.
Trace.Assert(aMBfileVersion >= 300,
"PIL ASSERT. Unknown MBx version: " + aMBfileVersion +
" In readFromStream2(), for ProteinHitStructure, file PILprotein.cs.");
//Changed PM_REFACTOR 2008-10-30. Generated by VB to C# converted.
//Disable it for now to stay faithful to the original.
//ProteinHitStructure toReturn = default(ProteinHitStructure);
ProteinHitStructure toReturn;
{
int hitNumber2 = anInReader.ReadInt32();
Trace.Assert(
hitNumber2 >= 1 && hitNumber2 <= 999999,
"PIL ASSERT. Deserialisation: protein hit number " +
"out of range: " + hitNumber2 + ".");
toReturn.hitNumber = hitNumber2;
}
toReturn.proteinHasBeenChecked = anInReader.ReadBoolean();
toReturn.proteinHasBeenQuantified = anInReader.ReadBoolean();
toReturn.accNum = anInReader.ReadString();
int accLen = toReturn.accNum.Length;
Trace.Assert(
accLen >= 1 && accLen <= 9999,
"PIL ASSERT. Deserialisation: protein hit number " +
"out of range: " + toReturn.hitNumber + ".");
toReturn.MascotTotalScore = anInReader.ReadDouble();
toReturn.MascotTotalPepts = anInReader.ReadInt32();
toReturn.description3 = anInReader.ReadString();
toReturn.monoIsotopicMass = anInReader.ReadDouble();
toReturn.peptsInABC = anInReader.ReadInt32();
toReturn.scoreInABC = anInReader.ReadDouble();
toReturn.numPeptsInA = anInReader.ReadInt32();
toReturn.numPeptsInB = anInReader.ReadInt32();
toReturn.numPeptsInC = anInReader.ReadInt32();
toReturn.peptides =
massSpectrometryBase.PILpeptides.readFromStream2(
ref anInReader, aMBfileVersion);
toReturn.resultFilePath3 = anInReader.ReadString();
toReturn.quantResults3 = null;
//Out here to keep compiler silent.. If it is inside the block
//then it claims quantResults3 is not initialised.
//List
{
int items = anInReader.ReadOptimizedInt32();
if (items > 0)
{
toReturn.quantResults3 =
new List<oneDishResultStructure>(items);
int lastIndex = items - 1;
int j = 0;
for (j = 0; j <= lastIndex; j++)
{
toReturn.quantResults3.Add(
oneDishResultStructure.readFromStream2(
ref anInReader, aMBfileVersion));
}
}
} //Block. List read.
toReturn.effectivePeptideCount = anInReader.ReadInt32();
//Changed PM_SAVE_ALLRECALIB_MB4 2008-11-25
if (aMBfileVersion >= AppConstants.SAVEDFILEVERSION_MB4)
{
toReturn.sequence = anInReader.ReadString();
toReturn.sequenceCoverage = anInReader.ReadDouble();
//List
{
toReturn.consensusScore3 = null;
int items = anInReader.ReadOptimizedInt32();
if (items > 0)
{
//Changed PM_EXTENDED_CONSENSUSSCORE 2008-11-28
// toReturn.consensusScore2 =
// anInReader.ReadList<double>();
//
//For now: adaption until MB5 file format is
// introduced.
//At that time consensusScoreStruct.readFromStream2() will
//be called for version MB5 and later...
List<double> mb4list = anInReader.ReadList<double>();
int items2 = mb4list.Count;
Trace.Assert(
items == items2,
"PIL ASSERT. " +
"items not items2, consensusScore2, " +
"protein, readFromStream2().");
toReturn.consensusScore3 =
new List<consensusScoreStruct>(items);
foreach ( double score in mb4list)
{
consensusScoreStruct newStru;
newStru.consensusScore = score;
newStru.nonZeroPoints = 0;
newStru.pointsWithInConsensus = 0;
toReturn.consensusScore3.Add(newStru);
} //Through mb4list
} //if any items.
} //Block. Reading list.
}
else
{
//MB3.
//Changed PM_MARKER_FOR_MB4 2008-04-16
//For now. To keep compiler happy.
toReturn.sequenceCoverage = 0.0;
//Not strictly needed.
toReturn.sequence = null;
//Changed PM_MARKER_FOR_MB4 2008-11-06
//Not loaded: consensusScore2;
toReturn.consensusScore3 = null;
}
return toReturn;
} //readFromStream2(). For ProteinHitStructure.
//Changed PM_FAST_SERIALISATION_AVOID_DOTNET 2006-12-19
//****************************************************************************
//* For ProteinHitStructure. *
//****************************************************************************
public void addToStream2(
ref SerializationWriter anInOutWriter, int aMBfileVersion)
{
//aVersion: e.g. 300 for MB3, 400 for MB4.
//SERMARK17. A marker. Keep it.
//Changed PM_MB4_VERSIONING 2008-11-12
//Detect uninitialised.
Trace.Assert(aMBfileVersion >= 300,
"PIL ASSERT. Unknown MBx version: " + aMBfileVersion +
" In addToStream2(), for ProteinHitStructure, file PILprotein.cs.");
anInOutWriter.Write(hitNumber);
anInOutWriter.Write(proteinHasBeenChecked);
anInOutWriter.Write(proteinHasBeenQuantified);
anInOutWriter.Write(accNum);
anInOutWriter.Write(MascotTotalScore);
anInOutWriter.Write(MascotTotalPepts);
anInOutWriter.Write(description3);
anInOutWriter.Write(monoIsotopicMass);
anInOutWriter.Write(peptsInABC);
//Do we need this?
anInOutWriter.Write(scoreInABC);
anInOutWriter.Write(numPeptsInA);
anInOutWriter.Write(numPeptsInB);
anInOutWriter.Write(numPeptsInC);
//Changed PM_FAST_SERIALISATION_AVOID_DOTNET 2006-12-19. Call
//serialisation directly.
//writer.WriteObject(peptides) 'Object!!
peptides.addToStream2(ref anInOutWriter, aMBfileVersion);
anInOutWriter.Write(resultFilePath3);
//Changed PM_FAST_SERIALISATION_AVOID_DOTNET 2006-12-20. Loop on the
//client side.
//'Write fails for Nothing.
//'writer.Write(quantResults3)
//anInOutWriter.WriteObject(quantResults3) 'Generic.List(Of oneDishResultStructure)
{
if (quantResults3 != null)
{
int items = quantResults3.Count;
//This is our own encoding.
anInOutWriter.WriteOptimized(items);
//Changed PM_REFACTOR 2008-10-30. Generated by VB to C# converted.
//Disable it for now to stay faithful to the original.
//oneDishResultStructure item = default(oneDishResultStructure);
foreach (oneDishResultStructure item in quantResults3)
{
item.addToStream2(ref anInOutWriter, aMBfileVersion);
}
}
else
{
int items = 0;
//Encode nothing as zero length
anInOutWriter.WriteOptimized(items);
}
} //Block. Writing list.
anInOutWriter.Write(effectivePeptideCount);
//Changed PM_SAVE_ALLRECALIB_MB4 2008-11-25
if (aMBfileVersion >= AppConstants.SAVEDFILEVERSION_MB4)
{
anInOutWriter.Write(sequence);
anInOutWriter.Write(sequenceCoverage);
if (consensusScore3 != null)
{
int items = consensusScore3.Count;
//This is our own encoding. Use a guard count so we
//can keep the list equal to null when we don't use
//it (this is most of the time).
anInOutWriter.WriteOptimized(items);
//Changed PM_EXTENDED_CONSENSUSSCORE 2008-11-28
////OK to have the library take care of this instead of a
////loop. It is acceptable because it is a list of a
////fundamental type (double) and the .NET serialiser
////is therefore NOT called.
//anInOutWriter.Write(consensusScore2);
////List<double>
//
//For now: adaption until MB5 file format is
// introduced.
//At that time addToStream2() will be used.
List<double> MBlist = new List<double>(items);
foreach (consensusScoreStruct item in consensusScore3)
{
//MB5: item.addToStream2(ref anInOutWriter, aMBfileVersion);
//MB4: build list to same the expected way
MBlist.Add( item.consensusScore);
}
//MB4:
anInOutWriter.Write(MBlist);
//List<double>
}
else
{
int items = 0;
//Encode nothing as zero length
anInOutWriter.WriteOptimized(items);
}
} //MB4 and later.
} //addToStream2(). For ProteinHitStructure.
//Changed PM_REFACTOR 2008-10-31
////Changed PM_VS2005 2006-06-15
//Moved from file clsMolShrStruct.vb, Class helper
//****************************************************************************
//* This function was called into existence in order to keep *
//* the compiler happy... This may be expanded later to have only *
//* place (this function) to invalidate a protein. *
//* E.g. some fields (value or reference) could be set to values that *
//* eases error detection. *
//****************************************************************************
public static ProteinHitStructure blankProtein()
{
//C# also requires values members to be initialised. If we only
//had C# clients then we would not need this function at all. Then
//keyword "default" could just be used inline at the client side.
//ProteinHitStructure someProtein; as original,
ProteinHitStructure someProtein = default(ProteinHitStructure);
someProtein.accNum = null;
someProtein.peptides = null;
someProtein.description3 = null;
someProtein.quantResults3 = null;
someProtein.resultFilePath3 = null;
//Changed PM_SEQUENCE_COVERAGE 2008-04-16
someProtein.sequence = null;
someProtein.sequenceCoverage = 0.0;
someProtein.consensusScore3 = null;
return someProtein;
} //blankProtein()
//Changed PM_REFACTOR_PCP 2008-10-31
//****************************************************************************
//* <placeholder for header> *
//****************************************************************************
public static int getDishesFromQuantResult(
List<proteinPCPstructure> anInList)
{
int toReturn = -1;
//For now.
Trace.Assert(anInList.Count > 0,
"PIL ASSERT. <message>.");
//toReturn =
// anInList[0].dimensionValues[0].SILACdishes2.Count;
int proteinIndex = 0;
toReturn =
anInList[proteinIndex].profiles.Count; //This only works if the first protein is
// quantified ... (as the number is derived from the quantitation
// result itself and not an external setting).
return toReturn;
} //getDishesFromQuantResult()
//Changed PM_CONSENSUSSCORE_ALLDISHES 2008-11-11.
//****************************************************************************
//* <placeholder for header> *
//****************************************************************************
public static consensusScoreStruct getConsensusScore2(
ref List<consensusScoreStruct> aConsensusList2, int aDishZ)
{
//Changed PM_EXTENDED_CONSENSUSSCORE 2008-11-28
//Old:
// ref List<double> aConsensusList
//
// double (return value)
//Changed PM_EXTENDED_CONSENSUSSCORE 2008-11-27
//double toReturn = 0.0;
consensusScoreStruct toReturn = default(consensusScoreStruct);
if (aConsensusList2 != null)
{
int lastIndex = aConsensusList2.Count - 1;
if (aDishZ <= lastIndex)
{
toReturn = aConsensusList2[aDishZ];
}
else
{
int peter2 = 2;
}
}
return toReturn;
} //getConsensusScore2()
} //ProteinHitStructure
//Changed PM_PCP_PLOT_SEVERAL_DISHES 2008-10-15
//Note: this contains collapsed values. E.g. there could 3 different
// raw files (representing 3 different gel slices)
//****************************************************************************
//* <placeholder for header> *
//****************************************************************************
public struct singleSILACvaluesStructure
{
//Redundant? Already
// somewhere else? Do we do unnecessary.
public double SILACratio2;
//Perhaps later: other values; XIC, some standard deviation,
// N (number of peptides used in getting the other
// values), etc.
} //Structure singleSILACvaluesStructure
// //Changed PM_PCP_PLOT_SEVERAL_DISHES 2008-10-16
// //****************************************************************************
// //* <placeholder for header> *
// //****************************************************************************
// public struct SILACvaluesForDimensionStructure
// {
// public List<singleSILACvaluesStructure> SILACdishes2;
//
// //Other fields to describe the result for a dimension? Score? Reference
// //to some consensus profile?
//
// } //Structure SILACvaluesForDimensionStructure
//****************************************************************************
//* <placeholder for header> *
//****************************************************************************
public struct proteinProfileStructure
{
public List<singleSILACvaluesStructure> dimensionValues;
public int identicalZeros; //Number of identical zero items
// in the protein profile. A derived value.
} //Structure proteinProfileStructure
//****************************************************************************
//* <placeholder for header> *
//****************************************************************************
public struct proteinPCPstructure
{
public int proteinDataIndex2;
//Old.
////Changed PM_PCP_PLOT_SEVERAL_DISHES 2008-10-16
////Dim values2 As List(Of Double)
////Size: the size of the dimension that plotted agaist. E.g. sucrose
//// fraction number.
////
////E.g. 5 items for 5 sucrose fractions.
//public List<SILACvaluesForDimensionStructure> dimensionValues;
//Later. Perhaps move somewhere else.
////E.g. number of peptides behind the protein value, say SILAC ratio.
////Should this also be vectorised?????? List(Of Integer)
////instead of Integer ?
//public List<int> Ns;
//E.g. 3 items for 3 SILAC dishes.
public List<proteinProfileStructure> profiles;
//Utility function. Should it be here?
//****************************************************************************
//* <placeholder for header> *
//****************************************************************************
public static List<proteinPCPstructure> initList(
int aProteins2, int aDimensionSize4, int aSILACdishes2)
{
List<proteinPCPstructure> toReturn =
new List<proteinPCPstructure>(aProteins2);
int ds = aDimensionSize4; //Purely for notational convenience.
int lastProteinIndex = aProteins2 - 1;
int j = 0;
for (j = 0; j <= lastProteinIndex; j++)
{
proteinPCPstructure someItem = default(proteinPCPstructure);
someItem.proteinDataIndex2 = -1;
someItem.profiles =
new List<proteinProfileStructure>(aSILACdishes2);
for (int m = 1; m <= aSILACdishes2; m++)
{
proteinProfileStructure someProfile =
default(proteinProfileStructure);
someProfile.dimensionValues =
new List<singleSILACvaluesStructure>(ds);
for (int k = 1; k <= ds; k++)
{
singleSILACvaluesStructure somePoint;
somePoint.SILACratio2 = 0.0;
someProfile.dimensionValues.Add(somePoint);
}
someItem.profiles.Add(someProfile);
} //Through SILAC dishes (each containing a protein profile).
toReturn.Add(someItem);
} //Through adding placeholders for proteins.
return toReturn;
} //initList()
} //Structure proteinPCPstructure
} //namespace MolecularSharedStructures
Generated by script codePublish.pl at 2009-01-05T15:20:59.