using System.Collections; //For ArrayList. May be removed later.
using System.Collections.Generic; //For Dictionary and List.
using System.Diagnostics; //For Trace. And its Assert.
/****************************************************************************
* <placeholder for header> *
****************************************************************************/
namespace massSpectrometryBase
{
//Changed PM_EVENMORE_GENERALISED_QUANTMODES 2005-04-07
//****************************************************************************
//* <placeholder for header> *
//****************************************************************************
//[Serializable()]
public struct dishSILACStructure
{
public string dishName;
//Real type is Integer,
public ArrayList modificationsForSILAC;
// modification IDs.
// Helper field, not for external storage...
public List<List<massSpectrometryBase.quantitation.AAsetStruct>>
INTERNAL_modCodes;
} //dishSILACStructure
//Changed PM_GENERALISED_QUANT_MODE 2003-12-04
//, XmlElement(ElementName: = "MolecularSharedStructures.quantitationModeStructure")
//XmlElement(ElementName:="MolecularSharedStructures.quantitationModeStructure")> _
//Note: to be phased out.
//****************************************************************************
//* <placeholder for header> *
//****************************************************************************
//[Serializable()]
public struct quantModificationStructure
{
//Defined externally.
//Unique integer, user defined.
public int quantModificationID;
//Regular expression, as from the XML
public string matchString;
// file. The real pattern used during parsing is the
// field INTERNAL_matchStringForMod.
//Fixed string, for display in
public string formattedString;
// GUI. Should be short, 3-4 characters.
//Unique string, e.g.
public string modificationName;
// "Arginine-13C6". Must be unique and stable. A sort
// of a name for the modification.
//Changed PM_MEMORY_ALLOCATION_MODMATCHSTR 2004-07-29
//Regular expression
public string INTERNAL_matchStringForMod;
// used during parsing.
//Changed PM_COLLAPSED_AA 2007-07-31
//All amino acids from
public string INTERNAL_collapsedAAset;
// the list affectedAAs (in this structure).
//Changed PM_MOD_PREFIX_AND_POSTFIX 2006-06-07
public string shortPrefix;
public string shortPostfix;
//Changed PM_QUANTGENERAL_PREPARATION 2006-07-12
//Dim AA As String
//Changed PM_QUANTGENERAL_PREPARATION 2006-07-12
//Dim massDiffFromBase As Double
//.NET 2.0 only thingy....
public List<massSpectrometryBase.quantitation.AAsetStruct> affectedAAs;
//Changed PM_TERMMOD 2007-09-10
//Start of position range for the
public int startPosition;
// modification. 1-based. If negative then
// from C-terminal and back; -1 is C-terminal amino acid.
//1-based. If negative then
public int endPosition2;
// from C-terminal and back; -1 is C-terminal amino acid.
//Changed PM_POSEXCLUDING_MODS 2008-06-17
public List<int> modsExcludedFromSamePosition;
} //quantModificationStructure
//Moved from file clsMolShrStruct.vb.
//Changed PM_EVENMORE_GENERALISED_QUANTMODES 2005-04-07
//****************************************************************************
//* <placeholder for header> *
//****************************************************************************
//[Serializable()]
public struct generalisedQuantModeStructure
{
//Future: some specification of purity of
//isotopes (e.g. N15 98%, C13 99.3 %)
public int uniqueID;
//Real type
public ArrayList dishes_StartingFromDish2;
// is dishSILACStructure.
//Rename to baseSILACdish ?
//Indicates the base modification.
public int baseModification;
// 0 is for the native form (no modification)
// 1 means the first (low) mass modification and onward makes
// sense (wild type ought not to exist - e.g. for HysTag
// and ICAT modes.)
// 2 second and onward makes sense, etc.
//Name of quant mode to be displayed in
public string GUIname;
// a pop-up list in the GUI.
//Defines the order of GUI names.
public int GUInameIndex;
// 0 for first in the pop-up list, etc.)
//Changed PM_BLENDOUT_QUANTMODES 2007-08-31
//Wether or not to display it in the
public bool GUIdoShow;
// Tools/Options dialog.
} //generalisedQuantModeStructure
//Changed PM_EVENMORE_GENERALISED_QUANTMODES 2005-04-07
//****************************************************************************
//* <placeholder for header> *
//****************************************************************************
//[Serializable()]
public struct fullGeneralisedQuantitationDefsStruct
{
//Changed PM_TYPESAFE 2006-11-09
//Dim quantitationModesList As ArrayList 'Type is
//' MolecularSharedStructures.generalisedQuantModeStructure
public List<generalisedQuantModeStructure> quantitationModesList2;
//Changed PM_TYPESAFE 2007-08-02
//Dim modificationsList As ArrayList 'Type is quantModificationStructure
public List<quantModificationStructure> modificationsList2;
} //fullGeneralisedQuantitationDefsStruct
/****************************************************************************
* <placeholder for header> *
****************************************************************************/
namespace quantitation
{
//****************************************************************************
//* <placeholder for header> *
//****************************************************************************
public enum isotopesUsedForQuantEnum
{
enumNoIsotopeForQuant2 = 223,
//Changed PM_QUANTGENERAL_BUGFIX_MORETHAN3DISHES 2007-01-09. We
// currently only need to distinguish between No isotope and
// the others.
//enumSingleIsotopeForQuant2
//enumTwoIsotopesForQuant2
enumOneOrMoreIsotopesForQuant
}
//isotopesUsedForQuantEnum
//Changed PM_REFACTOR_FINNEGAN 2003-07-25
//****************************************************************************
//* <placeholder for header> *
//****************************************************************************
public struct QuantModeClassificationStruct
{
//?? Not a checksum, but a constant field used for error detection.
public isotopesUsedForQuantEnum isotopesUsedForQuant;
//Later: probably some more fields....
}
//QuantModeClassificationStruct
//Moved....
//Public Structure simpleModificationSpecification
// Dim AA As String
// Dim diffFromBase As Double
//End Structure
//Changed PM_EVENMORE_GENERALISED_QUANTMODES 2005-04-08
//****************************************************************************
//* SUBROUTINE NAME: newQuant_SortByGUIIndexOrder *
//d$ <summary> N/A. ...
//d$ Note: xyz </summary>
class newQuant_SortByGUIIndexOrder :
System.Collections.Generic.IComparer<generalisedQuantModeStructure>
{
//Compiler error: "The modifier 'public' is not valid for this item".
//public int
// System.Collections.Generic.IComparer<generalisedQuantModeStructure>.Compare(
// generalisedQuantModeStructure aItem1,
// generalisedQuantModeStructure aItem2)
int
System.Collections.Generic.IComparer<generalisedQuantModeStructure>.Compare(
generalisedQuantModeStructure aItem1,
generalisedQuantModeStructure aItem2)
{
int toReturn = 0;
if (aItem1.GUInameIndex > aItem2.GUInameIndex)
{
toReturn = 1;
}
else
{
if (aItem1.GUInameIndex < aItem2.GUInameIndex)
{
toReturn = -1;
}
else
{
//Equal....
//Changed PM_GUINAMEINDEX_SENSITIVITY 2007-03-14.
//Secondary key to have a defined sort order if
//for some reason GUInameIndex is not unique.
//Shortcuts for more compact notation below.
int ID1 = aItem1.uniqueID;
int ID2 = aItem2.uniqueID;
if (ID1 > ID2)
{
toReturn = 1;
}
else
{
if (ID1 < ID2)
{
toReturn = -1;
}
else
{
//Equal.... Note: we can not use this to
// check if quant mode IDs are unique as we
// will sometimes be handed the same item by
// the sort algorithm...
int peter7 = 7;
}
}
}
}
return toReturn;
} //Compare
} //newQuant_SortByGUIIndexOrder
//****************************************************************************
//* <placeholder for header> *
//****************************************************************************
public sealed class QuantitationModes_moreGeneral
{
//Changed PM_EVENMORE_GENERALISED_QUANTMODES 2005-04-07
fullGeneralisedQuantitationDefsStruct mDefs;
//Changed PM_REFACTOR 2008-05-14. Moved from file clsMolShrStruct.vb.
//Changed PM_VS2005 2006-06-15
//****************************************************************************
//* 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 quantModificationStructure blankQuantModification()
{
quantModificationStructure qmod;
qmod.formattedString = null; //Keep compiler happy.
qmod.INTERNAL_matchStringForMod = null; //Keep compiler happy.
qmod.INTERNAL_collapsedAAset = null; //Keep compiler happy.
qmod.matchString = null; //Keep compiler happy.
qmod.modificationName = null; //Keep compiler happy.
qmod.shortPostfix = null; //Keep compiler happy.
qmod.shortPrefix = null; //Keep compiler happy.
//Changed PM_QUANTGENERAL_PREPARATION 2006-07-13
//qmod.AA = Nothing 'Keep compiler happy.
qmod.affectedAAs = null; //Keep compiler happy.
qmod.quantModificationID = -1; //For error chekcing.
//Changed PM_REFACTOR 2008-05-14
qmod.endPosition2 = -1; //Keep compiler happy.
qmod.startPosition = -1; //Keep compiler happy.
//Changed PM_POSEXCLUDING_MODS 2008-06-17
qmod.modsExcludedFromSamePosition = null; //Keep compiler happy.
return qmod;
} //blankQuantModification
//****************************************************************************
//* <placeholder for header> *
//****************************************************************************
public static generalisedQuantModeStructure defaultQuantModefields()
{
generalisedQuantModeStructure toReturn;
toReturn.GUIname = "Unknown quantitation mode";
toReturn.uniqueID = -1;
toReturn.GUInameIndex = -999999;
toReturn.baseModification = 0;
toReturn.dishes_StartingFromDish2 = null;
//Changed PM_BLENDOUT_QUANTMODES 2007-08-31
toReturn.GUIdoShow = true;
return toReturn;
} //defaultQuantModefields
//Changed PM_EVENMORE_GENERALISED_QUANTMODES 2005-04-07
//****************************************************************************
//* <placeholder for header> *
//****************************************************************************
public static dishSILACStructure createSILACdish(string aDishName)
{
dishSILACStructure toReturn;
toReturn.modificationsForSILAC = new ArrayList();
toReturn.dishName = aDishName;
//Changed PM_QUANTGENERAL_PREPARATION 2006-07-14
//toReturn.INTERNAL_modCodes = New ArrayList
toReturn.INTERNAL_modCodes = new List<List<AAsetStruct>>();
return toReturn;
} //createSILACdish
//Changed PM_EVENMORE_GENERALISED_QUANTMODES 2005-04-07
//****************************************************************************
//* <placeholder for header> *
//****************************************************************************
public static void addModificationToDish(
ref dishSILACStructure aDish, int aModificationID,
ref List<quantModificationStructure> anInModificationsList2)
{
//Old:
// ByRef anInModificationsList As ArrayList
aDish.modificationsForSILAC.Add(aModificationID);
quantModificationStructure someMod =
getModification(aModificationID, ref anInModificationsList2);
//Changed PM_QUANTGENERAL_PREPARATION 2006-07-13
//Dim forQuant As AAmassDiffStructure
//forQuant.diffFromBase = someMod.massDiffFromBase
//forQuant.AA = someMod.AA
//aDish.INTERNAL_modCodes.Add(forQuant)
aDish.INTERNAL_modCodes.Add(someMod.affectedAAs);
} //addModificationToDish()
//Changed PM_EVENMORE_GENERALISED_QUANTMODES 2005-04-07
//****************************************************************************
//* <placeholder for header> *
//****************************************************************************
public static ArrayList addGeneralisedQuantMode(
int aUniqueID, string aGUIname,
ref int aInOutGUInameIndex, int aBaseModification,
ref List<generalisedQuantModeStructure> anInOutQuantSpecList2)
{
// Old:
// ByRef anInOutQuantSpecList As ArrayList
//Future: new parameters, anonymous list of SILAC dishes.
generalisedQuantModeStructure newItem;
newItem.uniqueID = aUniqueID;
newItem.dishes_StartingFromDish2 = new ArrayList();
newItem.baseModification = aBaseModification;
newItem.GUIname = aGUIname;
newItem.GUInameIndex = aInOutGUInameIndex;
newItem.GUIdoShow = true;
//Fixed for now.
anInOutQuantSpecList2.Add(newItem);
aInOutGUInameIndex += 1;
return newItem.dishes_StartingFromDish2;
} //addGeneralisedQuantMode()
//Changed PM_EVENMORE_GENERALISED_QUANTMODES 2005-04-08. Moved from FindLCpeaks.vb
//****************************************************************************
//* <placeholder for header> *
//****************************************************************************
public static QuantModeClassificationStruct doQuantModeClassification(
generalisedQuantModeStructure aInQuantitationMode)
{
//During translation:
// ref generalisedQuantModeStructure aInQuantitationMode
//Merge with code in <derivedValuesFromQuantitationMode()?
QuantModeClassificationStruct toReturn;
isotopesUsedForQuantEnum res = isotopesUsedForQuantEnum.enumNoIsotopeForQuant2;
//Changed PM_EVENMORE_GENERALISED_QUANTMODES 2005-04-08
if (aInQuantitationMode.dishes_StartingFromDish2 != null)
{
//This is a complicated 'if' statement, but we may have more
//than two possibilities in the future.
switch (aInQuantitationMode.dishes_StartingFromDish2.Count)
{
case 0:
res = isotopesUsedForQuantEnum.enumNoIsotopeForQuant2;
break;
default:
res = isotopesUsedForQuantEnum.enumOneOrMoreIsotopesForQuant;
break;
}
}
else
{
int peter9 = 9;
}
toReturn.isotopesUsedForQuant = res;
return toReturn;
} //QuantModeClassification()
//Changed PM_QUANTGENERAL_BUGFIX_MORETHAN3DISHES 2007-01-09. Disabled, is
// not used. But do not delete yet.
// 'Changed PM_EVENMORE_GENERALISED_QUANTMODES 2005-04-08. Moved from FindLCpeaks.vb
// '****************************************************************************
// '* <placeholder for header> *
// '****************************************************************************
// Public Shared Function isTripleQuant_new2( _
// ByRef aInQuantitationMode As _
// generalisedQuantModeStructure) _
// As Boolean
//
// Dim res As QuantModeClassificationStruct = _
// doQuantModeClassification(aInQuantitationMode)
// Return res.isotopesUsedForQuant = _
// isotopesUsedForQuantEnum.enumTwoIsotopesForQuant
// End Function 'isTripleQuant_new
//****************************************************************************
//* <placeholder for header> *
//****************************************************************************
public static quantModificationStructure
getModification(
int aModificationCode,
ref List<quantModificationStructure> anInModificationsList2)
{
//Old:
// ByRef anInModificationsList As ArrayList
quantModificationStructure toReturn = blankQuantModification();
//Keep compiler happy.
foreach (quantModificationStructure someModification in anInModificationsList2)
{
if (someModification.quantModificationID == aModificationCode)
{
toReturn = someModification;
break; // TODO: might not be correct. Was : Exit For
}
}
Trace.Assert(toReturn.quantModificationID >= 0, "PIL ASSERT. Unknown modification code: " + aModificationCode);
return toReturn;
} //getModification()
//****************************************************************************
//* <placeholder for header> *
//****************************************************************************
public quantModificationStructure getModification(int aModificationCode)
{
//Changed PM_VS2005 2006-06-14. No "Me.".
return getModification(
aModificationCode, ref mDefs.modificationsList2);
} //getModification()
//****************************************************************************
//* <placeholder for header> *
//****************************************************************************
public bool isNoQuantitationMode(int aQuantModeCode)
{
//Use getQuantitationMode() instead?
bool toReturn = false;
bool found = false;
//For error checking
foreach (generalisedQuantModeStructure quantModeItem in mDefs.quantitationModesList2)
{
if (quantModeItem.uniqueID == aQuantModeCode)
{
QuantModeClassificationStruct res =
doQuantModeClassification(quantModeItem);
toReturn = res.isotopesUsedForQuant == isotopesUsedForQuantEnum.enumNoIsotopeForQuant2;
found = true;
break; // TODO: might not be correct. Was : Exit For
}
}
Trace.Assert(found, "PIL ASSERT. Unknown quantitation code: " + aQuantModeCode);
return toReturn;
} //isNoQuantitationMode()
//Changed PM_EVENMORE_GENERALISED_QUANTMODES 2005-04-08
//
//This function is no longer needed, but is kept as a reference for the
//old way and to indicate how the base modification value should be used.
//
// '****************************************************************************
// '* <placeholder for header> *
// '****************************************************************************
// Public Shared Sub derivedValuesFromQuantitationMode( _
// ByRef aInQuantitationMode As quantitationModeStructure, _
// ByRef aQuantitationModes As QuantitationModes, _
// ByRef aQuantValues As quantValuesStructure)
//
// 'To check the refactoring. Can be removed soon.
// Trace.Assert(FOUR_DEUTERIUM_HYDROGEN_DIFF > 3.9 And _
// FOUR_DEUTERIUM_HYDROGEN_DIFF < 4.1, _
// "PIL ASSERT. Bad value for 4 hydrogen-deuterium differences (about 4 Da expected):" & _
// FOUR_DEUTERIUM_HYDROGEN_DIFF.ToString() & "Da.", "")
//
// aQuantValues.AAfilter = "<bad>"
//
// 'Changed PM_SEQUENCE_DEPENDENT_QUANTMASSDIFF 2004-07-07
// 'aQuantValues.diff1fromBase = -1.0
// 'aQuantValues.diff2fromBase = -1.0
// aQuantValues.Diffs1FromBase = New ArrayList
// aQuantValues.Diffs2FromBase = New ArrayList
//
// 'Changed PM_GENERALISED_QUANT_MODE 2003-12-08
// Select Case aInQuantitationMode.numberOfMods
// Case 0
// 'No quantitation mode:
// aQuantValues.AAfilter = ""
//
// 'Changed PM_SEQUENCE_DEPENDENT_QUANTMASSDIFF 2004-07-07
// 'aQuantValues.diff1fromBase = 0.0
// FindLCpeaks.addMassDiffItem(aQuantValues.Diffs1FromBase, "", 0.0)
//
// Case 1 '"Normal" encoding
// Dim ref1 As Integer = aInQuantitationMode.firstModID
// Dim firstMod As quantModificationStructure = _
// aQuantitationModes.getQuantModification(ref1)
//
// 'Changed PM_SEQUENCE_DEPENDENT_QUANTMASSDIFF 2004-07-07
// FindLCpeaks.addMassDiffItem( _
// aQuantValues.Diffs1FromBase, firstMod.AA, firstMod.massDiffFromBase)
//
// 'Changed PM_MARKER_ADDITIVE_QUANTS 2003-12-11
//
// Dim filterToUse As String = firstMod.AA
// Dim ref2 As Integer = aInQuantitationMode.secondModID
// If ref2 > 0 Then
// 'This indicates additive mode - more than one kind of AA is modified.
// 'Note: this implies they are modified the same way (at least mass-wise)
//
// Dim secondMod As quantModificationStructure = _
// aQuantitationModes.getQuantModification(ref2)
//
// 'Changed PM_SEQUENCE_DEPENDENT_QUANTMASSDIFF 2004-07-07
// 'Note: it ***IS*** the "1" field we want to use, Diffs1FromBase, .
// FindLCpeaks.addMassDiffItem( _
// aQuantValues.Diffs1FromBase, secondMod.AA, secondMod.massDiffFromBase)
//
// filterToUse += secondMod.AA
// Else
// Dim peter9 As Integer = 9
// End If
//
// aQuantValues.AAfilter = filterToUse
//
// 'Changed PM_SEQUENCE_DEPENDENT_QUANTMASSDIFF 2004-07-07
// 'aQuantValues.diff1fromBase = firstMod.massDiffFromBase
//
// Case 2 'Triple encoding
// 'Hys tag is also modelled as triple encoding - there are 3 different
// 'masses but only the upper two are used, baseModification is
// 'set to 1.
//
// Dim ref1 As Integer = aInQuantitationMode.firstModID
// Dim firstMod As quantModificationStructure = _
// aQuantitationModes.getQuantModification(ref1)
//
// Dim ref2 As Integer = aInQuantitationMode.secondModID
// Dim secondMod As quantModificationStructure = _
// aQuantitationModes.getQuantModification(ref2)
//
// aQuantValues.AAfilter = firstMod.AA 'What about the second??
//
// Dim diff1 As Double = firstMod.massDiffFromBase
// Dim diff2 As Double = secondMod.massDiffFromBase
//
// 'Changed PM_HYSTAG_SUPPORT 2004-03-01
// If aInQuantitationMode.baseModification = 1 Then
// diff1 = 0.000000001 'Not 0.0: to avoid an assert later on.
// diff2 = secondMod.massDiffFromBase - firstMod.massDiffFromBase
// End If
//
// 'Changed PM_SEQUENCE_DEPENDENT_QUANTMASSDIFF 2004-07-07
// 'aQuantValues.diff1fromBase = diff1fromBase
// 'aQuantValues.diff2fromBase = diff2fromBase
// FindLCpeaks.addMassDiffItem( _
// aQuantValues.Diffs1FromBase, firstMod.AA, diff1)
// FindLCpeaks.addMassDiffItem( _
// aQuantValues.Diffs2FromBase, secondMod.AA, diff2)
// Case Else
// Trace.Assert(False, "PIL ASSERT. Select Case never fall-through")
// End Select
//
// Trace.Assert(aQuantValues.AAfilter <> "<bad>", _
// "PIL ASSERT. aQuantValues.AAfilter <> <bad>")
//
// 'Changed PM_SEQUENCE_DEPENDENT_QUANTMASSDIFF 2004-07-07
// Dim diff1fromBase As Double = _
// DirectCast(aQuantValues.Diffs1FromBase(0), AAmassDiffStructure).diffFromBase
// Trace.Assert(diff1fromBase > -0.0001, _
// "PIL ASSERT. aQuantValues.diff1fromBase > -0.0001")
// End Sub 'derivedValuesFromQuantitationMode()
//Changed PM_EVENMORE_GENERALISED_QUANTMODES 2005-04-07
//****************************************************************************
//* SUBROUTINE NAME: getFullDefs_generalised *
//d$ <summary> N/A </summary>
public void getFullDefs_generalised(
ref fullGeneralisedQuantitationDefsStruct anOutFullDefs)
{
anOutFullDefs = new fullGeneralisedQuantitationDefsStruct();
anOutFullDefs.quantitationModesList2 = mDefs.quantitationModesList2;
anOutFullDefs.modificationsList2 = mDefs.modificationsList2;
} //getFullQuantDefinitions()
//Changed PM_EVENMORE_GENERALISED_QUANTMODES 2005-04-07
//****************************************************************************
//* SUBROUTINE NAME: setFullDefs *
//d$ <summary> N/A </summary>
public void setFullDefs(
ref fullGeneralisedQuantitationDefsStruct anInFullDefs)
{
mDefs.quantitationModesList2 = anInFullDefs.quantitationModesList2;
mDefs.modificationsList2 = anInFullDefs.modificationsList2;
} //setFullDefs()
//****************************************************************************
//* <placeholder for header> *
//****************************************************************************
public int getFirstQuantitationCode()
{
int toReturn = -1;
Trace.Assert(
mDefs.quantitationModesList2.Count > 0,
"PIL ASSERT. mQuantSpecList is empty!");
generalisedQuantModeStructure firstInList = mDefs.quantitationModesList2[0];
toReturn = firstInList.uniqueID;
return toReturn;
} //getFirstQuantitationCode()
//****************************************************************************
//* <placeholder for header> *
//****************************************************************************
public List<generalisedQuantModeStructure>
getQuantSpecificationList_GUIIndexOrder()
{
//Old return value:
// As ArrayList
//Note: this will change the state of our list, but we should
//not be sensitive to that.
mDefs.quantitationModesList2.Sort(new newQuant_SortByGUIIndexOrder());
return mDefs.quantitationModesList2;
} //getQuantSpecificationList_GUIIndexOrder()
//****************************************************************************
//* <placeholder for header> *
//****************************************************************************
public List<quantModificationStructure> getModifications()
{
//Old return value:
// ArrayList
return mDefs.modificationsList2;
} //getQuantModificationsList()
//Changed PM_REFACTOR 2006-07-24
//****************************************************************************
//* <placeholder for header> *
//****************************************************************************
private generalisedQuantModeStructure findQuantitationCode(int aQuantModeCode)
{
generalisedQuantModeStructure toReturn;
toReturn.dishes_StartingFromDish2 = null;
//Keep compiler happy.
toReturn.GUIname = null;
//Keep compiler happy.
toReturn.uniqueID = -1;
//For error chekcing
//Changed PM_REFACTOR 2008-05-14
toReturn.GUIdoShow = false; //Keep compiler happy.
toReturn.GUInameIndex = -1; //Keep compiler happy.
toReturn.baseModification = -1; //Keep compiler happy.
foreach (generalisedQuantModeStructure quantModeItem in mDefs.quantitationModesList2)
{
if (quantModeItem.uniqueID == aQuantModeCode)
{
toReturn = quantModeItem;
break; // TODO: might not be correct. Was : Exit For
}
}
return toReturn;
} //findQuantitationCode()
//****************************************************************************
//* <placeholder for header> *
//****************************************************************************
public generalisedQuantModeStructure getQuantitationMode(int aQuantModeCode)
{
generalisedQuantModeStructure toReturn =
findQuantitationCode(aQuantModeCode);
Trace.Assert(
toReturn.uniqueID >= 0,
"PIL ASSERT. Unknown quantitation code: " + aQuantModeCode);
return toReturn;
} //getQuantitationMode()
//Changed PM_XMLFILE_SWITCH_BUG 2006-07-24
//****************************************************************************
//* <placeholder for header> *
//****************************************************************************
public bool quantitationCodeExists(int aQuantModeCode)
{
generalisedQuantModeStructure someQuantMode =
findQuantitationCode(aQuantModeCode);
bool toReturn = true;
if (someQuantMode.uniqueID < 0)
{
toReturn = false;
}
return toReturn;
} //quantitationCodeExists()
//****************************************************************************
//* <placeholder for header> *
//* anInList: type is quantModCount *
//****************************************************************************
public List<List<AAsetStruct>>
constructSimpleModificationList(
ref List<modificationCountStruct> anInList2)
{
List<List<AAsetStruct>> toReturn = new List<List<AAsetStruct>>();
if ((anInList2 != null))
{
foreach (modificationCountStruct inputItem in anInList2)
{
int ID = inputItem.quantModificationID;
quantModificationStructure quantInfo = this.getModification(ID);
//Changed PM_TERMMOD_FRAGMENTMASS_TROUBLE_MARKER 2007-09-14
if (true)
{
//Setting derived fields for later use with
// modifications that do not span the entire peptide
// sequence, e.g. terminal modifications.
int startPos = quantInfo.startPosition;
int endPos = quantInfo.endPosition2;
List<AAsetStruct> affectedAAs = quantInfo.affectedAAs;
//Alias
// for notational convenience.
AAsetStruct someAAset = affectedAAs[0];
//Note: we
// don't have to go through a loop here as the values
// would be exactly the same in all, e.g. for all 4 for N15.
// So we only change the first item. However clients must
// be aware of this fact.
if (
someAAset.INTERNAL_startPosition3 != startPos ||
someAAset.INTERNAL_endPosition3 != endPos)
{
// Optimisation so the memory operation (write-back)
// is not done for the modifications for which
// these two fields are not used anyway or they
// happen to be set to the correct values already.
someAAset.INTERNAL_startPosition3 = startPos;
someAAset.INTERNAL_endPosition3 = endPos;
//Write-back.
affectedAAs[0] = someAAset;
}
else
{
//Already at correct values...
int peter2 = 2;
}
}
//Changed PM_QUANTGENERAL_PREPARATION 2006-07-13
//Dim outItem As simpleModificationSpecification
//outItem.diffFromBase = quantInfo.massDiffFromBase
//outItem.AA = quantInfo.AA
//toReturn.Add(outItem)
toReturn.Add(quantInfo.affectedAAs);
}
}
return toReturn;
} //constructSimpleModificationList()
//Changed PM_GENERALISED_PTMSCORE 2006-05-03
//****************************************************************************
//* <placeholder for header> *
//* anInList: type is quantModCount *
//****************************************************************************
public Dictionary<int, int>
modificationIDsForQuantitationMode(
ref int aQuantModeCode)
{
// As Hashtable
Dictionary<int, int> toReturn = new Dictionary<int, int>(4);
//(modID, SILAC dish number) pairs. SILAC dish number is zero based...
generalisedQuantModeStructure curQuantMode =
this.getQuantitationMode(aQuantModeCode);
int dishNumberZeroBased = 2 - 1;
foreach (dishSILACStructure dish in curQuantMode.dishes_StartingFromDish2)
{
foreach (int someModID in dish.modificationsForSILAC)
{
//Changed PM_SILAC_AWARE_PEPTIDEFILTERDIALOG 2008-10-06. Now
//indicates SILAC dish, some clients need it.
//toReturn.Add(someModID, true);
toReturn.Add(someModID, dishNumberZeroBased);
}
dishNumberZeroBased += 1;
}
return toReturn;
} //modificationIDsForQuantitaionMode()
} //class QuantitationModes_moreGeneral
} //namespace quantitation
} //namespace massSpectrometryBase
Generated by script codePublish.pl at 2009-01-05T15:20:59.