'****************************************************************************
'* Copyright (C) 2004 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: <to be filled in>. *
'* *
'****************************************************************************
'****************************************************************************
'* 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: QuantWindow.vb *
'* TYPE: VISUAL_BASIC *
'* *
'* CREATED: PM 2003-??-?? Vrs 1.0. *
'* UPDATED: PM 2004-xx-xx *
'* *
'****************************************************************************
Option Strict On
Option Explicit On 'Changed PM_OPTIONEXPLICIT 2003-02-13
Imports System.Text.RegularExpressions 'For Regex
Imports System.Drawing.Drawing2D
Imports System.IO
Imports System.Text 'For StringBuilder
Imports System.Collections.Generic 'For Dictionary
Imports ZedGraph
Imports retentionTimePlotting
'Changed PM_SUPERCHARGE 2003-11-03
''Changed PM_REFACTOR_FINNEGAN 2003-06-02
'Imports Mascot_Parser.massSpectrometryBase
'Imports Mascot_Parser.SDUPutility
Imports massSpectrometryBase
Imports massSpectrometryBase.quantitation
Imports MolecularSharedStructures
Imports MSQuant
Imports SDUPutility
Imports CEBI_generalGUI 'For ListViewColumnSorter
'Changed PM_REFERENCES 2004-07-20
' Imports AxGraphControlLib '\Analyst\bin\GraphControl.ocx
'See guide in file frmAnalystSpectra.vb for how to add it.
'Changed PM_REFERENCES 2004-07-20
Imports AxXCALIBURDISPLAYSLib '\Xcalibur\system\programs\XcaliburDisplays.dll
'Requires using ActiveX Control:
'This is NOT correct.... Is for QSTAR/Sciex/Analyst.
'
'
' 1. menu Tools/Add;Remove Toolbox Items/COM components/GraphControl
' (or browse to 'D:\Program Files\Xcalibur\system\programs\XcaliburDisplays.dll')
' Open. OK.
' 2. Drag 'XSpecDisplay Class' to some form in order to have the
' references 'AxXCALIBURDISPLAYSLib' and 'XCALIBURDISPLAYSLib'
' added to References.
' 3. Delete the added control (the reference will stay)
'
' Typical objects are:
' XCALIBURDISPLAYSLib.XSpecPlot
' AxXCALIBURDISPLAYSLib.AxXSpecDisplay
' AxXCALIBURDISPLAYSLib._IXSpecDisplayEvents_MouseMoveEvent
' AxXCALIBURDISPLAYSLib._IXSpecDisplayEvents_MouseUpEvent
' XCALIBURDISPLAYSLib.XSpecPlottingStyles.XSpecPoint_To_Point
' XCALIBURDISPLAYSLib.XSpecPlottingStyles.XSpecAutomatic
Public Class frmQuantWindow
Inherits System.Windows.Forms.Form
'Changed PM_DECIMAL_MINUTES 2008-01-22
Private Enum LCplotTypeEnum
enumLCprofileClassic = 397
enumLCprofileZedGraph
enumQuantRatiosZedGraph
End Enum 'LCplotTypeEnum
#Region " Windows Form Designer generated code "
'****************************************************************************
'* Note: there is another constructor with a lot *
'* more parameters. That is the one we actually *
'* use. Why does this one exist? *
'****************************************************************************
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub 'Constructor.
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents txtOutput As System.Windows.Forms.TextBox
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents StatusBar1 As System.Windows.Forms.StatusBar
Friend WithEvents btnPrevSpec As System.Windows.Forms.Button
Friend WithEvents btnNextSpec As System.Windows.Forms.Button
Friend WithEvents btnPrevPept As System.Windows.Forms.Button
Friend WithEvents btnNextPept As System.Windows.Forms.Button
Friend WithEvents btnQuantPept As System.Windows.Forms.Button
Friend WithEvents cmdQuantProtein As System.Windows.Forms.Button
Friend WithEvents lvPept As ListViewCEBIExtended4
Friend WithEvents Label4 As System.Windows.Forms.Label
Friend WithEvents ContextMenu1 As System.Windows.Forms.ContextMenu
Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu
Friend WithEvents MenuItem1 As System.Windows.Forms.MenuItem
Friend WithEvents txtProteinRatio As System.Windows.Forms.TextBox
Friend WithEvents ProgressBar1 As System.Windows.Forms.ProgressBar
Friend WithEvents lvSpectra As System.Windows.Forms.ListView
Friend WithEvents mnuClose As System.Windows.Forms.MenuItem
Friend WithEvents lblSpecLst As System.Windows.Forms.Label
Friend WithEvents txtSpecLst As System.Windows.Forms.TextBox
Friend WithEvents pbLCpeak As System.Windows.Forms.PictureBox
Friend WithEvents lblPeptideInfo As System.Windows.Forms.Label
Friend WithEvents MenuItem2 As System.Windows.Forms.MenuItem
Friend WithEvents mnuRefreshForm As System.Windows.Forms.MenuItem
Friend WithEvents lblExtraPeptideInfo As System.Windows.Forms.Label
Friend WithEvents MenuItem3 As System.Windows.Forms.MenuItem
Friend WithEvents MenuItem6 As System.Windows.Forms.MenuItem
Friend WithEvents SaveFileDialog1 As System.Windows.Forms.SaveFileDialog
Friend WithEvents btnStopQuantitation As System.Windows.Forms.Button
Friend WithEvents btnDraw As System.Windows.Forms.Button
Friend WithEvents ToolTipMPQuant As System.Windows.Forms.ToolTip
Friend WithEvents MenuItem7 As System.Windows.Forms.MenuItem
Friend WithEvents mnuPrevPept As System.Windows.Forms.MenuItem
Friend WithEvents mnuNextPept As System.Windows.Forms.MenuItem
Friend WithEvents lblSpectrumInfo As System.Windows.Forms.Label
Friend WithEvents MenuItem8 As System.Windows.Forms.MenuItem
Friend WithEvents mnuPrevProtein_3 As System.Windows.Forms.MenuItem
Friend WithEvents mnuNextProtein_3 As System.Windows.Forms.MenuItem
Friend WithEvents mnuSaveSpectrumDataPoints As System.Windows.Forms.MenuItem
Friend WithEvents mnuExportSpectrumDataPoints As System.Windows.Forms.MenuItem
Friend WithEvents mnuQuantitateProtein As System.Windows.Forms.MenuItem
Friend WithEvents MenuItem5 As System.Windows.Forms.MenuItem
Friend WithEvents MenuItem12 As System.Windows.Forms.MenuItem
Friend WithEvents mnuDumpLogger As System.Windows.Forms.MenuItem
Friend WithEvents mnuTest_Zoom1 As System.Windows.Forms.MenuItem
Friend WithEvents mnuDumpAnalystCOM As System.Windows.Forms.MenuItem
Friend WithEvents retTplots_ZedGraph As ZedGraph.ZedGraphControl
Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox
Friend WithEvents rbRatiosPlot As System.Windows.Forms.RadioButton
Friend WithEvents rbNewLCplot As System.Windows.Forms.RadioButton
Friend WithEvents rbLCclassicPlot As System.Windows.Forms.RadioButton
Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
Friend WithEvents RadioButton2 As System.Windows.Forms.RadioButton
Friend WithEvents RadioButton3 As System.Windows.Forms.RadioButton
Friend WithEvents MenuItem4 As System.Windows.Forms.MenuItem
Friend WithEvents MenuItem9 As System.Windows.Forms.MenuItem
Friend WithEvents MenuItem11 As System.Windows.Forms.MenuItem
Friend WithEvents mnuEditUncheck As System.Windows.Forms.MenuItem
Friend WithEvents mnuEditCheck As System.Windows.Forms.MenuItem
Friend WithEvents mnuEditToggleChecked As System.Windows.Forms.MenuItem
Friend WithEvents MenuItem16 As System.Windows.Forms.MenuItem
Friend WithEvents mnuEditSelectAll As System.Windows.Forms.MenuItem
Friend WithEvents mnuEditSelectChecked As System.Windows.Forms.MenuItem
Friend WithEvents mnuEditInvertSelection As System.Windows.Forms.MenuItem
Friend WithEvents mnuQuantSelected As System.Windows.Forms.MenuItem
Friend WithEvents mnuSaveProteinsAndPeptides As System.Windows.Forms.MenuItem
Friend WithEvents mnuExportProteinsAndPeptides As System.Windows.Forms.MenuItem
Friend WithEvents MenuItem13 As System.Windows.Forms.MenuItem
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmQuantWindow))
Me.txtOutput = New System.Windows.Forms.TextBox
Me.btnPrevSpec = New System.Windows.Forms.Button
Me.btnNextSpec = New System.Windows.Forms.Button
Me.Label1 = New System.Windows.Forms.Label
Me.txtProteinRatio = New System.Windows.Forms.TextBox
Me.btnPrevPept = New System.Windows.Forms.Button
Me.btnNextPept = New System.Windows.Forms.Button
Me.StatusBar1 = New System.Windows.Forms.StatusBar
Me.btnQuantPept = New System.Windows.Forms.Button
Me.cmdQuantProtein = New System.Windows.Forms.Button
Me.Label4 = New System.Windows.Forms.Label
Me.lvSpectra = New System.Windows.Forms.ListView
Me.lblSpecLst = New System.Windows.Forms.Label
Me.ContextMenu1 = New System.Windows.Forms.ContextMenu
Me.MainMenu1 = New System.Windows.Forms.MainMenu(Me.components)
Me.MenuItem1 = New System.Windows.Forms.MenuItem
Me.mnuSaveProteinsAndPeptides = New System.Windows.Forms.MenuItem
Me.mnuExportProteinsAndPeptides = New System.Windows.Forms.MenuItem
Me.MenuItem13 = New System.Windows.Forms.MenuItem
Me.mnuSaveSpectrumDataPoints = New System.Windows.Forms.MenuItem
Me.mnuExportSpectrumDataPoints = New System.Windows.Forms.MenuItem
Me.MenuItem12 = New System.Windows.Forms.MenuItem
Me.mnuClose = New System.Windows.Forms.MenuItem
Me.MenuItem4 = New System.Windows.Forms.MenuItem
Me.MenuItem9 = New System.Windows.Forms.MenuItem
Me.MenuItem11 = New System.Windows.Forms.MenuItem
Me.mnuEditUncheck = New System.Windows.Forms.MenuItem
Me.mnuEditCheck = New System.Windows.Forms.MenuItem
Me.mnuEditToggleChecked = New System.Windows.Forms.MenuItem
Me.MenuItem16 = New System.Windows.Forms.MenuItem
Me.mnuEditSelectAll = New System.Windows.Forms.MenuItem
Me.mnuEditSelectChecked = New System.Windows.Forms.MenuItem
Me.mnuEditInvertSelection = New System.Windows.Forms.MenuItem
Me.MenuItem7 = New System.Windows.Forms.MenuItem
Me.mnuPrevProtein_3 = New System.Windows.Forms.MenuItem
Me.mnuNextProtein_3 = New System.Windows.Forms.MenuItem
Me.MenuItem8 = New System.Windows.Forms.MenuItem
Me.mnuPrevPept = New System.Windows.Forms.MenuItem
Me.mnuNextPept = New System.Windows.Forms.MenuItem
Me.MenuItem3 = New System.Windows.Forms.MenuItem
Me.MenuItem6 = New System.Windows.Forms.MenuItem
Me.mnuQuantitateProtein = New System.Windows.Forms.MenuItem
Me.MenuItem5 = New System.Windows.Forms.MenuItem
Me.mnuQuantSelected = New System.Windows.Forms.MenuItem
Me.MenuItem2 = New System.Windows.Forms.MenuItem
Me.mnuRefreshForm = New System.Windows.Forms.MenuItem
Me.mnuDumpLogger = New System.Windows.Forms.MenuItem
Me.mnuTest_Zoom1 = New System.Windows.Forms.MenuItem
Me.mnuDumpAnalystCOM = New System.Windows.Forms.MenuItem
Me.ProgressBar1 = New System.Windows.Forms.ProgressBar
Me.txtSpecLst = New System.Windows.Forms.TextBox
Me.pbLCpeak = New System.Windows.Forms.PictureBox
Me.lblPeptideInfo = New System.Windows.Forms.Label
Me.lblExtraPeptideInfo = New System.Windows.Forms.Label
Me.SaveFileDialog1 = New System.Windows.Forms.SaveFileDialog
Me.btnStopQuantitation = New System.Windows.Forms.Button
Me.btnDraw = New System.Windows.Forms.Button
Me.ToolTipMPQuant = New System.Windows.Forms.ToolTip(Me.components)
Me.lblSpectrumInfo = New System.Windows.Forms.Label
Me.retTplots_ZedGraph = New ZedGraph.ZedGraphControl
Me.GroupBox2 = New System.Windows.Forms.GroupBox
Me.rbRatiosPlot = New System.Windows.Forms.RadioButton
Me.rbNewLCplot = New System.Windows.Forms.RadioButton
Me.rbLCclassicPlot = New System.Windows.Forms.RadioButton
Me.GroupBox1 = New System.Windows.Forms.GroupBox
Me.RadioButton2 = New System.Windows.Forms.RadioButton
Me.RadioButton3 = New System.Windows.Forms.RadioButton
Me.lvPept = New ListViewCEBIExtended4
CType(Me.pbLCpeak, System.ComponentModel.ISupportInitialize).BeginInit()
Me.GroupBox2.SuspendLayout()
Me.GroupBox1.SuspendLayout()
Me.SuspendLayout()
'
'txtOutput
'
Me.txtOutput.Enabled = False
Me.txtOutput.Location = New System.Drawing.Point(1098, 142)
Me.txtOutput.Multiline = True
Me.txtOutput.Name = "txtOutput"
Me.txtOutput.ScrollBars = System.Windows.Forms.ScrollBars.Both
Me.txtOutput.Size = New System.Drawing.Size(368, 24)
Me.txtOutput.TabIndex = 0
'
'btnPrevSpec
'
Me.btnPrevSpec.Enabled = False
Me.btnPrevSpec.Location = New System.Drawing.Point(1098, 172)
Me.btnPrevSpec.Name = "btnPrevSpec"
Me.btnPrevSpec.Size = New System.Drawing.Size(75, 23)
Me.btnPrevSpec.TabIndex = 2
Me.btnPrevSpec.Text = "Prev spec"
'
'btnNextSpec
'
Me.btnNextSpec.Enabled = False
Me.btnNextSpec.Location = New System.Drawing.Point(1098, 201)
Me.btnNextSpec.Name = "btnNextSpec"
Me.btnNextSpec.Size = New System.Drawing.Size(75, 23)
Me.btnNextSpec.TabIndex = 3
Me.btnNextSpec.Text = "Next spec"
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(16, 336)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(72, 16)
Me.Label1.TabIndex = 6
Me.Label1.Text = "Protein ratio:"
'
'txtProteinRatio
'
Me.txtProteinRatio.Location = New System.Drawing.Point(88, 336)
Me.txtProteinRatio.Name = "txtProteinRatio"
Me.txtProteinRatio.Size = New System.Drawing.Size(208, 20)
Me.txtProteinRatio.TabIndex = 9
'
'btnPrevPept
'
Me.btnPrevPept.Enabled = False
Me.btnPrevPept.Location = New System.Drawing.Point(1098, 230)
Me.btnPrevPept.Name = "btnPrevPept"
Me.btnPrevPept.Size = New System.Drawing.Size(75, 23)
Me.btnPrevPept.TabIndex = 10
Me.btnPrevPept.Text = "Prev pept"
'
'btnNextPept
'
Me.btnNextPept.Enabled = False
Me.btnNextPept.Location = New System.Drawing.Point(1098, 259)
Me.btnNextPept.Name = "btnNextPept"
Me.btnNextPept.Size = New System.Drawing.Size(75, 23)
Me.btnNextPept.TabIndex = 11
Me.btnNextPept.Text = "Next pept"
'
'StatusBar1
'
Me.StatusBar1.Location = New System.Drawing.Point(0, 717)
Me.StatusBar1.Name = "StatusBar1"
Me.StatusBar1.Size = New System.Drawing.Size(1066, 22)
Me.StatusBar1.TabIndex = 12
Me.StatusBar1.Text = "<>"
'
'btnQuantPept
'
Me.btnQuantPept.Enabled = False
Me.btnQuantPept.Location = New System.Drawing.Point(1098, 288)
Me.btnQuantPept.Name = "btnQuantPept"
Me.btnQuantPept.Size = New System.Drawing.Size(75, 23)
Me.btnQuantPept.TabIndex = 13
Me.btnQuantPept.Text = "Quant Pept"
'
'cmdQuantProtein
'
Me.cmdQuantProtein.Enabled = False
Me.cmdQuantProtein.Location = New System.Drawing.Point(1098, 317)
Me.cmdQuantProtein.Name = "cmdQuantProtein"
Me.cmdQuantProtein.Size = New System.Drawing.Size(88, 23)
Me.cmdQuantProtein.TabIndex = 15
Me.cmdQuantProtein.Text = "Quant Protein"
'
'Label4
'
Me.Label4.Location = New System.Drawing.Point(8, 8)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(64, 16)
Me.Label4.TabIndex = 16
Me.Label4.Text = "Peptide List"
'
'lvSpectra
'
Me.lvSpectra.CheckBoxes = True
Me.lvSpectra.FullRowSelect = True
Me.lvSpectra.HideSelection = False
Me.lvSpectra.Location = New System.Drawing.Point(648, 24)
Me.lvSpectra.Name = "lvSpectra"
Me.lvSpectra.Size = New System.Drawing.Size(408, 304)
Me.lvSpectra.TabIndex = 17
Me.lvSpectra.UseCompatibleStateImageBehavior = False
Me.lvSpectra.View = System.Windows.Forms.View.Details
'
'lblSpecLst
'
Me.lblSpecLst.Location = New System.Drawing.Point(712, 8)
Me.lblSpecLst.Name = "lblSpecLst"
Me.lblSpecLst.Size = New System.Drawing.Size(80, 16)
Me.lblSpecLst.TabIndex = 18
Me.lblSpecLst.Text = "Spectrum List"
'
'MainMenu1
'
Me.MainMenu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem1, Me.MenuItem4, Me.MenuItem7, Me.MenuItem3, Me.MenuItem2})
'
'MenuItem1
'
Me.MenuItem1.Index = 0
Me.MenuItem1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuSaveProteinsAndPeptides, Me.mnuExportProteinsAndPeptides, Me.MenuItem13, Me.mnuSaveSpectrumDataPoints, Me.mnuExportSpectrumDataPoints, Me.MenuItem12, Me.mnuClose})
Me.MenuItem1.Text = "&File"
'
'mnuSaveProteinsAndPeptides
'
Me.mnuSaveProteinsAndPeptides.Index = 0
Me.mnuSaveProteinsAndPeptides.Text = "Protein, Peptides and Spectra Information (&save)..."
'
'mnuExportProteinsAndPeptides
'
Me.mnuExportProteinsAndPeptides.Index = 1
Me.mnuExportProteinsAndPeptides.Text = "Protein, Peptides and Spectra Information (&export)..."
'
'MenuItem13
'
Me.MenuItem13.Index = 2
Me.MenuItem13.Text = "-"
'
'mnuSaveSpectrumDataPoints
'
Me.mnuSaveSpectrumDataPoints.Index = 3
Me.mnuSaveSpectrumDataPoints.Text = "Save Current Spectrum Data Points As..."
'
'mnuExportSpectrumDataPoints
'
Me.mnuExportSpectrumDataPoints.Index = 4
Me.mnuExportSpectrumDataPoints.Text = "Export Current Spectrum Data Points"
'
'MenuItem12
'
Me.MenuItem12.Index = 5
Me.MenuItem12.Text = "-"
'
'mnuClose
'
Me.mnuClose.Index = 6
Me.mnuClose.Text = "Close"
'
'MenuItem4
'
Me.MenuItem4.Index = 1
Me.MenuItem4.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem9, Me.MenuItem11, Me.mnuEditUncheck, Me.mnuEditCheck, Me.mnuEditToggleChecked, Me.MenuItem16, Me.mnuEditSelectAll, Me.mnuEditSelectChecked, Me.mnuEditInvertSelection})
Me.MenuItem4.Text = "&Edit"
'
'MenuItem9
'
Me.MenuItem9.Enabled = False
Me.MenuItem9.Index = 0
Me.MenuItem9.Text = "Cut"
'
'MenuItem11
'
Me.MenuItem11.Index = 1
Me.MenuItem11.Text = "-"
'
'mnuEditUncheck
'
Me.mnuEditUncheck.Enabled = False
Me.mnuEditUncheck.Index = 2
Me.mnuEditUncheck.Shortcut = System.Windows.Forms.Shortcut.CtrlF6
Me.mnuEditUncheck.Text = "Uncheck"
'
'mnuEditCheck
'
Me.mnuEditCheck.Enabled = False
Me.mnuEditCheck.Index = 3
Me.mnuEditCheck.Shortcut = System.Windows.Forms.Shortcut.F6
Me.mnuEditCheck.Text = "Check"
'
'mnuEditToggleChecked
'
Me.mnuEditToggleChecked.Enabled = False
Me.mnuEditToggleChecked.Index = 4
Me.mnuEditToggleChecked.Text = "Toogle Checked"
'
'MenuItem16
'
Me.MenuItem16.Index = 5
Me.MenuItem16.Text = "-"
'
'mnuEditSelectAll
'
Me.mnuEditSelectAll.Index = 6
Me.mnuEditSelectAll.Shortcut = System.Windows.Forms.Shortcut.CtrlA
Me.mnuEditSelectAll.Text = "Select All"
'
'mnuEditSelectChecked
'
Me.mnuEditSelectChecked.Index = 7
Me.mnuEditSelectChecked.Shortcut = System.Windows.Forms.Shortcut.CtrlE
Me.mnuEditSelectChecked.Text = "Select Checked"
'
'mnuEditInvertSelection
'
Me.mnuEditInvertSelection.Index = 8
Me.mnuEditInvertSelection.Text = "Invert Selection"
'
'MenuItem7
'
Me.MenuItem7.Index = 2
Me.MenuItem7.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuPrevProtein_3, Me.mnuNextProtein_3, Me.MenuItem8, Me.mnuPrevPept, Me.mnuNextPept})
Me.MenuItem7.Text = "&View"
'
'mnuPrevProtein_3
'
Me.mnuPrevProtein_3.Enabled = False
Me.mnuPrevProtein_3.Index = 0
Me.mnuPrevProtein_3.Shortcut = System.Windows.Forms.Shortcut.F7
Me.mnuPrevProtein_3.Text = "Previous Protein"
'
'mnuNextProtein_3
'
Me.mnuNextProtein_3.Index = 1
Me.mnuNextProtein_3.Shortcut = System.Windows.Forms.Shortcut.F8
Me.mnuNextProtein_3.Text = "Next Protein"
'
'MenuItem8
'
Me.MenuItem8.Index = 2
Me.MenuItem8.Text = "-"
'
'mnuPrevPept
'
Me.mnuPrevPept.Index = 3
Me.mnuPrevPept.Shortcut = System.Windows.Forms.Shortcut.F9
Me.mnuPrevPept.Text = "Previous Peptide"
'
'mnuNextPept
'
Me.mnuNextPept.Index = 4
Me.mnuNextPept.Shortcut = System.Windows.Forms.Shortcut.F10
Me.mnuNextPept.Text = "Next Peptide"
'
'MenuItem3
'
Me.MenuItem3.Index = 3
Me.MenuItem3.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem6, Me.mnuQuantitateProtein, Me.MenuItem5, Me.mnuQuantSelected})
Me.MenuItem3.Text = "&Quantitation"
'
'MenuItem6
'
Me.MenuItem6.Index = 0
Me.MenuItem6.Text = "-"
'
'mnuQuantitateProtein
'
Me.mnuQuantitateProtein.Enabled = False
Me.mnuQuantitateProtein.Index = 1
Me.mnuQuantitateProtein.Text = "Quantitate Protein"
Me.mnuQuantitateProtein.Visible = False
'
'MenuItem5
'
Me.MenuItem5.Enabled = False
Me.MenuItem5.Index = 2
Me.MenuItem5.Text = "Quantitate All Proteins"
'
'mnuQuantSelected
'
Me.mnuQuantSelected.Enabled = False
Me.mnuQuantSelected.Index = 3
Me.mnuQuantSelected.Shortcut = System.Windows.Forms.Shortcut.F7
Me.mnuQuantSelected.Text = "&Quantitate"
'
'MenuItem2
'
Me.MenuItem2.Enabled = False
Me.MenuItem2.Index = 4
Me.MenuItem2.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuRefreshForm, Me.mnuDumpLogger, Me.mnuTest_Zoom1, Me.mnuDumpAnalystCOM})
Me.MenuItem2.Text = "&TestOnly"
'
'mnuRefreshForm
'
Me.mnuRefreshForm.Index = 0
Me.mnuRefreshForm.Text = "Refresh form"
Me.mnuRefreshForm.Visible = False
'
'mnuDumpLogger
'
Me.mnuDumpLogger.Index = 1
Me.mnuDumpLogger.Text = "Dump logger"
Me.mnuDumpLogger.Visible = False
'
'mnuTest_Zoom1
'
Me.mnuTest_Zoom1.Index = 2
Me.mnuTest_Zoom1.Text = "Set zoom 511.0 to 516.4"
Me.mnuTest_Zoom1.Visible = False
'
'mnuDumpAnalystCOM
'
Me.mnuDumpAnalystCOM.Index = 3
Me.mnuDumpAnalystCOM.Text = "Dump Analyst COM logger"
Me.mnuDumpAnalystCOM.Visible = False
'
'ProgressBar1
'
Me.ProgressBar1.Location = New System.Drawing.Point(320, 336)
Me.ProgressBar1.Name = "ProgressBar1"
Me.ProgressBar1.Size = New System.Drawing.Size(736, 16)
Me.ProgressBar1.TabIndex = 19
'
'txtSpecLst
'
Me.txtSpecLst.Location = New System.Drawing.Point(792, 0)
Me.txtSpecLst.Name = "txtSpecLst"
Me.txtSpecLst.Size = New System.Drawing.Size(224, 20)
Me.txtSpecLst.TabIndex = 20
'
'pbLCpeak
'
Me.pbLCpeak.BackColor = System.Drawing.SystemColors.HotTrack
Me.pbLCpeak.Location = New System.Drawing.Point(656, 358)
Me.pbLCpeak.Name = "pbLCpeak"
Me.pbLCpeak.Size = New System.Drawing.Size(360, 280)
Me.pbLCpeak.TabIndex = 22
Me.pbLCpeak.TabStop = False
'
'lblPeptideInfo
'
Me.lblPeptideInfo.Location = New System.Drawing.Point(72, 8)
Me.lblPeptideInfo.Name = "lblPeptideInfo"
Me.lblPeptideInfo.Size = New System.Drawing.Size(88, 16)
Me.lblPeptideInfo.TabIndex = 23
Me.lblPeptideInfo.Text = "<>"
'
'lblExtraPeptideInfo
'
Me.lblExtraPeptideInfo.Location = New System.Drawing.Point(168, 8)
Me.lblExtraPeptideInfo.Name = "lblExtraPeptideInfo"
Me.lblExtraPeptideInfo.Size = New System.Drawing.Size(528, 16)
Me.lblExtraPeptideInfo.TabIndex = 24
'
'SaveFileDialog1
'
Me.SaveFileDialog1.FileName = "prot1"
'
'btnStopQuantitation
'
Me.btnStopQuantitation.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.btnStopQuantitation.ForeColor = System.Drawing.Color.FromArgb(CType(CType(192, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer))
Me.btnStopQuantitation.Location = New System.Drawing.Point(549, 629)
Me.btnStopQuantitation.Name = "btnStopQuantitation"
Me.btnStopQuantitation.Size = New System.Drawing.Size(56, 24)
Me.btnStopQuantitation.TabIndex = 25
Me.btnStopQuantitation.Text = "Stop!"
'
'btnDraw
'
Me.btnDraw.Enabled = False
Me.btnDraw.Location = New System.Drawing.Point(1098, 346)
Me.btnDraw.Name = "btnDraw"
Me.btnDraw.Size = New System.Drawing.Size(48, 24)
Me.btnDraw.TabIndex = 26
Me.btnDraw.Text = "Test..."
'
'ToolTipMPQuant
'
Me.ToolTipMPQuant.ShowAlways = True
'
'lblSpectrumInfo
'
Me.lblSpectrumInfo.Location = New System.Drawing.Point(8, 656)
Me.lblSpectrumInfo.Name = "lblSpectrumInfo"
Me.lblSpectrumInfo.Size = New System.Drawing.Size(624, 16)
Me.lblSpectrumInfo.TabIndex = 28
Me.lblSpectrumInfo.Text = "<>"
'
'retTplots_ZedGraph
'
Me.retTplots_ZedGraph.Location = New System.Drawing.Point(668, 368)
Me.retTplots_ZedGraph.Name = "retTplots_ZedGraph"
Me.retTplots_ZedGraph.ScrollMaxX = 0
Me.retTplots_ZedGraph.ScrollMaxY = 0
Me.retTplots_ZedGraph.ScrollMaxY2 = 0
Me.retTplots_ZedGraph.ScrollMinX = 0
Me.retTplots_ZedGraph.ScrollMinY = 0
Me.retTplots_ZedGraph.ScrollMinY2 = 0
Me.retTplots_ZedGraph.Size = New System.Drawing.Size(388, 341)
Me.retTplots_ZedGraph.TabIndex = 29
Me.retTplots_ZedGraph.Visible = False
'
'GroupBox2
'
Me.GroupBox2.Controls.Add(Me.rbRatiosPlot)
Me.GroupBox2.Controls.Add(Me.rbNewLCplot)
Me.GroupBox2.Controls.Add(Me.rbLCclassicPlot)
Me.GroupBox2.Location = New System.Drawing.Point(394, 675)
Me.GroupBox2.Name = "GroupBox2"
Me.GroupBox2.Size = New System.Drawing.Size(218, 39)
Me.GroupBox2.TabIndex = 47
Me.GroupBox2.TabStop = False
Me.GroupBox2.Text = "Plot Type"
'
'rbRatiosPlot
'
Me.rbRatiosPlot.AutoSize = True
Me.rbRatiosPlot.Location = New System.Drawing.Point(155, 17)
Me.rbRatiosPlot.Name = "rbRatiosPlot"
Me.rbRatiosPlot.Size = New System.Drawing.Size(55, 17)
Me.rbRatiosPlot.TabIndex = 44
Me.rbRatiosPlot.Text = "Ratios"
Me.rbRatiosPlot.UseVisualStyleBackColor = True
'
'rbNewLCplot
'
Me.rbNewLCplot.AutoSize = True
Me.rbNewLCplot.Location = New System.Drawing.Point(86, 17)
Me.rbNewLCplot.Name = "rbNewLCplot"
Me.rbNewLCplot.Size = New System.Drawing.Size(63, 17)
Me.rbNewLCplot.TabIndex = 42
Me.rbNewLCplot.Text = "New LC"
Me.rbNewLCplot.UseVisualStyleBackColor = True
'
'rbLCclassicPlot
'
Me.rbLCclassicPlot.AutoSize = True
Me.rbLCclassicPlot.Checked = True
Me.rbLCclassicPlot.Location = New System.Drawing.Point(6, 17)
Me.rbLCclassicPlot.Name = "rbLCclassicPlot"
Me.rbLCclassicPlot.Size = New System.Drawing.Size(74, 17)
Me.rbLCclassicPlot.TabIndex = 43
Me.rbLCclassicPlot.TabStop = True
Me.rbLCclassicPlot.Text = "Classic LC"
Me.rbLCclassicPlot.UseVisualStyleBackColor = True
'
'GroupBox1
'
Me.GroupBox1.Controls.Add(Me.RadioButton2)
Me.GroupBox1.Controls.Add(Me.RadioButton3)
Me.GroupBox1.Location = New System.Drawing.Point(394, 630)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(149, 39)
Me.GroupBox1.TabIndex = 48
Me.GroupBox1.TabStop = False
Me.GroupBox1.Text = "Ratio transform"
'
'RadioButton2
'
Me.RadioButton2.AutoSize = True
Me.RadioButton2.Checked = True
Me.RadioButton2.Location = New System.Drawing.Point(86, 17)
Me.RadioButton2.Name = "RadioButton2"
Me.RadioButton2.Size = New System.Drawing.Size(43, 17)
Me.RadioButton2.TabIndex = 42
Me.RadioButton2.TabStop = True
Me.RadioButton2.Text = "Log"
Me.RadioButton2.UseVisualStyleBackColor = True
'
'RadioButton3
'
Me.RadioButton3.AutoSize = True
Me.RadioButton3.Enabled = False
Me.RadioButton3.Location = New System.Drawing.Point(6, 17)
Me.RadioButton3.Name = "RadioButton3"
Me.RadioButton3.Size = New System.Drawing.Size(51, 17)
Me.RadioButton3.TabIndex = 43
Me.RadioButton3.Text = "None"
Me.RadioButton3.UseVisualStyleBackColor = True
'
'lvPept
'
Me.lvPept.CheckBoxes = True
Me.lvPept.FullRowSelect = True
Me.lvPept.GridLines = True
Me.lvPept.HideSelection = False
Me.lvPept.Location = New System.Drawing.Point(12, 24)
Me.lvPept.Name = "lvPept"
Me.lvPept.Size = New System.Drawing.Size(632, 304)
Me.lvPept.TabIndex = 14
Me.lvPept.UseCompatibleStateImageBehavior = False
Me.lvPept.View = System.Windows.Forms.View.Details
'
'frmQuantWindow
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(1064, 757)
Me.Controls.Add(Me.GroupBox1)
Me.Controls.Add(Me.GroupBox2)
Me.Controls.Add(Me.retTplots_ZedGraph)
Me.Controls.Add(Me.lblSpectrumInfo)
Me.Controls.Add(Me.btnDraw)
Me.Controls.Add(Me.btnStopQuantitation)
Me.Controls.Add(Me.lblExtraPeptideInfo)
Me.Controls.Add(Me.lblPeptideInfo)
Me.Controls.Add(Me.pbLCpeak)
Me.Controls.Add(Me.txtSpecLst)
Me.Controls.Add(Me.txtProteinRatio)
Me.Controls.Add(Me.txtOutput)
Me.Controls.Add(Me.ProgressBar1)
Me.Controls.Add(Me.lblSpecLst)
Me.Controls.Add(Me.lvSpectra)
Me.Controls.Add(Me.Label4)
Me.Controls.Add(Me.cmdQuantProtein)
Me.Controls.Add(Me.lvPept)
Me.Controls.Add(Me.btnQuantPept)
Me.Controls.Add(Me.StatusBar1)
Me.Controls.Add(Me.btnNextPept)
Me.Controls.Add(Me.btnPrevPept)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.btnNextSpec)
Me.Controls.Add(Me.btnPrevSpec)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.MaximizeBox = False
Me.MaximumSize = New System.Drawing.Size(1072, 784)
Me.Menu = Me.MainMenu1
Me.MinimizeBox = False
Me.MinimumSize = New System.Drawing.Size(1072, 784)
Me.Name = "frmQuantWindow"
Me.Text = "Quantitation - www.cebi.sdu.dk & msquant.sourceforge.net"
CType(Me.pbLCpeak, System.ComponentModel.ISupportInitialize).EndInit()
Me.GroupBox2.ResumeLayout(False)
Me.GroupBox2.PerformLayout()
Me.GroupBox1.ResumeLayout(False)
Me.GroupBox1.PerformLayout()
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
#End Region
''For simulateDrawButtonClick().
'Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
'(ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long,
'ByVal lParam As Int16) As Long
'Const BM_SETSTATE As Long = &HF3
'enumeration for the subitem number
'Note: this is no longer the index of the column in the
' (visual) peptide display - it is now an identifier
' for a column no matter where it is.
Private Enum quantPeptTbItmColEnum2
'Change to positive number at any time.
enumSequence = -269 'Note: sequence must be first.
enumMascotScore 'zeros subitem
enumChargeState
enumMeasuredMCR
enumCalculatedMass 'Was 8.
'Changed PM_REFACTOR 2006-10-11. Disabled for now.
'enumDeltaPPM_MW
enumMeasMCR_StDev
enumModStr
enumRetentionTime
enumQueryNumber
enumRawfile
enumTemp2
'Note: these 5 must have a sufficient separation, e.g. 40 minumum.
enumRatioBaseNumber2 = 1103
enumRatioStdDevBaseNumber2 = 1601
enumIntensityBaseNumber2 = 1801
enumXICBaseNumber2 = 1301
'Changed PM_REFACTOR 2006-10-17
enumIntensRatioBaseNumber2 = 2003
End Enum 'quantPeptTbItmColEnum2
'Changed PM_REFACTOR 2006-04-05. Revived...
Private Enum specTbItmColEnum
enumRetT = 317 'Note: retention time must be first - first call
' of newColumn().
enumCycleNumber
'Changed PM_REFACTOR 2006-10-06
' enumIntensityWT_2
' enumIntensityIsotope2
' enumIntensityEvenHigherIsotope
'
' enumMeasMW_WT
' enumMeasMW_Isotope
' 'Changed PM_SPEC_DISPLAYFORTRIPLEENCODING 2006-04-05
' 'New ones
'
' enumIntensityRatio
' enumIntensityRatioEvenHigher
'Changed PM_REFACTOR 2006-10-06
'There are a variable number, one for each SILAC dish.
'Changed PM_ONLY_MSPEAKAREA 2006-11-10
'enumIntensityBaseNumber = 1009
'enumRatioBaseNumber = 1511
enumMSpeakAreaBaseNumber = 1009
enumMSpeakAreaRatioBaseNumber = 1511
enumMassBaseNumber = 1901
enumQuantOffsetBaseNumber = 1201 'For now
End Enum 'specTbItmColEnum
'Changed PM_REFACTOR 2006-10-11
Structure dishStatsStructure
Dim sumIntensity As Double
Dim aveRatio As Double
Dim stDevRatio As Double
Dim aveMass As Double
Dim stDevMass As Double
End Structure 'dishStatsStructure
'To be moved somewhere else
Structure quantStatsStructure
'Changed PM_REFACTOR 2006-10-10
' Dim sumIntWT As Double
' Dim sumIntIsotope As Double
'
' Dim aveRatio As Double
' Dim stDevRatio As Double
'
' Dim aveMassWT As Double
' Dim stDevMassWT As Double
'
' Dim aveMassIso As Double
' Dim stDevMassIso As Double
Dim dishInfo As List(Of dishStatsStructure)
'Dim checkedValue As Boolean in pept.useForQuantitation
'Changed PM_REFACTOR 2006-10-11. Disabled for now.
'Dim diffMass As Double
End Structure 'quantStatsStructure
'Changed PM_FEWER_FOR_QUANT 2004-11-17
Public Structure bestPeptScoreStructure
'Changed PM_REFACTOR 2006-03-15
'Dim peptID As Integer 'Some ID for a peptide. Can be index into
'' a datastructure - exact meaning is confined to whoever uses
' this structure.
Dim peptRef As Integer 'Some ID for a peptide. Can be index into
' a datastructure - exact meaning is confined to whoever uses
' this structure.
Dim mascotScore As Double
Dim addPeptide As Boolean 'Helper field, used during processing
End Structure 'bestPeptScoreStructure
'Changed PM_SAVE_MEMORY 2006-11-12. Moved to here...
Const QUANTWINDOWLEFTTEXT2 As String = "qwl"
Const QUANTWINDOWRIGHTTEXT2 As String = "qwr"
Private mMinQuant As Double
Private mFrmProtVal As frmProtValidation
Private mWiffInfo As rawFileInfoStruct
Private mProt As ProteinHitStructure
'Changed PM_SEVERALWIFFS_EXPORT 2003-08-29
'Copy from somewhere else.
Private mRawFiles() As massSpectrometryBase.fileSpecStructure
'Changed PM_MANUAL_PEPTIDEQUANTSTATUSUPDATE 2003-05-06
Private mProteinListIndex As Integer
'Changed PM_REFACTOR_FINNEGAN_MARKER 2003-07-12
Private mCurrCycle As Integer 'Current cycle for MS1 spectrum of
' current peptide.
'Changed PM_REFACTOR 2006-03-15
'Dim mCurrPepIdx As Integer 'current index into peptides, mProt.pept array
'Dim mCurrPeptide As peptideListIterator
Private mCurrPeptideToken As Integer
'Changed PM_MISSINGS_OBJECT_EXCEPTION_SPECS 2003-10-16
Private mCurrVisualPepIndex2 As Integer 'Current index
' into peptides, mProt.pept array
'Changed PM_FINNIGAN_QUANTWINDOW_RELATIVE 2005-07-12. No longer a
'constant. Must (in general) be computed for each mass.
''Changed PM_VARIABLE_XIC_WINDOW 2003-11-27. Negative value to catch
''errors. We now get the value from outside the program.
''Dim mDeltaMass As Double = 0.1 ' 0.01 test!!!!!!! 0.1 'look for
' the peak in a +- 0.1 MCR delta mass window
'Dim mDeltaMass As Double = -10000.0 ' 0.01 test!!!!!!! 0.1 'look
' for the peak in a +- 0.1 MCR delta mass window
'Changed PM_REFACTOR 2007-10-30
'Private mA As Double
'Private mB As Double
Private mRecalibrator As SDUPrecalibrator
'Changed PM_TYPESAFE 2006-11-09
'Private mQuantPeptQueryNumHash As New Hashtable
Private mQuantPeptQueryNumHash2 As New Dictionary(Of Integer, Integer)
Private mCurrSpecQuant As SpecQuantStructure 'Current mass spectrum,
' used to replace one in the ArrayList if changed. PM note: does
' not seem to be used.
'Does not seem to be used...
'Private mCurrMSList2 As New ArrayList 'List of values from single mass
'' spectra for the current peptide. PM note: does not seem to be used.
Private mCurrProtRatio As Double
Private mCurrProtRatioStDev As Double 'PM note: is assigned
' in CalculateProteinRatio(), but does not seem to be used. Am I missing
' something?
'Instance variables for interacting with graphics. This should be
' encapsulated in its own function.
Private mX_Offset As Double
Private mY_Offset As Double
Private mX_ScaleFactor As Double
'Changed PM_REFACTOR 2006-10-11
'Private mY_ScaleFactorWT As Double
'Private mY_ScaleFactorISO As Double
Private mY_ScaleFactors() As Double
Private mFixBackground As Double = 0.0 'Default background.
'Changed PM_REFACTOR 2006-10-11
''Changed PM_RATIO_PROBLEM 2003-08-11
'Dim mBckGrIntWT As Double
'Dim mBackGrIntIso As Double
Private mBackGround() As Double
'Changed PM_REFACTOR 2006-10-11
'Private mBackGroundWtAsPixel As Integer 'Position of background for
'' wild type isotope.
'Private mBackGroundIsoAsPixel As Integer 'Position of background
'' for labeled isotope.
Private mBackGroundsAsPixel() As Integer 'Position of backgrounds
'Changed PM_RATIO_PROBLEM 2003-08-11
Private mLastMousePosition As Point 'GUI thing
Private mStartingUp As Boolean
Private mLastMouseDownWithCtrPt As Point
'Changed PM_LCPEAK_DRAW 2003-03-24
Private mLCG As Graphics
Private mLCpeakBitmap As Bitmap 'Is the bitmap for mLCG/pbLCpeak.
Private mTEMPTEMP_LastPept As PeptideHitStructure
'Changed PM_REFACTOR 2005-02-28
''Changed PM_TRIPLEDISPLAY 2003-06-17
''Columns are now dynamic. We use this map (hash) to find
''the actual column index given an identifier.
'Dim mColumnPeptMap As Hashtable
'Changed PM_TRIPLEDISPLAY_PERFORMANCETROUBLE 2003-06-19
Private mPeptide_AvoidListEvents1 As Boolean
'Changed PM_TRIPLEDISPLAY_PERFORMANCETROUBLE 2003-06-24
Private mSpectrum_AvoidListEvents2 As Boolean
'Changed PM_KEEP_HIGHEST_FOR_RATIOS 2003-06-26
Private mOptions As OptionsStruct2 'const/read-only.
'Changed PM_VARIABLE_XIC_WINDOW 2003-11-27
Private mApplication As quantApplication
'Changed PM_REFACTOR_FINNEGAN 2003-07-21
''Changed PM_REFACTOR_FINNEGAN_MARKER 2003-07-12
'Dim mANALYSTCOM_TheData As New FMANSpecData()
'Dim mANALYSTCOM_WiffFile As FMANWiffFile ' to get info about data file
' 'todo: put this in the options dialog
'Changed PM_REFACTOR_FINNEGAN 2003-06-02
Private mRawDataFileHandling As rawDataFileHandling 'Requires importing
' namespace massSpectrometryBase
'Changed PM_QUANTSPEEDUP 2003-08-07
Private mChunkerPeptideQuantitation As SDUPchunker
'Changed PM_ANALYSTSPECTRA_DECOUPLING 2005-03-06
Private mChunkerAllPeptidesQuant As SDUPchunker
'Changed PM_DEBUG_EVENTCOUNTS 2003-08-12
'For debugging only.
Private mTempPeptideItemClickedCount As Integer
Private mTempPeptideAcceptedItemClickedCount As Integer
Private mTempSpectrumItemClickedCount As Integer
Private mTempSpectrumAcceptedItemClickedCount As Integer
Private mTempCheckedIsBeingSet As Boolean = False
'For debugging only.
'Changed PM_REFACTOR 2006-10-12
'Private mMSSignal As ArrayList
Private mMSSignal As List(Of massSpectrometryBase.signalStructure)
'Changed PM_STOP_AQUISITION 2003-09-29
Private mStopAquisition As Boolean
'Changed PM_QUANTMODESTR_DISPLAY 2003-09-29
Private mQuantModeStr As String
''Changed PM_FINNEGAN_DISPLAY 2003-10-23
'Dim mFinneganDialog As frmFinneganSpectra
Private mMSdisplay As frmSpectrumDisplay
'Changed PM_REFACTOR 2007-10-03. Now embedded in mMSdisplay.
''Changed PM_REFACTOR 2007-07-22
''Friend WithEvents mAxGraphControl_ANALYSTCOM_3 As _
'' AxQS20_GraphControlLib.AxGraphControl
'Private mAnalystCOM_Graph As AnalystCOM
Friend WithEvents mAxXSpecDisplayForQuantWindow_XCALIBURCOM_2 As _
AxXSpecDisplay
'Changed PM_REFACTOR 2004-04-14
Private mLogger As SDUPlogger
'Changed PM_FINNIGAN_QUANTWINDOW_RELATIVE 2005-07-12
Private mXICwindow As XICwindow
'Changed PM_XY_EXPORT 2005-01-11
Private mLastPeptHit As PeptideHitStructure 'Remember the last
' peptide for e.g. XY export.
'Changed PM_QUANTWINDOW_VISUALISATION 2005-02-02
Private mYlevelForMarkers As Integer
Const MASSMARKERSIZE As Integer = 37
'Changed PM_REFACTOR 2005-02-28
Private mPeptColumnMapper As listviewColumnMapper
'Changed PM_VISUAL_COLUMNSORT 2006-02-24
Private mListViewColumnSorter As ListViewColumnSorter
'Changed PM_TYPESAFE_HASH 2006-11-06
'Private mColumnSortSpecificationHash As Hashtable 'Collection of key
'' lists, one list per column to be sorted. Key is the ID for a
'' column.
Private mColumnSortSpecificationHash As Dictionary( _
Of Integer, List(Of sortKeyStructure))
'Changed PM_REFACTOR 2006-04-05
Private mSpecColumnMapper As listviewColumnMapper
'Changed PM_REFACTOR 2006-10-12
Private mDishes As Integer 'Cached value, derived from current
' quantitation mode.
'Changed PM_CLICKOFF_QUANTPEPTIDE_BUG 2007-04-13
Private mCalcProteinRatioCount As Integer 'For diagnostics.
'Changed PM_RETURN_KEY_OPEN_QUANTPETIDE 2007-08-31
'Changed PM_DOUBLE_RETURN_KEY 2007-09-08
Private mKeyObserver_PeptideList As SDUPkeyObserver
'Changed PM_REFACTOR 2008-01-02
Private mKeyObserver_SpectrumList As SDUPkeyObserver
'Changed PM_LCPROFILE_MODERNPLOT 2008-01-22
Private mRetentionTimePlotting As retentionTimePlotting
'Changed PM_SPECTRAEXPORT_GENERALISED 2008-05-06
Private WithEvents mExportFiltersForm As frmExportFilters
''Changed PM_ZOOM_QUANTWINDOW_BROKEN 2005-07-13
'Private mDataPointsInfoForLastSpectrum As dataPointsInfoStructure2
'Outcommented. Seems not to be used.
''Should it be here?
'Public Structure qPeptStruct 'for quantitation peptide
' Dim retTimeMinutes As Double
' Dim retTimeSec As Double
' Dim countsLowerMass As Double
' Dim countsHigherMass As Double
' Dim ratioHigherToLower As Double
'End Structure
'does this work?
'PM 2003-03-12. aProt was ByVal
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Sub New( _
ByRef aProtVal As frmProtValidation, _
ByRef aProt As ProteinHitStructure, _
ByRef anInCalibration As SDUPrecalibrator, _
ByVal aRawFileInfo As rawFileInfoStruct, _
ByRef aOptions As OptionsStruct2, _
ByVal aProteinListIndex As Integer, _
ByRef aRawFileObject As rawDataFileHandling, _
ByRef anInRawFiles() As massSpectrometryBase.fileSpecStructure, _
ByRef anApplication As quantApplication _
)
'Old:
' ByRef anInXICwindow As XICwindow at least not yet...
' ByVal aTempIsAnalyst As Boolean
' ByVal anA As Double, ByVal aB As Double, _
'aOptions: Changed PM_QUANTMODE 2003-02-18
'aOptions: const ref
'aProteinListIndex: used to refer back to the protein
' in frmProteinList/frmProteinList.vb when it needs to be updated.
Me.New()
'Changed PM_REMOVE_FINNEGAN_DEPENDENCY 2004-03-19
''Changed PM_TRUE_SPECTRUM_EMBEDDING 2004-02-16.
''Off by default. Makes it easier when MicroMass support is added..
'If True Then
' AxGraphControl_ANALYSTCOM_1.Visible = False
' AxXSpecDisplayForQuantWindow_XCALIBURCOM.Visible = False
'End If
'Changed PM_CASESTATEMENT_FOR_RAWFILETYPE 2004-02-22
''Changed PM_MULTIPLE_FINNEGAN_FIX 2003-12-12. Moved from Init() to only create it once.
''Changed PM_ANALYST_OPENFINNEGANWINDOW_BUG 2003-12-18
''Note: mOptions and aRawFileObject are not set yet. We use
'' the parameters instead...
'Changed PM_CLICKOFF_QUANTPEPTIDE_BUG 2007-04-13
mCalcProteinRatioCount = 0 'For diagnostics.
If True Then 'Add spectrum control, but only the one corresponding to the
' raw file mode.
' Note: in contrast to using the Designer this does not
' create dependencies as to what software needs to
' be installed on the target system. E.g. Finnegan and Analyst
' software no longer needs to be installed at the same time, only
' Analyst is needed for analysing Analyst data....
Dim loc2 As System.Drawing.Point = _
New System.Drawing.Point(16, 360)
'Changed PM_QUANTWINDOW_VISUALISATION 2005-02-02
''Changed PM_FINNEGAN_QUANT_MARKERS 2004-06-10
''Dim ySize As Integer = 280
''Dim ySize As Integer = 280 - 25
'Dim ySize As Integer = 280 - 10
Dim ySize2 As Integer = 280 - 10 - 32
Dim size2 As System.Drawing.Size = _
New System.Drawing.Size(672, ySize2)
Select Case aOptions.rawFileMode
Case rawFileModeEnum.enumAnalyst
Dim obj As Object = Nothing 'Keep compiler happy.
quantApplication.addSpectrumControl( _
Me, GetType(frmQuantWindow), _
obj, _
"mAxGraphControl_ANALYSTCOM_2", _
displayModeEnum.enumQS, _
loc2, size2, _
aOptions.COMversion)
'Changed PM_REFACTOR 2007-10-03
''Changed PM_REFACTOR 2007-07-22
''mAxGraphControl_ANALYSTCOM_2 = _
'' DirectCast(obj, AxQS20_GraphControlLib.AxGraphControl)
'mAnalystCOM_Graph = DirectCast(obj, AnalystCOM)
Dim comObj As AnalystCOM = DirectCast(obj, AnalystCOM)
Trace.Assert(Not comObj Is Nothing, _
"PIL ASSERT. mAxGraphControl_ANALYSTCOM_2 was not created....")
'mSpectrumDialog = _
' New frmAnalystSpectra( _
' aRawFileObject, _
' mAxGraphControl_ANALYSTCOM_2, _
' Me)
'Changed PM_QSTAR_BROKEN_QUANTITATION 2007-10-09
'Note:
' For some reason using the built-in Analyst
' markers results in zoom to the entire mass
' range (for the MS spectrum).
'
''Changed PM_REFACTOR 2007-09-19
'Dim marker As AnalystSpectrumMarking = _
' New AnalystSpectrumMarking( _
' comObj, aRawFileObject)
Dim marker As overlaySpectrumMarking = _
New overlaySpectrumMarking( _
Me, ToolTipMPQuant)
mMSdisplay = _
New frmAnalystSpectraWithLabelMarkers( _
aRawFileObject, _
comObj, _
aRawFileObject, _
DirectCast(marker, SDUPspectrumMarking)) '
' SDUPspectrumMarking is base class.
'Refactoring opportunity here...
Dim xOffsetForMarkers As Integer = _
mMSdisplay.xOffsetForMarkers()
Dim xOffsetFromRightEdge As Integer = _
mMSdisplay.xOffsetFromRightEdge()
Dim yOffsetForMarkers As Integer = _
mMSdisplay.yOffsetForMarkers()
mYlevelForMarkers = loc2.Y + ySize2 - yOffsetForMarkers
'Is this really what it is???
'Dim markersHeight As Integer = -77
Dim markersHeight As Integer = 34 'As Protein Validation.
marker.init2( _
xOffsetForMarkers, xOffsetFromRightEdge, _
mYlevelForMarkers, markersHeight)
Case rawFileModeEnum.enumFinnegan
Dim obj As Object = Nothing 'Keep compiler happy.
quantApplication.addSpectrumControl( _
Me, GetType(frmQuantWindow), _
obj, _
"AxXSpecDisplayForQuantWindow_XCALIBURCOM", _
displayModeEnum.enumXCalibur, _
loc2, size2, _
aOptions.COMversion)
mAxXSpecDisplayForQuantWindow_XCALIBURCOM_2 = _
DirectCast(obj, AxXSpecDisplay)
Trace.Assert(Not mAxXSpecDisplayForQuantWindow_XCALIBURCOM_2 Is Nothing, _
"PIL ASSERT. mAxXSpecDisplayForQuantWindow_XCALIBURCOM_2 was not created....")
Dim marker As overlaySpectrumMarking = _
New overlaySpectrumMarking( _
Me, ToolTipMPQuant)
mMSdisplay = _
New frmFinneganSpectra( _
aRawFileObject, _
mAxXSpecDisplayForQuantWindow_XCALIBURCOM_2, _
aRawFileObject, _
DirectCast(marker, SDUPspectrumMarking))
Dim xOffsetForMarkers As Integer = _
mMSdisplay.xOffsetForMarkers()
Dim xOffsetFromRightEdge As Integer = _
mMSdisplay.xOffsetFromRightEdge()
Dim yOffsetForMarkers As Integer = _
mMSdisplay.yOffsetForMarkers()
mYlevelForMarkers = loc2.Y + ySize2 - yOffsetForMarkers
'Is this really what it is???
'Dim markersHeight As Integer = -77
Dim markersHeight As Integer = 34 'As Protein Validation.
marker.init2( _
xOffsetForMarkers, xOffsetFromRightEdge, _
mYlevelForMarkers, markersHeight)
Case rawFileModeEnum.enumMicromass
Dim obj As Object = Nothing 'Keep compiler happy.
quantApplication.addSpectrumControl( _
Me, GetType(frmProtValidation), _
obj, _
"mZedGraphControl", _
displayModeEnum.enumZedGraph, _
loc2, size2, _
aOptions.COMversion)
Dim someZedGraphControl As ZedGraphControl = _
DirectCast(obj, ZedGraphControl)
Trace.Assert( _
Not someZedGraphControl Is Nothing, _
"PIL ASSERT. mZedGraphControl was not created....")
'Dim marker As ZedGraphSpectrumMarking = _
' New ZedGraphSpectrumMarking
Dim marker2 As overlaySpectrumMarking = _
New overlaySpectrumMarking( _
Me, ToolTipMPQuant)
mMSdisplay = _
New frmZedSpectra( _
aRawFileObject, _
someZedGraphControl, _
aRawFileObject, _
DirectCast(marker2, SDUPspectrumMarking))
Dim xOffsetForMarkers As Integer = _
mMSdisplay.xOffsetForMarkers()
Dim xOffsetFromRightEdge As Integer = _
mMSdisplay.xOffsetFromRightEdge()
Dim yOffsetForMarkers As Integer = _
mMSdisplay.yOffsetForMarkers()
mYlevelForMarkers = loc2.Y + ySize2 - yOffsetForMarkers
'Is this really what it is???
'Dim markersHeight As Integer = -77
Dim markersHeight As Integer = 34 'As Protein Validation.
marker2.init2( _
xOffsetForMarkers, xOffsetFromRightEdge, _
mYlevelForMarkers, yOffsetForMarkers)
Case Else
Trace.Assert(False, "PIL ASSERT. Select Case never fall-through")
End Select
'Changed PM_XY_EXPORT 2005-01-10
'Let frmSpectrumDisplay handle it?
End If 'Add spectrum control.
'Changed PM_LCPROFILE_MODERNPLOT 2008-01-22
If True Then
mRetentionTimePlotting = _
New retentionTimePlotting(retTplots_ZedGraph)
End If
'Changed PM_QUANTWINDOW_VISUALISATION 2005-02-02
''Changed PM_FINNEGAN_QUANT_MARKERS 2004-06-10
'Dim yFromLavel As Integer = yLevelForMarkers.Location.Y
'yLevelForMarkers.Visible = False
'Changed PM_REFACTOR 2006-10-12
If True Then
Dim quantitationModesObject As QuantitationModes_moreGeneral = _
anApplication.getQuantModes()
Dim curQuantMode As generalisedQuantModeStructure = _
quantitationModesObject.getQuantitationMode(aOptions.quantModeCode)
mDishes = _
curQuantMode.dishes_StartingFromDish2.Count + 1
End If
'Changed PM_REFACTOR 2004-04-14
mLogger = New SDUPlogger
'Changed PM_MEMORY_ALLOCATION 2004-08-05
mLogger.disableLogging()
'mLogger.enableLogging()
'Changed PM_EFFICIENCY 2007-10-10. .
Dim timeSliceSecs2 As Double = 2.0
timeSliceSecs2 = 0.5
timeSliceSecs2 = 2.0
mChunkerPeptideQuantitation = New SDUPchunker(timeSliceSecs2)
'Changed PM_ANALYSTSPECTRA_DECOUPLING 2005-03-06
Dim timeSliceSecs As Double = 2.0
mChunkerAllPeptidesQuant = New SDUPchunker(timeSliceSecs)
'Changed PM_REFACTOR 2005-02-28
mPeptColumnMapper = New listviewColumnMapper( _
DirectCast(lvPept, System.Windows.Forms.ListView))
'Changed PM_REFACTOR 2005-02-28
mSpecColumnMapper = New listviewColumnMapper(lvSpectra)
'Changed PM_VISUAL_COLUMNSORT 2006-02-24
mListViewColumnSorter = _
New ListViewColumnSorter(mPeptColumnMapper)
'Changed PM_TYPESAFE_HASH 2006-11-06
'mColumnSortSpecificationHash = New Hashtable
mColumnSortSpecificationHash = New Dictionary( _
Of Integer, _
List(Of sortKeyStructure))
'Changed PM_NO_INIT_TWICE 2005-02-28
'Moved from FillPeptideListView() (called from Init)
'to New() to avoid more than one initialisation (of column order)
'per window.
If True Then
'Dim addTripleEncodingColumns As Boolean = _
' anApplication.isTripleEncoding(aOptions.quantModeCode)
Trace.Assert(mDishes > 0, "PIL ASSERT. mDishes has not been set!.")
'Peptide!
Me.setPeptideListViewColumns(mDishes)
'Spectrum!
Me.setSpectrumListViewColumns(mDishes)
End If
'Visual sorting
If True Then
'Sequence
If True Then
Dim keyList1 As List(Of sortKeyStructure) = _
New List(Of sortKeyStructure)
keyList1.Add(New sortKeyStructure( _
quantPeptTbItmColEnum2.enumSequence, datatypeEnum.enumText, _
sortingDirectionEnum.enumAscendingSort))
keyList1.Add(New sortKeyStructure( _
quantPeptTbItmColEnum2.enumRawfile, datatypeEnum.enumText, _
sortingDirectionEnum.enumAscendingSort))
keyList1.Add(New sortKeyStructure( _
quantPeptTbItmColEnum2.enumMascotScore, datatypeEnum.enumDecimalNumber, _
sortingDirectionEnum.enumDescendingSort))
mColumnSortSpecificationHash.Add( _
quantPeptTbItmColEnum2.enumSequence, keyList1)
End If
'Score
If True Then
Dim keyList1 As List(Of sortKeyStructure) = _
New List(Of sortKeyStructure)
keyList1.Add(New sortKeyStructure( _
quantPeptTbItmColEnum2.enumMascotScore, datatypeEnum.enumDecimalNumber, _
sortingDirectionEnum.enumDescendingSort))
keyList1.Add(New sortKeyStructure( _
quantPeptTbItmColEnum2.enumSequence, datatypeEnum.enumText, _
sortingDirectionEnum.enumAscendingSort))
keyList1.Add(New sortKeyStructure( _
quantPeptTbItmColEnum2.enumRawfile, datatypeEnum.enumText, _
sortingDirectionEnum.enumAscendingSort))
keyList1.Add(New sortKeyStructure( _
quantPeptTbItmColEnum2.enumQueryNumber, datatypeEnum.enumInteger, _
sortingDirectionEnum.enumAscendingSort))
mColumnSortSpecificationHash.Add( _
quantPeptTbItmColEnum2.enumMascotScore, keyList1)
End If
'Changed PM_QUANTCOLUMNS_SORT 2007-04-03
If True Then
Dim keyBase As Integer = -5
Dim n As Integer 'Is selector for type: average ratio, stddev
' for average ratio, intensity and XIC.
For n = 0 To 4
Dim lastIndex As Integer = mDishes - 1
Dim dish As Integer
For dish = 0 To lastIndex
Select Case n
'Perhaps later: dependent width (in pixels).
Case 0 'Ratio
keyBase = quantPeptTbItmColEnum2.enumRatioBaseNumber2
Case 1 'Std. for ratio
keyBase = quantPeptTbItmColEnum2.enumRatioStdDevBaseNumber2
Case 2 'Ratio of intensities. Ratio of XICs instead?
keyBase = quantPeptTbItmColEnum2.enumIntensRatioBaseNumber2
Case 3 'XIC
keyBase = quantPeptTbItmColEnum2.enumXICBaseNumber2
Case 4 'Intensity
keyBase = quantPeptTbItmColEnum2.enumIntensityBaseNumber2
Case Else
Trace.Assert(False, _
"PIL ASSERT. Select Case never fall-through")
End Select
Dim key2 As Integer = keyBase + dish
If True Then 'Block, make sure keyList1 goes out of scope.
Dim keyList1 As List(Of sortKeyStructure) = _
New List(Of sortKeyStructure)
'Descending because most values are 0.0 and the interesting
'would end up at the end of the list.
keyList1.Add(New sortKeyStructure( _
key2, _
datatypeEnum.enumDecimalNumber, _
sortingDirectionEnum.enumDescendingSort))
'Secondary keys:
keyList1.Add(New sortKeyStructure( _
quantPeptTbItmColEnum2.enumRawfile, datatypeEnum.enumText, _
sortingDirectionEnum.enumAscendingSort))
keyList1.Add(New sortKeyStructure( _
quantPeptTbItmColEnum2.enumMascotScore, datatypeEnum.enumDecimalNumber, _
sortingDirectionEnum.enumDescendingSort))
'More secondary keys?
mColumnSortSpecificationHash.Add( _
key2, keyList1)
End If
Next dish
Next 'Selector
End If 'Block, quant columns.
'Mcal
If True Then
Dim keyList1 As List(Of sortKeyStructure) = _
New List(Of sortKeyStructure)
keyList1.Add(New sortKeyStructure( _
quantPeptTbItmColEnum2.enumCalculatedMass, datatypeEnum.enumDecimalNumber, _
sortingDirectionEnum.enumAscendingSort))
keyList1.Add(New sortKeyStructure( _
quantPeptTbItmColEnum2.enumSequence, datatypeEnum.enumText, _
sortingDirectionEnum.enumAscendingSort))
keyList1.Add(New sortKeyStructure( _
quantPeptTbItmColEnum2.enumRawfile, datatypeEnum.enumText, _
sortingDirectionEnum.enumAscendingSort))
keyList1.Add(New sortKeyStructure( _
quantPeptTbItmColEnum2.enumMascotScore, datatypeEnum.enumDecimalNumber, _
sortingDirectionEnum.enumDescendingSort))
keyList1.Add(New sortKeyStructure( _
quantPeptTbItmColEnum2.enumQueryNumber, datatypeEnum.enumInteger, _
sortingDirectionEnum.enumAscendingSort))
mColumnSortSpecificationHash.Add( _
quantPeptTbItmColEnum2.enumCalculatedMass, keyList1)
End If
'ret. T.
If True Then
Dim keyList1 As List(Of sortKeyStructure) = _
New List(Of sortKeyStructure)
keyList1.Add(New sortKeyStructure( _
quantPeptTbItmColEnum2.enumRetentionTime, datatypeEnum.enumDecimalNumber, _
sortingDirectionEnum.enumAscendingSort))
keyList1.Add(New sortKeyStructure( _
quantPeptTbItmColEnum2.enumRawfile, datatypeEnum.enumText, _
sortingDirectionEnum.enumAscendingSort))
keyList1.Add(New sortKeyStructure( _
quantPeptTbItmColEnum2.enumMascotScore, datatypeEnum.enumDecimalNumber, _
sortingDirectionEnum.enumDescendingSort))
mColumnSortSpecificationHash.Add( _
quantPeptTbItmColEnum2.enumRetentionTime, keyList1)
End If
'Query
If True Then
Dim keyList1 As List(Of sortKeyStructure) = _
New List(Of sortKeyStructure)
'Should be unique. Only the primary key should be needed.
keyList1.Add(New sortKeyStructure( _
quantPeptTbItmColEnum2.enumQueryNumber, datatypeEnum.enumInteger, _
sortingDirectionEnum.enumAscendingSort))
mColumnSortSpecificationHash.Add( _
quantPeptTbItmColEnum2.enumQueryNumber, keyList1)
End If
'Raw file
If True Then
Dim keyList1 As List(Of sortKeyStructure) = _
New List(Of sortKeyStructure)
keyList1.Add(New sortKeyStructure( _
quantPeptTbItmColEnum2.enumRawfile, datatypeEnum.enumText, _
sortingDirectionEnum.enumAscendingSort))
keyList1.Add(New sortKeyStructure( _
quantPeptTbItmColEnum2.enumSequence, datatypeEnum.enumText, _
sortingDirectionEnum.enumAscendingSort))
keyList1.Add(New sortKeyStructure( _
quantPeptTbItmColEnum2.enumMascotScore, datatypeEnum.enumDecimalNumber, _
sortingDirectionEnum.enumDescendingSort))
keyList1.Add(New sortKeyStructure( _
quantPeptTbItmColEnum2.enumMeasuredMCR, datatypeEnum.enumDecimalNumber, _
sortingDirectionEnum.enumAscendingSort))
keyList1.Add(New sortKeyStructure( _
quantPeptTbItmColEnum2.enumQueryNumber, datatypeEnum.enumInteger, _
sortingDirectionEnum.enumAscendingSort))
mColumnSortSpecificationHash.Add( _
quantPeptTbItmColEnum2.enumRawfile, keyList1)
End If
End If
Init(aProtVal, aProt, anInCalibration, _
aRawFileInfo, aOptions, aProteinListIndex, _
aRawFileObject, anInRawFiles, anApplication)
End Sub 'New
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Public Sub Init( _
ByRef aProtVal As frmProtValidation, _
ByRef aProt As ProteinHitStructure, _
ByRef anInCalibration As SDUPrecalibrator, _
ByVal aRawFileInfo As rawFileInfoStruct, _
ByRef aOptions As OptionsStruct2, _
ByVal aProteinListIndex As Integer, _
ByRef aRawFileObject As rawDataFileHandling, _
ByRef anInRawFiles() As massSpectrometryBase.fileSpecStructure, _
ByRef anApplication As quantApplication _
)
'Old:
' ByRef anInXICwindow As XICwindow at least not yet...
' ByVal aTempIsAnalyst As Boolean
'
' 'Changed PM_REFACTOR 2007-10-30
' ByVal anA As Double, ByVal aB As Double
If True Then
mFrmProtVal = aProtVal
'Changed PM_REFACTOR_FINNEGAN 2003-07-21
'mANALYSTCOM_TheData = aData
'mANALYSTCOM_WiffFile = aWiffFile
mProt = aProt
'Changed PM_SEVERALWIFFS_EXPORT 2003-08-29
mRawFiles = anInRawFiles
'Changed PM_KEEP_HIGHEST_FOR_RATIOS 2003-06-26
mOptions = aOptions
'Changed PM_VARIABLE_XIC_WINDOW 2003-11-27
mApplication = anApplication
'Changed PM_MANUAL_PEPTIDEQUANTSTATUSUPDATE 2003-05-06
mProteinListIndex = aProteinListIndex
'Changed PM_REFACTOR_FINNEGAN 2003-07-13
mRawDataFileHandling = aRawFileObject
''Changed PM_BACK_TO_NORMAL 2003-07-29
'mTempIsAnalyst = aTempIsAnalyst
'Is this used anymore??
mWiffInfo.sampleNumberInRawFile = _
aRawFileInfo.sampleNumberInRawFile
End If
'Changed PM_MULTIPLE_FINNEGAN_FIX 2003-12-12. Moved to New() to only create it once.
'Changed PM_VARIABLE_XIC_WINDOW 2003-11-27
Dim settings As miscSettingsStructure2Struct = _
mApplication.getMiscSettings()
'Changed PM_USERDEFINED_QUANT_THRESHOLD 2006-11-10
''Changed PM_FINNEGAN_COUNT_THRESHOLD 2003-12-19
'Select Case mOptions.rawFileMode
' Case rawFileModeEnum.enumAnalyst
' mMinQuant = MIN_SIGN_QUANT_ANALYST
' Case rawFileModeEnum.enumFinnegan
' mMinQuant = MIN_SIGN_QUANT_FINNEGAN
' Case rawFileModeEnum.enumMicromass
' mMinQuant = MIN_SIGN_QUANT_FINNEGAN
' Case Else
' Trace.Assert(False, "PIL ASSERT. Select Case never fall-through")
'End Select
'Changed PM_FINNEGAN_COUNT_THRESHOLD 2003-12-19
Select Case mOptions.rawFileMode
Case rawFileModeEnum.enumAnalyst
mMinQuant = settings.QSTARsettingsXIC.quantThreshold
Case rawFileModeEnum.enumFinnegan
mMinQuant = settings.LTQFTsettingsXIC.quantThreshold
Case rawFileModeEnum.enumMicromass
mMinQuant = settings.QtofsettingsXIC.quantThreshold
Case Else
Trace.Assert(False, "PIL ASSERT. Select Case never fall-through")
End Select
'Changed PM_FINNIGAN_QUANTWINDOW_RELATIVE 2005-07-12
'mDeltaMass = 0.5 * settings.absoluteMassWindowForXIC 'Note: later we
'' may or may not use percentage threshold instead of this
'' fixed (absolute) mass window.
mXICwindow = mApplication.getXICwindowObject()
Trace.Assert(Not mXICwindow Is Nothing, _
"PIL ASSERT. mXICwindow has not been called into existence....")
'For now: the parameters are only updated for each protein, but that
' should be more than enough.
Dim XICsettting As miscSettingsStructure2Struct = _
mApplication.getMiscSettings()
mXICwindow.setParameters(settings.currentXICwindowSetings)
'Changed PM_REFACTOR 2006-10-11
''Changed PM_RATIO_PROBLEM 2003-08-11
'mBckGrIntWT = 0.0
'mBackGrIntIso = 0.0
mStartingUp = True
'Changed PM_STOP_AQUISITION 2003-09-29
mStopAquisition = False
mPeptide_AvoidListEvents1 = False
'Changed PM_TRIPLEDISPLAY_PERFORMANCETROUBLE 2003-06-24
mSpectrum_AvoidListEvents2 = False
'Changed PM_DEBUG_EVENTCOUNTS 2003-08-12
mTempPeptideItemClickedCount = 0
mTempPeptideAcceptedItemClickedCount = 0
mTempSpectrumItemClickedCount = 0
mTempSpectrumAcceptedItemClickedCount = 0
'Changed PM_RETURN_KEY_OPEN_QUANTPETIDE 2007-08-31
mKeyObserver_PeptideList = New SDUPkeyObserver
'Changed PM_ENTERKEY_SPECTRUMLINE 2008-01-02
mKeyObserver_SpectrumList = New SDUPkeyObserver
Me.prepareProteinForQuantitation(mProt, aOptions)
'Why after prepareProteinForQuantitation()?
'Changed PM_REFACTOR 2007-10-30
'mA = anA
'mB = aB
mRecalibrator = anInCalibration
'Extra after refactoring.
lvPept.Items.Clear()
'Changed PM_REFACTOR 2006-03-15
'mCurrPepIdx = 0
Dim mCurrPeptide As peptideListIterator = _
New peptideListIterator(aProt.peptides)
'Read first???
'Changed PM_NEXTQUANTPEPTIDE_TROUBLE 2005-02-04. Now in FillPeptideListView().
''Changed PM_MISSINGS_OBJECT_EXCEPTION_SPECS 2003-10-16
'mCurrVisualPepIndex = 0
mQuantPeptQueryNumHash2.Clear() 'Needed?
'Changed PM_REFACTOR 2005-02-28.
'Old. Delete at any time.
''Changed PM_TRIPLEDISPLAY 2003-06-17
'mColumnPeptMap = New Hashtable
'To get things initialised in the right order. Maybe not so elegant.
'SetAndDisplaySpectrum(0) 'This assumes the current raw file has
' already been selected...
'Changed PM_QUANTMODESTR_DISPLAY 2003-09-29
mQuantModeStr = "Mode: " & _
quantApplication.quantModeString( _
mOptions.quantModeCode, _
mApplication)
'Changed PM_SAVE_RECALIBRATION 2005-02-02
Dim toDisplay As String = mQuantModeStr
If SDUPrecalibrator.identityCalibration(anInCalibration) Then
lblExtraPeptideInfo.BackColor = Color.Salmon
toDisplay &= ". Note: no recalibration!!!"
End If
lblExtraPeptideInfo.Text = toDisplay
'Changed PM_MISSINGS_OBJECT_EXCEPTION_SPECS 2003-10-16. Moved into FillPeptideListView().
'SetTheSpectrum(mCurrPepIdx) 'peptides are ordered by mass here so the
'' first spectrum will usually be bad for quantitation.
'write the protein information into the form header.
Me.WriteProteinInfoInHeader()
Me.FillPeptideListView(aOptions)
'Changed PM_QUANTITATE_NEXTPROTEIN 2004-11-16
Me.setQuantitationCommandsStatus(True) 'This is necessary if we are
' re-using a quantitation window for another protein.
'
'Perhaps we should have a state in this class that
'tells us wether we have reused the window for another
'(quantified) protein. In this way we could save time
'for the initial display of a quantified protein (this
'is the most common).
'Changed PM_OPENDELAY_QUANTWINDOW 2008-05-05. Turned off this
' logic. It would mean that if e.g. one peptide was manually
' quantified then reopening the Quantitation window would
' unexpectedly quantify ***all*** peptides.
'If True Then
' If mProt2.proteinHasBeenQuantified Then
' Me.QuantifyProtein()
' End If
'End If
'Changed PM_RATIO_PROBLEM 2003-08-11
mStartingUp = False
End Sub 'Init()
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub WriteProteinInfoInHeader()
Dim header As String = _
"Quantiation for: " & mProt.accNum & " " & _
(mProt.monoIsotopicMass / 1000.0).ToString("0.00") & " kDa " & _
mProt.description2
Me.Text = header
End Sub 'WriteProteinInfoInHeader
'Changed PM_REFACTOR 2003-04-03
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub prepareProteinForQuantitation( _
ByRef aProt As ProteinHitStructure, _
ByRef aOptions As OptionsStruct2)
'Changed PM_GENERALISED_QUANT_MODE 2003-12-08
Dim quantitationModesObject As QuantitationModes_moreGeneral = _
mApplication.getQuantModes()
Dim curQuantMode As generalisedQuantModeStructure = _
quantitationModesObject.getQuantitationMode( _
aOptions.quantModeCode)
'Not used...
'Dim quantSpecificationList As ArrayList = _
' quantitationModesObject.getQuantSpecificationList_GUIIndexOrder()
'Changed PM_REFACTOR 2006-10-11
Dim dishes As Integer = _
curQuantMode.dishes_StartingFromDish2.Count + 1
Dim lastIndex As Integer = dishes - 1
ReDim mBackGround(dishes - 1)
Dim j As Integer
For j = 0 To lastIndex
mBackGround(j) = 0.0
Next j
'Changed PM_EVENMORE_GENERALISED_QUANTMODES 2005-04-08. Not needed anymore...
'Dim theQuantValues As quantValuesStructure
''The derived information depends only on the quantitation mode, not
''on modifications (identified by Mascot) for a particular peptide.
'FindLCpeaks.derivedValuesFromQuantitationMode( _
' curQuantMode, quantitationModesObject, theQuantValues)
'Changed PM_REFACTOR 2006-03-15
'Dim i As Integer
Dim pept As PeptideHitStructure = _
helper.blankPeptide() 'Keep compiler happy.
Dim pepIter As peptideListIterator = _
New peptideListIterator(aProt.peptides)
'For i = 0 To mProt2.pepts.Count - 1
While Not pepIter.nextPeptide(pept)
Dim dummy1 As FindLCpeaks.multModCounterStructure
Dim peptideInvalidated As Boolean
pept = _
FindLCpeaks.preparePeptideForQuantitation( _
pept, _
curQuantMode, _
dummy1, _
peptideInvalidated) 'Reuse pept.... OK?
Trace.Assert(Not peptideInvalidated, _
"PIL ASSERT. <message>.")
pepIter.updateCurrentPeptide(pept)
'Some assert that fields were actually changed in aProt.pepts(i)
End While 'Through peptides.
End Sub 'prepareProteinForQuantitation()
'Changed PM_TRIPLEENC_QUANTEXCLUDE 2003-09-15
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub excludePeptideCheck(ByVal aAbsMassDiff As Double, _
ByVal aExpMassDiff1 As Double, ByRef anAddPeptide As Boolean)
'Use abs of this difference??. Yes! Sample: 0.33 - 2.0067096520000014 < 0.2
Dim diff2 As Double = aAbsMassDiff - aExpMassDiff1
Dim absDiff2 As Double = Math.Abs(diff2)
If absDiff2 < 0.2 Then 'this means they have same charge
' and are part of a pair.
anAddPeptide = False
Else
Dim peter As Integer = 45 'For breakpoints.
End If
End Sub 'excludePeptideCheck
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub FillPeptideListView(ByRef aOptions2 As OptionsStruct2)
'Changed PM_VISUAL_COLUMNSORT_TROUBLE 2006-03-01
'This is required to avoid getting into trouble when we are
're-using a quant window. Otherwise sorting would be done at arbitrary
'times while building up rows for the list, resulting in comparing
'in-complete rows with complete rows. The result is exceptions in the
'Compare() function.
lvPept.ListViewItemSorter() = Nothing
'Changed PM_FEWER_FOR_QUANT 2004-11-17
Dim PEPTIDE_UNIT_DISTANCE As Double = 1663.75 / 1663 'About 1.000451
Dim keyWindowSize As Double = PEPTIDE_UNIT_DISTANCE / 1
''Columns in lvPept are no longer constant. There are
''extra columns for triple encoding. In the future it
''may be possible for the user to exclude certain
''columns and even rearrange them.
'Start with running through the sequences.
'Changed PM_TYPESAFE 2006-11-09
'Dim someHash As Hashtable = New Hashtable
Dim someHash2 As Dictionary(Of String, Double) = _
New Dictionary(Of String, Double)
' Better name??
'Changed PM_TYPESAFE 2006-11-08
''Changed PM_FEWER_FOR_QUANT 2004-11-17
'Dim bestScoreHash As Hashtable = New Hashtable
Dim bestScoreHash2 As Dictionary( _
Of String, bestPeptScoreStructure) = _
New Dictionary( _
Of String, bestPeptScoreStructure) 'For equal mass, keep
' only best scoring peptide. This datastructure also holds the
' peptides to be used for quantitation, added in the second loop.
Dim quantitationModesObject As QuantitationModes_moreGeneral = _
mApplication.getQuantModes()
Dim curQuantMode As generalisedQuantModeStructure = _
quantitationModesObject.getQuantitationMode( _
aOptions2.quantModeCode)
'Changed PM_EVENMORE_GENERALISED_QUANTMODES 2005-04-08. Not needed
' anymore...
'Dim theQuantValues As quantValuesStructure
'FindLCpeaks.derivedValuesFromQuantitationMode( _
' curQuantMode, quantitationModesObject, theQuantValues)
Dim peptidesToQuantify As Integer = 0
Dim firstPepRef As Integer = -1 'The negative value (-1) is used as flag.
'Changed PM_QUANT_ALL 2007-10-12
'Special non-GUI way for users to turn off exclusion of peptides.
Dim quantAll As Boolean = False
If aOptions2.extra2.IndexOf("allQuant") >= 0 Then
quantAll = True
Else
Dim peter2 As Integer = 2
End If
Dim quantAllDoubleCounter As Integer = 0
If True Then 'Block to hide 'i' - can be removed at any time.
'Dim i As Integer
'First loop: find out which peptides to quantify. In the first
' loop we can ***not*** immediately find out which ones to use
' we don't know the highest scoring one for equal sequence,
' as charge, raw file and mass.
'Changed PM_REFACTOR 2006-03-15
Dim pept As PeptideHitStructure = _
helper.blankPeptide() 'Keep compiler happy.
Dim pepIter As peptideListIterator = _
New peptideListIterator(mProt.peptides)
Dim peptideToken As Integer
While Not pepIter.nextPeptide(pept, peptideToken)
'The peptide needs to be verified and contain Arg and
'not be part of a pair of which one is in already.
Dim addPeptide As Boolean = pept.verified
'Changed PM_NOISOTOPE_BROKEN 2004-11-29. Set a flag.
'Otherwise No Isotope is now handled the same
'as quantitation (modes).
Dim doQuantModeStuff As Boolean = True
'No isotope?
If curQuantMode.dishes_StartingFromDish2.Count = 0 Then '
doQuantModeStuff = False
End If
'Changed PM_QUANT_ALL 2007-10-12
'Special non-GUI way for users to turn off exclusion of peptides.
If quantAll Then
doQuantModeStuff = False
Else
Dim peter2 As Integer = 2
End If
'Changed PM_EVENMORE_GENERALISED_QUANTMODES 2005-04-11
'Changed PM_ARG6_LYS6 2003-04-23
'Dim numFilterAAs As Integer = thePept.AAsMatchingTheFilter2
'Trace.Assert(numFilterAAs >= 0, _
' "PIL ASSERT. Unexpected negative value for numFilterAAs: " & _
' numFilterAAs, "")
'If doQuantModeStuff AndAlso numFilterAAs = 0 Then
If doQuantModeStuff AndAlso Not pept.someAAsMatchingTheFilter Then
addPeptide = False 'Must contain Arg (or L or C or whatever
'the quantitation mode defines).
'This can happen if the peptide is C-terminal in the
'protein (and does not contain any SILAC affected aminoacid).
Else
Dim peter9 As Integer = 9 'For breakpoints.
End If
'Refactor note: as we will never put something into the hash
'table if there are no amino acids corresponding to the
'modification mode the Add() method would never be called.
If addPeptide Then
'Now check if this is the second peptide in a pair.
'We cannot just have the sequence as key in the hash table.
'Instead we append the charge state, because we allow to
'separately quantify on different charge states.
'Changed PM_FEW_PEPTIDES_FOR_QUANTITATION 2003-10-20
Dim keySB As StringBuilder = New StringBuilder
keySB.Append(pept.AASequence)
keySB.Append(pept.charge)
keySB.Append("_")
keySB.Append(pept.rawFileID)
'Dim sKey As String = _
' thePept.AASequence & _
' thePept.charge.ToString & "_" & _
' thePept.rawFileID
Dim sKey As String = keySB.ToString
'Delete...
''Changed PM_FEWER_FOR_QUANT 2004-11-17
'Dim massStr As String = (5 * thePept.measuredMZ).ToString
'Changed PM_FEWER_FOR_QUANT 2004-11-17
Dim massInt As Integer = _
CInt(pept.measuredMCR / keyWindowSize - 0.5) + 100
keySB.Append("_")
keySB.Append(massInt)
Dim keyWithMass As String = keySB.ToString
Dim curScore As Double = pept.MascotScore
Dim someBestScore As bestPeptScoreStructure
someBestScore.mascotScore = curScore
'Changed PM_REFACTOR 2006-03-15
'someBestScore.peptID = i
someBestScore.peptRef = peptideToken
someBestScore.addPeptide = True
'Changed PM_QUANTWINDOW_INCLUSION_BUG 2007-06-20
Dim addToHash As Boolean = False 'To postpone
' adding to the hash until we know for
' sure we want to add it.
'Changed PM_QUANT_ALL 2007-10-12
'Special non-GUI way for users to turn off exclusion of peptides.
If quantAll Then
addToHash = True
Else
Dim peter2 As Integer = 2
End If
'Changed PM_TYPESAFE 2006-11-08
Dim oldValue As bestPeptScoreStructure
'If bestScoreHash.ContainsKey(keyWithMass) Then
If bestScoreHash2.TryGetValue(keyWithMass, oldValue) Then
'Changed PM_QUANT_INSERTED_PEPTIDE_MASK_BUG 2007-02-02
'
' Effectively ignore the current peptide.
'
' We now assume it has been sorted physically such
' that we get the highest scoring first (including
' the inserted peptides with score 99 having an
' effective score of close to zero in in the sort).
' Thus if there is already something at the key then
' we already have the highest scoring (non-inserted)
'If curScore > oldValue.mascotScore Then
' 'Replace with the higher scoring...
' bestScoreHash2(keyWithMass) = someBestScore
'End If
If True Then 'For bug detection.
Dim oldScore As Double = oldValue.mascotScore
Dim tol As Double = 0.01
Dim isInsertedPeptide As Boolean = _
utilityStatic.numbersClose( _
pept.MascotScore, _
PILpeptides.FIXED_SCORE_FOR_INSERTED_PEPTIDES, _
tol)
If isInsertedPeptide Then
Dim peter9 As Integer = 9
End If
'Test the descending sort condition.
'Effectively no test for inserted peptide.
Trace.Assert(isInsertedPeptide Or curScore <= oldScore, _
"PIL ASSERT. Not sorted by descending score. " & _
"Query number " & pept.queryNumber & _
". Score: " & curScore & _
". Previous score: " & oldScore)
End If
Else
'Changed PM_QUANTWINDOW_INCLUSION_BUG 2007-06-20
' 'Changed PM_FEWER_FOR_QUANT 2004-11-17
' bestScoreHash2.Add(keyWithMass, someBestScore)
addToHash = True
End If
'Changed PM_NOISOTOPE_BROKEN 2004-11-29.
If doQuantModeStuff Then
'someHash2 effectively records previous peptides
'that we have seen (with some sequence/charge/rawFile)
'and we can look up it's mass).
'
'But: what if the modification set is different??
' -it seems we get to see an arbitrary version
' of a peptide???
'Changed PM_TYPESAFE 2006-11-09
'If someHash.ContainsKey(sKey) Then
Dim massMCR As Double
If someHash2.TryGetValue(sKey, massMCR) Then
'Note: which peptides we may eliminate in the call
' to excludePeptideCheck() below depends on
' the order we 'see' them.
'Put in the sequence as the key and the measured MCR
'as the value measured mass difference between
'the two peptides in the potential pair do this
'on measured MS so this does not also takes
'out the charge pairs.
Dim absMassDiff As Double = Math.Abs( _
massMCR - pept.measuredMCR) 'Why was
' this value limited to 2 decimal places? -
' e.g. 2.0100000. Because it has 2 decimal places
' in the Mascot result file!
If absMassDiff > 0.1 Then
Dim peter10 As Integer = 10
Else
'Changed PM_LOWSCORING_PEPTIDES_IN_QUANTITATIONWINDOW 2005-12-12
'This does happen. E.g. double entries by
'DTASuperCharge - exactly the same precursor
'mass, charge and fragment ion masses and
'intensities. Besides the same mass the score
'is also identical. Does not happen then if
'parenthesised peptides are turned off.
'
'Under what other circumstances does this happen?
Dim peter11 As Integer = 11
End If
'Changed PM_EVENMORE_GENERALISED_QUANTMODES 2005-04-08. Not for now...
''Changed PM_SEQUENCE_DEPENDENT_QUANTMASSDIFF 2004-07-07
'Trace.Assert(Not theQuantValues.Diffs1FromBase Is Nothing, _
' "PIL ASSERT. Diffs1FromBase has not been initialised!.")
'Dim diff1fromBase As Double = _
' ...theQuantValues.Diffs1FromBase(0), AAmassDiffStructure).diffFromBase
'Trace.Assert(diff1fromBase > 0.0, _
' "PIL ASSERT. Unexpected negative value of mass diff: " & _
' diff1fromBase.ToString, "")
'Possible problem with wild type and self, resulting
'almost all peptides being excluded???
'Changed PM_EVENMORE_GENERALISED_QUANTMODES_BUGFIX 2005-04-19
'In the old way and now: we compute all possible mass
'differences between the isotope mass differences
'and effectively with both signs. There could be
'a problem here: some peptides may be excluded
'from quantitation that should not be excluded.
'Changed PM_EVENMORE_GENERALISED_QUANTMODES_BUGFIX 2005-04-19. Now
'Compute all possible mass differences and do
'not compute and use identical zero difference.
'After this change it corresponds to the old code.
''Changed PM_EVENMORE_GENERALISED_QUANTMODES 2005-04-11
Dim lastIndex As Integer = pept.quantValues2.Count - 1
Dim someQuantValue1 As derivedQuantInfoStructure
Dim index As Integer = 0
For Each someQuantValue1 In pept.quantValues2
Dim j As Integer
For j = index + 1 To lastIndex
Dim someQuantValue2 As _
derivedQuantInfoStructure = pept.quantValues2(j)
'Dim theExpMassDiff As Double = _
' Math.Abs(someQuantValue.MCRuncalibDiff)
Dim expMassDiff As Double = _
someQuantValue2.MCRuncalibDiff - _
someQuantValue1.MCRuncalibDiff
'We exclude a peptide anyway if there is
'another identified peptide corresponding
'to a mass difference between the SILAC
'dish the peptide is belonging to and some
'other SILAC dish (with the same charge
'and in the same raw file).
excludePeptideCheck( _
absMassDiff, expMassDiff, addPeptide)
If Not addPeptide Then
Dim peter3 As Integer = 3 'SILAC partner!
End If
Next j
index += 1
Next
Else
someHash2.Add(sKey, pept.measuredMCR) 'See refactor
' comment above (about 26 lines up).
End If
End If 'Eliminate pairs of quantitation MS peaks.
'Changed PM_QUANTWINDOW_INCLUSION_BUG 2007-06-20
'We don't want to overwrite with a lower scoring peptide
'that happens to be a SILAC partner. In fact this
'bug excluded all SILAC pairs (two or more identified)
'from enterering into the quantitation window.
'If Not addPeptide Then
' 'Invalidate if we found out later that the peptide
' 'should not be used anyway.
' Dim curValue As bestPeptScoreStructure = _
' bestScoreHash2(keyWithMass)
' curValue.addPeptide = False
' bestScoreHash2(keyWithMass) = curValue
'End If
If addPeptide And addToHash Then
Dim dummy As bestPeptScoreStructure
If bestScoreHash2.TryGetValue(keyWithMass, dummy) Then
'Key already exists. This can only be the case if we quantify all.
Trace.Assert(quantAll = True, "PIL ASSERT. <message>.")
'Add with a slightly different key.
'Use reusable StringBuilder for this??
Dim newKey As String = _
keyWithMass & "_quantAll_" & quantAllDoubleCounter
bestScoreHash2.Add(newKey, someBestScore)
quantAllDoubleCounter += 1
Else
bestScoreHash2.Add(keyWithMass, someBestScore)
End If
Else
Dim peter2 As Integer = 2
End If
Else
Dim peter8 As Integer = 8
End If
'Add to HashTable.
'mQuantPeptQueryNumHash.Add(pept.queryNumber, i)
mQuantPeptQueryNumHash2.Add(pept.queryNumber, peptideToken)
End While 'Through peptides.
End If
If True Then
'Changed PM_TYPESAFE_HASH_ENUMERATOR 2006-11-08
'Dim hashEnumerator As IDictionaryEnumerator = _
' bestScoreHash.GetEnumerator()
Dim hashEnumerator2 As Dictionary( _
Of String, bestPeptScoreStructure).Enumerator = _
bestScoreHash2.GetEnumerator()
While (hashEnumerator2.MoveNext())
'Changed PM_TYPESAFE_HASH_ENUMERATOR 2006-11-08
'Dim curPep As bestPeptScoreStructure = _
' ...( _
' hashEnumerator.Value, bestPeptScoreStructure)
Dim curPep As bestPeptScoreStructure = _
hashEnumerator2.Current.Value
Dim addPeptide As Boolean = curPep.addPeptide
If addPeptide Then
Dim peptRef As Integer = curPep.peptRef
Dim pept As PeptideHitStructure = _
helper.blankPeptide() 'Keep compiler happy.
mProt.peptides.peptideByToken(peptRef, pept)
peptidesToQuantify += 1
'Changed PM_MISSINGS_OBJECT_EXCEPTION_SPECS 2003-10-16
If firstPepRef < 0 Then
firstPepRef = peptRef
'Changed PM_REFACTOR 2006-03-15
'mCurrPepIdx = index
mCurrPeptideToken = peptRef
'Changed PM_RETENTIONTIME_ASSERT 2004-10-25
'Needed because we call spectraRangeXYZ first .....
mRawDataFileHandling.newCurrentFile(pept.rawFileID)
SetTheSpectrum(mCurrPeptideToken) 'Peptides are
' ordered by mass here so the first spectrum
' will usually be bad for quantitation.
End If
Dim seq As String = pept.AASequence
'Calculated mass (w/o modification right now).
Dim mass As Double = _
MMaaSequence.monoMass(seq, "Carbamidomethyl (C)")
'Use size of map as an indication of how many (empty)
'columns should be added. We then afterwards fill in
'the ones we want/can to fill in at this time.
Dim newItem As ListViewItem = lvPept.Items.Add(seq)
'Changed PM_QUANTWINDOW_REOPEN_CHECKED_FOR_USE_IN_QUANT 2007-07-30
Dim savedAvoid1 As Boolean = mPeptide_AvoidListEvents1
mPeptide_AvoidListEvents1 = True 'This is absolutely required as normal
' handling of the event would try to refer to some columns that we
' have not set up yet - this happens below.
Dim useForQuant As Boolean = pept.useForQuantitation
newItem.Checked = useForQuant
mPeptide_AvoidListEvents1 = savedAvoid1
If useForQuant Then
Dim peter2 As Integer = 2
Else
Dim peter3 As Integer = 3
End If
With newItem
'Changed PM_REFACTOR 2005-02-28
'Dim columns As Integer = mColumnPeptMap.Count
Dim columns As Integer = mPeptColumnMapper.columnCount()
Dim j As Integer
For j = 1 To columns
.SubItems.Add("...")
Next j
mPeptColumnMapper.updateListItem( _
newItem, quantPeptTbItmColEnum2.enumMascotScore, _
pept.MascotScore.ToString)
mPeptColumnMapper.updateListItem( _
newItem, quantPeptTbItmColEnum2.enumChargeState, _
pept.charge.ToString)
mPeptColumnMapper.updateListItem( _
newItem, quantPeptTbItmColEnum2.enumCalculatedMass, _
mass.ToString("0.000"))
mPeptColumnMapper.updateListItem( _
newItem, quantPeptTbItmColEnum2.enumRetentionTime, _
pept.MSMSretentionTimeMinutes.ToString("0.00"))
mPeptColumnMapper.updateListItem( _
newItem, quantPeptTbItmColEnum2.enumQueryNumber, _
pept.queryNumber.ToString)
'Changed PM_VISUAL_COLUMNSORT 2006-02-24
mPeptColumnMapper.updateListItem( _
newItem, quantPeptTbItmColEnum2.enumRawfile, _
pept.rawFileID.ToString)
End With
'Changed PM_DISPLAYQUANTITATED_MISSING 2008-05-18
If Not pept.spectra Is Nothing Then
'Peptide already quantified. Display it... (it fact
'display is a side effect in Fill_lvPept(); it does not
'try to quantitate again)
Dim lastVisualIndex As Integer = lvPept.Items.Count() - 1
'As we have just added the item it is the last
'item that should be selected - Fill_lvPept depends on
'which one is selected...
Me.setSelectedPeptide(lastVisualIndex, True, True) 'Select the first peptide...
Fill_lvPept(pept, peptRef, True, False)
Else
'Not quantified. Leave it alone.
Dim peter2 As Integer = 2
End If
Else
Dim peter7 As Integer = 7
End If
End While 'Best score hash iteration.
End If
'Changed PM_STANDARDISE 2007-06-20
'lblPeptideInfo.Text = Str(peptidesToQuantify) & " to quantify."
lblPeptideInfo.Text = peptidesToQuantify.ToString() & " to quantify."
'Changed PM_NEXTQUANTPEPTIDE_TROUBLE 2005-02-04
Me.setSelectedPeptide(0, True, False) 'Select the first peptide...
If True Then
'Dim initialSortColumn As quantPeptTbItmColEnum2 = _
' quantPeptTbItmColEnum2.enumSequence
Dim initialSortColumn As quantPeptTbItmColEnum2 = _
quantPeptTbItmColEnum2.enumRawfile
'Changed PM_TYPESAFE_HASH 2006-11-06
'Dim keylist As ArrayList = _
' ...(mColumnSortSpecificationHash(initialSortColumn), _
' ArrayList)
Dim keylist As List(Of sortKeyStructure) = _
mColumnSortSpecificationHash(initialSortColumn)
mListViewColumnSorter.prepareSort(keylist)
lvPept.ListViewItemSorter() = mListViewColumnSorter
lvPept.Sort()
End If
End Sub 'FillPeptideListView()
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Function getPeptideTokenFromVisualIndex( _
ByVal aIndex As Integer) _
As Integer
'Changed PM_TRIPLEDISPLAY_PERFORMANCETROUBLE 2003-06-19
Dim savedAvoid1 As Boolean = mPeptide_AvoidListEvents1
mPeptide_AvoidListEvents1 = True
'Changed PM_TRIPLEDISPLAY 2003-06-18
'Dim qNumStr As String = _
' lvPept2.Items(aIndex).SubItems(quantPeptTbItmColEnum.eQueryNumber).Text
''Note: this fire the event that is handled by lvPept_ItemCheck()......
'Dim qNumStr As String = _
' readOffPeptideListItem(lvPept2.Items(aIndex), _
' quantPeptTbItmColEnum2.eQueryNumber)
'Changed PM_EVENTTROUBLE 2003-08-13
Dim qNumStr As String
'Note: this construct documents the very strange behavior with
' unexpected events being send and potential for slowing
' down the application to a crawl.
If False Then
'This will result in an event being send
'and lvPept_ItemCheck() called.
qNumStr = _
mPeptColumnMapper.readOffListItem( _
lvPept.Items(aIndex), _
quantPeptTbItmColEnum2.enumQueryNumber)
Else
If False Then
'This will also result in an event being send
'and lvPept_ItemCheck() called.
qNumStr = _
mPeptColumnMapper.readOffListItem( _
lvPept.Items.Item(aIndex), _
quantPeptTbItmColEnum2.enumQueryNumber)
Else
'This will NOT result in an event being send. Why?
Dim rowToRead As ListViewItem = lvPept.Items(aIndex)
qNumStr = _
mPeptColumnMapper.readOffListItem( _
rowToRead, _
quantPeptTbItmColEnum2.enumQueryNumber)
End If
End If
'Changed PM_TRIPLEDISPLAY_PERFORMANCETROUBLE 2003-06-19
mPeptide_AvoidListEvents1 = savedAvoid1
Dim queryNum As Integer
If IsNumeric(qNumStr) Then
queryNum = CInt(qNumStr)
Else
MsgBox("Could not extract query number from table")
End If
Dim idx As Integer = mQuantPeptQueryNumHash2(queryNum)
Return idx
End Function 'getPeptideTokenFromVisualIndex
'Changed PM_QUANTWINDOWS_SELECTION 2008-05-05. Disabled. No longer needed.
' Keep it for a while to clarify "can only do this once".
'
' '****************************************************************************
' '* <placeholder for header> *
' '****************************************************************************
' Private Sub cmdQuantProtein_Click( _
' ByVal sender As System.Object, ByVal anEvent As System.EventArgs) _
' Handles cmdQuantProtein.Click
'
' QuantifyProtein()
' Me.setQuantitationCommandsStatus(False) 'We can only do this once.
' End Sub 'cmdQuantProtein_Click
'Changed PM_QUANTWINDOWS_SELECTION 2008-05-05. Disabled. No longer needed.
' Keep it for a while to clarify "can only do this once".
'
' '****************************************************************************
' '* <placeholder for header> *
' '****************************************************************************
' Private Sub mnuQuantitateProtein_Click( _
' ByVal aSender As System.Object, _
' ByVal anEvent As System.EventArgs)
'
' QuantifyProtein()
' Me.setQuantitationCommandsStatus(False) 'We can only do this once.
' End Sub 'mnuQuantitateProtein_Click
'Changed PM_REFACTOR 2008-04-30
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub quantifyVisualSelection( _
ByRef anInVisualSelection As List(Of Integer))
lvPept.SelectedIndices.Clear() 'Needed as we depend
' on SelectedIndices(0) in a lot of places. We set
' a one item selection below, for each peptide...
' Note: the existing selecting is already saved, is the input parameter.
Dim quantifyInOrder As Boolean = True 'To be able to easily revert
' to the old way - to quickly reproduce the
' multiple Finnegan ASSERT bug...
mLogger.resetTimeLog()
Dim i As Integer
Dim len2 As Integer = anInVisualSelection.Count()
Dim lastIndex As Integer = len2 - 1
Dim peptideTokens2 As List(Of visibleAndPeptideTableIndexStruct) = _
New List(Of visibleAndPeptideTableIndexStruct)(len2)
If True Then 'Build visual indexes...
For i = 0 To lastIndex
Dim someItem As visibleAndPeptideTableIndexStruct
someItem.fileID = -1 'Not used for this purpose.
Dim visualIndex As Integer = anInVisualSelection(i)
Dim token As Integer = _
Me.getPeptideTokenFromVisualIndex(visualIndex)
someItem.visibleIndex = visualIndex
someItem.peptToken = token
peptideTokens2.Add(someItem)
Next
End If
Dim quantitationOrderIndexes(lastIndex) As _
visibleAndPeptideTableIndexStruct
quantApplication.findOrderByRawFile( _
peptideTokens2, mProt, quantitationOrderIndexes)
'Shared by both loops...
Dim pept As PeptideHitStructure = _
helper.blankPeptide() 'Keep compiler happy.
'Changed PM_ANALYSTSPECTRA_DECOUPLING 2005-03-06
'Dim timeSliceSecs As Double = 2.0
mChunkerAllPeptidesQuant.Init(0, lastIndex, False)
Dim peptideUpdateCount As Integer = 0
Dim allUpdateCount As Integer = 0
Dim doAllUpdates As Boolean = True 'So we get a xxx for the very first
' peptide.
While Not mChunkerAllPeptidesQuant.jobFinished() AndAlso _
Not mStopAquisition
'Possible bug: no immediate exit when, use of flag mStopAquisition.
While Not mChunkerAllPeptidesQuant.timeIsUp()
i = mChunkerAllPeptidesQuant.currentNumber()
'Make sure we get an update for the very last peptide..
Dim isLastpeptide As Boolean = i = lastIndex
If isLastpeptide Then
doAllUpdates = True
End If
Dim curIndexes As visibleAndPeptideTableIndexStruct = _
quantitationOrderIndexes(i)
Dim visibleIndex As Integer = curIndexes.visibleIndex
Dim peptideToken As Integer = curIndexes.peptToken
Me.setSelectedPeptide(visibleIndex, True, True)
'Application.DoEvents()
'Changed PM_REFACTOR 2006-03-15
'mCurrPepIdx = peptDataIdx 'Todo: don't rely on mCurrPepIdx
'pept = _
' ...(mProt2.pepts(peptDataIdx), _
' PeptideHitStructure)
mCurrPeptideToken = peptideToken
mProt.peptides.peptideByToken(peptideToken, pept)
mLogger.timeLog("**Before call of Fill_lvPept().")
Fill_lvPept(pept, peptideToken, doAllUpdates, isLastpeptide) 'Note: this call
' can take a long time, e.g. 20 seconds.
mLogger.timeLog("**After call of Fill_lvPept().")
peptideUpdateCount += 1
If doAllUpdates Then
allUpdateCount += 1 'Is true...
End If
'Changed PM_ANALYSTSPECTRA_DECOUPLING 2005-03-06
doAllUpdates = False
'Changed PM_REFACTOR 2006-03-15
'mProt2.pepts(peptDataIdx) = pept 'write-back
mProt.peptides.updatePeptideByToken(peptideToken, pept)
'Changed PM_BROKEN_EXPORT_IN_QUANTWINDOW 2003-05-09. Disabled
' as it could result useForQuantitation not being set to true.
' Instead we rely on an event being send that will result
' in lvPept_ItemCheck() being called. The write-back
' will happen there.
'mProt2.pepts(peptDataIdx) = thePept 'write-back
End While 'Time-is-up loop...
Application.DoEvents()
Dim rawFileStr As String = _
"Raw file: " & Path.GetFileName(pept.rawFileFullPath)
''Changed PM_SEVERALWIFFS 2003-08-27
''StatusBar12.Text = "Raw file tag: " & thePept.rawFileID
'StatusBar12.Text = rawFileStr
If True Then
Dim memDiffMB As Double
Dim tickTimeSecs As Double
quantApplication.GarbageCollect(mLogger, memDiffMB, tickTimeSecs)
'Changed PM_REFACTOR 2006-03-07
'StatusBar12.Text = rawFileStr & _
' ". GC time: " & tickTimeSecs.ToString("0.00") & _
' " secs, purged " & memDiffMB.ToString("0.00") & " MB."
Dim msg As String = rawFileStr & _
". GC time: " & tickTimeSecs.ToString("0.00") & _
" secs, purged " & memDiffMB.ToString("0.00") & " MB."
Me.updateStatusBar(msg)
End If
'Changed PM_REFACTOR 2008-04-30
ProgressBar1.Value = CInt(100 * (i + 1) / CDbl(len2))
doAllUpdates = True
End While
'Look at these:
' peptideUpdateCount
' allUpdateCount
If mStopAquisition Then
btnStopQuantitation.ForeColor = Color.DarkRed
mStopAquisition = False
End If
mLogger.timeLog("Start finish of quantifyVisualSelection().")
'Changed PM_REFACTOR 2005-12-05
'ProgressBar1.Value = 0
'CalculateProteinRatio()
'ColourPeptideItems()
''Changed PM_EXPORT_QUANTIFIED 2003-03-12
'mProt2.proteinHasBeenQuantified = True
''Changed PM_MANUAL_PEPTIDEQUANTSTATUSUPDATE 2003-05-0
''Write back protein
'mFrmProtVal.updateProtein(mProteinListIndex2, mProt2)
Me.proteinRatiosUpdate(True)
mLogger.timeLog("At the end of quantifyVisualSelection().")
mLogger.readOutTimeLog()
End Sub 'quantifyVisualSelection
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub QuantifyProtein()
'This is the old function where we quantify ***all*** peptides... It
' is called by external clients, e.g. when the user is quantifying
' from the Protein List window.
startMenuCommand() 'Note: this function is not really a menu
' command, but it correspond to the menu command for quantitation.
Dim len2 As Integer = lvPept.Items.Count
Dim visualSelection As List(Of Integer) = _
New List(Of Integer)(len2)
'Adapt to the new function where any subset can be quantified. We
'build a datastructure that points to all (visible) peptides...
If True Then
Dim i As Integer
Dim lastIndex As Integer = len2 - 1
If True Then 'Build visual indexes...
For i = 0 To lastIndex
visualSelection.Add(i)
Next
End If
End If
quantifyVisualSelection(visualSelection) 'Note: in this current
' function, QuantifyProtein(), the peptides are not actually
' all visibly selected - we only pretend...
stopMenuCommand("Quantitation (" & len2 & " peptides)")
End Sub 'QuantifyProtein()
'Changed PM_REFACTOR 2003-05-06
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub peptideUpdated(ByVal aPeptideToken As Integer, _
ByRef aPept As PeptideHitStructure)
'Will also update protein list back in the protein list window.
If True Then
'Changed PM_REFACTOR 2006-03-15
'mProt2.pepts(aPeptideIndex) = aPept 'write-back
mProt.peptides.updatePeptideByToken(aPeptideToken, aPept)
'Changed PM_REFACTOR 2005-12-05
'CalculateProteinRatio()
'ColourPeptideItems()
''Write back protein
'mFrmProtVal.updateProtein(mProteinListIndex2, mProt2)
Me.proteinRatiosUpdate(False)
End If
End Sub 'peptideUpdated()
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub spectrumListUpdateCheckedStatusFromDataStructure( _
ByRef aPept As PeptideHitStructure)
Dim len As Integer = aPept.spectra.Count
'Loop:
Dim lastIndex As Integer = len - 1
Dim i As Integer
For i = 0 To lastIndex
Dim dval As Boolean = aPept.spectra(i).useForQuant_WT
lvSpectra.Items(i).Checked = dval 'Will this fire an event??
Next
End Sub 'spectrumListUpdateCheckedStatusFromDataStructure
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub lvPept_ItemCheck(ByVal sender As Object, _
ByVal anEvent As System.Windows.Forms.ItemCheckEventArgs) _
Handles lvPept.ItemCheck
'Changed PM_DEBUG_EVENTCOUNTS 2003-08-12
mTempPeptideItemClickedCount += 1
'Changed PM_TRIPLEDISPLAY_PERFORMANCETROUBLE 2003-06-19. Temp fix,
' avoid a cascade of unnecessary events.
If Not mPeptide_AvoidListEvents1 Then
'Changed PM_DEBUG_EVENTCOUNTS 2003-08-12
mTempPeptideAcceptedItemClickedCount += 1
Dim newVal As Boolean = CBool(anEvent.NewValue)
Dim clickIndex As Integer = anEvent.Index
'Set the 'use for quantitation' and recalculate the ratio.
Dim peptToken As Integer = _
Me.getPeptideTokenFromVisualIndex(clickIndex)
'This block is disabled because of this problem:
' Double-clicking should quantifify a peptide or display
' it (the list of spectra, LC peak, etc.) if already quantified.
' But double-clicking is also seen as a click on the check-box and
' thus this function is called. If we reset the included spectra
' for a quantitation then this information is lost.
'If False Then
' 'Note that this code block was not bug-free when it was disabled on 2003-05-08....
' Trace.Assert(False, "PIL ASSERT. Should never get here...")
' 'Changed PM_MANUAL_PEPTIDEQUANTSTATUSUPDATE 2003-05-06
' 'Note: this block must be first (before peptideUpdated(), etc.) because
' ' clearQuantitationStatusForSpecList() makes changes in mProt2.
' If newVal = False Then
' 'If thePept.useForQuantitation = False Then
' clearQuantitationStatusForSpecList(peptDataIdx)
' spectrumListUpdateCheckedStatusFromDataStructure( _
' ...(mProt2.pepts(peptDataIdx), PeptideHitStructure))
' lvSpectra.Refresh()
' End If
'End If
'This must come ***after*** clearQuantitationStatusForSpecList().
'Changed PM_REFACTOR 2006-03-15
'Dim pept As PeptideHitStructure = _
' ...(mProt2.pepts(peptDataIdx), _
' PeptideHitStructure)
Dim pept As PeptideHitStructure = _
helper.blankPeptide() 'Keep compiler happy.
mProt.peptides.peptideByToken(peptToken, pept)
pept.useForQuantitation = newVal
'Changed PM_MANUAL_PEPTIDEQUANTSTATUSUPDATE 2003-05-06
'Instead of the block above we reset the values that we don't
'want to get into.
If True Then
If newVal = False Then
resetQuantitationFields(pept)
End If
End If
mProt.proteinHasBeenQuantified = True
Me.peptideUpdated(peptToken, pept) 'Will also update protein list
' back in the protein list window.
'Changed PM_MANUAL_PEPTIDEQUANTSTATUSUPDATE 2003-05-06
'We need to refresh because when a peptide is unchecked some
'of the quantitation values that we display has been recomputed (reset).
Me.visualUpdatePeptideListFromFieldsInPeptideStructure( _
clickIndex, pept)
Else
Dim peter7 As Integer = 7 'Our flag indicated this event should
' not be handled.
End If
End Sub 'lvPept_ItemCheck()
'Changed PM_REFACTOR 2003-10-13
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub newPeptideToDisplayOrQuantify( _
ByVal aPeptToken As Integer, _
ByVal aVisualIndex As Integer)
mCurrPeptideToken = aPeptToken
'Changed PM_QUANTWINDOWS_SELECTION 2008-05-05. The existing selection
' must be cleared, otherwise we an ASSERT...
''Changed PM_NEXTQUANTPEPTIDE_TROUBLE 2005-02-04. Now factored out....
''mCurrVisualPepIndex = anVisualIndex
'Me.setSelectedPeptide(aVisualIndex, True, False)
Me.setSelectedPeptide(aVisualIndex, True, True)
Dim pept As PeptideHitStructure = _
helper.blankPeptide() 'Keep compiler happy.
mProt.peptides.peptideByToken(aPeptToken, pept)
'Changed PM_XY_EXPORT 2005-01-11
mLastPeptHit = pept
Fill_lvPept(pept, aPeptToken, True, True)
mProt.peptides.updatePeptideByToken(aPeptToken, pept)
'Changed PM_STRING_CLEANUP 2004-12-14
'Changed PM_MSQA 2003-04-02
lblExtraPeptideInfo.Text = _
PILInputOutput.emptyForNothing(pept.badPeakReason)
'Changed PM_NEXTQUANTPEPTIDE_TROUBLE 2005-02-04. This is the actual
' fix. Changing the selection happend too late. This now happens in
' the beginning of this function, in setSelectedPeptide().
''Extra: select the peptide...
'lvPept2.Focus()
'lvPept2.Items(anVisualIndex).Selected = True
'lvPept2.EnsureVisible(anVisualIndex)
mLogger.timeLog( _
"Call of DrawLCPeak() from newPeptideToDisplayOrQuantify().")
DrawLCPeakEtc(pept)
End Sub 'newPeptideToDisplayOrQuantify
'Changed PM_REFACTOR 2007-08-31
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub displayOrQuantifySelectedPeptide()
Dim visualIndex As Integer = lvPept.SelectedIndices.Item(0)
Dim peptToken As Integer = Me.getPeptideTokenFromVisualIndex(visualIndex)
newPeptideToDisplayOrQuantify(peptToken, visualIndex)
End Sub 'displayOrQuantifySelectedPeptide
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub lvPept_DoubleClick(ByVal sender As Object, _
ByVal anEvent As System.EventArgs) _
Handles lvPept.DoubleClick
displayOrQuantifySelectedPeptide()
End Sub 'lvPept_DoubleClick()
'Changed PM_RETURN_KEY_OPEN_QUANTPETIDE 2007-08-31
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub lvPept_KeyDown( _
ByVal aSender As Object, _
ByVal anEvent As System.Windows.Forms.KeyEventArgs) _
Handles lvPept.KeyDown
'Note: this observing of key down is not strictly necessary, but
' is to prevent problems later with an OpenFile
' dialog (for some reason we can get the key up event from
' dismissal of the file dialog with Enter/Return).
mKeyObserver_PeptideList.keyDown(anEvent.KeyCode)
End Sub 'lvPept_KeyDown
'Changed PM_RETURN_KEY_OPEN_QUANTPETIDE 2007-08-31
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub lvPept_KeyUp( _
ByVal aSender As Object, _
ByVal anEvent As System.Windows.Forms.KeyEventArgs) _
Handles lvPept.KeyUp
If mKeyObserver_PeptideList.keyUp(anEvent.KeyCode) Then
displayOrQuantifySelectedPeptide()
End If
End Sub 'lvPept_KeyUp
'Wrapper for getting only centroid of peak and relieving the
'client of getting the data, etc.
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub FindMSpeak( _
ByVal aRawFileRef As Integer, _
ByVal aStartMass As Double, ByVal anEndMass As Double, _
ByRef anOutCentroidMass As Double, ByRef anOutCentroidIntensity As Double, _
ByRef anOutNotEnoughDataPoints As Boolean _
)
'Changed PM_SEVERALWIFFS 2003-08-26
Trace.Assert(aRawFileRef > 0, _
"PIL ASSERT. Bad raw file ID, " & aRawFileRef & ".")
'Changed PM_REFACTOR 2006-10-12
'Dim MSSignal As ArrayList = Nothing 'Keep compiler happy.
Dim MSSignal As _
List(Of massSpectrometryBase.signalStructure) = _
Nothing 'Keep compiler happy.
GetMSDataPointsInRange( _
aRawFileRef, aStartMass, anEndMass, _
MSSignal, anOutNotEnoughDataPoints)
'Test only!
mMSSignal = MSSignal
If Not anOutNotEnoughDataPoints Then
'For MS signals we certainly expect to find peaks over more
'than a few datapoints.
Trace.Assert(MSSignal.Count > 2, _
"PIL ASSERT: theMSSignal.Count>2. In FindMSpeak()")
Dim outMSMaxIndex As Integer
'Dim outMSpeakMassCentroid As Double
'Dim outMSpeakIntensity As Double
Dim outMSPeakIndexStart As Integer
Dim outMSPeakIndexEnd As Integer
Dim outMSpeakWindowStart As Integer
Dim outMSpeakWindowEnd As Integer
Dim outMSMaxMass As Double
Dim outMSMaxIntensity As Double
Dim dummy1 As Double
BSignal.findSignalPeak( _
MSSignal, 0, MSSignal.Count - 1, _
99.9, 199.9, _
anOutCentroidMass, anOutCentroidIntensity, _
outMSPeakIndexStart, outMSPeakIndexEnd, _
outMSpeakWindowStart, outMSpeakWindowEnd, _
outMSMaxMass, outMSMaxIntensity, outMSMaxIndex, dummy1)
Else
'Out of spectrum
Dim peter9 As Integer = 9
End If
End Sub 'FindMSpeak()
'Changed PM_REFACTOR 2003-04-11
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub MSQA( _
ByVal anInMaxCycle As Integer, _
ByRef anOutPept As PeptideHitStructure)
'Reality check in the MS spectrum
'Do the checking on the spectrum related to the highest LC peak.
'Note: in the LC peak we use the neutral peptide mass whereas
'we need to look in the raw MS data, close to the mass-to-charge place.
'Dim MCR
Dim goodPeak As Boolean = True
'Changed PM_EXPORTQUANTIFIED_ASSERT 2003-09-29
Dim badReason As String = vbTab 'Because an error string contains a TAB and
' that columns must align in the Save/Export, in NakedPeptideTable(), QuantWindow.vb.
Trace.Assert(anInMaxCycle > 0, "PIL ASSERT: theMaxCycle > 0")
'Changed PM_REFACTOR 2003-04-01
Dim maxYinDisplayedSpectrum As Double
SetAndDisplaySpectrum(anInMaxCycle, maxYinDisplayedSpectrum)
'To do here:
' 1. find MS peaks around the MZ, taking into account charge
' 2. Find charge. For external quantitation the actual charge may
' not match the expected because of the wrong LC peak, etc.
' 3. Exact MS filter, e.g. within 20 ppm.
' 4. something else
Dim massToUse As Double = anOutPept.measuredMCR
'How about this instead:
' Dim theLowerMZ, theHigherMZ As Double
' GetLowerAndHigherMZ(theLowerMZ, theHigherMZ) 'PM: perhaps do recalibration
'dim rel
Dim lowestChargeState As Integer = 2 '2: Don't look at single charged.
Dim highestChargeState As Integer = 5 '2: Don't look at single charged.
Dim windowSize As Double = 1.0 / lowestChargeState
Dim windowMargin As Double = 1.0 / (highestChargeState + 1) '+1 is to
' actually get the peak for the highest specified charge state, not
' just half of that peak....
Dim massWidth As Double = 0.15
Dim massHalfWidth As Double = 0.5 * massWidth
Dim specfiedCenterMass As Double = massToUse + 0.0 'Other offsets can be for isotopes....
Dim specfiedStartMass As Double = specfiedCenterMass - massHalfWidth
Dim specfiedEndMass As Double = specfiedCenterMass + massHalfWidth
Dim outSpecifiedCentroidMass As Double
Dim outSpecifiedCentroidIntensity As Double
Dim outNotEnoughDataPointsMainPeak As Boolean
'Nominal
FindMSpeak(anOutPept.rawFileID, specfiedStartMass, specfiedEndMass, _
outSpecifiedCentroidMass, outSpecifiedCentroidIntensity, _
outNotEnoughDataPointsMainPeak)
'Changed PM_FINNEGAN_PPM_ERROR 2003-10-24
Dim bestCentroidedWildTypeMass As Double = outSpecifiedCentroidMass 'Supposes
' this function is called with .LCMaxCycle....
'Is bestCentroidedWildTypeMass calibrated or not ????????????????????????????????????????
anOutPept.uncalibratedMSCentroidMass = bestCentroidedWildTypeMass
'Changed PM_PERFILE_RECALIBRATION 2007-11-16
Dim tag As Integer = anOutPept.rawFileID
'Changed PM_REFACTOR 2007-10-30
''Changed PM_FINNEGAN_PPM_ERROR 2003-10-29
'anOutPept.calibratedMSCentroidMass = _
' mA + mB * bestCentroidedWildTypeMass
anOutPept.calibratedMSCentroidMass = _
mRecalibrator.uncalib2calib(bestCentroidedWildTypeMass, tag)
' Note: this is per file. Currently no way to use
' the value for all if there is not enough
' data points for recalibration for one or
' more raw files.
'If there is no peak then there is no point in continuing. Should we
'flag "no peak"??
Dim skipPeakDetections As Boolean = outNotEnoughDataPointsMainPeak
Dim outLeftWindowCentroidMass As Double
Dim outLeftWindowCentroidIntensity As Double
Dim outNotEnoughDataPointsLeftPeak As Boolean
If Not skipPeakDetections Then
'Use the centroid value in the following. This eliminates any dependence on
'correct calibration.
'Dim leftWindowEndMass As Double = specfiedStartMass
Dim leftWindowEndMass As Double = outSpecifiedCentroidMass - windowMargin
Dim leftWindowStartMass As Double = leftWindowEndMass - windowSize
'To the left
FindMSpeak(anOutPept.rawFileID, leftWindowStartMass, leftWindowEndMass, _
outLeftWindowCentroidMass, outLeftWindowCentroidIntensity, _
outNotEnoughDataPointsLeftPeak)
Else
Dim peter11 As Integer = 11
End If
If Not skipPeakDetections And Not outNotEnoughDataPointsLeftPeak Then
'May be very high if there is only noise to the left.
'Note: CInt is only used for the type conversion.
Dim leftWindowPossibleChargeState As Integer = _
CInt(Int(1.0 / _
(outSpecifiedCentroidMass - outLeftWindowCentroidMass) _
+ 0.5))
'Check 1: don't allow a higher peak to the left. In most
' cases it is because our peak is a C13 peak.
If outLeftWindowCentroidIntensity > outSpecifiedCentroidIntensity Then
goodPeak = False
badReason = "Higher peak to the left (C13?). Possible charge state: " & _
vbTab & leftWindowPossibleChargeState
End If
Else
Dim peter2 As Integer = 2
End If
Dim outRightWindowCentroidMass As Double
Dim outRightWindowCentroidIntensity As Double
'Note: even if the mass range to the left was empty we
' continue with the right peak.
Dim outNotEnoughDataPointsRightPeak As Boolean
If Not skipPeakDetections And goodPeak Then
'Check 2: correct peak higher of peak to the right.
'Dim rightWindowStartMass As Double = specfiedEndMass
Dim rightWindowStartMass As Double = outSpecifiedCentroidMass + windowMargin
Dim rightWindowEndMass As Double = rightWindowStartMass + windowSize
If anOutPept.rawFileID = 809 AndAlso anOutPept.AASequence = "GGVQNFNK" Then
Dim peter87 As Integer = 87
End If
'To the right
FindMSpeak(anOutPept.rawFileID, rightWindowStartMass, rightWindowEndMass, _
outRightWindowCentroidMass, outRightWindowCentroidIntensity, _
outNotEnoughDataPointsRightPeak)
'To implement: Check 2 check... (height of isotope as compared to nominal)
If Not outNotEnoughDataPointsRightPeak Then
'Check 3: charge state detected from the mass of the
'right peak must fit with the expected.
'Changed PM_MSQA_ARITOVERFLOW 2003-10-02
Dim diff1 As Double = _
outRightWindowCentroidMass - outSpecifiedCentroidMass
If diff1 > 0.001 Then
Else
'This happen when there are no or very few datapoints.
diff1 = 26000.0 'To let deciCharge be zero (when rounded)
'Note: this can no longer happen after the fix
' in returnDataPoints()/AnalystRawDataFileHandling.vb.
Trace.Assert(False, _
"PIL ASSERT. outRightWindowCentroidMass - outSpecifiedCentroidMass is zero. In MSQA().")
End If
'Note: CInt is only used for the type conversion.
Dim deciCharge As Double = 1.0 / diff1
'Depending on the mass accuracy we may have strict rules for
'how closely the charge computed from the mass diffence should be
'close to an integer.
'Two times int????
Dim rightWindowPossibleChargeState As Integer = _
CInt(Int(deciCharge + 0.5))
Dim chargeDiffToInt As Double = _
Math.Abs(rightWindowPossibleChargeState - deciCharge)
If rightWindowPossibleChargeState <> anOutPept.charge Then
goodPeak = False
'There is trouble in the export file with a variable
'number of tabs, for this message there were 4 tabs.
'Idea: use another delimiter within the bad peak text.
badReason = "Charge state is not the expected. Detected: " & _
vbTab & rightWindowPossibleChargeState & _
". Expected: " & " " & anOutPept.charge & " " & _
" Deci charge: " & " " & deciCharge.ToString("0.00")
'Old:
' vbTab & _
' ". Expected: " & vbTab & anOutPept.charge & vbTab & _
' " Deci charge: " & vbTab & deciCharge
End If
End If
End If
anOutPept.goodMSpeak = goodPeak
anOutPept.badPeakReason = badReason
End Sub 'MSQA()
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub CalculateProteinRatio(ByVal aDishes As Integer)
'Changed PM_CLICKOFF_QUANTPEPTIDE_BUG 2007-04-13
mCalcProteinRatioCount += 1 'For diagnostics.
lblExtraPeptideInfo.Text = _
"Protein ratio calc count: " & mCalcProteinRatioCount.ToString()
Dim lastArrIndex As Integer = 100
' 100 for now. Should we have two loops just to determine the number?
' We could also get the number from the parsing. Do we already
' have it?
Dim sumRatioArr(lastArrIndex) As Double
Dim sumRatioSquareArr(lastArrIndex) As Double
Dim nArr(lastArrIndex) As Integer
Dim fileIDloopArr(1) As Integer '2 element array to make sure we
' also compute the values for the whole protein.
fileIDloopArr(0) = MultipleRawFilesHandling.REF_WHOLEPROTEIN
Dim pept As PeptideHitStructure = _
helper.blankPeptide() 'Keep compiler happy.
Dim mapper2 As Dictionary(Of Integer, Integer) = Nothing
'We have two nested loops. Outer is through dishes.
'Inner is through the peptides. Would it be better
'the other way around (only going through the peptide
'once) ?
'Changed PM_REFACTOR 2006-10-17. Moved up here. Otherwise we would
' keep adding to list, e.g. size 3, 6, 9, 12, ....
'
'This will replace existing... Could we avoid this if there is
'no change, etc.
mProt.quantResults3 = New List(Of oneDishResultStructure)
Dim lastIndex3 As Integer = aDishes - 1
Dim dish As Integer
For dish = 0 To lastIndex3
'Later: leave out the trivial case (base / base = 1.0, std = 0.0)
'Must be reset for every dish in order to reset the sum counters (below).
mapper2 = New Dictionary(Of Integer, Integer)
'Changed PM_REFACTOR 2006-10-10
Dim oneDishResult As oneDishResultStructure
oneDishResult.n = 0
oneDishResult.quantRes2 = Nothing
Dim proteinQuantValuesForOneDish As protSILACresultStructure
proteinQuantValuesForOneDish.averageRatioToBase = -14.0
proteinQuantValuesForOneDish.stdDevAverageRatioToBase = -27.0
proteinQuantValuesForOneDish.inv_averageRatioToBase = 0.0
proteinQuantValuesForOneDish.inv_stdDevAverageRatioToBase = 0.0
Dim builtMapperIndex As Integer = 0
Dim pepIter As peptideListIterator = _
New peptideListIterator(mProt.peptides)
While Not pepIter.nextPeptide(pept)
'Note: could be put into single boolean expression but
'we want to have breakpoints.
'Exclude peptide if quantitation result was not good
'enough or the user unclicked it.
Dim useIt As Boolean = False
If pept.useForQuantitation Then
useIt = True
Else
Dim peter1 As Integer = 1
End If
'Exclude peptide if it has not been quantified.
If useIt Then
If pept.LCprofilesProperties Is Nothing Then
useIt = False
Else
Dim peter2 As Integer = 2
End If
End If
If useIt Then
Dim LCprofilesProps As LCprofilesPropertiesStructure = _
pept.LCprofilesProperties(dish)
Dim ratio3 As Double = LCprofilesProps.ratioOfXICs
Dim ratioSquare3 As Double = ratio3 * ratio3
'Changed PM_PROTEINRATIO_FOR_EACH_RAWFILE 2006-02-27
Dim fileID7 As Integer = pept.rawFileID
fileIDloopArr(1) = fileID7 'This second element is
' for the current raw file (for the current peptide).
Dim lastIndex2 As Integer = fileIDloopArr.Length() - 1
Dim j As Integer
For j = 0 To lastIndex2 '2 iterations: one for
' the protein values and one for the raw file
' for the current peptide.
Dim fileID2 As Integer = fileIDloopArr(j)
Dim mapIndex As Integer = builtMapperIndex
Dim someValue As Integer
If mapper2.TryGetValue(fileID2, someValue) Then
mapIndex = someValue
Else
sumRatioArr(mapIndex) = 0.0
sumRatioSquareArr(mapIndex) = 0.0
nArr(mapIndex) = 0
mapper2.Add(fileID2, builtMapperIndex)
builtMapperIndex += 1
End If
sumRatioArr(mapIndex) += ratio3
sumRatioSquareArr(mapIndex) += ratioSquare3
nArr(mapIndex) += 1
Next j
End If
End While 'Through peptides.
Dim hashEnumerator2 As _
Dictionary(Of Integer, Integer).Enumerator = _
mapper2.GetEnumerator()
While (hashEnumerator2.MoveNext())
Dim fileID3 As Integer = hashEnumerator2.Current.Key
Dim index3 As Integer = hashEnumerator2.Current.Value
Dim sumRatio As Double = sumRatioArr(index3)
Dim sumRatioSquare As Double = sumRatioSquareArr(index3)
Dim n As Integer = nArr(index3)
Dim aveRatio As Double = sumRatio / n
Dim stDev As Double = 0.0
If n > 1 Then
stDev = _
Math.Sqrt((n * sumRatioSquare - sumRatio * sumRatio) / _
(n * (n - 1)))
Else
stDev = 0
End If
Dim invRatio As Double = 1 / aveRatio
'ToDo: make this correct
Dim invRatioStDev As Double
If n > 1 Then
invRatioStDev = _
0.5 * ((1 / (aveRatio - stDev) - invRatio) - _
(1 / (aveRatio + stDev) - invRatio))
End If
Dim someQuantValues2 As protSILACresultStructure
someQuantValues2.averageRatioToBase = aveRatio
someQuantValues2.stdDevAverageRatioToBase = stDev
someQuantValues2.inv_averageRatioToBase = invRatio
someQuantValues2.inv_stdDevAverageRatioToBase = invRatioStDev
'Lazy instantiation
If oneDishResult.quantRes2 Is Nothing Then
oneDishResult.quantRes2 = _
New Dictionary(Of Integer, protSILACresultStructure)
oneDishResult.n = n 'We only need to do this once.
End If
MSQuantCommon.updateProteinQuantValues2( _
fileID3, oneDishResult.quantRes2, someQuantValues2)
End While 'Through the raw files.
mProt.quantResults3.Add(oneDishResult)
Dim qCount As Integer = mProt.quantResults3.Count
Trace.Assert( _
qCount < 25, _
"PIL ASSERT. " & qCount & _
"is probably too many SILAC dishes") 'For now, for error detection.
If qCount > 3 Then
Dim peter3 As Integer = 3
End If
Next dish
Dim quantValuesForWholeProtein2 As oneDishResultStructure
quantValuesForWholeProtein2.quantRes2 = Nothing
If Not mapper2 Is Nothing Then
Dim lastIndex2 As Integer = mProt.quantResults3.Count - 1
Dim qCount As Integer = lastIndex2 + 1
Trace.Assert( _
qCount < 25, _
"PIL ASSERT. " & qCount & _
"is probably too many SILAC dishes") 'For now, for error detection.
If qCount > 3 Then
Dim peter3 As Integer = 3
End If
'Why do we need this loop?? A check for number of dishes and an
'assignment should be enough.
Dim j As Integer
For j = 0 To lastIndex2
'This is because we are only showing the result for the
'second SILAC dish (isotope). Results for higher dishes
'are not displayed.
If j = 1 Then 'Assuming 0 for the trivial (wild/wild)
quantValuesForWholeProtein2 = mProt.quantResults3(j)
End If
Next j
End If
Dim count As Integer = 0
Dim invRatioWT2 As Double = 0.0
Dim invRatioStDevWT2 As Double = 0.0
If Not quantValuesForWholeProtein2.quantRes2 Is Nothing Then
Dim forWholeProtein As protSILACresultStructure = _
quantValuesForWholeProtein2.quantRes2( _
MultipleRawFilesHandling.REF_WHOLEPROTEIN)
mCurrProtRatio = forWholeProtein.averageRatioToBase
mCurrProtRatioStDev = forWholeProtein.stdDevAverageRatioToBase
invRatioWT2 = forWholeProtein.inv_averageRatioToBase
invRatioStDevWT2 = forWholeProtein.inv_stdDevAverageRatioToBase
count = quantValuesForWholeProtein2.n
Else
mCurrProtRatio = 0.0
mCurrProtRatioStDev = 0.0
End If
If aDishes > 1 Then '1: assuming dish 1 is counted.
'This block should be converted to handle any number of SILAC dishes.
'mCurrProtRatio is computed just above. Is also used
'in ColourPeptideItems().
'Changed PM_MEMORY_EFFICIENCY 2007-04-16
Dim prSB As StringBuilder = New StringBuilder(20)
' txtProteinRatio.Text = mCurrProtRatio.ToString("0.00")
' If count > 1 Then
' txtProteinRatio.Text &= " +- " & mCurrProtRatioStDev.ToString("0.00")
' End If
'
' txtProteinRatio.Text &= "; inv ratio: " & invRatioWT2.ToString("0.00")
' If count > 1 Then
' txtProteinRatio.Text &= " +- " & invRatioStDevWT2.ToString("0.00")
' End If
' txtProteinRatio.Refresh()
prSB.Append(mCurrProtRatio.ToString("0.00"))
If count > 1 Then
prSB.Append(" +- ")
prSB.Append(mCurrProtRatioStDev.ToString("0.00"))
End If
prSB.Append("; inv ratio: ")
prSB.Append(invRatioWT2.ToString("0.00"))
If count > 1 Then
prSB.Append(" +- ")
prSB.Append(invRatioStDevWT2.ToString("0.00"))
End If
txtProteinRatio.Text = prSB.ToString()
End If
End Sub 'CalculateProteinRatio()
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub ColourPeptideItems()
'Colour the lines depending on (a) stDev and (b) difference from mean.
Const MIN_PEPT_ST_DEV As Double = 0.2 'Relative standard deviation of
' one peptide.
Const MIN_PEPT_DEV_FROM_MEAN As Double = 0.25 'Relative st. dev. peptide
' from protein mean.
Dim pept As PeptideHitStructure = helper.blankPeptide() 'Keep
' compiler happy.
Dim len As Integer = lvPept.Items.Count
Dim lastIndex As Integer = len - 1
Dim i As Integer
For i = 0 To lastIndex
'Changed PM_REFACTOR 2006-03-16
Dim peptToken As Integer = _
Me.getPeptideTokenFromVisualIndex(i)
mProt.peptides.peptideByToken(peptToken, pept)
'Changed PM_TRIPLEDISPLAY_PERFORMANCETROUBLE 2003-06-19
Dim savedAvoid1 As Boolean = mPeptide_AvoidListEvents1
mPeptide_AvoidListEvents1 = True
'Changed PM_EVENTTROUBLE 2003-08-13
'PeptideListItemForeColor(lvPept2.Items(i), quantPeptTbItmColEnum2.eIntensityRatioStDev, wrstdColour)
Dim row As ListViewItem = lvPept.Items(i)
Dim lastIndex2 As Integer = -1
If Not pept.LCprofilesProperties Is Nothing Then
lastIndex2 = pept.LCprofilesProperties.Count - 1
Else
Dim peter2 As Integer = 2 'It is Nothing!
End If
Dim dish As Integer
For dish = 0 To lastIndex2
Dim someItem As LCprofilesPropertiesStructure = _
pept.LCprofilesProperties(dish)
Dim relativeError As Double = _
someItem.ratioStDev / someItem.averageOfRatios2
Dim ratioDeviation As Double = _
someItem.averageOfRatios2 - mCurrProtRatio
'Note: these are different quantities,
' average of rations and ratio of intensities .... !!!!!!!!!!!
Dim relativeRatioDeviation As Double = ratioDeviation / mCurrProtRatio
Dim wrStdColour2 As Color = Color.Black
If relativeError > MIN_PEPT_ST_DEV Then
wrStdColour2 = Color.Red
End If
Dim wiColour2 As Color = Color.Black
If Math.Abs(relativeRatioDeviation) > MIN_PEPT_DEV_FROM_MEAN Then
wiColour2 = Color.Red
End If
If True Then 'GUI
Dim key1 As Integer = _
quantPeptTbItmColEnum2.enumRatioStdDevBaseNumber2 + dish
mPeptColumnMapper.listItemForeColour(row, key1, wrStdColour2)
Dim key2 As Integer = _
quantPeptTbItmColEnum2.enumRatioBaseNumber2 + dish
'Changed PM_EVENTTROUBLE 2003-08-13
'PeptideListItemForeColor(lvPept2.Items(i), quantPeptTbItmColEnum2.eIntensityRatio, wiColour)
mPeptColumnMapper.listItemForeColour( _
row, key2, wiColour2)
End If 'GUI
Next dish
'Changed PM_EVENTTROUBLE 2003-08-13
'lvPept2.Items(i).UseItemStyleForSubItems = False
row.UseItemStyleForSubItems = False
'Changed PM_TRIPLEDISPLAY_PERFORMANCETROUBLE 2003-06-19
mPeptide_AvoidListEvents1 = savedAvoid1
Next i
lvPept.Refresh()
End Sub 'ColourPeptideItems
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub FromSaved_FillOutlvSpetra( _
ByVal anIndex As Integer, _
ByRef aPept As PeptideHitStructure)
'ByRef aMS_Lst As ArrayList)
'aCycle is the real cycle minus the first cycle in the list, so
'we can use it as an index.
Dim specQuant As SpecQuantStructure = aPept.spectra(anIndex)
'Changed PM_SLOW_QUANTWINDOW 2006-11-20
Dim savedAvoid2 As Boolean = mSpectrum_AvoidListEvents2
mSpectrum_AvoidListEvents2 = True
'Changed PM_REFACTOR 2006-04-05. Note: is not identical to the below, but
' at least it is now the same.
addVisual_SpectrumLine(specQuant)
'Changed PM_SLOW_QUANTWINDOW 2006-11-20
mSpectrum_AvoidListEvents2 = savedAvoid2
End Sub 'FromSaved_FillOutlvSpetra()
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub newMassMarker( _
ByVal anMCR As Double, _
ByVal aDescr As String, ByVal anID As Integer, _
ByVal aIsC12 As Boolean)
Dim newMarker As markerStructure
newMarker.MCR = anMCR
'Changed PM_REFACTOR 2005-01-26
'newMarker.Yion = False
'newMarker.Bion = True
newMarker.ionType3 = ionTypeEnum.enumBion2 'It would be better with
' just a colour specification. It is misleading with b-ion - we
' are marking peaks in a MS spectrum...
newMarker.labelDescription = aDescr
newMarker.charge = 1
newMarker.tag = anID.ToString
'Changed PM_QUANT_CHARGE_DISPLAY 2005-03-14
Dim overrideColour As Color = Color.Empty
If aIsC12 Then
overrideColour = Color.Green
End If
'Changed PM_VS2005_SERIOUS 2006-06-15
newMarker.moreDescription = ""
'Changed PM_XY_EXPORT 2005-01-10
'mSpectrumDialog.addMarker(Me, mFarOff, newMarker, yLevelForMarkers.Height)
'If Not aIsC12 Then
' mSpectrumDialog.highLightMarker(Me, anID)
'End If
mMSdisplay.addMarker2( _
newMarker, MASSMARKERSIZE, Not aIsC12, _
overrideColour, labelDirectionEnum.enumLineDown, 0, 0)
End Sub 'newMassMarker
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub newMassMarker_low( _
ByVal anMCR As Double, _
ByRef anInDescr As String, _
ByVal anID As Integer)
If True Then
Dim newMarker As markerStructure
newMarker.MCR = anMCR
newMarker.ionType3 = ionTypeEnum.enumYion2 'It would be better with
' just a colour specification. It is misleading with b-ion - we
' are marking peaks in a MS spectrum...
newMarker.labelDescription = anInDescr
newMarker.charge = 1
newMarker.tag = anID.ToString
'Changed PM_VS2005_SERIOUS 2006-06-15
newMarker.moreDescription = ""
mMSdisplay.addMarker2( _
newMarker, MASSMARKERSIZE, False, _
Color.Empty, _
labelDirectionEnum.enumLineDown, 0, 0)
End If
End Sub 'newMassMarker_low
'Changed PM_ISOTOPEDISTRIBUTION_PLOT 2008-01-31
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub newVerticalMarker( _
ByVal anMCR As Double, _
ByVal aYpixelOffset As Integer, _
ByVal aDescr As String, ByVal anID As Integer)
'Name of this function: shouldn't it be newHorizontalMarker() ?????
'Perhaps: .
Dim newMarker As markerStructure
newMarker.MCR = anMCR
'Changed PM_REFACTOR 2005-01-26
'newMarker.Yion = False
'newMarker.Bion = True
newMarker.ionType3 = ionTypeEnum.enumBion2 'It would be better with
' just a colour specification. It is misleading with b-ion - we
' are marking a mass in a MS spectrum (for a mass range) ...
newMarker.labelDescription = aDescr
newMarker.charge = 1
newMarker.tag = anID.ToString
'Changed PM_QUANT_CHARGE_DISPLAY 2005-03-14
Dim overrideColour As Color = Color.Empty
'Changed PM_VS2005_SERIOUS 2006-06-15
newMarker.moreDescription = ""
'Changed PM_XY_EXPORT 2005-01-10
'mSpectrumDialog.addMarker(Me, mFarOff, newMarker, yLevelForMarkers.Height)
'If Not aIsC12 Then
' mSpectrumDialog.highLightMarker(Me, anID)
'End If
mMSdisplay.addMarker2( _
newMarker, 12, False, _
overrideColour, labelDirectionEnum.enumLineRight, aYpixelOffset, 0)
End Sub 'newVerticalMarker
'Changed PM_REFACTOR 2003-04-08
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub addQuantMarkers( _
ByVal aCharge As Integer, _
ByVal aDeltaMass As Double, _
ByRef anInUncalibratedSILACmasses2 As List(Of Double), _
ByVal aQuantMCROffSet As Double, _
ByVal aDishInfo As List(Of shortFormSILACinfoStructure), _
ByVal aMaxYinDisplayedSpectrum2 As Double, _
ByRef aPeptideSequence As String _
)
'Dim charge As Integer
'Changed PM_REFACTOR 2006-10-03
''Add red arrows, ToDo: do this at the right mass over the LC peak
'Dim lowerMZuncalibrated As Double
'Dim higherMZuncalibrated As Double
'
''Changed PM_TRIPLE_ENCODING 2003-04-08
'Dim evenHigherMZuncalibrated As Double
'FindLCpeaks.computeSILACmasses( _
' mProt2, mCurrPeptideToken, _
' mA, mB, _
' lowerMZuncalibrated, higherMZuncalibrated, evenHigherMZuncalibrated, _
' charge) 'PM: perhaps
'' do recalibration in reverse as we are going to set markers in
'' the original un-calibrated data? Yes, indeed.
'Changed PM_SAVE_MEMORY 2006-11-12. Moved...
'Dim quantWindowLeftText As String = "qwl"
'Dim quantWindowRightText As String = "qwr"
Dim diff1 As Double = MSconstants.C12_C13_DIFF / aCharge
Dim diff2 As Double = 2 * diff1
mMSdisplay.clearMarkers()
'Changed PM_REFACTOR 2006-10-03
' newMassMarker(higherMZuncalibrated, "high", 20, True)
' newMassMarker(higherMZuncalibrated + diff1, "+1", 21, False)
' newMassMarker(higherMZuncalibrated + diff2, "+2", 22, False)
'
' 'Changed PM_QUANTWINDOW_VISUALISATION 2005-02-02
' 'Indicate quant window:
' 'Note: we assume that we have fixed mass window. This may change
' ' for Finnigan and this knowlegde should be refactored out in
' ' a quantitation object.
' newMassMarker_low(higherMZuncalibrated - aDeltaMass, quantWindowLeftText, 119)
' newMassMarker_low(higherMZuncalibrated + aDeltaMass, quantWindowRightText, 121)
'
' If evenHigherMZuncalibrated > 0.0 Then
' newMassMarker(evenHigherMZuncalibrated, "higher", 30, True)
' newMassMarker(evenHigherMZuncalibrated + diff1, "+1", 31, False)
' newMassMarker(evenHigherMZuncalibrated + diff2, "+2", 32, False)
'
' 'Changed PM_QUANTWINDOW_VISUALISATION 2005-02-02
' newMassMarker_low(evenHigherMZuncalibrated - aDeltaMass, _
' quantWindowLeftText, 129)
' newMassMarker_low(evenHigherMZuncalibrated + aDeltaMass, _
' quantWindowRightText, 131)
' End If
'
' 'Placed wild last because then it will be displayed in
' 'case of quant mode is No Isotope.
' Dim wildStr As String = "wild" & mSpectrumDialog.chargeEncoding(charge)
' newMassMarker(lowerMZuncalibrated, wildStr, 10, True)
' newMassMarker(lowerMZuncalibrated + diff1, "+1", 11, False)
' newMassMarker(lowerMZuncalibrated + diff2, "+2", 12, False)
'
' 'Changed PM_QUANTWINDOW_VISUALISATION 2005-02-02
' newMassMarker_low( _
' lowerMZuncalibrated - aDeltaMass, quantWindowLeftText, 109)
' newMassMarker_low( _
' lowerMZuncalibrated + aDeltaMass, quantWindowRightText, 111)
''Changed PM_REFACTOR 2006-10-03
'Dim names As String() = _
' {"wild" & mSpectrumDialog.chargeEncoding(aCharge), _
' "high", _
' "higher"}
'Later: let the names ("wild", "high", "higher") be defined in
' quantiation modes file.
Dim ID As Integer = 1801
'Changed PM_REFACTOR 2006-10-05
'Dim uncalibratedSILACmasses As List(Of Double) = _
' mLastPeptHit.uncalibratedSILACmasses2
Dim uncalibratedSILACmasses As List(Of Double) = _
anInUncalibratedSILACmasses2
Dim iso As List(Of Double) = Nothing
'Changed PM_ISOTOPEDISTRIBUTION_PLOT 2008-01-30
If True Then
Dim somePeptide As PILpeptide = New PILpeptide(aPeptideSequence)
Dim carbons As Integer
Dim hydrogens As Integer
Dim nitrogens As Integer
Dim oxygens As Integer
Dim sulphors As Integer
Dim electrons As Integer
Dim phosphors As Integer
somePeptide.getResidueComposition( _
carbons, _
hydrogens, _
nitrogens, _
oxygens, _
sulphors, _
electrons, _
phosphors _
)
'For now: only use residue. Ignore water and charges
'(protons). Carbon dominates anyway, but there could
'be a difference for higher masses, especially for
'higher isotopes.
Dim iso2 As List(Of Double) = _
isotopeDistribution.findIsotopeDistribution( _
carbons, hydrogens, nitrogens, oxygens, sulphors)
'Normalise to the mono isotopic as we only have the
'signal height for mono isotopic peak (actually max
'in integration interval).
Dim mono As Double = iso2(0)
iso = New List(Of Double)
Dim someItem As Double
For Each someItem In iso2
Dim newValue As Double = someItem / mono
iso.Add(newValue)
Next 'Through checkBoxInfoList
End If
'Changed PM_AK_QUANT_CRASH 2008-03-05
Dim effectiveMaxYinDisplayedSpectrum As Double = aMaxYinDisplayedSpectrum2
If effectiveMaxYinDisplayedSpectrum = 0.0 Then 'Avoid infinity.
effectiveMaxYinDisplayedSpectrum = 10000000000.0 'To get markers
' on the x-axis.
Dim peter1 As Integer = 1
End If
Dim chargeStr As String = mMSdisplay.chargeEncoding(aCharge)
Dim lastIndex As Integer = uncalibratedSILACmasses.Count - 1
Dim j As Integer
For j = lastIndex To 0 Step -1
'Note to backwards for loop:
' Wild is plotted last because then it will be displayed in
' case of quant mode is No Isotope.
'Changed PM_ISOTOPEDISTRIBUTION_PLOT 2008-01-30
Dim someQuantResult As shortFormSILACinfoStructure = aDishInfo(j)
Dim maxYforIsotopeCluster As Double = someQuantResult.maxYmono
Trace.Assert(effectiveMaxYinDisplayedSpectrum <> 0, _
"PIL ASSERT. " & _
"effectiveMaxYinDisplayedSpectrum is zero. About to compute Infitity...")
Dim relativeMonoHeight As Double = _
maxYforIsotopeCluster / effectiveMaxYinDisplayedSpectrum
'We could cache these in an array as a class member, size
'according to quantmode.
'This would save on temporary strings.
Dim dishNumber As Integer = j + 1
Dim someName As String = "S" & dishNumber & chargeStr
'Changed PM_QUANT_AUTO_CENTERING 2006-11-13
Dim origUncalibratedMCR As Double = uncalibratedSILACmasses(j)
Dim trueUncalibratedMCR As Double = _
origUncalibratedMCR + aQuantMCROffSet
If True Then 'Theoretical isotope marking.
'Note: for now same pattern for all SILAC isotope cluster
' groups. The fewer variable carbons are not
' considered. And the SILAC isotope purity is
' not considered either.
Dim MCRiso As Double = trueUncalibratedMCR
Dim isoLen As Integer = 4
Dim lastIndex3 As Integer = isoLen - 1
Dim k As Integer
For k = 0 To lastIndex3 Step 1
Dim isotopeRel As Double = iso(k) 'Relative to mono.
Dim relativeHeightInSpectrum As Double = _
relativeMonoHeight * isotopeRel
Dim pixelHeight As Double = _
relativeHeightInSpectrum * 182
'Changed PM_AK_QUANT_CRASH 2008-03-05
Trace.Assert(relativeHeightInSpectrum >= 0.0, _
"PIL ASSERT. relativeHeightInSpectrum is negative.") 'This can
' happen if relativeHeightInSpectrum is minus infinity
' as a result of a division by zero...
'
' Error message for CInt() below will then be:
' "Arithmetic operation resulted in an overflow" ...
Dim pixelHeightInt As Integer = CInt(pixelHeight)
' Trace.Assert(False, _
' "Stop!", "PIL ASSERT. Internal/development assert for stopping execution......")
'No text label for now. Needed?
Dim iID As Integer = ID + 20 + k
Me.newVerticalMarker( _
MCRiso, pixelHeightInt, "", iID)
MCRiso += diff1
Next k
End If 'Block. Theoretical isotope marking.
If j = 0 Then
'newMassMarker( _
' origUncalibratedMass, someName & ",orig", ID, False)
newMassMarker_low( _
origUncalibratedMCR, someName & ",orig", ID + 12)
End If
newMassMarker(trueUncalibratedMCR, someName, ID, True)
newMassMarker(trueUncalibratedMCR + diff1, "+1", ID + 1, False)
newMassMarker(trueUncalibratedMCR + diff2, "+2", ID + 2, False)
newMassMarker(trueUncalibratedMCR - diff1, "-1", ID + 3, False)
'Changed PM_QUANT_ISOTOPES 2008-01-31. Now one interval for each peak quantified.
Dim centerUncalibMCR As Double = trueUncalibratedMCR
Dim quantIntervals As Integer = 1 + someQuantResult.isotopesQuantified
Dim lastIndex7 As Integer = quantIntervals - 1
Dim m As Integer
For m = 0 To lastIndex7
newMassMarker_low( _
centerUncalibMCR - aDeltaMass, QUANTWINDOWLEFTTEXT2, ID + 40 + m)
newMassMarker_low( _
centerUncalibMCR + aDeltaMass, QUANTWINDOWRIGHTTEXT2, ID + 61 + m)
centerUncalibMCR += diff1
Next m
ID += 59
Next j 'Through SILAC dishes.
End Sub 'addQuantMarkers()
'Changed PM_REFACTOR 2006-04-05
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub findQuantProperties( _
ByRef anInLCpeakProfiles As _
List(Of _
List(Of massSpectrometryBase.signalStructure)), _
ByVal aSpectrumIndex As Integer, _
ByRef anOutAllGood As Boolean, _
ByRef anOutAllBad As Boolean _
)
'Old:
' ByRef aInQuantModesObject As QuantitationModes_moreGeneral, _
' ByVal aLowerQuantIntensity As Double, _
' ByVal aHigherQuantIntensity As Double, _
' ByVal aEvenHigherQuantIntensity As Double, _
'Changed PM_REFACTOR 2006-10-06
' Dim curQuantMode As _
' generalisedQuantModeStructure = _
' aInQuantModesObject.getQuantitationMode( _
' mOptions.quantModeCode)
'
' Dim noQuantMode As Boolean = aInQuantModesObject.isNoQuantitationMode( _
' mOptions.quantModeCode)
'
' Dim tripleQuantMode As Boolean = _
' QuantitationModes_moreGeneral.isTripleQuant_new(curQuantMode)
'
' Dim doubleQuantMode As Boolean = Not noQuantMode And Not tripleQuantMode
' Dim DoubleOrLessQuantMode As Boolean = Not tripleQuantMode
'
' 'Changed PM_COUNTRULE_FOR_ALL_ISOTOPES 2003-06-26
' Dim goodLowerQuant As Boolean = aLowerQuantIntensity > mMinQuant
'
' Dim goodHigherQuantUC As Boolean = aHigherQuantIntensity > mMinQuant
' Dim goodHigherQuant As Boolean = _
' goodHigherQuantUC Or noQuantMode
'
' Dim goodEvenHigherQuantUC As Boolean = _
' aEvenHigherQuantIntensity > mMinQuant
' Dim goodEvenHigherQuant As Boolean = _
' goodEvenHigherQuantUC Or _
' DoubleOrLessQuantMode
'
' anOutAllGood = _
' goodLowerQuant AndAlso goodHigherQuant AndAlso goodEvenHigherQuant
' anOutAllBad = _
' Not goodLowerQuant AndAlso _
' (Not goodHigherQuantUC Or noQuantMode) AndAlso _
' (Not goodEvenHigherQuantUC Or DoubleOrLessQuantMode)
'Changed PM_REFACTOR 2006-10-06
'So much simpler!
anOutAllGood = True 'Start value, for the loop below.
anOutAllBad = True 'Start value, for the loop below.
'E.g. 3 profiles for triple encoding
Dim lastIndex As Integer = anInLCpeakProfiles.Count - 1
Dim j As Integer
For j = 0 To lastIndex Step 1 'E.g. 3 iterations for triple encoding SILAC.
Dim currentLCprofile As _
List(Of massSpectrometryBase.signalStructure) = _
anInLCpeakProfiles(j)
Dim forOneLCProfile As signalStructure = _
currentLCprofile(aSpectrumIndex)
Dim quantResult As quantResultStructure = _
forOneLCProfile.quantResult
'Changed PM_ONLY_MSPEAKAREA_THRESHOLD 2006-11-10
''Changed PM_ONLY_MSPEAKAREA 2006-11-10. Still sum of MS intensities.
'Dim good As Boolean = quantResult.intensity5 > mMinQuant
Dim good As Boolean = quantResult.MSpeakArea3 > mMinQuant
Dim bad As Boolean = Not good
anOutAllGood = anOutAllGood AndAlso good
anOutAllBad = anOutAllBad AndAlso bad
Next
If anOutAllGood Then
Dim peter63 As Integer = 63
Else
Dim peter64 As Integer = 64
End If
If anOutAllBad Then
Dim peter65 As Integer = 65
Else
Dim peter66 As Integer = 66
End If
End Sub 'findQuantProperties
'Changed PM_MVC_QUANTIFY 2003-08-07
'****************************************************************************
'* <placeholder for header> *
'* Model-only. *
'****************************************************************************
Private Sub quantForOneSpectrum( _
ByVal anInLCWindow As Boolean, _
ByVal aSpectrumIndex As Integer, _
ByRef anOutMSpeakAreas As List(Of Double), _
ByRef anInOutPept As PeptideHitStructure, _
ByRef anOutSpecQuant As SpecQuantStructure)
'Note: as it is now this function does not actually
' quantitate. We just copy values from a stored
' result. The actual quantiation is done in
' doChunkLCPeakFind() and sub functions
' CalcParametersForCurrentMS_2() and
' GetIntegratedPeakIntensityAtMass().
'Old:
' ByRef anOutIntensWT As Double, _
' ByRef anOutIntensI As Double, _
' ByRef anOutIntensHI As Double, _
'Old:
' ByVal aCycle As Integer, _
'Changed PM_REFACTOR 2006-10-05
' 'Changed PM_REFACTOR 2003-10-14
' Dim lowerQuantResult As quantResultStructure
' Dim higherQuantResult As quantResultStructure
' Dim evenHigherQuantResult As quantResultStructure
'
' 'Changed PM_REFACTOR 2003-10-14
' 'Use stored information instead of quantifying again.
' Dim lowerSig As signalStructure = _
' ...(anInOutPept.lowerLCpeakProfile(aSpectrumIndex), _
' signalStructure)
'
' ''Changed PM_LCMAX_PROBLEM 2004-07-17
' 'Trace.Assert(aCycle = lowerSig.tagValue2, _
' ' "PIL ASSERT. Spectrum number (" & _
' ' aCycle & ") is not the same as in the LC profile (" & _
' ' lowerSig.tagValue2 & ")...")
'
' lowerQuantResult = lowerSig.quantResult
' higherQuantResult = _
' ...(anInOutPept.higherLCpeakProfile(aSpectrumIndex), _
' signalStructure).quantResult
' evenHigherQuantResult = _
' ...(anInOutPept.evenHigherLCpeakProfile(aSpectrumIndex), _
' signalStructure).quantResult
'Changed PM_REFACTOR 2006-10-06
' anOutSpecQuant.intensityWT = lowerQuantResult.intensity
' anOutSpecQuant.intensityStableIsotope = _
' higherQuantResult.intensity 'theHigherInt
'
' 'Changed PM_TRIPLE_ENCODING 2003-04-09
' anOutSpecQuant.intensityEvenHigherStableIsotope = _
' evenHigherQuantResult.intensity
'
' anOutSpecQuant.massWT = _
' lowerQuantResult.calibratedNeutralMass 'theLowerMass
' anOutSpecQuant.massStableIsotope = _
' higherQuantResult.calibratedNeutralMass 'theHigherMass
'
' 'Changed PM_XIC 2003-03-09
' anOutSpecQuant.peakAreaWT2 = lowerQuantResult.peakArea
'
' 'Changed PM_XIC_ISOTOPES 2004-03-19
' anOutSpecQuant.peakAreaIsotope = higherQuantResult.peakArea
' anOutSpecQuant.peakAreaEvenHigherIsotope = evenHigherQuantResult.peakArea
'
' 'Normal isotope to wild type ratio. Right name?
' Dim ratioWTI As Double = _
' higherQuantResult.intensity / lowerQuantResult.intensity
' If ratioWTI > 10.0 Then
' Dim peter9 As Integer = 9
' End If
'
' 'Changed PM_MVC_QUANTIFY 2003-08-07
' 'Note: this is also computed much later, but we need it very
' ' soon for the screen update, in FillOutlvSpectra().
' anOutSpecQuant.ratioHigherToBase = ratioWTI
'
' 'Changed PM_SPEC_DISPLAYFORTRIPLEENCODING 2006-04-05
' 'Note: also done in AverageAndStDevFromMSLst(), but then
' ' it is too late for the display....
' anOutSpecQuant.ratioEvenHigherToBase = _
' evenHigherQuantResult.intensity / lowerQuantResult.intensity
'
' 'Changed PM_MVC_QUANTIFY 2003-08-07. We need to remember those values.
' anOutSpecQuant.lowerQuantCalibratedNeutralMass = _
' lowerQuantResult.calibratedNeutralMass
' anOutSpecQuant.higherQuantCalibratedNeutralMass = _
' higherQuantResult.calibratedNeutralMass
'
' 'Changed PM_REFACTOR 2006-10-05. Seems not to be used.
' ''Changed PM_FULL_LCWINDOW_DISPLAY 2003-03-27
' 'If Not anInLCWindow Then
' ' lowerQuantResult.maxSignal = 0 'Flag used in code
' ' ' below() 'theMaxLowerInt
' 'End If
'Changed PM_REFACTOR 2006-10-05
Dim someLCprofile2 As _
List(Of massSpectrometryBase.signalStructure) = _
anInOutPept.LCpeakProfiles(0)
Dim someDish As signalStructure = someLCprofile2(aSpectrumIndex)
'Fill out the data structure for a single spectrum and add it
'to the array list.
'Changed PM_REFACTOR 2006-08-31
'anOutSpecQuant.cycle = aCycle
anOutSpecQuant.cycle = someDish.tagValue2
'Changed PM_MARKER 2007-01-30
If anOutSpecQuant.cycle = 10989 Then
Dim peter1 As Integer = 1
End If
If anOutSpecQuant.cycle = 8731 Then
Dim peter1 As Integer = 1
End If
'Changed PM_REFACTOR 2003-10-14
'anOutSpecQuant.retT = theStartT
anOutSpecQuant.retT = someDish.Xsig 'OK???????
anOutSpecQuant.dishInfo = _
New List(Of shortFormSILACinfoStructure)
anOutMSpeakAreas = New List(Of Double)
'E.g. 3-1 = 2 for triple encoding.
Dim lastIndex As Integer = anInOutPept.LCpeakProfiles.Count - 1
Dim baseIntensity2 As Double = -10.0
Dim baseMSpeakArea As Double = -10.0
Dim j As Integer
For j = 0 To lastIndex Step 1
Dim currentLCprofile As _
List(Of massSpectrometryBase.signalStructure) = _
anInOutPept.LCpeakProfiles(j)
Dim forOneLCProfile As signalStructure = _
currentLCprofile(aSpectrumIndex)
Dim newItem As shortFormSILACinfoStructure
Dim quantResult As quantResultStructure = _
forOneLCProfile.quantResult
'Changed PM_MARKER_MISSING_COPY_OF_STRUCT_FIELD 2008-02-05
'Note: quantResult.centroidMCR2 is not copied below (nor is there
' a field for it). Why not?
'Changed PM_ONLY_MSPEAKAREA 2006-11-10
Dim intensity2 As Double = quantResult.intensity5
Dim MSpeakArea As Double = quantResult.MSpeakArea3
If j = 0 Then
baseIntensity2 = intensity2
baseMSpeakArea = quantResult.MSpeakArea3
End If
'Changed PM_ONLY_MSPEAKAREA 2006-11-10
'We assign, but it should not be used anymore.
newItem.intensity4 = intensity2
newItem.intensityRatioToBase3 = intensity2 / baseIntensity2
'Changed PM_REFACTOR_MARKER 2006-10-05
newItem.mass2 = quantResult.calibratedNeutralMass
newItem.MSpeakArea2 = quantResult.MSpeakArea3
'Changed PM_QUANT_AUTO_CENTERING 2006-11-13
newItem.MCRoffset2 = quantResult.offsetMCR8
'Changed PM_ONLY_MSPEAKAREA 2006-11-10
newItem.MSpeakAreaRatioToBase = MSpeakArea / baseMSpeakArea
newItem.quantCalibratedNeutralMass2 = _
quantResult.calibratedNeutralMass
'Changed PM_ISOTOPEDISTRIBUTION_PLOT 2008-01-30
newItem.maxYmono = quantResult.maxSignal 'This may not be true...
' Should we rename maxSignal to maxSignal_mono?
'Changed PM_QUANT_ISOTOPES 2008-01-31
newItem.isotopesQuantified = quantResult.isotopesQuantified2
anOutSpecQuant.dishInfo.Add(newItem)
anOutMSpeakAreas.Add(MSpeakArea)
Next j
anOutSpecQuant.inLCwindow = anInLCWindow
'Dim quantModesObject As QuantitationModes_moreGeneral = _
' mApplication.getQuantModes()
Dim allGood As Boolean
Dim allBad As Boolean
Me.findQuantProperties( _
anInOutPept.LCpeakProfiles, _
aSpectrumIndex, _
allGood, allBad)
'Changed PM_ACCEPTEDQUANT_ONLYIN_LCWINDOW 2003-09-18
'Only use quantitation within the LC peak window (the time
'window **considered** for the LC-peak - the LC peak itself
'is usally more narrow).
'anInLCWindow
If Not anInLCWindow Then
'If False Then
allGood = False
allBad = True
Else
Dim peter9 As Integer = 9
End If
'Changed PM_MVC_QUANTIFY 2003-08-07
anOutSpecQuant.allGoodQuant = allGood
anOutSpecQuant.allBadQuant = allBad
'Changed PM_LCWINDOW_CHECK_ERROR 2003-09-30
anOutSpecQuant.useForQuant_WT = False
anOutSpecQuant.useForMW = False
If allGood Then
anOutSpecQuant.useForQuant_WT = True
anOutSpecQuant.useForMW = True
End If
'Changed PM_REFACTOR 2006-10-06
''Changed PM_KEEP_HIGHEST_FOR_RATIOS 2003-06-25
'anOutIntensWT = anOutSpecQuant.intensityWT
'anOutIntensI = anOutSpecQuant.intensityStableIsotope
'anOutIntensHI = anOutSpecQuant.intensityEvenHigherStableIsotope
'Changed PM_LCWINDOW_CHECK_ERROR 2003-09-30
Trace.Assert(Not anOutSpecQuant.useForQuant_WT Or anInLCWindow, _
"PIL ASSERT. Quantitation accepted outside LC peak range. " & _
"(field useForQuantitation2)")
Trace.Assert(Not anOutSpecQuant.useForMW Or anInLCWindow, _
"PIL ASSERT. <message>. " & _
" Quantitation accepted outside LC peak range. (field useForMW)")
'Attach the structure to the main data structure.
'ToDo: see what the memory requirements are when doing this
' for all peptides.
'...(mProt2.pepts(mCurrPepIdx), _
' PeptideHitStructure).specs.Add(theSpecQuant) doesn't
' work since ArrayList not created.
'aMS_Lst.Add(theSpecQuant) 'Later, we add the list array to
' the mProt2.pepts data structure.
anInOutPept.spectra.Add(anOutSpecQuant)
End Sub 'quantForOneSpectrum
'Changed PM_QUANTSPEEDUP 2003-08-07
'****************************************************************************
'* <placeholder for header> *
'* anSpecQuant is read-only. *
'****************************************************************************
Private Sub addVisual_SpectrumLine( _
ByRef anSpecQuant As SpecQuantStructure)
'Changed PM_DECIMAL_MINUTES 2008-01-22. Better in line with
' Analyst and with ZedGraph display (but it may be able to
' handle time).
'Dim retTimeStr As String = sec2minuteString(anSpecQuant.retT)
Dim retMin As Double = anSpecQuant.retT / 60.0
'Changed PM_3DECIMALS_FOR_RETT 2008-02-14
'Dim retTimeStr2 As String = retMin.ToString("0.00")
Dim retTimeStr2 As String = retMin.ToString("0.000")
'Later: refactor to separate creation and update of display/spectrum line.
Dim newItem As ListViewItem = lvSpectra.Items.Add(retTimeStr2)
'With lvSpectra.Items.Add(retTimeStr)
With newItem
Dim columns As Integer = mSpecColumnMapper.columnCount()
Dim j As Integer
For j = 1 To columns
.SubItems.Add("...")
Next j
mTempCheckedIsBeingSet = True
'Changed PM_NOTUPDATED_UNCHECKED_SPECTRA 2007-01-29
''Changed PM_MVC_QUANTIFY 2003-08-07
'.Checked = anSpecQuant.allGoodQuant
.Checked = anSpecQuant.useForQuant_WT 'Will this fire an event??
mTempCheckedIsBeingSet = False
Dim newForeColour As Color = Color.LawnGreen
If anSpecQuant.allBadQuant Then
'All bad. Or outside LC peak...
newForeColour = Color.Red
Else
If anSpecQuant.allGoodQuant Then
'All good
newForeColour = Color.Black
Else
newForeColour = Color.Gray 'i.e. one is over and one is under
' the(limit).
'Gray is a color, Grey is a *colour*.
End If
End If
.ForeColor = newForeColour
'.SubItems.Add(anSpecQuant.cycle.ToString) 'unique identifier
mSpecColumnMapper.updateListItem( _
newItem, specTbItmColEnum.enumCycleNumber, _
anSpecQuant.cycle.ToString)
'Changed PM_REFACTOR 2006-10-06
' Dim higherQuantResultIntensity As Double = _
' anSpecQuant.intensityStableIsotope
' '.SubItems.Add(anSpecQuant.intensityWT.ToString("0")) 'intensity w.t.
' mSpecColumnMapper.updateListItem( _
' newItem, specTbItmColEnum.enumIntensityWT_2, _
' anSpecQuant.intensityWT.ToString("0"))
'
' '.SubItems.Add(higherQuantResultIntensity.ToString("0")) 'intensity isotope
' mSpecColumnMapper.updateListItem( _
' newItem, specTbItmColEnum.enumIntensityIsotope2, _
' higherQuantResultIntensity.ToString("0"))
'
' 'Changed PM_SPEC_DISPLAYFORTRIPLEENCODING 2006-04-05
' mSpecColumnMapper.updateListItem( _
' newItem, specTbItmColEnum.enumIntensityEvenHigherIsotope, _
' anSpecQuant.intensityEvenHigherStableIsotope.ToString("0"))
'
' Dim ratioStr As String = anSpecQuant.ratioHigherToBase.ToString("0.00")
' If higherQuantResultIntensity > 0 Then
' '.SubItems.Add(anSpecQuant.ratioHigherToBase.ToString("0.00")) 'ratio
' Else
' '.SubItems.Add("...")
' ratioStr = "..."
' End If
' mSpecColumnMapper.updateListItem( _
' newItem, specTbItmColEnum.enumIntensityRatio, _
' ratioStr)
'
' mSpecColumnMapper.updateListItem( _
' newItem, specTbItmColEnum.enumIntensityRatioEvenHigher, _
' anSpecQuant.ratioEvenHigherToBase.ToString("0.00"))
'
' '.SubItems.Add( _
' ' anSpecQuant.lowerQuantCalibratedNeutralMass.ToString("0.000")) 'mass w.t.
' mSpecColumnMapper.updateListItem( _
' newItem, specTbItmColEnum.enumMeasMW_WT, _
' anSpecQuant.lowerQuantCalibratedNeutralMass.ToString("0.000"))
'
' '.SubItems.Add( _
' ' anSpecQuant.higherQuantCalibratedNeutralMass.ToString("0.000")) 'mass isotope
' mSpecColumnMapper.updateListItem( _
' newItem, specTbItmColEnum.enumMeasMW_Isotope, _
' anSpecQuant.higherQuantCalibratedNeutralMass.ToString("0.000"))
'Changed PM_REFACTOR 2006-10-06
'So much simpler!
'Group intensities together, etc.
'Note: if the order is changed then it must also be
' changed in function setSpectrumListViewColumns().
Dim value As Double = -10.0
Dim formatStringsArr() As String = _
{"0.0", "0.00", "0.000", "0.0000"} 'For intensity,
' ratio and mass - in that order....
Dim value2 As Double = -10.0
Dim keyBase As Integer = -5
'We need this complicated stuff with two nested loops
'as we want to group.
Dim n As Integer
For n = 0 To 3 Step 1
Dim index As Integer = 0
Dim someItem As shortFormSILACinfoStructure
For Each someItem In anSpecQuant.dishInfo
Select Case n
Case 0
value = someItem.MSpeakArea2
keyBase = specTbItmColEnum.enumMSpeakAreaBaseNumber
Case 1
value = someItem.MSpeakAreaRatioToBase
keyBase = specTbItmColEnum.enumMSpeakAreaRatioBaseNumber
Case 2
value = someItem.quantCalibratedNeutralMass2
keyBase = specTbItmColEnum.enumMassBaseNumber
'Changed PM_QUANT_AUTO_CENTERING 2006-11-13
Case 3
value = someItem.MCRoffset2
keyBase = specTbItmColEnum.enumQuantOffsetBaseNumber
Case Else
Trace.Assert(False, "PIL ASSERT. Select Case never fall-through")
End Select
Dim key2 As Integer = keyBase + index
mSpecColumnMapper.updateListItem( _
newItem, key2, _
value.ToString(formatStringsArr(n)))
index += 1
Next 'Through SILAC dish information, e.g. 3 times for triple encoding.
Next n 'For each type of information: intensity, ratio and mass.
'.Font = New Font(Me.Font, FontStyle.Regular) 'restore the form's font ??
End With
End Sub 'addVisual_SpectrumLine
'Changed PM_REFACTOR 2003-10-08
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub setTitleOnSpectrum(ByVal aCycleNumber As Integer)
Dim titleStr As String = rawFile_DataTitle()
Dim temp5Arr As String() = Regex.Split(titleStr, "Experiment")
titleStr = Join(temp5Arr, "Exp")
Dim idx As Integer = titleStr.IndexOf("wiff")
If idx > 0 Then
titleStr = titleStr.Remove(idx, titleStr.Length - (idx + 4))
End If
titleStr &= " Cycle: " & aCycleNumber
'Changed PM_XY_EXPORT 2005-01-11
'Select Case mOptions.rawFileMode
' Case rawFileModeEnum.enumAnalyst
' mAxGraphControl_ANALYSTCOM_2.SeriesColl.Item(1).Title.Text = titleStr
' Case rawFileModeEnum.enumFinnegan
' mSpectrumDialog.setSpectrumTitle(titleStr)
'
' 'Changed PM_QUANTSPECTRUM_INFO 2004-07-06
' If False Then
' Dim header As String = mRawDataFileHandling.DataTitle()
' Dim spectrumNum As Integer = _
' mRawDataFileHandling.currentSpectrumNumber()
' lblSpectrumInfo2.Text = "Spectrum " & spectrumNum & ": " & header
' End If
' lblSpectrumInfo2.Text = titleStr
'
'
' Case rawFileModeEnum.enumMicromass
' mSpectrumDialog.setSpectrumTitle(titleStr)
' Case Else
' Trace.Assert(False, "PIL ASSERT. Select Case never fall-through")
'End Select
mMSdisplay.setSpectrumTitle(titleStr)
lblSpectrumInfo.Text = titleStr
End Sub 'setTitleOnSpectrum
'Changed PM_QUANTSPEEDUP 2003-08-07
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub rawSpectrumUpdate( _
ByRef anSpecQuant As SpecQuantStructure, _
ByRef anInUncalibratedSILACmasses2 As List(Of Double), _
ByRef aPeptideSequence As String _
)
'Update of raw spectrum ***view***
'Changed PM_QUANTSPEEDUP 2003-08-07.
'Speed-up: only update spectrum display it was quantitation was good.
If anSpecQuant.allGoodQuant Then 'Raw spectrum. Change title/ID line
' and set x-axis mass markers.
'Changed PM_CYCLENUMBER_IN_SPECTRUM 2003-10-08
setTitleOnSpectrum(anSpecQuant.cycle)
'Changed PM_WINDOW_AGAIN 2005-10-31
'Changed PM_FINNIGAN_QUANTWINDOW_RELATIVE 2005-07-12
Dim deltaMass As Double = 0.5 * mXICwindow.XICwindowSize(100.0) '?????????
'Changed PM_ISOTOPEDISTRIBUTION_PLOT 2008-01-30. Moved to
' before call to addQuantMarkers().
Dim maxYinDisplayedSpectrum As Double
ZoomToSILACgroup(maxYinDisplayedSpectrum)
'Changed PM_REFACTOR 2003-04-08
addQuantMarkers( _
1, deltaMass, anInUncalibratedSILACmasses2, 0.0, _
anSpecQuant.dishInfo, maxYinDisplayedSpectrum, _
aPeptideSequence) '???????????????????
End If
End Sub 'rawSpectrumUpdate
'Not used.
''Changed PM_QUANTSPEEDUP 2003-08-07
''****************************************************************************
''* <placeholder for header> *
''* anSpecQuant is read-only.
''****************************************************************************
'Private Sub visualAddAndUpdateSpectrumInfo( _
' ByRef anSpecQuant As SpecQuantStructure)
'
' If True Then
' addVisual_SpectrumLine(anSpecQuant)
'
' lvSpectra.EnsureVisible(lvSpectra.Items.Count - 1) 'Ensure that last
' ' addition is visible by scrolling.
' lvSpectra.Refresh()
' End If
'
' 'Changed PM_REFACTOR 2003-04-01. Now is done in beginning of
' ' the Sub, in SetAndDisplaySpectrum(). Will this change be
' ' of any significance?
' 'ZoomToArgDoublet()
'
' rawSpectrumUpdate(anSpecQuant)
'End Sub 'visualAddAndUpdateSpectrumInfo
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub updateSpecFields_QuantitationStatus_NoWriteBack( _
ByRef anInOutSpectrumInfo As SpecQuantStructure, _
ByVal aNewValue As Boolean)
anInOutSpectrumInfo.useForMW = aNewValue
anInOutSpectrumInfo.useForQuant_WT = aNewValue
End Sub 'updateSpecFields_QuantitationStatus_NoWriteBack
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub updateSpecFields_QuantitationStatus( _
ByRef aPept As PeptideHitStructure, _
ByVal aSpecIndex As Integer, ByVal aNewValue As Boolean)
If True Then
Dim specQuant As SpecQuantStructure = aPept.spectra(aSpecIndex)
updateSpecFields_QuantitationStatus_NoWriteBack(specQuant, aNewValue)
aPept.spectra(aSpecIndex) = specQuant 'write-back. Peptide.
End If
End Sub 'updateSpecFields_QuantitationStatus()
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub lvSpectra_ItemCheck(ByVal aSender As Object, _
ByVal anEvent As System.Windows.Forms.ItemCheckEventArgs) _
Handles lvSpectra.ItemCheck
If mTempCheckedIsBeingSet Then
Dim peter5 As Integer = 5
Else
Dim peter6 As Integer = 6
End If
'Changed PM_DEBUG_EVENTCOUNTS 2003-08-12
mTempSpectrumItemClickedCount += 1
'Changed PM_TRIPLEDISPLAY_PERFORMANCETROUBLE 2003-06-24
If Not mSpectrum_AvoidListEvents2 Then
'Changed PM_DEBUG_EVENTCOUNTS 2003-08-12
mTempSpectrumAcceptedItemClickedCount += 1
mLogger.timeLog("In lvSpectra_ItemCheck(). Very beginning of function.")
Dim pept As PeptideHitStructure = _
helper.blankPeptide() 'Keep compiler happy.
mProt.peptides.peptideByToken(mCurrPeptideToken, pept)
If Not pept.spectra Is Nothing Then
Dim newValue As Boolean = CBool(anEvent.NewValue)
Dim specIndex As Integer = anEvent.Index
'Dim thePept As PeptideHitStructure = _
' ...(mProt2.pepts(mCurrPepIdx), _
' PeptideHitStructure)
updateSpecFields_QuantitationStatus(pept, specIndex, newValue)
'Changed PM_REFACTOR 2006-03-15
'mProt2.pepts(mCurrPepIdx) = thePept 'write-back.
mProt.peptides.updatePeptideByToken(mCurrPeptideToken, pept)
'Changed PM_REFACTOR 2003-05-06. Delete at any time.
' If True Then
' Dim theSpecQuant As SpecQuantStructure = _
' ...(thePept.specs(specIndex), SpecQuantStructure)
' theSpecQuant.useForMW = newValue
' theSpecQuant.useForQuantitation2 = newValue
' thePept.specs(specIndex) = theSpecQuant 'write-back
' End If
specFieldsQuantitationWasUpdated_byIndex(mCurrPeptideToken)
'Note: specFieldsQuantitationWasUpdated_byIndex() changes
' mProt2.pepts so we must re-read the peptide for the
' function below.
mProt.peptides.peptideByToken(mCurrPeptideToken, pept)
'Changed PM_MANUAL_PEPTIDEQUANTSTATUSUPDATE 2003-05-06
'Update over in the peptide list - new ratios, etc.
'
'Will this not update the incorrect peptide line if the
'user changed the selection in the peptide list?????????
Me.visualUpdatePeptideListFromFieldsInPeptideStructure( _
lvPept.SelectedItems(0).Index, pept)
mLogger.timeLog("In lvSpectra_ItemCheck(). Very end of function.")
Else
Dim peter2 As Integer = 2 'Spectrum list is Nothing...
End If
Else
Dim peter9 As Integer = 9
End If 'mSpectrum_AvoidListEvents
End Sub 'lvSpectra_ItemCheck()
'Changed PM_MANUAL_PEPTIDEQUANTSTATUSUPDATE 2003-05-06
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub resetQuantitationFields( _
ByRef aPept As PeptideHitStructure)
'Note: we might need to reset more fields as those
'below are only the ones that are displayed in the
'quantitation window - more fields are include in the
'export.
'Changed PM_REFACTOR 2006-10-10
' aPept.totalLCSignalWT = 0.0
' aPept.totalLCSignalStableIsotope = 0.0
' aPept.totalLCPeakAreaWT = 0.0
'
' 'Changed PM_RESETTING_ALL_QUANTFIELDS 2004-10-05
' aPept.totalLCPeakArea_Isotope = 0.0
' aPept.totalLCPeakArea_EvenHigherIsotope = 0.0
' aPept.stableIsotopeRatio = 0.0
' aPept.stableIsotopeRatioStDev = 0.0
'
' aPept.totalLCSignalEvenHigherStableIsotope = 0.0
' aPept.stableEvenHigherIsotopeRatio = 0.0
' aPept.stableEvenHigherIsotopeRatioStDev = 0.0
'
' aPept.averageOf_IWT_Ratios = 0.0
' 'Changed PM_PROTEIN_RATIOS 2003-06-27
' aPept.averageOf_HIWT_Ratios = 0.0
'
' 'Changed PM_RESETTING_ALL_QUANTFIELDS 2004-10-05
' aPept.maxWTintensity = 0.0
' aPept.maxIsotopeintensity = 0.0
' aPept.maxHigherIsotopeTintensity = 0.0
'Changed PM_CLICKOFF_QUANTPEPTIDE_BUG 2007-04-13
'aPept.LCprofilesProperties = Nothing No! We don't want to forget
' these values! When the user click the peptide on again then we
' need the values.
aPept.usedForQuantitation_maxWTintensity = 0.0
End Sub 'resetQuantitationFields
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub visualUpdatePeptideListFromFieldsInPeptideStructure( _
ByVal aClickIndex As Integer, _
ByRef aPept As PeptideHitStructure)
'Changed PM_TRIPLEDISPLAY 2003-06-17. Changes using updatePeptideListItem().
'Dim rowToUpdate As ListViewItem = lvPept2.Items(aClickIndex)
'Changed PM_TRIPLEDISPLAY_PERFORMANCETROUBLE 2003-06-19
Dim savedAvoid1 As Boolean = mPeptide_AvoidListEvents1
mPeptide_AvoidListEvents1 = True
Dim row As ListViewItem = lvPept.Items(aClickIndex)
If Not aPept.LCprofilesProperties Is Nothing Then
Dim formatStringsArr() As String = _
{"0.00", "0.00", "0.00", "0.0", "0"} 'For ratio,
' stddev ratio, intensity and XIC - in that order....
Dim keyBase As Integer = -5
Dim value As Double = -10.0
'We need this complicated stuff with two nested loops as we want
'to group .
Dim n As Integer
For n = 0 To 4
Dim index As Integer = 0
Dim someItem As LCprofilesPropertiesStructure
For Each someItem In aPept.LCprofilesProperties
Select Case n
Case 0
value = someItem.averageOfRatios2
keyBase = quantPeptTbItmColEnum2.enumRatioBaseNumber2
Case 1
value = someItem.ratioStDev
keyBase = quantPeptTbItmColEnum2.enumRatioStdDevBaseNumber2
Case 2
'Changed PM_NO_RATIO_OF_INTENSITY_SUMS 2006-11-08
'value = someItem.ratioOfItensities
value = someItem.ratioOfXICs
keyBase = quantPeptTbItmColEnum2.enumIntensRatioBaseNumber2
Case 3
value = someItem.totalLCPeakArea
keyBase = quantPeptTbItmColEnum2.enumXICBaseNumber2
Case 4
value = someItem.totalLCSignal
keyBase = quantPeptTbItmColEnum2.enumIntensityBaseNumber2
Case Else
Trace.Assert(False, "PIL ASSERT. Select Case never fall-through")
End Select
Dim key2 As Integer = keyBase + index
mPeptColumnMapper.updateListItem( _
row, key2, value.ToString(formatStringsArr(n)))
index += 1
Next 'Through SILAC dish information, e.g. 3 times for triple encoding.
Next n 'For each type of information
End If 'Not Nothing...
'Changed PM_TRIPLEDISPLAY_PERFORMANCETROUBLE 2003-06-19
mPeptide_AvoidListEvents1 = savedAvoid1
'Changed PM_MAXWT_USEDFORQUANT 2003-10-01
Dim extraInfoStr As String = "Max WT for checked: " & _
aPept.usedForQuantitation_maxWTintensity & "."
'Why is this outside the event guard? Does
'setting "Tag" fire events?
row.Tag = extraInfoStr
End Sub 'visualUpdatePeptideListFromFieldsInPeptideStructure()
'Changed PM_REFACTOR 2003-08-08.
'****************************************************************************
'* <placeholder for header> *
'* *
'* Better name for this function? *
'* Note: both parameters are intended to be read-only. *
'****************************************************************************
Private Sub someScreenUpdates( _
ByRef aPept As PeptideHitStructure, _
ByRef aQuantStats As quantStatsStructure)
'Refactored out from AverageAndStDevFromMSLst().
'Changed PM_REFACTOR 2006-10-11. Disabled unnecessary
' code after the 2006-04-05 disable.
' Dim bckGrIntWT, backGrIntIso As Double
'
' Dim newTextI As String = "I (w.t.)"
'
' If mBackGroundWtAsPixel <> pbLCpeak.Height Then
' 'Changed PM_RATIO_PROBLEM 2003-08-11
' 'bckGrIntWT = IntWTFromPixelY(mBackGroundWtAsPixel)
' bckGrIntWT = mBckGrIntWT
'
' newTextI = "I (w.t.)*" 'Feedback for
' ' subtracting background is a * in column header.
' Else
' bckGrIntWT = 0
'
' 'The mapper should be used instead of hard coded index...
' 'lvSpectra.Columns(1).Text = "I (w.t.)"
' End If
'
' 'Changed PM_REFACTOR 2006-04-05. Disabled for now...
' 'lvSpectra.Columns(1).Text = newTextI
'
' Dim newTextIso As String = "I (iso)"
'
' If mBackGroundIsoAsPixel <> pbLCpeak.Height Then
'
' 'Changed PM_RATIO_PROBLEM 2003-08-11
' 'backGrIntIso = IntISOFromPixelY(mBackGroundIsoAsPixel)
' backGrIntIso = mBackGrIntIso
'
' newTextIso = "I (iso)*" 'Feedback for
' ' subtracting background is a * in column header.
' Else
' backGrIntIso = 0
'
' 'The mapper should be used instead of hard coded index...
' 'lvSpectra.Columns(2).Text = "I (iso)"
' End If
'
' 'Changed PM_REFACTOR 2006-04-05. Disabled for now...
' 'lvSpectra.Columns(2).Text = newTextIso
'Changed PM_REFACTOR 2006-10-11. Disabled for now.
'txtSpecLst.Text = _
' aQuantStats.sumIntWT.ToString("0") & " " & _
' aQuantStats.sumIntIsotope.ToString("0") & " " & _
' aQuantStats.aveRatio.ToString("0.00") & " +- " & _
' aQuantStats.stDevRatio.ToString("0.00") & " " & _
' aQuantStats.aveMassWT.ToString("0.000") & " +- " & _
' aQuantStats.stDevMassWT.ToString("0.000") & " " & _
' aQuantStats.aveMassIso.ToString("0.000") & " +- " & _
' aQuantStats.stDevMassIso.ToString("0.000")
'txtSpecLst.Refresh()
'Note: useForQuantitation is set in AverageAndStDevFromMSLst()
'Dim rowToUpdate As ListViewItem = lvPept2.SelectedItems2(0)
'With rowToUpdate
'Will this not update the incorrect peptide line if the
'user changed the selection in the peptide list?????????
With lvPept.SelectedItems(0)
'Changed PM_MSQA 2003-04-02
If Not aPept.goodMSpeak Then
'.SubItems(quantPeptTbItmColEnum.eSequence).BackColor = _
' Color.LightSalmon
mPeptColumnMapper.itemBackColour( _
lvPept.SelectedItems(0), _
quantPeptTbItmColEnum2.enumSequence, _
Color.LightSalmon)
Else
Dim peter8 As Integer = 8
End If
'Changed PM_REFACTOR 2006-10-11
Dim wildStats As dishStatsStructure = _
aQuantStats.dishInfo(0)
mPeptColumnMapper.updateListItem(lvPept.SelectedItems(0), _
quantPeptTbItmColEnum2.enumMeasuredMCR, _
wildStats.aveMass.ToString("0.000"))
mPeptColumnMapper.updateListItem(lvPept.SelectedItems(0), _
quantPeptTbItmColEnum2.enumMeasMCR_StDev, _
wildStats.stDevMass.ToString("0.000"))
'Changed PM_REFACTOR 2006-10-11. Disabled for now.
' '.SubItems(quantPeptTbItmColEnum.eDeltaPPM_MW).Text = _
' ' diffMass.ToString("0.000")
' mPeptColumnMapper.updateListItem(lvPept2.SelectedItems(0), _
' quantPeptTbItmColEnum2.enumDeltaPPM_MW, _
' aQuantStats.diffMass.ToString("0.000"))
'Note: new is not strictly the same as it is now always set to some value
'If sumIntWT > MIN_SIGN_QUANT * 10 Or _
' sumIntIsotope * 10 > MIN_SIGN_QUANT Then
' .Checked = true
'End If
'Note: ".Checked" below will fire undireable events.
Dim savedAvoid1 As Boolean = mPeptide_AvoidListEvents1
mPeptide_AvoidListEvents1 = True
mTempCheckedIsBeingSet = True
.Checked = aPept.useForQuantitation 'Will this fire an event??
mTempCheckedIsBeingSet = False
mPeptide_AvoidListEvents1 = savedAvoid1
'Changed PM_ALWAYS_SHOW_RAWFILE 2006-03-07
Dim rawFileStr As String = _
"Raw file: " & Path.GetFileName(aPept.rawFileFullPath)
Me.updateStatusBar(rawFileStr)
End With
End Sub 'someScreenUpdates
'Changed PM_REFACTOR 2008-01-02
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub displaySelectedSpectrumLine()
'TODO: this can give a crash when double clicking in the
' check box. Make safe.
Dim doContinue As Boolean = True
Dim idx As Integer
Try
idx = lvSpectra.SelectedIndices.Item(0) 'From GUI.....
Catch
' Exit Sub
doContinue = False 'User meant to click check box but double
' clicked in it instead.
End Try
If doContinue Then
Dim pept As PeptideHitStructure = _
helper.blankPeptide() 'Keep compiler happy.
mProt.peptides.peptideByToken(mCurrPeptideToken, pept)
Trace.Assert(Not pept.spectra Is Nothing, _
"PIL ASSERT. Spectra do not exist. In lvSpectra_DoubleClick().")
'Changed PM_REFACTOR 2008-01-29
'Dim cycle As Integer = pept.spectra(idx).cycle
Dim someSpectrum As SpecQuantStructure = pept.spectra(idx)
Dim cycle As Integer = someSpectrum.cycle
'Changed PM_REFACTOR 2003-04-01
Dim maxYinDisplayedSpectrum As Double
SetAndDisplaySpectrum(cycle, maxYinDisplayedSpectrum)
'Changed PM_CYCLENUMBER_IN_SPECTRUM 2003-10-08
setTitleOnSpectrum(cycle)
'Changed PM_WINDOW_AGAIN 2005-10-31
'Changed PM_FINNIGAN_QUANTWINDOW_RELATIVE 2005-07-12
Dim deltaMass As Double = _
0.5 * mXICwindow.XICwindowSize(pept.measuredMCR)
'Changed PM_QUANT_AUTO_CENTERING 2006-11-13
Dim someLCpoint As signalStructure = _
pept.LCpeakProfiles(0)(idx)
Dim quantOffset As Double = someLCpoint.tagValue3
'Changed PM_REFACTOR 2003-04-08
addQuantMarkers( _
pept.charge, deltaMass, pept.uncalibratedSILACmasses2, _
quantOffset, _
someSpectrum.dishInfo, maxYinDisplayedSpectrum, _
pept.AASequence)
mMSdisplay.refresh2()
End If
End Sub 'displaySelectedSpectrumLine
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub lvSpectra_DoubleClick( _
ByVal sender As Object, _
ByVal anEvent As System.EventArgs) _
Handles lvSpectra.DoubleClick
displaySelectedSpectrumLine()
End Sub 'lvSpectra_DoubleClick()
'Changed PM_ENTERKEY_SPECTRUMLINE 2008-01-02
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub lvSpectra_KeyDown( _
ByVal aSender As Object, _
ByVal anEvent As System.Windows.Forms.KeyEventArgs) _
Handles lvSpectra.KeyDown
'Note: this observing of key down is not strictly necessary, but
' is to prevent any problems later with an OpenFile
' dialog (for some reason we can get the key up event from
' dismissal of the file dialog with Enter/Return).
mKeyObserver_SpectrumList.keyDown(anEvent.KeyCode)
End Sub 'lvSpectra_KeyDown
'Changed PM_ENTERKEY_SPECTRUMLINE 2008-01-02
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub lvSpectra_KeyUp( _
ByVal aSender As Object, _
ByVal anEvent As System.Windows.Forms.KeyEventArgs) _
Handles lvSpectra.KeyUp
If mKeyObserver_SpectrumList.keyUp(anEvent.KeyCode) Then
displaySelectedSpectrumLine()
End If
End Sub 'lvSpectra_KeyUp
'Seems not to be used. Outcommented.
''****************************************************************************
''* <placeholder for header> *
''****************************************************************************
'Friend Sub quantArgLabeledPept()
' 'Determine the MS spectrum belonging to the mass spectrum
' 'in the Quant window, show the MS spectrum for the current protein
' 'show the user the current ratio
' 'the user can then accept or reject via dialog.
' Dim theArg0Int As Double
' Dim theArg6C13Int As Double
' Dim theArg0Mass As Double
' Dim theArg6C13Mass As Double
' 'Need to determine if it is Arg modified or not. Worse to worse out
' 'of the table.
' 'First do this only with the MS1 mass spectrum following the
' 'picked one (and before?)
' SetTheSpectrum(mCurrPepIdx)
'End Sub 'quantArgLabeledPept()
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub IntegrateCurrentPeaks2(ByVal aRawFileRef As Integer)
'Changes have not been tested!!
Trace.Assert(False, "Stop!", _
"PIL ASSERT. Internal/development assert for stopping execution......")
'Changed PM_NO_PREVNEXT_SPEC_GUI 2006-09-22
'Disabled for now.... The two GUI buttons were already disabled.
' 'Give the retention time and difference.
'
' 'Changed PM_REFACTOR_FINNEGAN 2003-07-21
' 'Dim lastT As Single = mANALYSTCOM_WiffFile.GetActualTimeFromPeriodAndCycle( _
' ' 1, 0, 0, mCurrCycle - 1)
' 'Dim thisT As Single = mANALYSTCOM_WiffFile.GetActualTimeFromPeriodAndCycle( _
' ' 1, 0, 0, mCurrCycle)
' Dim lastT As Double = _
' mRawDataFileHandling.SpectrumNumber2RetentionTime(mCurrCycle - 1, 0)
' Dim thisT As Double = _
' mRawDataFileHandling.SpectrumNumber2RetentionTime(mCurrCycle, 0)
'
' txtOutput.AppendText((thisT / 60).ToString("0.00") & vbTab & _
' (thisT - lastT).ToString("0.0") & vbTab)
'
' ''intensity of lower isotope
' 'Dim thePept As PeptideHitStructure = ...(mProt2.pepts(mCurrPepIdx), PeptideHitStructure)
' 'Dim theMZ As Double = thePept.measuredMZ
' 'Dim theIntensity As Double = GetIntegratedPeakIntensityAtMass(theMZ)
' 'txtOutput.AppendText(theIntensity.ToString("0") & vbTab)
'
' 'Dim numArgs, j As Integer
' 'For j = 0 To thePept.sequence.Length - 1
' ' If thePept.sequence.Chars(j) = "R"c Then numArgs += 1
' 'Next j
' 'Dim theCharge As Integer = CInt((thePept.calculatedMW / thePept.measuredMZ) + 0.2)
' 'Dim theMZ_Diff As Double = (6.0 / theCharge) * numArgs 'for fully substituted C13 arg
' 'If thePept.numArgC13 > 0 Then theMZ_Diff *= (-1) '
'
' 'If numArgs > 0 Then
' 'Add red arrows
'
' 'Changed PM_REFACTOR 2006-03-15
' 'Dim thePept As PeptideHitStructure = _
' ' ...(mProt2.pepts(mCurrPepIdx), _
' ' PeptideHitStructure)
' Dim pept As PeptideHitStructure = helper.blankPeptide() 'Keep compiler happy.
'
' mProt2.peptides.peptideByToken( _
' mCurrPeptideToken, pept)
'
' 'Changed PM_WINDOW_AGAIN 2005-10-31
' 'measuredMZ is probably accurate enough....
' Dim deltaMass As Double = _
' 0.5 * mXICwindow.XICwindowSize(pept.measuredMCR)
'
' 'Changed PM_REFACTOR 2003-04-08
' addQuantMarkers(pept.charge, deltaMass)
'
' 'Changed PM_REFACTOR 2003-04-09. As preparation for use of quantResultStructure.
' Dim lowerQuantResult As quantResultStructure
' Dim higherQuantResult As quantResultStructure
' Dim evenHigherQuantResult As quantResultStructure
' Dim vResult As Boolean
'
' Trace.Assert(deltaMass > 0.0, "PIL ASSERT. mDeltaMass is undefined!")
'
' 'Changed PM_EVENMORE_GENERALISED_QUANTMODES 2005-04-08
' 'Dim quantitationModesObject As QuantitationModes = _
' ' mApplication.getQuantitationModesObject()
' 'Dim curQuantitationMode As quantitationModeStructure = _
' ' quantitationModesObject.getQuantitationMode( _
' ' mOptions.quantModeCode)
' Dim quantitationModesObject As QuantitationModes_moreGeneral = _
' mApplication.getQuantModes()
' Dim curQuantitationMode As generalisedQuantModeStructure = _
' quantitationModesObject.getQuantitationMode( _
' mOptions.quantModeCode)
'
' Dim quantModeClassification As QuantModeClassificationStruct = _
' QuantitationModes_moreGeneral.doQuantModeClassification( _
' curQuantitationMode)
'
' FindLCpeaks.CalcParametersForCurrentMS( _
' aRawFileRef, _
' mProt2, mCurrPeptideToken, _
' mA, mB, _
' deltaMass, mRawDataFileHandling, _
' mFixBackground, quantModeClassification, _
' _
' lowerQuantResult, _
' higherQuantResult, evenHigherQuantResult, _
' vResult)
'
' Dim intenRat As Double = _
' higherQuantResult.intensity / lowerQuantResult.intensity
'
' txtOutput.AppendText(lowerQuantResult.intensity.ToString("0") & vbTab)
' txtOutput.AppendText(higherQuantResult.intensity.ToString("0") & vbTab)
' txtOutput.AppendText(intenRat.ToString("0.00"))
'
' 'Not used....
' 'Dim charge As Integer = _
' ' CInt(pept.MascotCalculatedMass / pept.measuredMCR + 0.2)
'
' 'Changed PM_TRIPLE_ENCODING 2003-04-09
' 'Old, now done in CalcParametersForCurrentMS
' ' centroidMassLower = theCharge * (mA + mB * centroidMassLower) - _
' ' theCharge * PROTON_MASS
'
' txtOutput.AppendText( _
' vbTab & lowerQuantResult.calibratedNeutralMass.ToString("0.000"))
'
' Dim massDiffPPM As Double
' Try
' massDiffPPM = 1000000 * _
' (pept.MascotCalculatedMass - lowerQuantResult.calibratedNeutralMass) / _
' pept.MascotCalculatedMass
' Catch
' End Try
'
' Dim massDiffPPMint As Integer = CInt(massDiffPPM) 'Is this really needed?
'
' txtOutput.AppendText(vbTab & massDiffPPMint.ToString("0"))
' txtOutput.AppendText(vbCrLf)
End Sub 'IntegrateCurrentPeaks()
'Changed PM_DEADCODE 2008-05-05. Disabled. Not used anymore, but keep
' for reference for a while. We have similar ***menu*** commands.
' '****************************************************************************
' '* <placeholder for header> *
' '****************************************************************************
' Private Sub btnPrevSpec_Click(ByVal sender As System.Object, _
' ByVal anEvent As System.EventArgs) _
' Handles btnPrevSpec.Click
'
' mCurrCycle -= 1 'Change this, as there is no check if outside bounds....
'
' 'Changed PM_SEVERALWIFFS 2003-08-27
' Dim curTag As Integer = mRawDataFileHandling.getCurrentRawFileTag()
'
' SetMS1ByCycleNum2(mCurrCycle, curTag)
'
' Dim maxYinDisplayedSpectrum As Double
' ZoomToSILACgroup(maxYinDisplayedSpectrum)
' End Sub 'btnPrevSpec_Click
'Changed PM_DEADCODE 2008-05-05. Disabled. Not used anymore, but keep
' for reference for a while. We have similar ***menu*** commands.
' '****************************************************************************
' '* <placeholder for header> *
' '****************************************************************************
' Private Sub btnNextSpec_Click(ByVal sender As System.Object, _
' ByVal anEvent As System.EventArgs) _
' Handles btnNextSpec.Click
'
' mCurrCycle += 1 'Change this, as there is no check if outside bounds....
'
' 'Changed PM_SEVERALWIFFS 2003-08-27
' Dim curTag As Integer = mRawDataFileHandling.getCurrentRawFileTag()
'
' SetMS1ByCycleNum2(mCurrCycle, curTag)
'
' Dim maxYinDisplayedSpectrum As Double
' ZoomToSILACgroup(maxYinDisplayedSpectrum)
' End Sub 'btnNextSpec_Click
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub SetMS1ByCycleNum2( _
ByVal aRawFileRef As Integer, _
ByVal aCycle As Integer)
'Changed PM_REFACTOR 2003-04-01. Note: there will be an extra
'ZoomToArgDoublet() call in SetAndDisplaySpectrum() - does it matter??.
Dim maxYinDisplayedSpectrum As Double = 0.0001 'For now.
SetAndDisplaySpectrum(mCurrCycle, maxYinDisplayedSpectrum) 'Why not aCycle???
'To delete at any time:
'Dim theStartT As Single = _
' mANALYSTCOM_WiffFile.GetActualTimeFromPeriodAndCycle(1, 0, 0, mCurrCycle)
'Call mANALYSTCOM_TheData.SetSpectrum(mWiffInfo.sample, 0, 0, theStartT, theStartT)
'Changed PM_REFACTOR 2003-10-08
'Delete at any time:
''trim the second line
'Dim titleStr As String = rawFile_DataTitle()
'Dim idx As Integer = titleStr.IndexOf(vbCr)
'If idx > 0 Then
' titleStr = titleStr.Remove(idx, titleStr.Length - idx)
'End If
'AxGraphControl_ANALYSTCOM_1.SeriesColl.Item(1).Title.Text = titleStr
'Changed PM_CYCLENUMBER_IN_SPECTRUM 2003-10-08
setTitleOnSpectrum(aCycle)
IntegrateCurrentPeaks2(aRawFileRef)
End Sub 'SetMS1ByCycleNum()
'Changed PM_REFACTOR 2003-10-13
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub NextOrPrevPept(ByVal aVisualIndex As Integer)
btnNextPept.Enabled = False 'Needed because quantitation may take a long time
btnPrevPept.Enabled = False
Dim savedColour As Color = btnNextPept.ForeColor
btnNextPept.ForeColor = Color.Red
Dim peptToken As Integer = _
Me.getPeptideTokenFromVisualIndex(aVisualIndex)
'Changed PM_REFACTOR 2003-10-13
newPeptideToDisplayOrQuantify(peptToken, aVisualIndex)
'Changed PM_REFACTOR 2003-10-13
If False Then 'Old. Is different, but does it make any difference.
' SetTheSpectrum(peptToken)
'
' 'Dim thePept As PeptideHitStructure = _
' ' ...(mProt2.pepts(mCurrPepIdx),
' ' PeptideHitStructure)
' Dim pept As PeptideHitStructure
' mProt2.peptides.peptideByToken(peptToken, pept)
'
' txtOutput.AppendText(pept.AASequence & vbCrLf)
End If
btnNextPept.ForeColor = savedColour
btnNextPept.Enabled = True
btnPrevPept.Enabled = True
End Sub 'NextOrPrevPept
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub prevPept()
'Changed PM_MISSINGS_OBJECT_EXCEPTION_SPECS 2003-10-16
'Dim visualIndex As Integer = Math.Max(0, mCurrPepIdx - 1)
Dim visualIndex As Integer = Math.Max(0, mCurrVisualPepIndex2 - 1)
NextOrPrevPept(visualIndex)
End Sub
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub nextPept()
'Changed PM_MISSINGS_OBJECT_EXCEPTION_SPECS 2003-10-16
Dim maxIndex As Integer = lvPept.Items.Count - 1
'Dim visualIndex As Integer = _
' Math.Min(mProt2.pepts.Count - 1, mCurrPepIdx + 1)
Dim visualIndex As Integer = _
Math.Min(maxIndex, mCurrVisualPepIndex2 + 1)
NextOrPrevPept(visualIndex)
End Sub
'Changed PM_DEADCODE 2008-05-05. Disabled. Not used anymore, but keep
' for reference for a while. We have similar ***menu*** commands.
' '****************************************************************************
' '* <placeholder for header> *
' '****************************************************************************
' Private Sub btnPrevPept_Click(ByVal sender As System.Object, _
' ByVal anEvent As System.EventArgs) _
' Handles btnPrevPept.Click
'
' prevPept()
' End Sub 'btnPrevPept_Click
'Changed PM_DEADCODE 2008-05-05. Disabled. Not used anymore, but keep
' for reference for a while. We have similar ***menu*** commands.
' '****************************************************************************
' '* <placeholder for header> *
' '****************************************************************************
' Private Sub btnNextPept_Click(ByVal sender As System.Object, _
' ByVal anEvent As System.EventArgs) _
' Handles btnNextPept.Click
'
' nextPept()
' End Sub 'btnNextPept_Click
'Changed PM_DEADCODE 2008-05-05. Disabled. Not used anymore, but keep
' for reference for a while. We have similar ***menu*** commands.
' '****************************************************************************
' '* <placeholder for header> *
' '****************************************************************************
' Private Sub btnQuantPept_Click(ByVal sender As System.Object, _
' ByVal anEvent As System.EventArgs) _
' Handles btnQuantPept.Click
'
' QuantitatePeptide()
' End Sub
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub QuantitatePeptide()
'quantitate one peptide automatically
'first we try a fixed time window for the quantitation
'try an iterative procedure
'ls;dj
Trace.Assert(False, "Stop!", "PIL ASSERT. Internal/development assert for stopping execution......")
End Sub
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub mnuClose_Click( _
ByVal aSender As System.Object, _
ByVal anEvent As System.EventArgs) _
Handles mnuClose.Click
Me.Close()
End Sub 'mnuClose_Click
'Changed PM_SPECTRAEXPORT_GENERALISED 2008-05-05. No longer needed, but
' we keep it for reference for a while as the output is slightly different
' than the standard output...
' '****************************************************************************
' '* <placeholder for header> *
' '****************************************************************************
' Private Function FormatQuantifiedPeptides() _
' As String
'
' 'Changed PM_EXCELEXPORT 2003-03-11
' 'To do:
' '1. Export ALL values
' '2. Add average for I(w.t.), XIC, I iso
' '3. Add Protein ratio: average, sigma, and inverted
' '4. Column with sequence plus modifications, exactly as in the
' ' result HTML file.
' '5.
'
' 'Changed PM_EXCELEXPORT 2003-03-11. Nothing change, just a note.
' Dim someStr As String = txtProteinRatio.Text & vbCrLf & vbCrLf 'TODO:
' ' do not use txtProteinRatio.Text, separate content into tab
' ' separated items.
'
' 'Changed PM_PEPTIDEFILTER_GENERALISED 2007-08-27
' 'For now: no filter.
' Dim somePeptideFilter As peptideFilterStructure = _
' peptideFilterStructure.noPepFilter()
' somePeptideFilter.quantifiedOnly = True
'
' 'Changed PM_QUANTEXPORT_RECALIBSWOP 2007-10-30
' 'There was an error here, swopping of slope and
' 'offset. Impact: only for export from the Quantitation window (this class).
' 'someStr &= quantApplication.peptideTableWithHeader2( _
' ' mB, mA, mProt2, mOptions.quantModeCode, mApplication, somePeptideFilter)
' someStr &= quantApplication.peptideTableHeaderWithAheader( _
' mRecalibrator, mProt2, mOptions.quantModeCode, _
' mApplication, somePeptideFilter)
'
' Return someStr
' End Function 'FormatQuantifiedPeptides()
'Unit for aTime is seconds
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub drawVerticalMarker( _
ByVal aTime_secs As Double, ByVal aColour As Color, _
ByVal anXOffset As Double, ByVal aXScaleFactor As Double, _
ByVal anYOffset As Double, _
ByRef aGraphics As Graphics)
Dim P1 As New Point
Dim P2 As New Point
Dim dashPen As Pen = New Pen(aColour, 1)
'Changed PM_LC_PEAKDETECTION 2003-03-20
'dashPen.DashStyle = DashStyle.Dash
dashPen.DashStyle = DashStyle.DashDot
'To catch result of division by zero, in a completely different place.
Trace.Assert(aTime_secs >= 0.0, _
"PIL ASSERT. aTime > 0.0. In drawVerticalMarker().")
P1.X = CInt((aTime_secs + anXOffset) * aXScaleFactor)
P2.X = P1.X
P1.Y = CInt(anYOffset)
P2.Y = 0
aGraphics.DrawLine(dashPen, P1, P2)
End Sub 'drawVerticalMarker()
'Changed PM_REFACTOR 2008-01-22
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub DrawLCPeak_Old(ByRef anInPept As PeptideHitStructure)
'Better to move this to a once-per-program-start place, e.g.
'the application object.
'Color.Cyan
' Dim penColours() As Color = _
' {Color.Black, _
' Color.Red, _
' Color.ForestGreen, _
' Color.DarkOrange, _
' Color.Yellow, _
'_
' Color.Violet, _
' Color.Brown, _
' Color.DarkSlateBlue, _
' Color.DarkSalmon _
' }
' Dim altPenColours() As Color = _
' {Color.Cyan, _
' Color.DarkRed, _
' Color.DarkSeaGreen, _
' Color.Red, _
' Color.Brown, _
'_
' Color.Violet, _
' Color.Brown, _
' Color.DarkSlateBlue, _
' Color.DarkSalmon _
' }
' Dim penColours() As Color = _
Dim penColours() As Color = _
{Color.DarkBlue, _
Color.DarkRed, _
Color.DarkGreen, _
Color.DarkOrange, _
Color.Yellow, _
_
Color.Violet, _
Color.Brown, _
Color.DarkSlateBlue, _
Color.DarkSalmon _
}
'Gray is a color, Grey is a *colour*.
Dim altPenColours() As Color = _
{Color.Blue, _
Color.Red, _
Color.Green, _
Color.DarkGray, _
Color.Brown, _
_
Color.Violet, _
Color.Brown, _
Color.DarkSlateBlue, _
Color.DarkSalmon _
}
Dim blackPen As Pen = New Pen(Color.Black, 2)
'Changed PM_REFACTOR 2006-10-11
Dim dishes As Integer = anInPept.LCprofilesProperties.Count
If dishes > 0 Then
Trace.Assert(Not anInPept.spectra Is Nothing, _
"PIL ASSERT. aPept.specs Is Nothing, in DrawLCPeak().")
Dim xScaleFactor As Double = -1.0E+20
Dim xOffset As Double = -1.0E+20
'Changed PM_PLOTADJUSTMENT 2006-11-05
'Dim availXPixels As Integer = pbLCpeak.Width - 4 'Keep 2 pixels
'' on each side.
Dim availXPixels As Integer = _
pbLCpeak.Width - 2 - (2 + 2 * dishes) 'Paren: 2 for the pixel
' margin, 2*dishes for x-offset for each LC profile (to show
' all LC profile at the same time).
Dim availYPixels As Integer = pbLCpeak.Height - 4
Dim yOffset As Double = availYPixels + 4
' For the offset from which to begin.
'Changed PM_REFACTOR 2006-10-16. Moved here.
'Set it as early as possible. Some functions used
'further down need them.
'Note: this is a side-effect of drawing the LC peak. Bad
' design - should be changed.
mY_Offset = yOffset
'Changed PM_LCPROFILE_ALSO_WHEN_NO_RATIO 2004-07-17
'Const PLOT_ZERO_THRESHOLD As Double = 0.0
Const PLOT_ZERO_THRESHOLD As Double = _
FindLCpeaks.IDENTICAL_ZERO_INTENSITY_THRESHOLD
'Dim pens(lastDishIndex) As Double not used...
If True Then 'GUI
''Dim LCG As Graphics = pbLCpeak.CreateGraphics
''Dim LCG As Graphics = Graphics.FromImage(pbLCpeak.Image)
If mLCG Is Nothing Then
mLCpeakBitmap = New Bitmap(pbLCpeak.Size.Width, _
pbLCpeak.Size.Height, pbLCpeak.CreateGraphics())
mLCG = Graphics.FromImage(mLCpeakBitmap)
'mLCG = pbLCpeak.CreateGraphics
'mLCG = Graphics.FromHwnd(pbLCpeak.Handle)
End If
mLCG.Clear(Color.White)
'Dim blackPen As Pen = New Pen(Color.Black, 2)
'Dim bluePen As Pen = New Pen(Color.Cyan, 2)
'Dim redPen As Pen = New Pen(Color.Red, 2)
'Dim xxPen As Pen = New Pen(Color.ForestGreen, 2) 'Proper
'' name when proper colour has been found...
End If
Dim lastDishIndex As Integer = dishes - 1
Dim lastIndex As Integer = anInPept.spectra.Count - 1
'Changed PM_REFACTOR 2006-10-11
''Get two arrays of values: x values are the ret times,
'' y values intensities.
''Changed PM_TRAILING_LCPOINTS_LEFTOUT 2004-06-22
''Dim xyVals(99, 3) As Double
'Dim xyVals(lastIndex + 1, 3) As Double '+1 to avoid unhandled
'' exception if lastIndex is 0.
Dim xyVals(lastIndex + 1, lastDishIndex + 1) As Double '+1 to avoid
' unhandled exception if lastIndex is 0.
' Second 1 is because the first item is for the X value.
'Changed PM_REFACTOR 2006-10-11
'Dim maxWT As Double = Double.MinValue
'Dim maxIso As Double = Double.MinValue
'Dim maxRatio As Double = Double.MinValue
'
''Changed PM_TRIPLE_ENCODING 2003-04-09
'Dim maxHigherIso As Double = Double.MinValue
Dim maxVals(lastDishIndex) As Double
ReDim mY_ScaleFactors(lastDishIndex)
ReDim mBackGround(lastDishIndex)
Dim maxIdxForScaleFactor As Integer = lastIndex
'Changed PM_REFACTOR 2006-10-12
Dim dish As Integer
For dish = 0 To lastDishIndex
maxVals(dish) = Double.MinValue
Dim i As Integer
For i = 0 To lastIndex
Dim specQuant As SpecQuantStructure = anInPept.spectra(i)
xyVals(i, 0) = specQuant.retT 'This is in seconds.
'Changed PM_REFACTOR 2006-10-11
' xyVals(i, 1) = specQuant.intensityWT
' maxWT = Math.Max(maxWT, specQuant.intensityWT)
'
' xyVals(i, 2) = specQuant.intensityStableIsotope
' maxIso = Math.Max(maxIso, specQuant.intensityStableIsotope)
'
' xyVals(i, 3) = specQuant.intensityEvenHigherStableIsotope
' maxHigherIso = _
' Math.Max( _
' maxHigherIso, specQuant.intensityEvenHigherStableIsotope)
Dim MSpeakArea As Double = _
specQuant.dishInfo(dish).MSpeakArea2
xyVals(i, dish + 1) = MSpeakArea
maxVals(dish) = Math.Max(maxVals(dish), MSpeakArea)
Next 'i. Through LC profile points
'For a single peak there is no x scaling. Insert an
'artificial peak at the double x to avoid this situation.
If lastIndex = 0 Then
maxIdxForScaleFactor = 1
xyVals(1, 0) = 2 * xyVals(0, 0)
'Changed PM_REFACTOR 2006-10-11
'xyVals(1, 1) = xyVals(0, 1)
'xyVals(1, 2) = xyVals(0, 2)
'xyVals(1, 3) = xyVals(0, 3)
xyVals(1, dish + 1) = xyVals(0, dish + 1)
Else
Trace.Assert(lastIndex > 0, _
"PIL ASSERT. maxIdx > 0. Single point LC peak. maxIdx: " & _
lastIndex & ". In DrawLCPeak().")
End If
'Changed PM_PLOTERROR 2006-11-05.
'xOffset = -xyVals(0, 0) + 2
'xScaleFactor = _
' (pbLCpeak.Width - 4) / _
' (xyVals(maxIdxForScaleFactor, 0) - xyVals(0, 0))
xOffset = -xyVals(0, 0)
xScaleFactor = _
availXPixels / _
(xyVals(maxIdxForScaleFactor, 0) + xOffset)
'Changed PM_REFACTOR 2006-10-16. Moved here.
'Set them as early as possible. Some functions used
'further down need them.
If dish = 0 Then
'Note: these are side-effects of drawing the LC peak. Bad
' design - should be changed.
mX_ScaleFactor = xScaleFactor
mX_Offset = xOffset
End If
'Changed PM_REFACTOR 2006-10-12
' 'Changed PM_STOP_BUG 2003-03-15
' Dim yScaleFactorWT As Double = 1 'This value will be the exception.
' If maxWT > PLOT_ZERO_THRESHOLD Then
' yScaleFactorWT = availYPixels / maxWT
' Else
' Dim peter22 As Integer = 22 'For breakpoints
' End If
'
' Dim yScaleFactorIso As Double = _
' yScaleFactorWT 'This value will be the exception.
' If maxIso > PLOT_ZERO_THRESHOLD Then
' yScaleFactorIso = availYPixels / maxIso
' Else
' Dim peter23 As Integer = 23 'For breakpoints
' End If
'
' 'Changed PM_TRIPLE_ENCODING 2003-04-09
' Dim yScaleFactorEvenHigherIso As Double = _
' yScaleFactorWT 'This value will be the exception.
' If maxHigherIso > PLOT_ZERO_THRESHOLD Then
' yScaleFactorEvenHigherIso = availYPixels / maxHigherIso
' End If
' 'Changed PM_LC_PEAKDETECTION 2003-03-20
' 'Have a clear area at the top so we can see the vertical
' 'lines in case they coincide with the LC points....
' yScaleFactorWT *= 0.9
' yScaleFactorIso *= 0.9
' 'Changed PM_TRIPLE_ENCODING 2003-04-09
' yScaleFactorEvenHigherIso *= 0.9
Dim yScaleFactor As Double = 1.0 'This value will be the exception.
Dim maxVal As Double = maxVals(dish)
If maxVal > PLOT_ZERO_THRESHOLD Then
yScaleFactor = availYPixels / maxVal
Else
Dim peter22 As Integer = 22 'For breakpoints
End If
yScaleFactor *= 0.9
If True Then 'GUI
'Now draw the values
Dim P1 As New Point
Dim P2 As New Point
'Dim P3 As New Point
'Dim P4 As New Point
Dim R1 As New RectangleF
For i = 0 To lastIndex
' 'WT
' P1.X = CInt((xyVals(i, 0) + xOffset) * xScaleFactor)
' P1.Y = CInt(yOffset)
' P2.X = P1.X
' P2.Y = CInt(yOffset - xyVals(i, 1) * yScaleFactorWT)
' 'Different colour if used for quantitation
' specQuant = ...(anInPept.specs(i), SpecQuantStructure)
' If specQuant.useForQuant_WT Then
' mLCG.DrawLine(bluePen, P1, P2)
' Else
' mLCG.DrawLine(blackPen, P1, P2)
' End If
'
' 'Isotope
' P1.X += 2 'offset to make them both visible
' P3.X = P1.X
' P3.Y = CInt(yOffset - xyVals(i, 2) * yScaleFactorIso)
' mLCG.DrawLine(redPen, P1, P3)
'
' 'Even higher isotope
' P1.X += 2 'offset to make this visible too
' P4.X = P1.X
' P4.Y = CInt(yOffset - xyVals(i, 3) * yScaleFactorEvenHigherIso)
' mLCG.DrawLine(xxPen, P1, P4)
Dim xValue As Integer = _
CInt((xyVals(i, 0) + xOffset) * xScaleFactor) + _
2 * dish + 2
P1.X = xValue
P1.Y = CInt(yOffset)
P2.X = P1.X
P2.Y = _
CInt(yOffset - xyVals(i, dish + 1) * yScaleFactor)
Dim specQuant As SpecQuantStructure = anInPept.spectra(i)
Dim colourToUse As Color = penColours(dish)
If specQuant.useForQuant_WT Then
colourToUse = altPenColours(dish)
End If
Dim penToUse As Pen = New Pen(colourToUse, 2)
mLCG.DrawLine(penToUse, P1, P2)
'redPen.Dispose()
penToUse.Dispose()
If dish = 0 Then
If specQuant.inLCwindow Then
R1.X = P2.X - 3
R1.Y = P2.Y - 14
R1.Width = 6
R1.Height = 10
If xyVals(i, dish + 1) > 0.1 Then
mLCG.DrawEllipse(blackPen, R1)
Else
Dim peter1 As Integer = 1
End If
Else
'empty
Dim peter79 As Integer = 79
End If
End If
Next i
End If 'GUI block
'Note: these are side-effects of drawing the LC peak. Bad design - should be changed.
If True Then
'Changed PM_REFACTOR 2006-10-12
' mY_ScaleFactorWT = yScaleFactorWT
' mY_ScaleFactorISO = yScaleFactorIso
' 'Later: = yScaleFactorEvenHigherIso
' mBckGrIntWT = IntWTFromPixelY(mBackGroundWtAsPixel)
' mBackGrIntIso = IntISOFromPixelY(mBackGroundIsoAsPixel)
mY_ScaleFactors(dish) = yScaleFactor
mBackGround(dish) = _
intensityFromPixelY(mBackGroundsAsPixel(dish), dish)
End If
'Now draw the background lines.
'DrawBckGrLn(mBackGroundWtAsPixel, True)
'DrawBckGrLn(mBackGroundIsoAsPixel, False)
Dim someFlag As Boolean = True 'Change later. What
' is the meaning of the flag?
DrawBckGrLn(mBackGroundsAsPixel(dish), someFlag)
Next dish
blackPen.Dispose()
If True Then '3 vertical for LC peak times.
'First draw a dashed line at sequencing time
'Draw a marker at sequencing point.
drawVerticalMarker(anInPept.MSMSretentionTimeMinutes * 60, _
Color.Black, xOffset, xScaleFactor, yOffset, mLCG)
'Changed PM_JA_TROUBLE 2004-05-11
Trace.Assert( _
anInPept.retentionTimeCentroid_secs > -1000000000000.0 AndAlso _
anInPept.retentionTimeCentroid_secs < 1000000000000.0, _
"PIL ASSERT. aPept.retentionTimeCentroid is infinite.")
'Changed PM_LC_CENTROID 2003-03-11
'Mark x centroid (retention time) for the LC peak,
drawVerticalMarker(anInPept.retentionTimeCentroid_secs, _
Color.Violet, xOffset, xScaleFactor, yOffset, mLCG)
mLogger.timeLog( _
"In DrawLCPeak(). anInPept.retentionTimeCentroid_secs: " & _
anInPept.retentionTimeCentroid_secs)
'Changed PM_LC_PEAKDETECTION 2003-03-20
drawVerticalMarker(anInPept.LCpeakDetectionTimeCentroidSeconds, _
Color.LightGreen, xOffset, xScaleFactor, yOffset, mLCG)
End If
'Changed PM_REFACTOR 2006-10-16. Moved up because some of the
' functions we use in the loops above need them.
''Changed PM_RATIO_PROBLEM 2003-08-11
''Note: these are side-effects of drawing the LC peak. Bad
'' design - should be changed.
'If True Then
' mX_ScaleFactor = xScaleFactor
' mX_Offset = xOffset
'
' mY_Offset = yOffset
'End If
'Changed PM_LCPEAK_DRAW 2003-03-24
'Save visual LC peak as a bitmap to avoid having to
'redraw everytime we get a refresh.
'System.Windows.Forms.Application.DoEvents()
'mLCpeakBitmap = New Bitmap(pbLCpeak.Size.Width, pbLCpeak.Size.Height, mLCG)
'Copy the bitmap to the form
pbLCpeak.CreateGraphics.DrawImage(mLCpeakBitmap, 0, 0)
'LCG.Dispose() no!
Else 'dishes > 0
'Nothing to plot!
Dim peter10 As Integer = 10
End If
mTEMPTEMP_LastPept = anInPept
End Sub 'DrawLCPeak_Old
'Changed PM_REFACTOR 2008-01-22. Old now in separate function so we are
' sure to call the new ZedGraph stuff.
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
'Note: this subroutine has the side-effect of changing some
' instance variables, e.g. mY_ScaleFactors
' is used in the mouse movement function, pbLCpeak_MouseMove() and
' the result can be strange output in the Status bar,
' e.g. "ret. T. 0:00 min. I (w.t.) -Infinity I (Iso) -Infinity"
' depending on the order of the calls.
Private Sub DrawLCPeakEtc(ByRef anInPept As PeptideHitStructure)
DrawLCPeak_Old(anInPept)
'Changed PM_LCPROFILE_MODERNPLOT 2008-01-22
mRetentionTimePlotting.setData(anInPept) 'Last
' parameter: depends on start-up value of
displayAkindOfLCplot()
End Sub 'DrawLCPeakEtc()
'Changed PM_REFACTOR 2005-12-05
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
'Name of this sub: is not more descriptive because we want it to be only
' associated with pbLCpeak_MouseDown() - at least for now.
'BTW: why do we do all these things, updating
Private Sub commonFor_pbLCpeak_MouseDown()
Dim pept As PeptideHitStructure = _
helper.blankPeptide() 'Keep compiler happy.
mProt.peptides.peptideByToken(mCurrPeptideToken, pept)
'Changed PM_REFACTOR 2003-08-08
Dim quantStats As quantStatsStructure
quantStats.dishInfo = Nothing
'False as this function is called from an event handler.
Me.AverageAndStDevFromMSLst(pept, quantStats, mDishes, False)
'Changed PM_REFACTOR 2003-08-08
someScreenUpdates(pept, quantStats)
'Changed PM_MANUAL_PEPTIDEQUANTSTATUSUPDATE 2003-05-06
'Will this not update the incorrect peptide line if the
'user changed the selection in the peptide list?????????
Me.visualUpdatePeptideListFromFieldsInPeptideStructure( _
lvPept.SelectedItems(0).Index, pept)
'Changed PM_REFACTOR 2005-12-05
'mProt2.pepts(mCurrPepIdx) = thePept 'reattach the peptide. write-back
'CalculateProteinRatio()
Me.peptideUpdated(mCurrPeptideToken, pept)
End Sub 'commonFor_pbLCpeak_MouseDown
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub pbLCpeak_MouseDown( _
ByVal aSender As Object, _
ByVal anEvent As System.Windows.Forms.MouseEventArgs) _
Handles pbLCpeak.MouseDown
'Changed PM_STRUCTURED_PROGRAMMING 2005-12-05
'One entry, one exit.....
Dim drawsomeBackGroundLine As Boolean = False
Dim dish As Integer = -1
Dim drawFlag As Boolean 'What is it for??
'First see if this is an attempt to set the background level manually
'Dim thePept As PeptideHitStructure
If anEvent.Button = Windows.Forms.MouseButtons.Left And _
Control.ModifierKeys = Keys.Control Then
'Set (subtract) background for wildtype...
'Changed PM_REFACTOR 2006-10-12
'mBackGroundWtAsPixel = anEvent.Y
'DrawBckGrLn(anEvent.Y, True) 'indicate background for wild type
''Changed PM_REFACTOR 2005-12-05
'Me.commonFor_pbLCpeak_MouseDown()
drawsomeBackGroundLine = True
dish = 0
drawFlag = True
Else
If anEvent.Button = Windows.Forms.MouseButtons.Left And _
Control.ModifierKeys = Keys.Alt Then
'Set (subtract) background for isotope...
'Changed PM_REFACTOR 2006-10-12
'mBackGroundIsoAsPixel = anEvent.Y
'DrawBckGrLn(anEvent.Y, False) 'indicate background for labeled form
''Changed PM_REFACTOR 2005-12-05
''We must update because all (effective) intensities have
''changed and thereby the quantitation ratios.
'Me.commonFor_pbLCpeak_MouseDown()
drawsomeBackGroundLine = True
dish = 1
drawFlag = False
Else
'Proceed with drag attempt to define quantitation region.
mLastMouseDownWithCtrPt.X = anEvent.X
mLastMouseDownWithCtrPt.Y = anEvent.Y
Dim retentionTimeSeconds As Double = RetTimeFromPixelX(anEvent.X)
Dim retTimeStr As String = _
quantApplication.sec2minuteString(retentionTimeSeconds)
'Changed PM_REFACTOR 2006-03-07
'StatusBar12.Text = retTimeStr & " min"
Dim msg As String = retTimeStr & " min"
Me.updateStatusBar(msg)
End If
End If
If drawsomeBackGroundLine Then
'Changed PM_REFACTOR_MARKER_BUG 2006-10-12
'Note: will fail if the dish 1 keyboard modifier is used when
' quantitation mode is No isotope...
mBackGroundsAsPixel(dish) = anEvent.Y
DrawBckGrLn(anEvent.Y, drawFlag)
Me.commonFor_pbLCpeak_MouseDown()
End If
End Sub 'pbLCpeak_MouseDown()
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub pbLCpeak_MouseUp(ByVal sender As Object, _
ByVal anEvent As System.Windows.Forms.MouseEventArgs) _
Handles pbLCpeak.MouseUp
'Changed PM_LCPROFILE_CRASH 2003-10-13
If Not mLCG Is Nothing Then 'Ignore until we have an LC profile
If anEvent.Button = Windows.Forms.MouseButtons.Left And _
(Control.ModifierKeys = Keys.Control Or _
Control.ModifierKeys = Keys.Alt) Then
Exit Sub 'for background level determination we have done our work in mouse down event
End If
If (anEvent.X < 0 Or anEvent.X > pbLCpeak.Width) Or _
(anEvent.Y < 0 Or anEvent.Y > pbLCpeak.Height) Then
'Changed PM_REFACTOR 2006-03-07
'StatusBar12.Text = "Drag canceled"
Me.updateStatusBar("Drag canceled")
mLastMouseDownWithCtrPt.X = 0
mLastMouseDownWithCtrPt.Y = 0
Exit Sub
End If
Dim T1 As Double = RetTimeFromPixelX(mLastMouseDownWithCtrPt.X)
Dim timeStr As String = _
quantApplication.sec2minuteString(T1)
Dim retTimeStr As String = "Quant region: from " & timeStr
'Changed PM_REFACTOR 2003-03-11
'Outfactored. Can be deleted at any time
'Dim theMinutes As Integer = CInt(Fix(theT1 / 60)) 'Fix truncates to lower integer
'Dim theSecs As Integer = CInt(theT1 - theMinutes * 60)
'Dim retTimeStr As String = "Quant region: from " & theMinutes.ToString & ":"
'If theSecs < 10 Then
' retTimeStr &= "0" & theSecs
'Else
' retTimeStr &= theSecs
'End If
retTimeStr &= " min to "
Dim T2 As Double = RetTimeFromPixelX(anEvent.X)
Dim timeStr2 As String = _
quantApplication.sec2minuteString(T2)
retTimeStr &= timeStr2
'Changed PM_REFACTOR 2003-03-11
'Outfactored. Can be deleted at any time
'theMinutes = CInt(Fix(theT2 / 60))
'theSecs = CInt(theT2 - theMinutes * 60)
'retTimeStr &= theMinutes.ToString & ":"
'If theSecs < 10 Then
' retTimeStr &= "0" & theSecs
'Else
' retTimeStr &= theSecs
'End If
'Changed PM_REFACTOR 2006-03-07
'StatusBar12.Text = retTimeStr & " min. (Right click and drag to deselect)"
Dim msg As String = _
retTimeStr & " min. (Right click and drag to deselect)"
Me.updateStatusBar(msg)
Dim isLeftMouseButton As Boolean = anEvent.Button = Windows.Forms.MouseButtons.Left
VerifyForQuant( _
T1, T2, isLeftMouseButton) 'True for selecting, false for deselecting.
'Changed PM_LCPEAK_DRAW_CLEANUP 2003-03-25
If Not mLCG Is Nothing Then
mLogger.timeLog("Call of DrawLCPeak() from pbLCpeak_MouseUp().")
DrawLCPeakEtc(mTEMPTEMP_LastPept)
End If
mLogger.timeLog("In pbLCpeak_MouseUp(). Just before Draw button simulation.")
Me.simulateDrawButtonClick() 'This is a temporary . Why is it that
' the side effect of pressing the Draw button is that correct
' value of retentionTimeCentroid is used in DrawLCPeak()?????
mLogger.timeLog("In pbLCpeak_MouseUp(). End of function.")
End If 'LC profile is defined
End Sub 'pbLCpeak_MouseUp()
'****************************************************************************
'* SUBROUTINE NAME: pbLCpeak_MouseMove *
'* <general description>. *
'* *
'* '''<summary>
'* ''' Purpose: general description
'* ''' <see cref="T:VBXMLDoc.CVBXMLDoc" />.
'* '''</summary>
'* '''<param name="application">
'* ''' Parameter of type <see cref="T:System.Object" />
'* '''</param>
'* '''<param name="connectMode">
'* ''' Parameter of type <see cref="T:Extensibility.ex_ConnectMode" />.
'* '''</param>
'* '''<remarks>
'* ''' <para>
'* ''' </para>
'* ''' <para>
'* ''' </para>
'* ''' <seealso cref="E:EnvDTE.BuildEvents.OnBuildDone" /> event. This
'* '''</remarks>
'd$ <summary>
'd$ Purpose 2: naked...
'd$ .
'd$ </summary>
'****************************************************************************
Private Sub pbLCpeak_MouseMove(ByVal sender As Object, _
ByVal anEvent As System.Windows.Forms.MouseEventArgs) _
Handles pbLCpeak.MouseMove
'Changed PM_LCPROFILE_CRASH 2003-10-13
If Not mLCG Is Nothing Then 'Ignore until we have an LC profile
If anEvent.Button = Windows.Forms.MouseButtons.Left And _
(Control.ModifierKeys = Keys.Control Or _
Control.ModifierKeys = Keys.Alt) Then
Exit Sub 'For background level determination we have
' done our work in mouse down event.
End If
'mLastMouseDownWithCtrPt.X). Unit: seconds.
Dim retentionTimeSeconds As Double = RetTimeFromPixelX(anEvent.X)
Dim timeStr As String = _
quantApplication.sec2minuteString(retentionTimeSeconds)
'Changed PM_LC_CENTROID 2003-03-11
'Draw when it is zero?
Dim pept As PeptideHitStructure = _
helper.blankPeptide() 'Keep compiler happy.
mProt.peptides.peptideByToken(mCurrPeptideToken, pept)
Dim RCtimeStr As String = _
quantApplication.sec2minuteString(pept.retentionTimeCentroid_secs)
'If the mouse is just passing over we give the retention
'time and the y intensity.
If anEvent.Button = Windows.Forms.MouseButtons.None Then
'Changed PM_RATIO_PROBLEM 2003-08-11
If anEvent.X = mLastMousePosition.X AndAlso _
anEvent.Y = mLastMousePosition.Y Then
'Mouse not moved.... Nothing to do
Dim peter67 As Integer = 67
Else
'Changed PM_REFACTOR 2006-10-12
' 'Determine the y intensity and debug this.
' Dim intWT As Double = IntWTFromPixelY(anEvent.Y)
' Dim intIso As Double = IntISOFromPixelY(anEvent.Y)
'
' 'Changed PM_REFACTOR 2006-03-07
' 'StatusBar12.Text = "ret.T. " & timeStr & " min. I (w.t.) " & _
' ' intWT.ToString("0") & " I (Iso) " & intIso.ToString("0") & _
' ' " LC centroid " & RCtimeStr & " min."
' Dim msg As String = _
' "ret.T. " & timeStr & " min. I (w.t.) " & _
' intWT.ToString("0") & " I (Iso) " & intIso.ToString("0") & _
' " LC centroid " & RCtimeStr & " min."
Dim msgSB As StringBuilder = New StringBuilder(200) 'Adjust
' later.
msgSB.Append("ret.T. ")
msgSB.Append(timeStr)
msgSB.Append(" min. ")
Dim lastIndex As Integer = mDishes - 1
Dim j As Integer
For j = 0 To lastIndex Step 1
Dim intensity As Double = _
intensityFromPixelY(anEvent.Y, j)
msgSB.Append(" I")
msgSB.Append(j + 1)
msgSB.Append(intensity.ToString("0"))
Next j
msgSB.Append(" LC centroid ")
msgSB.Append(RCtimeStr)
msgSB.Append(" min.")
Dim msg As String = msgSB.ToString()
Me.updateStatusBar(msg)
End If
'Changed PM_RATIO_PROBLEM 2003-08-11
mLastMousePosition.X = anEvent.X
mLastMousePosition.Y = anEvent.Y
Else
'We get here if we are in a drag operation.
Dim retTimeStr As String = _
"Defining quant region: from " & timeStr
retTimeStr &= " min to "
Dim theT2 As Double = RetTimeFromPixelX(anEvent.X)
Dim timeStr2 As String = _
quantApplication.sec2minuteString(theT2)
retTimeStr &= timeStr2
'Changed PM_REFACTOR 2006-03-07
'StatusBar12.Text = retTimeStr & " min. (Drag outside to cancel)"
Dim msg2 As String = retTimeStr & " min. (Drag outside to cancel)"
Me.updateStatusBar(msg2)
'Draw a line as visual feedback, but only when the mouse is down.
If anEvent.Button <> Windows.Forms.MouseButtons.None Then
Dim dashPen As New Pen(Color.Gray, 3)
'Gray is a color, Grey is a *colour*.
dashPen.EndCap = LineCap.Square
dashPen.StartCap = LineCap.Square
dashPen.DashStyle = DashStyle.Dash
Dim P1 As New Point( _
mLastMouseDownWithCtrPt.X, mLastMouseDownWithCtrPt.Y)
Dim P2 As New Point(anEvent.X, mLastMouseDownWithCtrPt.Y)
'Changed PM_ASSERT_BEFORE_RUNTIMEERROR 2003-08-2
Trace.Assert(Not mLCG Is Nothing, _
"PIL ASSERT. mLCG is null. In pbLCpeak_MouseMove().")
'Dim LCG As Graphics = pbLCpeak.CreateGraphics
mLCG.DrawLine(dashPen, P1, P2)
dashPen.Dispose()
'Changed PM_LCPEAK_DRAW_CLEANUP 2003-03-25
pbLCpeak.CreateGraphics.DrawImage(mLCpeakBitmap, 0, 0)
'LCG.Dispose() no
End If
End If
End If 'LC profile is defined
End Sub 'pbLCpeak_MouseMove()
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Function RetTimeFromPixelX(ByVal aPixel As Integer) As Double
'given the x location in the LC graph, return the retention time in seconds
'P1.X = CInt((xyVals(i, 0) + xOffset) * xScaleFactor)
Dim toReturn As Double = 0
If mX_ScaleFactor = 0 Or mX_Offset = 0 Then
'Empty
Else
toReturn = aPixel / mX_ScaleFactor - mX_Offset
End If
Return toReturn
End Function 'RetTimeFromPixelX
'Old. Delete at any time.
''****************************************************************************
''* <placeholder for header> *
''****************************************************************************
'Private Function IntWTFromPixelY(ByVal aPixelY As Integer) As Double
'
' 'Trace.Assert(mY_ScaleFactorWT <> 0.0, "PIL ASSERT. mY_ScaleFactorWT <> 0.0.")
'
' 'For now: return something reasonable
' Dim toReturn As Double = -0.00001
' If mY_ScaleFactorWT <> 0.0 Then
' toReturn = (mY_Offset - aPixelY) / mY_ScaleFactorWT
' Else
' Dim peter1 As Integer = 1
' End If
'
' 'given the Y location in the LC graph, return the intensity of the wild type ion
' 'P2.Y = CInt(yOffset - xyVals(i, 1) * yScaleFactorWT)
' Return toReturn
'End Function 'IntWTFromPixelY
'Old. Delete at any time.
''****************************************************************************
''* <placeholder for header> *
''****************************************************************************
'Private Function IntISOFromPixelY(ByVal aPixelY As Integer) As Double
' 'given the Y location in the LC graph, return the intensity of the labelled ion
' 'P3.Y = CInt(yOffset - xyVals(i, 2) * yScaleFactorIso)
'
' 'For now: return something reasonable
' Dim toReturn As Double = -0.00001
' If mY_ScaleFactorISO <> 0 Then
' toReturn = (mY_Offset - aPixelY) / mY_ScaleFactorISO
' Else
' Dim peter2 As Integer = 2
' End If
' Return toReturn
'End Function 'IntISOFromPixelY
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Function intensityFromPixelY( _
ByVal aPixelY As Integer, ByVal aDish As Integer) _
As Double
'Given the Y location in the LC graph, return the intensity of the
'labelled ion.
'P3.Y = CInt(yOffset - xyVals(i, aDish + 1) * yScaleFactorIso)
'For now: return something reasonable
Dim toReturn As Double = -0.00001
Dim yScaleFactor As Double = mY_ScaleFactors(aDish)
If yScaleFactor <> 0 Then
toReturn = (mY_Offset - aPixelY) / yScaleFactor
Else
Dim peter2 As Integer = 2
End If
Return toReturn
End Function 'intensityFromPixelY
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub VerifyForQuant( _
ByVal aStartRT As Double, ByVal aEndRT As Double, ByVal aVerify As Boolean)
'Called from a mouse event handler.
Dim pept As PeptideHitStructure = helper.blankPeptide() 'Keep compiler happy.
mProt.peptides.peptideByToken(mCurrPeptideToken, pept)
Dim quantModesObject As QuantitationModes_moreGeneral = _
mApplication.getQuantModes()
Dim spQ As SpecQuantStructure
Dim len As Integer = lvSpectra.Items.Count
Dim lastIndex As Integer = len - 1
Dim i As Integer
For i = 0 To lastIndex
spQ = pept.spectra(i)
Dim toSet As Boolean = True
If spQ.retT > aStartRT And spQ.retT < aEndRT Then
'Changed PM_REFACTOR 2006-10-06
' Dim lowerQuantResult As quantResultStructure = _
' ...(pept.lowerLCpeakProfile(i), _
' signalStructure).quantResult
'
' Dim higherQuantResult As quantResultStructure = _
' ...(pept.higherLCpeakProfile(i), _
' signalStructure).quantResult
'
' Dim evenHigherQuantResult As quantResultStructure = _
' ...(pept.evenHigherLCpeakProfile(i), _
' signalStructure).quantResult
'Changed PM_NOEMPTY_AT_DRAGLCPEAKSELECT 2006-04-05
'Do the same decisions as when initially quantifying.
Dim allGood As Boolean
Dim allBad As Boolean
Me.findQuantProperties( _
pept.LCpeakProfiles, _
i, _
allGood, allBad)
toSet = allGood
If aVerify Then
'Refactored out...
Else 'if the user wants the range cleared
toSet = Not toSet
End If
Else
toSet = False
End If
spQ.useForMW = toSet
spQ.useForQuant_WT = toSet
'Note: will fire an event, lvSpectra.ItemCheck....
' Handler: lvSpectra_ItemCheck().
lvSpectra.Items(i).Checked = toSet
pept.spectra(i) = spQ 'Write-back.
Next i
mLogger.timeLog( _
"In VerifyForQuant(). Before call of AverageAndStDevFromMSLst().")
'Changed PM_REFACTOR 2003-08-08
Dim quantStats As quantStatsStructure
quantStats.dishInfo = Nothing
'False as this function is called from an event handler.
Me.AverageAndStDevFromMSLst(pept, quantStats, mDishes, False)
'Changed PM_REFACTOR 2003-08-08
someScreenUpdates(pept, quantStats)
'Changed PM_MANUAL_PEPTIDEQUANTSTATUSUPDATE 2003-05-06
'Will this not update the incorrect peptide line if the
'user changed the selection in the peptide list?????????
Me.visualUpdatePeptideListFromFieldsInPeptideStructure( _
lvPept.SelectedItems(0).Index, pept)
mLogger.timeLog( _
"In VerifyForQuant(). After call of AverageAndStDevFromMSLst().")
'Changed PM_REFACTOR 2005-12-05
'mProt2.pepts(mCurrPepIdx) = thePept 'write-back. Reattach the peptide (why
'' did it even work before when it was up one line?).
'CalculateProteinRatio()
Me.peptideUpdated(mCurrPeptideToken, pept)
mLogger.timeLog("In VerifyForQuant(). Before call of lvPept.Refresh().")
lvPept.Refresh()
mLogger.timeLog("In VerifyForQuant(). After call of lvPept.Refresh().")
End Sub 'VerifyForQuant()
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub DrawBckGrLn( _
ByVal aYPixLoc As Integer, ByVal aIsWTFlag As Boolean)
'Changed PM_REFACTOR 2006-10-12
' 'check if a background line is indicated
' If (mBackGroundWtAsPixel <> pbLCpeak.Height And aIsWTFlag) Or _
' (mBackGroundIsoAsPixel <> pbLCpeak.Height And Not aIsWTFlag) Then
' 'draw a line indicating the background
'
' Dim somePen As New Pen(Color.Black, 2)
' somePen.DashStyle = DashStyle.Dot
'
' 'Dim LCG As Graphics = pbLCpeak.CreateGraphics
'
' Dim P1 As New Point(0, aYPixLoc)
' Dim P2 As New Point(pbLCpeak.Width, aYPixLoc)
' If aIsWTFlag Then
' somePen.Color = Color.Black
' Else
' somePen.DashStyle = DashStyle.Dash
' somePen.Color = Color.Red
' End If
' mLCG.DrawLine(somePen, P1, P2)
' somePen.Dispose()
'
' 'LCG.Dispose() no....
' End If
End Sub 'DrawBckGrLn()
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub BackgroundValuesToDefault(ByVal aDishes As Integer)
'Changed PM_REFACTOR 2006-10-12
'mBackGroundWtAsPixel = pbLCpeak.Height
'mBackGroundIsoAsPixel = pbLCpeak.Height
Dim lastIndex As Integer = aDishes - 1
ReDim mBackGroundsAsPixel(lastIndex)
Dim j As Integer
For j = 0 To lastIndex Step 1
mBackGroundsAsPixel(j) = pbLCpeak.Height
Next j
End Sub 'BackgroundValuesToDefault
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub frmQuantWindow_Load(ByVal aSender As System.Object, _
ByVal anEvent As System.EventArgs) _
Handles MyBase.Load
'Empty!
End Sub 'frmQuantWindow_Load()
'Changed PM_QUANT_AUTOMATION 2003-03-11
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Public Sub doQuantitateProtein()
QuantifyProtein()
End Sub 'doQuantitateProtein()
'Changed PM_EXPORT_QUANTIFIED 2003-03-12
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Public Function getCurrentProtein() _
As ProteinHitStructure
Return mProt
End Function 'getCurrentProtein()
'Changed PM_LCPEAK_DRAW 2003-03-24
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub frmQuantWindow_Paint( _
ByVal sender As Object, _
ByVal e As System.Windows.Forms.PaintEventArgs) _
Handles MyBase.Paint
If Not (mLCpeakBitmap Is Nothing) Then
'e.Graphics.DrawImage(mLCpeakBitmap, 0, 0)
'e.Graphics.DrawImage(mLCpeakBitmap, 0, 0)
End If
End Sub 'frmQuantWindow_Paint()
'Changed PM_LCPEAK_DRAW 2003-03-24
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub LC_Paint( _
ByVal sender As Object, _
ByVal anEvent As System.Windows.Forms.PaintEventArgs) _
Handles pbLCpeak.Paint
If Not (mLCpeakBitmap Is Nothing) Then
'e.Graphics.DrawImage(mLCpeakBitmap, 0, 0)
'e.Graphics.DrawImage(mLCpeakBitmap, 0, 0)
anEvent.Graphics.DrawImage(mLCpeakBitmap, 0, 0)
'DrawLCPeak(mTEMPTEMP_LastPept)
End If
End Sub 'LC_Paint()
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub pbLCpeak_Paint(ByVal sender As Object, _
ByVal anEvent As System.Windows.Forms.PaintEventArgs) _
Handles pbLCpeak.Paint
'Is this really supposed to be empty? Why not delete this function?
'This crashes because it is called too early.
'Dim thePept As PeptideHitStructure =
' ...(mProt2.pepts(mCurrPepIdx), _
' PeptideHitStructure)
'DrawLCPeak(thePept)
Dim peter67 As Integer = 67
End Sub
'Changed PM_LCPEAK_DRAW 2003-03-24
'
' Is this function used????
'
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Protected Overrides Sub onPaint( _
ByVal anEvent As PaintEventArgs)
MyBase.OnPaint(anEvent)
If False And Not mTEMPTEMP_LastPept.spectra Is Nothing Then
'pbLCpeak.CreateGraphics.DrawImage(mLCpeakBitmap, 0, 0)
'DrawLCPeak(mTEMPTEMP_LastPept)
'Test only!!!
Dim g As Graphics = anEvent.Graphics
Dim myPen As Pen = New Pen(Color.Blue, 2)
g.DrawLine(myPen, 10, 10, 210, 210)
g.DrawLine(myPen, 10, 210, 210, 10)
g.DrawEllipse(myPen, 50, 50, 200, 100)
myPen.Dispose()
End If
End Sub 'onPaint()
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub MenuItem3_Click(ByVal sender As System.Object, _
ByVal anEvent As System.EventArgs) _
Handles mnuRefreshForm.Click
Me.Refresh()
End Sub
'This is for a temporary fix. The real reason should be found.
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub simulateDrawButtonClick()
btnDraw.PerformClick()
'Dim retLng As Long
'Dim xu As Long = btnDraw.Handle
'btnDraw.
'retLng = SendMessage(btnDraw.Handle, _
' BM_SETSTATE, _
' 1&, _
' 0&)
''btnDraw.Value = True
'retLng = SendMessage(btnDraw.Handle, BM_SETSTATE, 0&, 0&)
End Sub 'simulateDrawButtonClick
'Changed PM_QUANTWINDOWS_SELECTION 2008-05-05. No longer needed, but
' keep it for reference for a while.
'Changed PM_REFACTOR 2003-04-15
' '****************************************************************************
' '* <placeholder for header> *
' '****************************************************************************
' Private Function peptideWithSpectraInformationString() _
' As String
'
' Dim peptideIndex As Integer = lvPept.SelectedIndices.Item(0)
' Dim peptToken As Integer = _
' Me.getPeptideTokenFromVisualIndex2(peptideIndex)
'
' Dim pept As PeptideHitStructure = helper.blankPeptide() 'Keep compiler happy.
' mProt2.peptides.peptideByToken(peptToken, pept)
'
' Dim saveStr As String = CalSpectrumTableSaveStr(pept)
' Return saveStr
' End Function 'peptideWithSpectraInformationString
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
'Note: ***identical*** to sub of the same name in
' "frmProteinList.vb"/Class frmProteinList. They are in different
' forms. How do we refactor? SaveFileDialog1 and ParserStatus/StatusBar12
' belongs to a particular form.
'
Public Function pushToUserSelectedFile2( _
ByVal aStr As String, _
ByVal aOKStatusStr As String, _
ByVal aStartFileName As String) _
As Boolean
'Return value is true if the file was saved, false if the user cancelled.
Dim toReturn As Boolean = _
PILInputOutput.pushToUserSelectedFile2( _
aStr, SaveFileDialog1, StatusBar1.Text, _
aOKStatusStr, aStartFileName)
Return toReturn
End Function 'pushToUserSelectedFile2()
'Changed PM_SPECTRAEXPORT_GENERALISED 2008-05-05. No longer needed, but
' we keep it for reference until the new version works...
' '****************************************************************************
' '* <placeholder for header> *
' '****************************************************************************
' Private Sub mnuSaveQuantified_Click( _
' ByVal aSender As System.Object, _
' ByVal anEvent As System.EventArgs) _
' Handles mnuSaveQuantified.Click
'
' Dim saveStr As String = FormatQuantifiedPeptides()
'
' 'Use return value for some text reporting to GUI?
' Dim wasSaved As Boolean = _
' pushToUserSelectedFile2( _
' saveStr, "Saved quantified peptides to file.", "")
'
' End Sub 'mnuSaveQuantified_Click
'Changed PM_SPECTRAEXPORT_GENERALISED 2008-05-05. No longer needed, but
' we keep it for reference until the new version works...
' '****************************************************************************
' '* <placeholder for header> *
' '****************************************************************************
' Private Sub mnuExportQuantified_Click( _
' ByVal aSender As System.Object, _
' ByVal anEvent As System.EventArgs) _
' Handles mnuExportQuantified.Click
'
' Dim saveStr As String = FormatQuantifiedPeptides()
' PILInputOutput.pushToExcel(saveStr)
' End Sub 'mnuExportQuantified_Click
'Changed PM_DEBUG_EVENTCOUNTS 2003-08-12
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub updateDebugCountersDisplay()
'Changed PM_DEBUG_EVENTCOUNTS 2003-08-12
'Debug only. Use the status bar at the bottom to display
'number of handled "clicked" events.
Dim toOutput As String = _
"Pept events: " & mTempPeptideAcceptedItemClickedCount & "/" & _
mTempPeptideItemClickedCount & ". " & _
"Spectrum events: " & mTempSpectrumAcceptedItemClickedCount & "/" & _
mTempSpectrumItemClickedCount & "."
'Changed PM_REFACTOR 2006-03-07
'StatusBar12.Text = toOutput
Me.updateStatusBar(toOutput)
End Sub 'updateDebugCountersDisplay
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub specFieldsQuantitationWasUpdated_byIndex( _
ByVal aPeptideToken As Integer)
'Dim thePept As PeptideHitStructure = _
' ...(mProt2.pepts(aPeptideIndex),
' PeptideHitStructure)
Dim pept As PeptideHitStructure = helper.blankPeptide() 'Keep compiler happy.
'Changed PM_CLEANER 2006-03-21
'mProt2.peptides.peptideByToken(mCurrPeptideToken, pept)
mProt.peptides.peptideByToken(aPeptideToken, pept)
'Changed PM_REFACTOR 2003-08-08
Dim quantStats As quantStatsStructure
quantStats.dishInfo = Nothing
'False as this function is called from an event handler.
Me.AverageAndStDevFromMSLst(pept, quantStats, mDishes, False)
'Changed PM_REFACTOR 2003-08-08
someScreenUpdates(pept, quantStats)
'Changed PM_UPDATE_PROTEINTRATIO 2005-12-05
'This solves it, peptideUpdated() will result in
'update in Protein List window
'Changed PM_REFACTOR 2005-12-05
'mProt2.pepts(aPeptideIndex) = thePept 'write-back. Peptide.
''write-back protein as well?
'CalculateProteinRatio()
'ColourPeptideItems()
Me.peptideUpdated(mCurrPeptideToken, pept)
End Sub 'specFieldsQuantitationWasUpdated_byIndex()
'Changed PM_REFACTOR 2006-03-15
'Not used....
' '****************************************************************************
' '* <placeholder for header> *
' '****************************************************************************
' Private Sub clearQuantitationStatusForSpecList( _
' ByVal aPeptideIndex As Integer)
'
' 'Dim thePept As PeptideHitStructure = _
' ' ...(mProt2.pepts(aPeptideIndex), _
' ' PeptideHitStructure)
'
' If Not (thePept.specs Is Nothing) Then
' Dim len As Integer = thePept.specs.Count
'
' 'Loop:
' Dim i As Integer
' For i = 0 To len - 1
' updateSpecFields_QuantitationStatus(thePept, i, False)
' Next
'
' mProt2.pepts(aPeptideIndex) = thePept 'write-back. Necessary for
' ' specFieldsQuantitationWasUpdated().
'
' specFieldsQuantitationWasUpdated_byIndex(aPeptideIndex)
' End If
' End Sub 'clearQuantitationStatusForSpecList
'Changed PM_REFACTOR 2003-08-12
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub applySpectrumRulesToOneSpectrum_NoWriteBack3( _
ByRef anInOutSpectrumInfo As SpecQuantStructure, _
ByRef anInPept As PeptideHitStructure, _
ByRef anOutChangedState As Boolean)
'Changed PM_FASTER 2007-01-26. Added parameter anOutChangedState.
anOutChangedState = False
'Note: it ***is*** "<" as we are only changing some already
' checked to an unchecked state....
If anInOutSpectrumInfo.useForQuant_WT Then
' Trace.Assert(anInPept.maxWTintensity >= 0, _
' "PIL ASSERT. anInPept.maxWTintensity is undefined. " & _
' "In applySpectrumRulesToOneSpectrum_NoWriteBack().")
' Trace.Assert(anInPept.maxIsotopeintensity >= 0, _
' "PIL ASSERT. anInPept.maxIsotopeintensity is undefined. " & _
' "In applySpectrumRulesToOneSpectrum_NoWriteBack().")
' Trace.Assert(anInPept.maxHigherIsotopeTintensity >= 0, _
' "PIL ASSERT. anInPept.maxHigherIsotopeTintensity is undefined. " & _
' "In applySpectrumRulesToOneSpectrum_NoWriteBack().")
'
' 'We compute this every time the function is called. Optimisation
' 'will be to compute somewhere else, once per peptide. But it may
' 'not matter at all.
' Dim WTlcPeakIntensityThreshold As Double = _
' 0.2 * anInPept.maxWTintensity
' Dim IlcPeakIntensityThreshold As Double = _
' 0.2 * anInPept.maxIsotopeintensity
' Dim HIlcPeakIntensityThreshold As Double = _
' 0.2 * anInPept.maxHigherIsotopeTintensity
' 'Dim lcPeakIntensityThreshold As Integer = 678
'
' 'This will fail for no isotope!!!!!
'
' 'Changed PM_KEEP_HIGHEST_FOR_RATIOS 2003-06-26
'
' Dim fail1 As Boolean = anInOutSpectrumInfo.intensityWT < WTlcPeakIntensityThreshold
' Dim fail2 As Boolean = anInOutSpectrumInfo.intensityStableIsotope < IlcPeakIntensityThreshold
'
' 'Dim quantitationModesObject As QuantitationModes = _
' ' mApplication.getQuantitationModesObject()
' 'Dim curQuantMode As quantitationModeStructure = _
' ' quantitationModesObject.getQuantitationMode( _
' ' mOptions.quantModeCode)
' Dim quantitationModesObject As QuantitationModes_moreGeneral = _
' mApplication.getQuantModes()
' Dim curQuantMode As generalisedQuantModeStructure = _
' quantitationModesObject.getQuantitationMode( _
' mOptions.quantModeCode)
'
' 'Changed PM_GENERALISED_QUANT_MODE 2003-12-08
' 'Very important check!!
' 'Changed PM_REFACTOR 2003-11-25
' 'If mOptions.quantMode = quantModeEnum.enumArg13C6C10 Then
' Dim qCode As Integer = mOptions.quantModeCode
'
' Dim fail3 As Boolean
' If QuantitationModes_moreGeneral.isTripleQuant_new(curQuantMode) Then
' fail3 = _
' anInOutSpectrumInfo.intensityEvenHigherStableIsotope < _
' HIlcPeakIntensityThreshold
' Else
' fail3 = False
' End If
'Changed PM_LOCAL_20_PERCENT_RULE 2007-01-31
Dim LCMaxIndex As Integer = anInPept.LCMaxIndex 'Note: based
' on LC peak detection for the first SILAC dish.
'So much easier!
Dim dishes As Integer = anInPept.LCprofilesProperties.Count
Dim lastIndex As Integer = dishes - 1
Dim failTot As Boolean = False
Dim j As Integer
For j = 0 To lastIndex Step 1
'Not really needed anymore - for debugging.
Dim someProfileProps As LCprofilesPropertiesStructure = _
anInPept.LCprofilesProperties(j)
'Dim maxIntensity As Double = someProfile.maxIntensity
Dim maxMSpeakArea As Double = someProfileProps.maxMSpeakArea
Trace.Assert(maxMSpeakArea >= 0, _
"PIL ASSERT. maxMSpeakArea for SILAC dish " & (j + 1) & _
"is undefined. " & _
"In applySpectrumRulesToOneSpectrum_NoWriteBack().")
'Note: we repeat computing this threshold stuff for every
'spectrum. We could compute it once in the caller and
'pass a vector of thresholds.
'Changed PM_LOCAL_20_PERCENT_RULE 2007-01-31
'Dim lcPeakIntensityThreshold As Double = 0.2 * maxMSpeakArea
Dim maxLCpoint As massSpectrometryBase.signalStructure = _
anInPept.LCpeakProfiles(j)(LCMaxIndex)
' Note 1: this may not be the max index for profiles
' other than for the first SILAC dish.
'
' Note 2: based on LC peak detection for the first SILAC dish.
'
Dim LCpeakMax As Double = maxLCpoint.Ysig
'Marker: 20 percent.
Dim lcPeakIntensityThreshold2 As Double = 0.2 * LCpeakMax
'Changed PM_MARKER_NOTUPDATED_UNCHECKED_SPECTRA 2007-01-29. Note: code
'marker only... -no code change.
Dim fail As Boolean = _
anInOutSpectrumInfo.dishInfo(j).MSpeakArea2 < _
lcPeakIntensityThreshold2
failTot = failTot Or fail
Next j
'Changed PM_REFACTOR 2006-10-12
'If fail1 Or fail2 Or fail3 Then
' updateSpecFields_QuantitationStatus_NoWriteBack( _
' anInOutSpectrumInfo, False)
'End If
If failTot Then
updateSpecFields_QuantitationStatus_NoWriteBack( _
anInOutSpectrumInfo, False)
anOutChangedState = True
End If
End If '.useForQuant_WT
End Sub 'applySpectrumRulesToOneSpectrum_NoWriteBack
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub applySpectrumRules_ModelOnly( _
ByRef aPept As PeptideHitStructure, _
ByVal aPeptideToken As Integer)
If Not aPept.spectra Is Nothing Then
Dim lastIndex As Integer = aPept.spectra.Count - 1
Dim spectrumIndex As Integer
For spectrumIndex = 0 To lastIndex
'Changed PM_REFACTOR 2003-08-12. To allow applying the rules
' just after quantifying a single spectrum. However it may
' not possible if all spectra must have been processed
' before the rules can be appplied.
Dim outSpectrum As SpecQuantStructure = _
aPept.spectra(spectrumIndex)
Dim stateChange As Boolean
'Note: we do it for one spectrum at a time, but it can
' only be done after quantifying all spectra as some
' parameters are found during quantitation.
applySpectrumRulesToOneSpectrum_NoWriteBack3( _
outSpectrum, aPept, stateChange)
'Changed PM_FASTER 2007-01-26
If stateChange Then
aPept.spectra(spectrumIndex) = outSpectrum 'Write-back.
End If
Next
'Changed PM_REFACTOR 2003-08-11. Disabled. Done elsewhere (?).
'mProt2.pepts(aPeptIndex) = aPept 'write-back. Necessary for
' specFieldsQuantitationWasUpdated().
End If
End Sub 'applySpectrumRules_ModelOnly
'Not currently used. Should this checking be re-enabled?
''Changed PM_KEEP_HIGHEST_FOR_RATIOS 2003-06-25
''****************************************************************************
''* <placeholder for header> *
''****************************************************************************
'Private Sub applySpectrumRules( _
' ByRef aPept As PeptideHitStructure, _
' ByVal aPeptIndex As Integer)
' If Not (aPept.specs Is Nothing) Then
' applySpectrumRules_ModelOnly(aPept, aPeptIndex)
' specFieldsQuantitationWasUpdated_byIndex(aPeptIndex)
' End If
'End Sub 'applySpectrumRules()
'Changed PM_STOP_AQUISITION 2003-09-29
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub btnStopQuantitation_Click(ByVal sender As System.Object, _
ByVal anEvent As System.EventArgs) _
Handles btnStopQuantitation.Click
mStopAquisition = True
btnStopQuantitation.ForeColor = Color.DarkBlue
End Sub
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub lvPeptItem_MouseHover2( _
ByVal sender As Object, _
ByVal anEvent As System.EventArgs) _
Handles lvPept.MouseHover
Dim rowInFocus As ListViewItem = lvPept.FocusedItem
'lvPept2.MousePosition()
If Not rowInFocus Is Nothing Then
'Dim clickIndex As Integer = anEvent.Index
'Dim aRowToSet As ListViewItem = lvPept2.Items(clickIndex)
'ToolTipMPQuant.SetToolTip(aRowToSet, clickIndex.ToString)
''
ToolTipMPQuant.SetToolTip(lvPept, "XYZ help")
Dim newTooltipText As String = DirectCast(rowInFocus.Tag, String)
If newTooltipText = "" Then
newTooltipText = "<>"
End If
ToolTipMPQuant.SetToolTip(lvPept, newTooltipText)
Else
Dim peter9 As Integer = 9
End If
End Sub 'lvPeptItem_MouseHover2
'****************************************************************************
'* R A W F I L E A C C E S S E S , B E G I N *
'****************************************************************************
'Changed PM_REFACTOR_FINNEGAN 2003-06-02
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Function rawFile_DataTitle() As String
'Return mANALYSTCOM_TheData.DataTitle
'Sample for Analyst file: '" +TOF MS: Experiment 1, 0.034 min from Q1LCMS190203_01DoubleArg.wiff'.
Return mRawDataFileHandling.DataTitle()
End Function
'Changed PM_MSQA 2003-03-31
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub GetMSDataPointsInRange( _
ByVal aRawFileRef As Integer, _
ByVal aStartMass As Double, ByVal anEndMass As Double, _
ByRef anOutSignal As List(Of massSpectrometryBase.signalStructure), _
ByRef anOutNotEnoughDataPoints As Boolean)
'Old:
' ByRef anOutSignal As ArrayList
'Changed PM_SEVERALWIFFS 2003-08-26
Trace.Assert(aRawFileRef > 0, _
"PIL ASSERT. Bad raw file ID, " & aRawFileRef & ".")
Const MIN_DATAPOINTS As Integer = 5 'In very clean spectra it
' can be the case that there are very few or no datapoints in
' a mass range to the left of a mono isotopic peak.
anOutNotEnoughDataPoints = False
'Changed PM_REFACTOR 2006-10-12
'anOutSignal = New ArrayList
anOutSignal = New List(Of massSpectrometryBase.signalStructure)
'Changed PM_REFACTOR_FINNEGAN 2003-07-10
'Now most of it is in the new class!
Dim dataPointsInfo As dataPointsInfoStructure2
'Changed PM_SEVERALWIFFS 2003-08-26
'mRawDataFileHandling.DataPoints( _
' aStartMass, anEndMass, 883, anOutSignal, dataPointsInfo)
mRawDataFileHandling.DataPoints( _
aStartMass, anEndMass, aRawFileRef, anOutSignal, _
dataPointsInfo) 'mDataPointsInfoForLastSpectrum
Dim datapoints As Integer = anOutSignal.Count
If datapoints < MIN_DATAPOINTS Then
anOutNotEnoughDataPoints = True
End If
End Sub 'GetMSDataPointsInRange()
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub nonPeptideListUpdates( _
ByRef aPept As PeptideHitStructure, _
ByVal aCycle As Integer, _
ByVal anLCprofileIndex As Integer)
'Changed PM_QUANT_AUTO_CENTERING 2006-11-13. New parameters.
If True Then '
'Changed PM_MSZOOM_TO_MAXLC 2003-04-08
'MS spectrum display.
Dim maxYinDisplayedSpectrum As Double
SetAndDisplaySpectrum(aCycle, maxYinDisplayedSpectrum)
'Changed PM_CYCLENUMBER_IN_SPECTRUM 2003-10-08
'MS spectrum display.
setTitleOnSpectrum(aCycle)
'Changed PM_FINNIGAN_QUANTWINDOW_RELATIVE 2005-07-12
Dim deltaMass As Double = _
0.5 * mXICwindow.XICwindowSize(aPept.measuredMCR)
'Changed PM_QUANT_AUTO_CENTERING 2006-11-13
Dim count1 As Integer = aPept.LCpeakProfiles(0).Count
Dim count2 As Integer = aPept.spectra.Count
Trace.Assert(count1 = count2, _
"PIL ASSERT. Number of items in LCpeakProfiles(0) (" & count1 & _
") does not correspond to spectra (" & count2 & ").")
Dim someLCpoint As signalStructure = _
aPept.LCpeakProfiles(0)(anLCprofileIndex)
Dim quantOffset As Double = someLCpoint.tagValue3
'Changed PM_REFACTOR 2008-01-29
Dim someSpectrum As SpecQuantStructure = _
aPept.spectra(anLCprofileIndex)
'MS spectrum display.
addQuantMarkers( _
aPept.charge, deltaMass, aPept.uncalibratedSILACmasses2, _
quantOffset, _
someSpectrum.dishInfo, maxYinDisplayedSpectrum, _
aPept.AASequence)
DrawLCPeakEtc(aPept) 'This may flash very fast.
'Changed PM_CENTERSPECTRIMLINE_QUANTWINDOW 2004-11-02
'Affects upper right display.
makeSpectrumLineForLCMaxVisible(aPept.spectra, aCycle)
End If
End Sub 'nonPeptideListUpdates
'DDDDDDDDDDD A marker!
'
'Core for quantiation - also computations in:
' FillOutlvSpectra()
' CalcParametersForCurrentMS()
' GetLowerAndHigherMZ()
' GetIntegratedPeakIntensityAtMass()
'
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub Fill_lvPept( _
ByRef aPept As PeptideHitStructure, _
ByVal aPeptideToken As Integer, _
ByVal aNonPeptideListUpdates As Boolean, _
ByVal aIsLastPeptide As Boolean)
Dim doUpdateNonPeptideListStuff As Boolean = aNonPeptideListUpdates
' May be changed further down...
'Needed because we call spectraRange_External() or
'spectraRange_Internal() first .....
mRawDataFileHandling.newCurrentFile(aPept.rawFileID)
'ToDo: implement this: If aPept.bckGrIso = 0 And aPept.bckGrWT = 0 Then
BackgroundValuesToDefault(mDishes) 'reset both background values
'Changed PM_QUANTIFY_FROMFILE_RET_START_AND_END 2003-03-15
'Dim theRT As Double
'Dim t1_secs As Double
'Dim t2_secs As Double
Dim outStartSpectrum As spectrumSpecStructure
Dim outEndSpectrum As spectrumSpecStructure
'Changed PM_FINNIGAN_QUANTWINDOW_RELATIVE 2005-07-12
Dim deltaMass As Double = _
0.5 * mXICwindow.XICwindowSize(aPept.measuredMCR)
'Changed PM_LCPEAKDETECTION_OPTIONS 2006-06-20
'Moved up here...
Dim corr As correlationSettingsStructure = _
mApplication.getCorrSettings()
'Changed PM_REFACTOR 2004-02-02
If FindLCpeaks.isExternalQuantitation(aPept) Then
'If aPept.retentionTimeEndMinutes < -0.000001 Then 'Negative value is a
' flag that we should use an EXTERNALLY specified LC time window.
'Changed PM_REFACTOR 2004-02-02
''Changed PM_INSERTEDPEPTIDES_LCWINDOW_TROUBLE 2004-01-26
''This should be removed when the user can select how
''to set the score for inserted peptides ...
'Trace.Assert(aPept.MascotScore < 98.99 Or aPept.MascotScore > 99.01, _
' "PIL ASSERT. Fixed LC window for inserted peptide... Sequence: " & aPept.AASequence)
'
'What is this for??? And what does this text mean???
'
Trace.Assert(Not FindLCpeaks.isInsertedPeptide(aPept), _
"PIL ASSERT. Fixed LC window for inserted peptide... Sequence: " & _
aPept.AASequence & ". Score: " & aPept.MascotScore)
'Needed?
' theRT = (aPept.retentionTimeStartMinutes + _
' (-aPept.retentionTimeEndMinutes)) / 2
' 'Somewhere in the middle, not so critical.
'
't1_secs = aPept.retentionTimeStartMinutes * 60
't2_secs = -aPept.retentionTimeEndMinutes * 60
Dim retRange As retentionTimeRangeStructure
retRange.startTime_secs = aPept.retentionTimeStartMinutes * 60
retRange.endTime_secs = -aPept.retentionTimeEndMinutes * 60
mRawDataFileHandling.spectraRange_External( _
retRange, outStartSpectrum, outEndSpectrum)
Else
'-60 secs ?????????????????????????????????? Find in old versions
Const PRE_PICK_QUANT_TIME_SECS As Single = 30 '30 seconds before
' the peptide was picked (this is in seconds).
Const POST_PICK_QUANT_TIME_SECS As Single = 90 '1.5 minutes after
' the peptide was picked.
Dim effectivePre As Double
Dim effectivePost As Double
If False Then
'Old
effectivePre = PRE_PICK_QUANT_TIME_SECS
effectivePost = POST_PICK_QUANT_TIME_SECS
Else
'User defined
effectivePre = corr.leftLCwindowSecs
effectivePost = corr.rightLCwindowSecs
End If
'theRT = aPept.retentionTimeStartMinutes
't1 = theStartT - PRE_PICK_QUANT_TIME
't2 = theStartT + POST_PICK_QUANT_TIME
Dim retT_secs As Double = aPept.retentionTimeStartMinutes * 60
mRawDataFileHandling.spectraRange_Internal( _
retT_secs, effectivePre, effectivePost, _
outStartSpectrum, outEndSpectrum)
Trace.Assert(retT_secs >= outStartSpectrum.retentionTime_secs AndAlso _
retT_secs <= outEndSpectrum.retentionTime_secs, _
"PIL ASSERT. t2_secs > t1_secs, in Fill_lvPept()")
End If
'Shortcuts for the asserts
Dim t1_secs As Double = outStartSpectrum.retentionTime_secs
Dim t2_secs As Double = outEndSpectrum.retentionTime_secs
Trace.Assert(t2_secs >= t1_secs, _
"PIL ASSERT. t2_secs > t1_secs, in Fill_lvPept()")
Trace.Assert(t1_secs > 0, "PIL ASSERT. t1_secs > 0, in Fill_lvPept()")
Trace.Assert(t2_secs > 0, "PIL ASSERT. t2_secs > 0, in Fill_lvPept()")
'Input for the rest...
Dim startCycle As Integer = outStartSpectrum.specNum
Dim endCycle As Integer = outEndSpectrum.specNum
'We can already calculate the two masses that we want to integrate
'mCurrPepIdx is set in calling function (double click).
Dim haveSpecList As Boolean = Not (aPept.spectra Is Nothing)
Dim LCwindowStartCycle As Integer = startCycle
Dim LCwindowEndCycle As Integer = endCycle
Dim scanFilter As spectrumSubTypeEnum = _
spectrumSubTypeEnum.enumIsNormalMS
If Not haveSpecList Then
mLogger.timeLog( _
"In Fill_lvPept(). Before LC peak detection. startCycle: " & _
startCycle & ". endCycle: " & endCycle)
'Changed PM_REFACTOR 2003-04-11
'findLCpeak(theStartCycle, theEndCycle, _
' theLCwindowStartCycle, theLCwindowEndCycle, aPept)
Trace.Assert(deltaMass > 0.0, "PIL ASSERT. mDeltaMass is undefined!")
'Changed PM_EVENMORE_GENERALISED_QUANTMODES 2005-04-08
'Dim quantitationModesObject As QuantitationModes = _
' mApplication.getQuantitationModesObject()
'Dim curQuantitationMode As quantitationModeStructure = _
' quantitationModesObject.getQuantitationMode( _
' mOptions.quantModeCode)
Dim quantitationModesObject As QuantitationModes_moreGeneral = _
mApplication.getQuantModes()
Dim curQuantitationMode As generalisedQuantModeStructure = _
quantitationModesObject.getQuantitationMode( _
mOptions.quantModeCode)
Dim quantModeClassification As QuantModeClassificationStruct = _
QuantitationModes_moreGeneral.doQuantModeClassification( _
curQuantitationMode)
'Changed PM_REFACTOR 2003-10-14
Dim LCprofile As FindLCpeaks = New FindLCpeaks
LCprofile.initLCPeakFind( _
startCycle, endCycle, aPept, mRawDataFileHandling, _
mProt, mCurrPeptideToken, _
mRecalibrator, _
deltaMass, _
mFixBackground, quantModeClassification, _
mOptions.MStypes, _
corr, _
mDishes)
While LCprofile.doChunkLCPeakFind()
'Do some progress update here
Application.DoEvents()
End While
'Copy information from XYZ, to aPept.specs and to lvSpectra.
'Changed PM_REFACTOR 2003-10-14
LCprofile.GetLCprofileResult( _
aPept, LCwindowStartCycle, LCwindowEndCycle, _
scanFilter, mOptions.MStypes)
' If False Then
' Dim lastIndex As Integer = aPept.lowerLCpeakProfile.Count - 1
' Dim str As String = _
' BSignal.dumpLCprofile(aPept.lowerLCpeakProfile, _
' 0, lastIndex, _
' 199, aPept.queryNumber, _
' aPept.AASequence, aPept.calibratedMeasuredMCR, aPept.charge)
' PILInputOutput.pushToFile( _
' "C:\_LCprofileDump_" & aPept.AASequence & "_" & aPept.charge & _
' "_" & aPept.rawFileID & ".txt", str)
' End If
mLogger.timeLog( _
"In Fill_lvPept(). After LC peak detection. theStartCycle: " & _
startCycle & ". theEndCycle: " & endCycle)
'Changed PM_REFACTOR 2003-04-11
'Reality check in the MS spectrum
MSQA(aPept.LCMaxCycle, aPept) 'Later: use cycle for max for the
' selected LC peak.
'Changed PM_COMMANDLINE 2006-11-15
mApplication.quantifiedAnotherPeptide()
Else
Dim peter2 As Integer = 2 'Already quantified.
End If 'no specList
lvSpectra.Items.Clear()
'Changed PM_SPECTRUM_LINES_UPDATE 2003-08-12
'Moved to here from beginning of function to let the user view
'the result of the previous peptide's spectra quantitation result.
'On selection of a peptide, fill the MS list.
'lvSpectra.Items.Clear()
If haveSpecList Then 'Just fill in the saved values.
'Ignore current start/end. Use our saved values.
startCycle = aPept.savedStartCycle
endCycle = aPept.savedEndCycle
'Changed PM_TRIPLEDISPLAY_MORE_PERFORMANCETROUBLE 2003-06-23
Dim savedAvoid1 As Boolean = mPeptide_AvoidListEvents1
mPeptide_AvoidListEvents1 = True
'For already quantified: we only need to fill in the spectra GUI
'list for the very last peptide. Client indicates if it is the case.
If aIsLastPeptide Then
'Changed PM_REFACTOR_FINNEGAN 2003-08-21
Dim lastIndex As Integer = aPept.spectra.Count - 1
Dim index As Integer
'For theCycle = theStartCycle To theEndCycle
For index = 0 To lastIndex
FromSaved_FillOutlvSpetra(index, aPept)
Next
'Changed PM_QUANTWINDOW_REOPEN_NO_UPDATE_FOR_PEPTIDE_CLICK 2007-07-30
''Changed PM_TRIPLEDISPLAY_MORE_PERFORMANCETROUBLE 2003-06-23
'mPeptide_AvoidListEvents1 = savedAvoid1 now on same level as the save...
Else
doUpdateNonPeptideListStuff = False 'Not the last peptide... Avoid
' possible exceptions in call of nonPeptideListUpdates()....
End If
'Changed PM_QUANTWINDOW_REOPEN_NO_UPDATE_FOR_PEPTIDE_CLICK 2007-07-30
'Moved from if block.
mPeptide_AvoidListEvents1 = savedAvoid1
Else
aPept.savedStartCycle = startCycle
aPept.savedEndCycle = endCycle
mLogger.timeLog("Before doQuantifyAPeptide().")
'Changed PM_MVC_QUANTIFY 2003-08-06
doQuantifyAPeptide( _
aPept, startCycle, endCycle, _
LCwindowStartCycle, LCwindowEndCycle, _
scanFilter)
mLogger.timeLog("After doQuantifyAPeptide().")
'Changed PM_MISSINGS_OBJECT_EXCEPTION_SPECS 2003-10-16
Trace.Assert(Not aPept.spectra Is Nothing, _
"PIL ASSERT. Spectra do not exist. In Fill_lvPept().")
'Changed PM_KEEP_HIGHEST_FOR_RATIOS 2003-06-25
'Removing some spectra for quantitation that we can not remove
'before we .
applySpectrumRules_ModelOnly(aPept, aPeptideToken)
If True Then
'Changed PM_POSTQUANTITATION_MISSING_UDPATE 2007-01-26
Dim lastQuantifiedSpectraList As List(Of Integer) = _
New List(Of Integer)
If True Then
Dim prof As List( _
Of massSpectrometryBase.signalStructure) = _
aPept.LCpeakProfiles(0)
Dim lastIndex As Integer = prof.Count() - 1
Dim j As Integer
For j = 0 To lastIndex Step 1
lastQuantifiedSpectraList.Add(j)
Next j
End If
'Changed PM_MARKER 2007-01-29
'Changed PM_POSTQUANTITATION_MISSING_UDPATE 2007-01-26
'We must wait until here??
rangedAddAndUpdateSpectrumInfo(aPept, lastQuantifiedSpectraList)
End If
'specFieldsQuantitationWasUpdated_byIndex(aPeptIndex)
End If
'Changed PM_REFACTOR 2003-08-08
Dim quantStats As quantStatsStructure
quantStats.dishInfo = Nothing
'Changed PM_QUANTWINDOW_REOPEN_CHECKED_FOR_USE_IN_QUANT 2007-07-30
Dim forceChecked As Boolean = Not haveSpecList
Me.AverageAndStDevFromMSLst(aPept, quantStats, mDishes, forceChecked)
'Changed PM_REFACTOR 2006-03-15
''Changed PM_REFACTOR 2003-08-11
'mProt2.pepts(aPeptIndex) = aPept 'write-back. Peptide.
mProt.peptides.updatePeptideByToken(aPeptideToken, aPept) 'Do we
' need to do this if the peptide has already
' been quantified????
mLogger.timeLog("Before screen updats().")
If True Then 'false: temp!!!!!!!!!!!!!
'Changed PM_REFACTOR 2003-08-08
someScreenUpdates(aPept, quantStats)
'Changed PM_QUANTWINDOWS_SELECTION 2008-04-30
'Will this fire events??
Dim selected As Integer = lvPept.SelectedItems.Count
Trace.Assert(selected = 1, _
"PIL ASSERT. Number of selected peptides is not one: " & selected)
'Changed PM_MANUAL_PEPTIDEQUANTSTATUSUPDATE 2003-05-06
Me.visualUpdatePeptideListFromFieldsInPeptideStructure( _
lvPept.SelectedItems(0).Index, aPept)
'Changed PM_TRIPLEDISPLAY_PERFORMANCETROUBLE 2003-06-19
lvPept.Refresh()
End If
'Changed PM_REFACTOR 2005-03-06
If doUpdateNonPeptideListStuff Then
Me.nonPeptideListUpdates(aPept, aPept.LCMaxCycle, aPept.LCMaxIndex)
End If
mLogger.timeLog("After screen updats().")
End Sub 'Fill_lvPept()
'Changed PM_MSZOOM_TO_MAXLC 2003-04-08
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Function makeSpectrumLineForLCMaxVisible( _
ByRef anInSpectra2 As List(Of SpecQuantStructure), _
ByVal aCycle As Integer) _
As Single
'Old:
' ByRef anInSpectra As ArrayList
'Note: we don't look into lvSpectra, we assume we can just
' index into . Does this work when we only display
' e.g. SIM spectra (Tools/Options setting)?
Dim lastIndex As Integer = anInSpectra2.Count - 1
Dim i As Integer
'Changed PM_SPECTRUM_SCROLL_BUG 2008-04-24
'Dim lastGUIindex As Integer = lvSpectra.Items.Count()
Dim lastGUIindex As Integer = lvSpectra.Items.Count() - 1
'ASSERT lastIndex and lastGUIindex ???
'Linear search...
For i = 0 To lastIndex
Dim curCycle As Integer = anInSpectra2(i).cycle
If curCycle >= aCycle Then 'We can not check for exact match as
' the max may not be a spectrum in the list. We just use
' close match instead.
'Changed PM_SPECTRUM_SCROLL_BUG 2008-04-02
'8 is half the number of displayed.
'Dim effIndex As Integer = i - 8
Dim effIndex As Integer = i + 8 'As the item scrolled
' to by EnsureVisible() is usually displayed at the
' bottom of the pane.
If effIndex < 0 Then
effIndex = 0
End If
If effIndex > lastGUIindex Then
effIndex = lastGUIindex
End If
lvSpectra.EnsureVisible(effIndex)
Exit For 'We must escape.
End If
Next i
End Function 'makeSpectrumLineForLCMaxVisible
'Changed PM_REFACTOR 2003-04-01
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Function SetAndDisplaySpectrum( _
ByVal aCycle As Integer, _
ByRef anOutMaxYval As Double) _
As Single
'Changed PM_REFACTOR_FINNEGAN 2003-07-10
' Dim startT As Single = _
' mANALYSTCOM_WiffFile.GetActualTimeFromPeriodAndCycle(1, 0, 0, aCycle)
' Call mANALYSTCOM_TheData.SetSpectrum( _
' mWiffInfo.sample, 0, 0, startT, startT)
Dim dummy4 As SpectrumClassificationStructure
dummy4.dataSourceName = Nothing 'Keep compiler happy.
Dim retentionTime_Secs As Double = _
mRawDataFileHandling.newSpectrumBySpectrumNumber(aCycle, dummy4)
Trace.Assert(retentionTime_Secs > 0.0, _
"PIL ASSERT. retentionTime_Secs > 0.0. In SetAndDisplaySpectrum().")
'Changed PM_XY_EXPORT 2005-01-10
'asdasd() ' Perhaps save information about last displayed spectrum
' for use for X-Y export.
ZoomToSILACgroup(anOutMaxYval)
'Changed PM_XY_EXPORT 2005-01-11
'Old. Delete at any time.
''Changed PM_FINNEGAN_DISPLAY 2003-10-23
''Analyst specific!
'Select Case mOptions.rawFileMode
' Case rawFileModeEnum.enumAnalyst
' 'deliberately empty
' Case rawFileModeEnum.enumFinnegan
' Me.newSpectrumControlUpdate()
' Case rawFileModeEnum.enumMicromass
' Me.newSpectrumControlUpdate()
' Case Else
' Trace.Assert(False, "PIL ASSERT. Select Case never fall-through")
'End Select
Me.newSpectrumControlUpdate()
Return CSng(retentionTime_Secs)
End Function 'SetAndDisplaySpectrum
'****************************************************************************
'* R A W F I L E A C C E S S E S , E N D *
'****************************************************************************
'********************************
'********************************
'********************************
'********************************
'****************************************************************************
'* A N A L Y S T D E P E N D E N T , B E G I N *
'****************************************************************************
'Changed PM_FINNEGAN_DISPLAY 2003-10-23
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub newSpectrumControlUpdate()
mMSdisplay.updateData()
End Sub 'newSpectrumControlUpdate
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub SetTheSpectrum(ByVal aPeptideToken As Integer)
'Sets the mCurrCycle instance variable.
Dim pept As PeptideHitStructure = helper.blankPeptide() 'Keep compiler happy.
mProt.peptides.peptideByToken(aPeptideToken, pept)
'Note: MSMSretentionTimeMinutes may be rounded off, e.g. to two decimal
' places for minutes in the Mascot result file, which again may
' be caused by rounding in the program that produced a Mascot
' input file, e.g. IDAprocessor.
Dim RT_secs As Double = 60.0 * pept.MSMSretentionTimeMinutes
'Adaption to previous:
If True Then
Dim outStartSpectrum As spectrumSpecStructure
Dim outEndSpectrum As spectrumSpecStructure
mRawDataFileHandling.spectraRange_Internal( _
RT_secs, 0, 0, _
outStartSpectrum, outEndSpectrum)
mCurrCycle = outStartSpectrum.specNum
End If
'Changed PM_REFACTOR 2003-04-01. Note: ZoomToArgDoublet() is
'called before mANALYSTCOM_TheData is set. Does it matter?
'Note: assumes that mCurrCycle has been found from theRT in the
' code above.
Dim maxYinDisplayedSpectrum As Double
SetAndDisplaySpectrum(mCurrCycle, maxYinDisplayedSpectrum)
Me.newSpectrumControlUpdate()
'Changed PM_CYCLENUMBER_IN_SPECTRUM 2003-10-08
setTitleOnSpectrum(mCurrCycle)
ZoomToSILACgroup(maxYinDisplayedSpectrum) 'Needed ??
'Changed PM_REFACTOR 2006-03-07
'StatusBar12.Text = thePept.AASequence & " " & " Score = " & _
' thePept.MascotScore.ToString("0") & _
' " MCR = " & thePept.measuredMZ.ToString(".000")
Dim msg As String = _
pept.AASequence & " " & " Score = " & _
pept.MascotScore.ToString("0") & _
" MCR = " & pept.measuredMCR.ToString(".000")
Me.updateStatusBar(msg)
End Sub 'SetTheSpectrum
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub ZoomToSILACgroup(ByRef anOutMaxYval As Double)
Dim lowerX, higherX As Double
Dim pept As PeptideHitStructure = helper.blankPeptide() 'Keep compiler happy.
mProt.peptides.peptideByToken(mCurrPeptideToken, pept)
'Dim MCR As Double = pept.measuredMZ not used....
'Changed PM_REFACTOR 2006-10-03
'Dim lowerPeakPos As Double
'Dim higherPeakPos As Double
'Dim evenHigherPeakPos As Double
'Dim charge As Integer
'FindLCpeaks.computeSILACmasses( _
' mProt2, mCurrPeptideToken, _
' mA, mB, _
' lowerPeakPos, higherPeakPos, evenHigherPeakPos, _
' charge)
'Dim highMassToUse As Double = higherPeakPos
'
''Changed PM_BETTER_ZOOM 2004-07-08
''If evenHigherPeakPos > 0 Then
'If evenHigherPeakPos > higherPeakPos Then
' highMassToUse = evenHigherPeakPos
'Else
' Dim peter2 As Integer = 2
'End If
'Changed PM_REFACTOR 2006-10-03
Dim uncalibratedSILACmasses As List(Of Double) = _
pept.uncalibratedSILACmasses2
Dim lastIndex As Integer = uncalibratedSILACmasses.Count - 1
Dim lowerPeakPos As Double = uncalibratedSILACmasses(0)
Dim highMassToUse As Double = uncalibratedSILACmasses(lastIndex)
'Changed PM_SPECTRUM_ZOOM_WINDOW 2003-11-24
''Changed PM_SPECTRUM_ZOOM_WINDOW 2003-10-27
''lowerX = lowerPeakPos - 2.0
''higherX = highMassToUse + 2.0
'lowerX = lowerPeakPos - 0.5
'higherX = highMassToUse + 3.5
lowerX = lowerPeakPos - 1.5
higherX = highMassToUse + 2.5
'Old:
' mANALYSTCOM_TheData.GetYValueRangeForXValueRange( _
' lowerX, higherX, minYPt, maxYPt)
' AxGraphControl_ANALYSTCOM_1.GraphArea.YAxis.Max = _
' mANALYSTCOM_TheData.GetDataPointYValue(maxYPt)
Dim maxYval As Integer = _
CInt(mRawDataFileHandling.maxYValueInMassRange(lowerX, higherX))
Dim zoom As massZoomStructure
zoom.startMass = lowerX
zoom.endMass = higherX
zoom.maxYVal = maxYval
Dim fullZoom As massZoomStructure
'Changed PM_ZOOM_QUANTWINDOW_BROKEN 2005-07-13
'This does not work, the structure only contains narrow range
'for integration, not several Daltons.... Instead make it
'a bit wider than initial spectrum mass range. The
'only purpose here is to make zooming work. It is not
'so interesting to zoom much further out.
' fullZoom.startMass = mDataPointsInfoForLastSpectrum.minX2
' fullZoom.endMass = mDataPointsInfoForLastSpectrum.maxX2
fullZoom.startMass = zoom.startMass - 100.0
fullZoom.endMass = zoom.endMass + 100.0
'Changed PM_QSTAR_BROKEN_QUANTITATION 2007-10-09
'To avoid ASSERT "aMaxY is undefined: 0." in AnalystCOM.vb
fullZoom.maxYVal = maxYval
If fullZoom.startMass > zoom.startMass Then
fullZoom.startMass = zoom.startMass
End If
If fullZoom.endMass < zoom.endMass Then
fullZoom.endMass = zoom.endMass
End If
mLogger.timeLog( _
"For setInitialZoom(): [" & fullZoom.startMass & _
"; " & fullZoom.endMass & "].")
mMSdisplay.setInitialZoom(fullZoom)
mLogger.timeLog( _
"For setZoomRange2(): [" & zoom.startMass & _
"; " & zoom.endMass & "].")
mMSdisplay.setZoomRange2(zoom)
anOutMaxYval = maxYval
End Sub 'ZoomToSILACgroup()
'****************************************************************************
'* A N A L Y S T D E P E N D E N T , E N D *
'****************************************************************************
'********************************
'********************************
'****************************************************************************
'* M V C , B E G I N *
'****************************************************************************
'Changed PM_QUANTSPEEDUP 2003-08-07
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub rangedAddAndUpdateSpectrumInfo( _
ByRef aPept As PeptideHitStructure, _
ByRef aLastQuantifiedSpectraList2 As List(Of Integer))
'Changed PM_REFACTOR 2003-08-11
Dim savedAvoid2 As Boolean = mSpectrum_AvoidListEvents2
mSpectrum_AvoidListEvents2 = True
Dim specQuant As SpecQuantStructure
specQuant.dishInfo = Nothing
Dim i As Integer
Dim len As Integer = aLastQuantifiedSpectraList2.Count
For Each i In aLastQuantifiedSpectraList2
specQuant = aPept.spectra(i)
addVisual_SpectrumLine(specQuant)
'visualAddAndUpdateSpectrumInfo(theSpecQuant)
Next
'Changed PM_REFACTOR 2003-08-11
mSpectrum_AvoidListEvents2 = savedAvoid2
'Changed PM_REFACTOR 2008-03-25
Dim lastGUIindex As Integer = lvSpectra.Items.Count() - 1
If lastGUIindex > -1 Then
lvSpectra.EnsureVisible(lastGUIindex) 'Ensure that last
' addition is visible by scrolling.
lvSpectra.Refresh()
Else
Dim peter9 As Integer = 9 'Still empty..
End If
If len > 0 Then
rawSpectrumUpdate( _
specQuant, aPept.uncalibratedSILACmasses2, _
aPept.AASequence) 'Display the last
' spectrum for the range of .
End If
End Sub 'rangedAddAndUpdateSpectrumInfo
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub doQuantifyAPeptide( _
ByRef aPept2 As PeptideHitStructure, _
ByVal aStartCycle As Integer, ByVal anEndCycle As Integer, _
ByVal aLCwindowStartCycle As Integer, ByVal aLCwindowEndCycle As Integer, _
ByVal anInScanFilter As spectrumSubTypeEnum)
'Old:
' ByRef anOutMaxIntensWt As Double, _
' ByRef anOutMaxIntensI As Double, _
' ByRef anOutMaxIntensHI As Double, _
'Later: eliminate parameters aLCwindowStartCycle and aLCwindowEndCycle.
aPept2.spectra = New List(Of SpecQuantStructure)
'Changed PM_FINNEGAN_RETENTION_TIME 2003-11-18
Trace.Assert( _
Not (aPept2.retentionTimeStartMinutes > 4444.4444 AndAlso _
aPept2.retentionTimeStartMinutes < 4444.4445), _
"PIL ASSERT. Retention time not patch properly.")
'Changed PM_REFACTOR 2006-10-06
''Changed PM_KEEP_HIGHEST_FOR_RATIOS 2003-06-25
'anOutMaxIntensWt = -1000000.0
'anOutMaxIntensI = -1000000.0
'anOutMaxIntensHI = -1000000.0
'Changed PM_ONLY_MSPEAKAREA 2006-11-10
'Dim maxIntensities As List(Of Double) = Nothing
Dim maxMSpeakAreas As List(Of Double) = Nothing
'Changed PM_REFACTOR 2006-10-12
''Changed PM_REFACTOR 2006-08-31
''For notational convenience.
'Dim prof As ArrayList = aPept2.lowerLCpeakProfile
Dim prof2 As List(Of massSpectrometryBase.signalStructure) = _
aPept2.LCpeakProfiles(0)
Dim LCprofileSize2 As Integer = prof2.Count
Dim lastIndex As Integer = LCprofileSize2 - 1
Dim specQuant2 As SpecQuantStructure
specQuant2.dishInfo = Nothing
Dim lastQuantifiedSpectraList2 As ArrayList = New ArrayList 'Note: is
' cleared in the loop below everytime there is a progress update.
'Changed PM_EFFICIENCY 2007-10-10. Moved to constructor so the
'correct countdown number will actually eventually be found.
'Dim timeSliceSecs2 As Double = 2.0
'timeSliceSecs2 = 0.5
mChunkerPeptideQuantitation.Init(0, lastIndex, False)
Dim outIterations As Integer = 0
While Not mChunkerPeptideQuantitation.jobFinished() AndAlso _
Not mStopAquisition
outIterations += 1
If outIterations > 1 Then
Dim peter2 As Integer = 2
End If
While Not mChunkerPeptideQuantitation.timeIsUp()
Dim LCindex As Integer = _
mChunkerPeptideQuantitation.currentNumber()
'Changed PM_REFACTOR 2006-10-12
'Note: is using LC profile for wild type...
'Dim someSignal As signalStructure = _
' ...(prof(LCindex), signalStructure)
Dim someSignal As signalStructure = prof2(LCindex)
Dim cycle2 As Integer = someSignal.tagValue2
Dim inLCwindow As Boolean = False
'If cycle2 >= MS_LCwindowStartCycle And _
' cycle2 <= aLCwindowEndCycle Then
If cycle2 >= aLCwindowStartCycle And _
cycle2 <= aLCwindowEndCycle Then
inLCwindow = True
Else
Dim peter31 As Integer = 31
End If
'Changed PM_REFACTOR 2006-10-06
'Dim intensWT As Double
'Dim intensI As Double
'Dim intensHI As Double
'Changed PM_ONLY_MSPEAKAREA 2006-11-10
'Dim intensities As List(Of Double) = Nothing
Dim MSpeakAreas As List(Of Double) = Nothing
quantForOneSpectrum( _
inLCwindow, LCindex, _
MSpeakAreas, _
aPept2, _
specQuant2)
'Changed PM_REFACTOR 2006-10-06
''Changed PM_KEEP_HIGHEST_FOR_RATIOS 2003-06-25
'If intensWT > anOutMaxIntensWt Then
' anOutMaxIntensWt = intensWT
'End If
'If intensI > anOutMaxIntensI Then
' anOutMaxIntensI = intensI
'End If
'If intensHI > anOutMaxIntensHI Then
' anOutMaxIntensHI = intensHI
'End If
If maxMSpeakAreas Is Nothing Then 'Lazy instantiation
maxMSpeakAreas = _
New List(Of Double)(MSpeakAreas.Count)
Dim someMSpeakArea As Double
For Each someMSpeakArea In MSpeakAreas
maxMSpeakAreas.Add(someMSpeakArea) '-1.0E+20
Next 'Through intensities
End If
Dim lastIndex2 As Integer = MSpeakAreas.Count - 1
Dim j As Integer
For j = 0 To lastIndex2 Step 1
'Dim intensity As Double = intensities(j)
Dim MSpeakArea As Double = MSpeakAreas(j)
Dim maxMSpeakArea As Double = maxMSpeakAreas(j)
If MSpeakArea > maxMSpeakArea Then
maxMSpeakAreas(j) = MSpeakArea
End If
Next j
lastQuantifiedSpectraList2.Add(LCindex)
End While 'Not timeIsUp()
'Changed PM_POSTQUANTITATION_MISSING_UDPATE 2007-01-26. Turned off.
' Effectively turns off partial update of the spectrum list.
' It is turned off in order to wait until the underlying boolean
' field for the Check state has been updated at the end of
' the quantitation.
'
' If we need partial update again in the future then some
' complicated gyrations must take place after quantitation in
' order to properly update the check boxes.
'
''lastQuantifiedSpectraList2 is cleared below!
'rangedAddAndUpdateSpectrumInfo(aPept2, lastQuantifiedSpectraList2)
'Changed PM_QSTAR_BROKEN_QUANTITATION_FULLZOOMBUG 2007-10-10
Dim currentCountDownFrom As Integer = _
mChunkerPeptideQuantitation.getINTERNAL_mCurrentCountDownFrom()
mLogger.timeLog("currentCountDownFrom=" & currentCountDownFrom)
lastQuantifiedSpectraList2.Clear()
'Probably too often
Me.newSpectrumControlUpdate()
Application.DoEvents()
End While
'Write the max values to the peptide...
If True Then
'Changed PM_REFACTOR_MARKER 2006-10-13
'Create LCprofilesProperties if it does not already exist, etc.
If aPept2.LCprofilesProperties Is Nothing Then
aPept2.LCprofilesProperties = _
New List(Of LCprofilesPropertiesStructure)
End If
If aPept2.LCprofilesProperties.Count = 0 Then
Dim somePr As LCprofilesPropertiesStructure
somePr.totalLCSignal = 0.0
somePr.totalLCPeakArea = 0.0
somePr.averageOfRatios2 = 0.0
somePr.ratioStDev = -77.777777777
somePr.backGround = 0.0
somePr.maxMSpeakArea = 0.0
Dim lastIndex3 As Integer = maxMSpeakAreas.Count - 1
Dim dish As Integer
For dish = 0 To lastIndex3
aPept2.LCprofilesProperties.Add(somePr)
Next dish
End If
Dim lastIndex2 As Integer = aPept2.LCprofilesProperties.Count - 1
Dim j As Integer
For j = 0 To lastIndex2
Dim someItem As LCprofilesPropertiesStructure = _
aPept2.LCprofilesProperties(j)
someItem.maxMSpeakArea = maxMSpeakAreas(j)
aPept2.LCprofilesProperties(j) = someItem 'Write-back.
Next j
End If
End Sub 'doQuantifyAPeptide
'****************************************************************************
'* M V C , E N D *
'****************************************************************************
'Changed PM_MAXWT_USEDFORQUANT 2003-10-01
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub lsvPepts_SelectedIndexChanged(ByVal sender As System.Object, _
ByVal anEvent As System.EventArgs) _
Handles lvPept.SelectedIndexChanged
'Why is this function called two times when the user changes
'selection (single line only) - first with empty selection
'and then with a selection with length 1 ????
'Changed PM_QUANTWINDOWS_SELECTION 2008-04-30
If True Then
Dim newEnabledState As Boolean = False
If lvPept.SelectedIndices.Count > 0 Then
newEnabledState = True
Else
Dim peter8 As Integer = 8
End If
If True Then 'Edit menu
mnuEditUncheck.Enabled = newEnabledState
mnuEditCheck.Enabled = newEnabledState
mnuEditToggleChecked.Enabled = newEnabledState
End If 'Block, Edit menu
If True Then 'Quantitation menu
mnuQuantSelected.Enabled = newEnabledState
End If 'Block, Quantitation menu
End If
'Changed PM_QUANTWINDOWS_SELECTION 2008-04-30. Disabled for
' now. Perhaps later: display some information about the
' new selection, e.g. bad peak reason. Perhaps special
' action if one and only one selected.
'
' If lvPept2.SelectedItems.Count > 0 Then
' Dim visualIndex As Integer = lvPept2.SelectedIndices.Item(0)
' Me.setSelectedPeptide(visualIndex, False) 'False to avoid an infinite loop...
'
' Dim peptToken As Integer = _
' Me.getPeptideTokenFromVisualIndex2(visualIndex)
'
' Dim pept As PeptideHitStructure = _
' helper.blankPeptide() 'Keep compiler happy.
' mProt2.peptides.peptideByToken(peptToken, pept)
'
' Dim selectedItem As ListViewItem = lvPept2.SelectedItems2(0)
' Dim tag As String = DirectCast(selectedItem.Tag, String)
' lblExtraPeptideInfo.Text = tag & " " & _
' PILInputOutput.emptyForNothing(pept.badPeakReason)
' 'Changed PM_STRING_CLEANUP 2004-12-14
' End If
End Sub 'lsvPepts_SelectedIndexChanged
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub mnuPrevPept_Click( _
ByVal aSender As System.Object, _
ByVal anEvent As System.EventArgs) _
Handles mnuPrevPept.Click
startMenuCommand()
prevPept()
stopMenuCommand("Previous Peptide")
End Sub 'mnuPrevPept_Click
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub mnuNextPept_Click( _
ByVal aSender As System.Object, _
ByVal anEvent As System.EventArgs) _
Handles mnuNextPept.Click
startMenuCommand()
nextPept()
stopMenuCommand("Next Peptide")
End Sub 'mnuNextPept_Click
'Note: Draw button removed 2003-09-29. To make this work again: add
' a "Test" button or some menu item.
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub btnDraw_Click(ByVal sender As System.Object, _
ByVal anEvent As System.EventArgs) _
Handles btnDraw.Click 'Changed PM_FINNEGAN_DISPLAY_TRYOUT 2003-10-23
'Note: this function may be needed even if it is empty!!!?
End Sub 'btnDraw_Click()
'Changed PM_MEMORY_ALLOCATION 2004-08-03. Finalize() is evil (?)
'Protected Overrides Sub Finalize()
' MyBase.Finalize()
'End Sub
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
'Normally used for computing properties for an LC peak.
Private Sub AverageAndStDevFromMSLst( _
ByRef aOutPept As PeptideHitStructure, _
ByRef aOutQuantStats As quantStatsStructure, _
ByVal aDishes As Integer, _
ByVal aForceQuantFlag As Boolean)
If aOutPept.spectra Is Nothing Then
'This is the case when the list is first filled out.
Dim peter3 As Integer = 3
Else
Dim numSpectra As Integer = aOutPept.spectra.Count
'Changed PM_REFACTOR 2006-10-11
' Dim intWT, intIsotope, ratio As Double
' Dim sumIntWT As Double = 0.0
' Dim sumIntIsotope As Double = 0.0
'
' 'Changed PM_TRIPLE_ENCODING 2003-04-09
' Dim intEvenHigherIsotope As Double
' Dim sumIntEvenHigherIsotope As Double = 0.0
' Dim ratioEvenHigher As Double
' Dim sumRatioEvenHigher As Double = 0.0
' Dim sumRatioEvenHigherSquare As Double = 0.0
'
' Dim totalLCPeakAreaWT As Double = 0.0
'
' 'Changed PM_XIC_ISOTOPES 2004-03-19
' Dim totalLCPeakArea_Isotope As Double = 0.0
' Dim totalLCPeakArea_EvenHigherIsotope As Double = 0.0
'
' Dim massWT, massIsotope, sumMassWT, sumMassIsotope, _
' sumMassWTSquare, sumMassIsoSquare As Double
' 'Visual things out-factored from here.
'
' 'Changed PM_RATIO_PROBLEM 2003-08-11
' 'Dim bckGrIntWT As Double = IntWTFromPixelY(mBackGroundWtAsPixel)
' 'Dim backGrIntIso As Double = IntISOFromPixelY(mBackGroundIsoAsPixel)
' Dim bckGrIntWT As Double = mBckGrIntWT
' Dim backGrIntIso As Double = mBackGrIntIso
' Dim sumRatio As Double = 0.0
' Dim sumRatioSquare As Double = 0.0
'Changed PM_REFACTOR_MARKER 2006-10-13
aOutPept.LCprofilesProperties = _
New List(Of LCprofilesPropertiesStructure)
'Changed PM_REFACTOR 2006-10-13
aOutQuantStats.dishInfo = New List(Of dishStatsStructure)
'Changed PM_REFACTOR 2006-10-11
Dim checkedValue As Boolean = False
'Changed PM_REFACTOR 2006-10-16
Dim sumBaseIntensities3 As Double = -7.0E+77 'Is outside loop.
' Only changed for dish 0.
Dim sumBaseXIC As Double = -7.0E+77 'Is outside loop.
' Only changed for dish 0.
'Changed PM_OFFCLICKPEPTIDE_NOQUANTSPECTRA 2007-12-18
Dim allSpectraClickedOff As Boolean = False
Dim lastIndex As Integer = aDishes - 1
Dim dish As Integer
For dish = 0 To lastIndex
Dim n As Integer = 0
Dim backGround As Double = mBackGround(dish)
'For breakpoints.
Select Case dish
Case 0
Dim peter0 As Integer = 0
Case 1
Dim peter1 As Integer = 1
Case 2
Dim peter2 As Integer = 2
Case Else
Dim peter99 As Integer = 99
End Select
'Changed PM_REFACTOR 2006-10-11
''Changed PM_RATIO_PROBLEM 2003-08-11
''Detect "-1#INF".
'Trace.Assert(bckGrIntWT > -1.0E+20 And bckGrIntWT < 1.0E+20, _
' "PIL ASSERT. bckGrIntWT out of range.")
'Trace.Assert(backGrIntIso > -1.0E+20 And backGrIntIso < 1.0E+20, _
' "PIL ASSERT. backGrIntIso out of range.")
Trace.Assert(backGround > -1.0E+20 And backGround < 1.0E+20, _
"PIL ASSERT. bckGrIntWT out of range.")
'Unbiased Standard Deviation:
' SQRT((n * Sum(x * x) - Sum(x) * Sum(x)) / n(n - 1))
'
'data structure and spec list are co-linear. One can use the
'same index.
Dim weigthedRetSum As Double = 0.0
Dim prevUseForQuantitation As Boolean = False
Dim prevRetT As Double = -1.0
'Changed PM_REFACTOR 2006-10-11
' Dim prevPeakAreaWT As Double = 0.0
' 'Changed PM_XIC_ISOTOPES 2004-03-19
' Dim prevPeakAreaIsotope As Double = 0.0
' Dim prevPeakAreaEvenHigher As Double = 0.0
Dim totalLCPeakArea As Double = 0.0
'Changed PM_XIC_NOZERO 2006-11-10
Dim onePointLCprofile As Boolean = True 'Set to false
' later if we see more than one point the LC profile.
Dim prevPeakArea As Double = 0.0
Dim sumIntensity As Double = 0.0
Dim sumMass As Double = 0.0
Dim sumMassSquare As Double = 0.0
Dim baseIntensity2 As Double = -1.0E+20
Dim sumRatio2 As Double = 0.0
Dim sumRatioSquare2 As Double = 0.0
'Changed PM_LCPEAK_WIDTH 2003-03-14
Dim sumRetentionTime As Double = 0.0
Dim sumRetSquare As Double = 0.0
Dim ySum As Double = 0.0
'Changed PM_SEVERALWIFFS 2003-08-27
Dim minRetTime_Secs As Double = 100000000.0
Dim maxRetTime_Secs As Double = -100000000.0
Dim usedForQuantitation_maxIntensity As Double = 0.0 'Value
' when no spectra are selected.
Dim idx As Integer
Dim lastIndex2 As Integer = numSpectra - 1
For idx = 0 To lastIndex2
Dim curSpec As SpecQuantStructure = aOutPept.spectra(idx)
Dim curRetentionTime_Secs As Double = curSpec.retT 'Unit: seconds.
'Changed PM_SEVERALWIFFS 2003-08-27
If curRetentionTime_Secs < minRetTime_Secs Then
minRetTime_Secs = curRetentionTime_Secs
End If
If curRetentionTime_Secs > maxRetTime_Secs Then
maxRetTime_Secs = curRetentionTime_Secs
End If
Dim someDishInfo As shortFormSILACinfoStructure = _
curSpec.dishInfo(dish)
'Dim peakAreaWT As Double = curSpec.peakAreaWT2
Dim peakArea As Double = someDishInfo.MSpeakArea2
If curSpec.useForQuant_WT Then
n += 1
'Changed PM_REFACTOR 2006-10-11
'intWT = curSpec.intensityWT
'intWT = Math.Max((intWT - bckGrIntWT), 0) 'Must not become
'' negative.
'sumIntWT += intWT 'should not become negative
Dim intensity As Double = someDishInfo.intensity4
intensity = Math.Max((intensity - backGround), 0) 'Must
' not become negative.
sumIntensity += intensity 'Should not become negative.
'Changed PM_REFACTOR 2006-10-11
''Changed PM_MAXWT_USEDFORQUANT 2003-10-01
'If intWT > usedForQuantitation_maxWTintensity Then
' usedForQuantitation_maxWTintensity = intWT
'End If
If intensity > usedForQuantitation_maxIntensity Then
usedForQuantitation_maxIntensity = intensity
End If
'Changed PM_XIC 2003-03-09
'As for mass/intensity (MS spectrum) level we take into
'account non-uniform sampling (retention time).
'
'We ignore single points
If prevUseForQuantitation Then
'Note: we do not use background at the moment because
' area. bckGrIntWT is specified by the user in
' the lower right pane where the y-axis value
' is intensityWT.
Trace.Assert(curRetentionTime_Secs - prevRetT > 0.0, _
"PIL ASSERT. curRetentionTime_Secs - prevRetT > 0.0")
'Changed PM_REFACTOR 2006-10-11
' Dim LCpeakArea_WT As Double = _
' xHalf * _
' (prevPeakAreaWT + peakAreaWT)
'
' 'Changed PM_XIC_ISOTOPES 2004-03-19
' Dim LCpeakArea_Isotope As Double = _
' xHalf * _
' (prevPeakAreaIsotope + curSpec.peakAreaIsotope)
' Dim LCpeakArea_EvenHigherIsotope As Double = _
' xHalf * _
' (prevPeakAreaEvenHigher + _
' curSpec.peakAreaEvenHigherIsotope)
'
'LC peak area: "bi-linear"
Dim xHalf As Double = _
0.5 * (curRetentionTime_Secs - prevRetT)
Dim LCpeakArea As Double = _
xHalf * _
(prevPeakArea + peakArea)
'Changed PM_REFACTOR 2006-10-11
'totalLCPeakAreaWT += LCpeakArea_WT
'totalLCPeakArea_Isotope += LCpeakArea_Isotope
'totalLCPeakArea_EvenHigherIsotope += _
' LCpeakArea_EvenHigherIsotope
totalLCPeakArea += LCpeakArea
'Changed PM_XIC_NOZERO 2006-11-10
onePointLCprofile = False
End If
'Changed PM_REFACTOR 2006-10-11
''Changed PM_LC_CENTROID 2003-03-11
''For finding x-centroid:
'Dim wCon As Double = peakAreaWT * curRetentionTime_Secs
'weigthedRetSum += wCon
'ySum += peakAreaWT
Dim wCon2 As Double = peakArea * curRetentionTime_Secs
weigthedRetSum += wCon2
ySum += peakArea
'Changed PM_LCPEAK_WIDTH 2003-03-14
sumRetentionTime += curRetentionTime_Secs
sumRetSquare += _
curRetentionTime_Secs * curRetentionTime_Secs
'Changed PM_REFACTOR 2006-10-11
' intIsotope = curSpec.intensityStableIsotope
' intIsotope = Math.Max(0, (intIsotope - backGrIntIso))
' sumIntIsotope += intIsotope
'
' 'Changed PM_TRIPLE_ENCODING 2003-04-09
' intEvenHigherIsotope = _
' curSpec.intensityEvenHigherStableIsotope
' intEvenHigherIsotope = _
' Math.Max(0, (intEvenHigherIsotope - backGrIntIso))
' sumIntEvenHigherIsotope += intEvenHigherIsotope
'Changed PM_REFACTOR 2006-10-11
' massWT = curSpec.massWT
' sumMassWT += massWT
' sumMassWTSquare += (massWT * massWT)
' massIsotope = curSpec.massStableIsotope
' sumMassIsotope += massIsotope
' sumMassIsoSquare += (massIsotope * massIsotope)
Dim mass As Double = someDishInfo.mass2
sumMass += mass
sumMassSquare += (mass * mass)
'Changed PM_REFACTOR 2006-10-11
' If intWT > 0 Then
' ratio = intIsotope / intWT
' ratioEvenHigher = intEvenHigherIsotope / intWT
' Else
' ratio = 0
' ratioEvenHigher = 0
' End If
Dim baseIntensity As Double = intensity
Dim basePeakArea As Double = peakArea
If Not dish = 0 Then
baseIntensity = curSpec.dishInfo(0).intensity4
basePeakArea = curSpec.dishInfo(0).MSpeakArea2
Else
Dim peter1 As Integer = 1 'We have it already...
End If
'Changed PM_QUANTTROUBLE_USEAREA 2007-01-25
'Dim ratio As Double = intensity / baseIntensity
Dim intensityRatio As Double = intensity / baseIntensity
Dim areaRatio As Double = peakArea / basePeakArea
'There is no need to do this. It happens in quantForOneSpectrum()....
someDishInfo.intensityRatioToBase3 = intensityRatio
someDishInfo.MSpeakAreaRatioToBase = areaRatio
'To refactor: make the ratio calculations once and only
' once. And separate them from the GUI. And make them
' earlier than when this function is called.
'Changed PM_QUANTTROUBLE_USEAREA 2007-01-25. Use MS peak
' area instead of MS intensity.
''Changed PM_REFACTOR 2006-10-11
'' sumRatio += ratio
'' sumRatioSquare += (ratio * ratio)
''
'' 'Changed PM_TRIPLE_ENCODING 2003-04-09
'' sumRatioEvenHigher += ratioEvenHigher
'' sumRatioEvenHigherSquare += _
'' (ratioEvenHigher * ratioEvenHigher)
'sumRatio2 += ratio
'sumRatioSquare2 += (ratio * ratio)
sumRatio2 += areaRatio
Dim ratioSquare As Double = areaRatio * areaRatio
sumRatioSquare2 += ratioSquare
'For break-points
If dish > 0 Then
Dim peter1 As Integer = 1
End If
curSpec.dishInfo(dish) = someDishInfo 'Write-back.
'This must be done immediately as we get
' a new curSpec soon.
aOutPept.spectra(idx) = curSpec 'Write-back.
End If 'curSpec.useForQuant_WT
prevUseForQuantitation = curSpec.useForQuant_WT
prevRetT = curRetentionTime_Secs
'Changed PM_REFACTOR 2006-10-11
' prevPeakAreaWT = peakArea
'
' 'Changed PM_XIC_ISOTOPES 2004-03-19
' prevPeakAreaIsotope = curSpec.peakAreaIsotope
' prevPeakAreaEvenHigher = curSpec.peakAreaEvenHigherIsotope
prevPeakArea = peakArea
Next 'idx. Through spectra (for peptide LC profile).
'Changed PM_XIC_NOZERO 2006-11-10
If onePointLCprofile Then
'Then totalLCPeakArea is zero...
'Set it to unit width area, same as sum of
'intensities. We could also scale it, but
'what should it be?
totalLCPeakArea = -sumIntensity
Else
Dim peter2 As Integer = 2 'Several points in LC profile...
End If
'Changed PM_REFACTOR 2006-11-08
If dish = 0 Then
sumBaseIntensities3 = sumIntensity
sumBaseXIC = totalLCPeakArea
Else
Dim peter1 As Integer = 1 'Don't do it!
End If
'Changed PM_RET_RANGE_ASSERT_JD 2006-11-09. To have
'a code marker here...
'Changed PM_SEVERALWIFFS 2003-08-27
'This is for diagnostics only. But it has caught a lot
'of real bugs! -including in 2006.
If numSpectra > 0 Then
Dim MSMSret_secs As Double = _
60.0 * aOutPept.MSMSretentionTimeMinutes
Trace.Assert( _
MSMSret_secs >= minRetTime_Secs AndAlso _
MSMSret_secs <= maxRetTime_Secs, _
"PIL ASSERT. MSMS retention time (" & MSMSret_secs / 60.0 & _
" min) outside the range " & minRetTime_Secs / 60.0 & _
" min - " & maxRetTime_Secs / 60.0 & " min.")
End If
'Changed PM_REFACTOR 2006-10-11
' Dim aveRatio, stDevRatio As Double
'
' Dim aveRatioEvenHigher As Double
' Dim stDevRatioEvenHigher As Double
'
' Dim aveMassWT, stDevMassWT As Double
' Dim aveMassIso, stDevMassIso As Double
'For breakpoints.
Select Case dish
Case 0
Dim peter0 As Integer = 0
Case 1
Dim peter1 As Integer = 1
Case 2
Dim peter2 As Integer = 2
Case Else
Dim peter99 As Integer = 99
End Select
Dim aveRetentionTime As Double = 0.0
Dim stdDevRetentionTime As Double = 0.0
Dim aveRatio2 As Double = 0.0
Dim stdDevRatio2 As Double = 0.0
Dim aveMass2 As Double = 0.0
Dim stdDevMass2 As Double = 0.0
If n > 0 Then
'Changed PM_REFACTOR 2006-10-11
' aveRatio = sumRatio / n
'
' 'Changed PM_TRIPLE_ENCODING 2003-04-09
' aveRatioEvenHigher = sumRatioEvenHigher / n
'
' aveMassWT = sumMassWT / n
' aveMassIso = sumMassIsotope / n
aveRatio2 = sumRatio2 / n
aveMass2 = sumMass / n
aveRetentionTime = sumRetentionTime / n
'Why is this not in the "n>2" ??
stdDevRetentionTime = _
Math.Sqrt( _
(sumRetSquare - _
sumRetentionTime * sumRetentionTime / n) / _
n)
End If
If n > 2 Then
'Changed PM_REFACTOR 2006-10-11
' stDevRatio = _
' Math.Sqrt((n * sumRatioSquare - sumRatio * sumRatio) / _
' (n * (n - 1)))
'
' 'Changed PM_TRIPLE_ENCODING 2003-04-09
' stDevRatioEvenHigher = _
' Math.Sqrt((n * sumRatioEvenHigherSquare - _
' sumRatioEvenHigher * sumRatioEvenHigher) / (n * (n - 1)))
stdDevRatio2 = _
Math.Sqrt((n * sumRatioSquare2 - sumRatio2 * sumRatio2) / _
(n * (n - 1)))
'Changed PM_REFACTOR 2006-10-11
' stDevMassWT = _
' Math.Sqrt((n * sumMassWTSquare - sumMassWT * sumMassWT) / _
' (n * (n - 1)))
' stDevMassIso = _
' Math.Sqrt(( _
' n * sumMassIsoSquare - _
' sumMassIsotope * sumMassIsotope) / _
' (n * (n - 1)))
stdDevMass2 = _
Math.Sqrt((n * sumMassSquare - sumMass * sumMass) / _
(n * (n - 1)))
End If
'Changed PM_LC_CENTROID 2003-03-11
Dim retentionTimeCentroid_secs As Double = 0.0
If n > 0 Then
If ySum > 0.000000000001 Then
retentionTimeCentroid_secs = weigthedRetSum / ySum
Else
'This can happen when there is only a single data point
'for the peak area computation in the raw datapoints.
retentionTimeCentroid_secs = 0.00001
'But why this small value??? Why not use the single
'data point??
End If
End If
Trace.Assert( _
retentionTimeCentroid_secs > -1000000000000.0 AndAlso _
retentionTimeCentroid_secs < 1000000000000.0, _
"PIL ASSERT. theRetentionTimeCentroid is infinite. " & _
"In AverageAndStDevFromMSLst().")
'Visual things out-factored from here.
'Changed PM_REFACTOR 2006-10-11
' aOutQuantStats.sumIntWT = sumIntWT
' aOutQuantStats.sumIntIsotope = sumIntIsotope
' aOutQuantStats.aveRatio = aveRatio
' aOutQuantStats.stDevRatio = stDevRatio
' aOutQuantStats.aveMassWT = aveMassWT
' aOutQuantStats.stDevMassWT = stDevMassWT
' aOutQuantStats.aveMassIso = aveMassIso
' aOutQuantStats.stDevMassIso = stDevMassIso
Dim someDishStats As dishStatsStructure
someDishStats.sumIntensity = sumIntensity
someDishStats.aveRatio = aveRatio2
someDishStats.stDevRatio = stdDevRatio2
someDishStats.aveMass = aveMass2
someDishStats.stDevMass = stdDevMass2
aOutQuantStats.dishInfo.Add(someDishStats)
aOutPept.retentionTimeCentroid_secs = retentionTimeCentroid_secs
mLogger.timeLog("In AverageAndStDevFromMSLst(). " & _
"Updating retentionTimeCentroid_secs. " & _
"retentionTimeCentroid_secs: " & _
retentionTimeCentroid_secs)
'Changed PM_REFACTOR 2006-10-11
' aOutPept.totalLCSignalWT = sumIntWT
' aOutPept.totalLCPeakAreaWT = totalLCPeakAreaWT
' aOutPept.bckGrWT = bckGrIntWT
'
' aOutPept.totalLCSignalStableIsotope = sumIntIsotope
' aOutPept.totalLCPeakArea_Isotope = totalLCPeakArea_Isotope
' aOutPept.stableIsotopeRatio = sumIntIsotope / sumIntWT
' aOutPept.stableIsotopeRatioStDev = stDevRatio
' aOutPept.bckGrIso = bckGrIntWT
'
' 'Changed PM_TRIPLEDISPLAY 2003-06-18
' aOutPept.totalLCSignalEvenHigherStableIsotope = _
' sumIntEvenHigherIsotope
' aOutPept.totalLCPeakArea_EvenHigherIsotope = _
' totalLCPeakArea_EvenHigherIsotope
'
' 'Changed PM_TRIPLE_ENCODING 2003-04-09
' aOutPept.stableEvenHigherIsotopeRatio = _
' sumIntEvenHigherIsotope / sumIntWT
' aOutPept.stableEvenHigherIsotopeRatioStDev = stDevRatioEvenHigher
Dim somePr As LCprofilesPropertiesStructure
somePr.totalLCSignal = sumIntensity
somePr.totalLCPeakArea = totalLCPeakArea
somePr.ratioOfItensities3 = sumIntensity / sumBaseIntensities3
'Changed PM_NO_RATIO_OF_INTENSITY_SUMS 2006-11-08
somePr.ratioOfXICs = totalLCPeakArea / sumBaseXIC
somePr.ratioStDev = stdDevRatio2
somePr.backGround = backGround
'Changed PM_REFACTOR 2006-10-11
' 'Changed PM_PROTEIN_RATIO 2003-02-26
' aOutPept.averageOf_IWT_Ratios = aveRatio
'
' 'Changed PM_PROTEIN_RATIOS 2003-06-27
' aOutPept.averageOf_HIWT_Ratios = aveRatioEvenHigher
somePr.averageOfRatios2 = aveRatio2
'Changed PM_REFACTOR_MARKER 2006-10-13
'Note: OK to Add() as we create a new empty in the beginning
' of this function...
aOutPept.LCprofilesProperties.Add(somePr)
'Changed PM_REFACTOR 2006-10-11. What was this for??
' 'Changed PM_TRIPLE_ENCODING 2003-04-10
' Dim higherAve As Double = aOutPept.stableIsotopeRatio 'Not the
' ' true average of ratios (?).
' higherAve = aveRatio
'
' Dim evenHigherAve As Double = _
' aOutPept.stableEvenHigherIsotopeRatio '
'
' ' Not the true average of ratios (?).
' evenHigherAve = aveRatioEvenHigher
'
' Dim stdHigher As Double = aOutPept.stableIsotopeRatioStDev
' Dim stdEvenHigher As Double = _
' aOutPept.stableEvenHigherIsotopeRatioStDev
'Changed PM_REFACTOR 2006-10-11
'If sumIntWT > mMinQuant * 10 Or _
' sumIntIsotope * 10 > mMinQuant Then
' checkedValue = True
'End If
'Changed PM_MARKER_STRANGE_TEN_FACTOR_RULE 2007-01-29
checkedValue = _
checkedValue Or (sumIntensity > mMinQuant * 10) 'For the
' peptide, not the spectrum.
'Note: use of old value as we are in a loop; in any dish is
' above the 10 factor then we accept it.
'Changed PM_OFFCLICKPEPTIDE_NOQUANTSPECTRA 2007-12-18
If n = 0 Then
allSpectraClickedOff = True
Else
Dim peter2 As Integer = 2
End If
'This is for two fields in peptide that should be vectorised..
If dish = 0 Then
'Changed PM_REFACTOR 2006-10-11
' aOutPept.estimatedLCPeakWidth = 4 * stdDevRetentionTime '2 "sigma"
' ' for 95 %. 2 for width instead of +/-.
' 'Changed PM_MAXWT_USEDFORQUANT 2003-10-01
' aOutPept.usedForQuantitation_maxWTintensity = _
' usedForQuantitation_maxWTintensity
aOutPept.estimatedLCPeakWidth = 4 * stdDevRetentionTime
' 2 "sigma" for 95 %. 2 for width instead of +/-.
aOutPept.usedForQuantitation_maxWTintensity = _
usedForQuantitation_maxIntensity
End If
Next dish
'Changed PM_REFACTOR 2006-10-11. Disabled.
' If True Then 'Correlation of ratios
' Dim covSum As Double = 0.0
' n = 0
'
' 'For triple encoding: Compute correllation between the two ratios.
' For idx = 0 To numSpectra - 1
' Dim curSpec As SpecQuantStructure = _
' ...(aOutPept.specs(idx), SpecQuantStructure)
' If curSpec.useForQuant_WT Then 'lvSpectra.Items(idx).Checked Then
' n += 1
'
' Dim higherDiff As Double = _
' curSpec.ratioHigherToBase - higherAve
' Dim evenHigherDiff As Double = _
' curSpec.ratioEvenHigherToBase - evenHigherAve
' Dim covContr As Double = higherDiff * evenHigherDiff
' covSum += covContr
' End If
' Next
'
' Dim covariance As Double = covSum / (n - 1)
' Dim correlation As Double = covariance / (stdHigher * stdEvenHigher)
'
' aOutPept.ratiosCorrelation = correlation
' End If
If True Then
'Changed PM_OFFCLICKPEPTIDE_NOQUANTSPECTRA 2007-12-18
If allSpectraClickedOff Then
checkedValue = False
Else
Dim peter2 As Integer = 2
End If
'If aForceQuantFlag or Then
If aForceQuantFlag Or allSpectraClickedOff Then
aOutPept.useForQuantitation = checkedValue
Else
'Leave it untouched. It may be a user selected/changed value.
Dim peter2 As Integer = 2
End If
End If
'Changed PM_REFACTOR 2006-10-11. Disabled for now. What was
' it doing??
'
' If True Then
' 'Enter these values into the data structure and into the table.
'
' 'Dim checkedValue As Boolean = False
'
' 'Isn't this value already in a field in aOutPept??
' 'Changed PM_TRIPLEDISPLAY 2003-06-18
'
' 'Changed PM_TRIPLEDISPLAY_PERFORMANCETROUBLE 2003-06-19
' Dim savedAvoid As Boolean = mPeptide_AvoidListEvents
' mPeptide_AvoidListEvents = True
'
' 'Dim calMass As Double = _
' ' MMaaSequence.monoMW(.SubItems(quantPeptTbItmColEnum.eSequence).Text)
' Dim rowToRead As ListViewItem = lvPept2.SelectedItems2(0)
' Dim calMass As Double = _
' MMaaSequence.monoMass( _
' mPeptColumnMapper.readOffListItem( _
' rowToRead, _
' quantPeptTbItmColEnum2.enumSequence), _
' "Carbamidomethyl (C)")
' Dim diffMass As Double = aveMassWT - calMass
'
' aOutQuantStats.diffMass = diffMass
'
' 'Visual things out-factored from here.
'
' 'aOutQuantStats.checkedValue = checkedValue not needed, delete....
'
' 'Changed PM_TRIPLEDISPLAY_PERFORMANCETROUBLE 2003-06-19
' mPeptide_AvoidListEvents = savedAvoid
' End If
End If 'aOutPept.specs is not Nothing.
End Sub 'AverageAndStDevFromMSLst()
'Changed PM_QUANTITATE_NEXTPROTEIN 2004-11-16
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub mnuNextProtein_Click( _
ByVal aSender As System.Object, _
ByVal anEvent As System.EventArgs) _
Handles mnuNextProtein_3.Click
startMenuCommand()
mFrmProtVal.NextProteinForQuantitation()
stopMenuCommand("Next Protein")
End Sub 'mnuNextProtein_Click
'Changed PM_REFACTOR 2004-11-16
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub setQuantitationCommandsStatus(ByVal aStatus As Boolean)
mnuQuantitateProtein.Enabled = aStatus 'we can only do this once
cmdQuantProtein.Enabled = aStatus
End Sub 'setQuantitationCommandsStatus
'Changed PM_XY_EXPORT 2005-01-07
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Function spectrumDatapointsSaveString() _
As String
'Changed PM_REFACTOR 2006-10-12
'Dim signalToUse As ArrayList = Nothing 'Keep compiler happy.
Dim signalToUse As _
List(Of massSpectrometryBase.signalStructure) = _
Nothing 'Keep compiler happy.
mMSdisplay.getSignalInZoomRange(signalToUse)
Dim toReturn As String = _
PILoutUtil.dumpXYSpectrumPoints( _
signalToUse, mRawDataFileHandling.DataTitle(), _
mLastPeptHit.AASequence, mProt.accNum, "MS spectrum data points", _
True)
Return toReturn
End Function 'spectrumDatapointsSaveString
'Changed PM_XY_EXPORT 2005-01-07
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub mnuExportSpectrumDataPoints_Click( _
ByVal aSender As System.Object, _
ByVal anEvent As System.EventArgs) _
Handles mnuExportSpectrumDataPoints.Click
startMenuCommand()
Dim str As String = spectrumDatapointsSaveString()
PILInputOutput.pushToExcel(str)
stopMenuCommand("Export Current Spectrum Data Points")
End Sub 'mnuExportSpectrumDataPoints_Click
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub mnuSaveSpectrumDataPoints_Click( _
ByVal aSender As System.Object, _
ByVal anEvent As System.EventArgs) _
Handles mnuSaveSpectrumDataPoints.Click
startMenuCommand()
'Changed PM_GI_ACCNUM_TROUBLE 2008-05-05
'Dim accNum As String = mProt2.accNum
Dim accNum As String = mProt.accNum.Replace("|", "_")
Dim suggestedFileName As String = _
"MSspectrum_" & accNum & "_" & mLastPeptHit.AASequence
Dim str As String = spectrumDatapointsSaveString()
'Use return value for some text reporting to GUI?
Dim wasSaved As Boolean = _
pushToUserSelectedFile2( _
str, _
"Saved current spectrum data points to file.", _
suggestedFileName)
Dim msg As String = "Save Current Spectrum Data Points As..."
If Not wasSaved Then
msg &= " User cancelled."
End If
stopMenuCommand(msg)
End Sub 'mnuSaveSpectrumDataPoints_Click
'Changed PM_SPECTRAEXPORT_GENERALISED 2008-05-05. No longer needed, but
' we keep it for reference until the new version works...
' 'Changed PM_SAVETOFILE 2003-04-15
' '****************************************************************************
' '* <placeholder for header> *
' '****************************************************************************
' Private Sub mnuSaveWithSpectrumList_Click( _
' ByVal aSender As System.Object, _
' ByVal anEvent As System.EventArgs) _
' Handles mnuSaveWithSpectrumList.Click
'
' If lvPept.SelectedIndices.Count > 0 Then
' Dim saveStr As String = peptideWithSpectraInformationString()
'
' 'Use return value for some text reporting to GUI?
' Dim wasSaved As Boolean = _
' pushToUserSelectedFile2( _
' saveStr, _
' "Saved peptide with all spectra information to file.", _
' "")
' Else
' MsgBox("Could not complete action. No peptide or peptides was/were selected. Select one or more peptides first.")
' End If
' End Sub 'mnuSaveWithSpectrumList_Click
'Changed PM_SPECTRAEXPORT_GENERALISED 2008-05-05. No longer needed, but
' we keep it for reference until the new version works...
' '****************************************************************************
' '* <placeholder for header> *
' '****************************************************************************
' Private Sub mnuExportWithSpectrumList_Click( _
' ByVal aSender As System.Object, _
' ByVal anEvent As System.EventArgs) _
' Handles mnuExportWithSpectrumList.Click
'
' If lvPept.SelectedIndices.Count > 0 Then
' 'Changed PM_REFACTOR 2003-04-15
' Dim saveStr As String = peptideWithSpectraInformationString()
' PILInputOutput.pushToExcel(saveStr)
' Else
' MsgBox("Could not complete action. No peptide or peptides was/were selected. Select one or more peptides first.")
' End If
' End Sub 'mnuExportWithSpectrumList_Click
'Changed PM_NEXTQUANTPEPTIDE_TROUBLE 2005-02-04
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub setSelectedPeptide( _
ByVal aVisualIndex As Integer, _
ByVal aVisualUpdate As Boolean, _
ByVal aClearExistingSelection As Boolean _
)
mCurrVisualPepIndex2 = aVisualIndex
If aVisualUpdate Then
'Side-effect: select the peptide in question.
If lvPept.Items.Count > 0 Then
'lvPept2.Focus() no, this will force the quantitation
' window to the front. Very rude!
'Changed PM_QUANTWINDOWS_SELECTION 2008-04-30
If aClearExistingSelection Then
lvPept.SelectedItems.Clear()
End If
lvPept.Items(mCurrVisualPepIndex2).Selected = True
lvPept.EnsureVisible(mCurrVisualPepIndex2)
Else
Dim peter0 As Integer = 0
End If
Else
Dim peter2 As Integer = 2 'For breakpoints..
End If
End Sub 'setSelectedPeptide
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub setSpectrumListViewColumns( _
ByVal aSILACdishes As Integer)
'Old:
' ByVal anAddTripleEncodingColumns As Boolean, _
lvSpectra.Columns.Clear() 'Just in case..
'Changed PM_COLUMNALIGNMENT 2008-04-16
Dim numberAlignment As HorizontalAlignment = HorizontalAlignment.Right
'Must be first!!
mSpecColumnMapper.newColumn( _
"ret.T.", 60 - 5 - 2, specTbItmColEnum.enumRetT, _
numberAlignment)
'Changed PM_SCREENSPACE 2007-01-31
'Moved to 2nd position....
mSpecColumnMapper.newColumn( _
"Cycle", 45 - 5 - 2 + 5, specTbItmColEnum.enumCycleNumber, _
numberAlignment)
' mSpecColumnMapper.newColumn( _
' "I (w.t.)", 55, specTbItmColEnum.enumIntensityWT_2)
'
' mSpecColumnMapper.newColumn( _
' "I iso", 55, specTbItmColEnum.enumIntensityIsotope2)
'
' 'Changed PM_SPEC_DISPLAYFORTRIPLEENCODING 2006-04-05
' If anAddTripleEncodingColumns Then
' mSpecColumnMapper.newColumn( _
' "I h", 55, specTbItmColEnum.enumIntensityEvenHigherIsotope)
' End If
'
' mSpecColumnMapper.newColumn( _
' "i/w", 50, specTbItmColEnum.enumIntensityRatio)
'
' 'Changed PM_SPEC_DISPLAYFORTRIPLEENCODING 2006-04-05
' If anAddTripleEncodingColumns Then
' mSpecColumnMapper.newColumn( _
' "h/w", 50, specTbItmColEnum.enumIntensityRatioEvenHigher)
' End If
'
' mSpecColumnMapper.newColumn( _
' "Mass w.t.", 65, specTbItmColEnum.enumMeasMW_WT)
'
' mSpecColumnMapper.newColumn( _
' "Mass iso", 65, specTbItmColEnum.enumMeasMW_Isotope)
'Changed PM_REFACTOR 2006-10-09
Dim quantityString As String = Nothing
Dim quantityString2 As String = Nothing
Dim keyBase As Integer = -5
Dim n As Integer 'Is selector for type: intensity, ratio or mass.
For n = 0 To 3 Step 1
Dim lastIndex As Integer = aSILACdishes - 1
Dim dish As Integer
For dish = 0 To lastIndex
Dim dish1 As Integer = dish + 1
Select Case n
'Perhaps later: dependent width (in pixels).
Case 0
'Changed PM_ONLY_MSPEAKAREA 2006-11-10
'quantityString = "I "
quantityString = "A "
quantityString2 = ""
keyBase = specTbItmColEnum.enumMSpeakAreaBaseNumber
Case 1
quantityString = ""
quantityString2 = "/1"
keyBase = specTbItmColEnum.enumMSpeakAreaRatioBaseNumber
Case 2
quantityString = "Mass"
quantityString2 = ""
keyBase = specTbItmColEnum.enumMassBaseNumber
'Changed PM_QUANT_AUTO_CENTERING 2006-11-13
Case 3
quantityString = "qOff"
quantityString2 = ""
keyBase = specTbItmColEnum.enumQuantOffsetBaseNumber
Case Else
Trace.Assert(False, "PIL ASSERT. Select Case never fall-through")
End Select
Dim key2 As Integer = keyBase + dish
mSpecColumnMapper.newColumn( _
quantityString & dish1 & quantityString2, 30 + 10, key2, _
numberAlignment)
Next dish
Next
End Sub 'setSpectrumListViewColumns
'Changed PM_TRIPLEDISPLAY 2003-06-17
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub setPeptideListViewColumns(ByVal aSILACdishes As Integer)
lvPept.Columns.Clear()
'Note: alignment was all "Left" in the original.
'Changed PM_COLUMNALIGNMENT 2008-04-16
Dim numberAlignment As HorizontalAlignment = HorizontalAlignment.Right
mPeptColumnMapper.newColumn( _
"Sequence", 150 - 70, quantPeptTbItmColEnum2.enumSequence, _
HorizontalAlignment.Left)
'Changed PM_VISUAL_COLUMNSORT 2006-02-24
mPeptColumnMapper.newColumn( _
"Raw file ID", 50 - 10, quantPeptTbItmColEnum2.enumRawfile, _
numberAlignment)
mPeptColumnMapper.newColumn( _
"Score", 25, quantPeptTbItmColEnum2.enumMascotScore, _
numberAlignment)
'Changed PM_SCREENSPACE 2007-01-31
mPeptColumnMapper.newColumn( _
"Query", 20 + 23, quantPeptTbItmColEnum2.enumQueryNumber, _
numberAlignment)
Dim quantityString As String = Nothing
Dim quantityString2 As String = Nothing
Dim keyBase As Integer = -5
Dim n As Integer 'Is selector for type: average ratio, stddev
' for average ratio, intensity and XIC.
For n = 0 To 4
Dim lastIndex As Integer = aSILACdishes - 1
Dim dish As Integer
For dish = 0 To lastIndex
Dim dishOneBased As Integer = dish + 1
Select Case n
'Perhaps later: dependent width (in pixels).
Case 0 'Ratio
quantityString = ""
quantityString2 = "/1, average of ratios"
keyBase = quantPeptTbItmColEnum2.enumRatioBaseNumber2
Case 1 'Std. for ratio
quantityString = ""
quantityString2 = "/1, stDev for average of ratios"
keyBase = quantPeptTbItmColEnum2.enumRatioStdDevBaseNumber2
Case 2 'Ratio of intensities. Ratio of XICs instead?
quantityString = ""
quantityString2 = "/1, XIC ratio"
keyBase = quantPeptTbItmColEnum2.enumIntensRatioBaseNumber2
Case 3 'XIC
quantityString = ""
quantityString2 = ", XIC"
keyBase = quantPeptTbItmColEnum2.enumXICBaseNumber2
Case 4 'Intensity
quantityString = ""
quantityString2 = ", intensity sum"
keyBase = quantPeptTbItmColEnum2.enumIntensityBaseNumber2
Case Else
Trace.Assert(False, _
"PIL ASSERT. Select Case never fall-through")
End Select
Dim key2 As Integer = keyBase + dish
Dim header As String = _
quantityString & dishOneBased & quantityString2
mPeptColumnMapper.newColumn(header, 36 + 30, key2, _
numberAlignment)
Next dish
Next 'Selector
mPeptColumnMapper.newColumn( _
"Charge", 22, quantPeptTbItmColEnum2.enumChargeState, _
numberAlignment)
'Changed PM_REFACTOR 2006-10-11. Disabled for now.
'mPeptColumnMapper.newColumn( _
' "Mass Delta", 43, quantPeptTbItmColEnum2.enumDeltaPPM_MW)
mPeptColumnMapper.newColumn( _
"Mmeas", 52, quantPeptTbItmColEnum2.enumMeasuredMCR, _
numberAlignment)
mPeptColumnMapper.newColumn( _
"Mcal", 51, quantPeptTbItmColEnum2.enumCalculatedMass, _
numberAlignment)
''Replace by greek sigma
'mPeptColumnMapper.newColumn( _
' "sigma", 39, quantPeptTbItmColEnum2.enumMeasMCR_StDev)
'mPeptColumnMapper.newColumn( _
' "modStr", 22, quantPeptTbItmColEnum2.enumModStr)
mPeptColumnMapper.newColumn( _
"ret.T.", 40, quantPeptTbItmColEnum2.enumRetentionTime, _
numberAlignment)
End Sub 'setPeptideListViewColumns
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub proteinRatiosUpdate(ByVal aSetProteinQuantifiedToTRUE As Boolean)
CalculateProteinRatio(mDishes)
ColourPeptideItems()
If aSetProteinQuantifiedToTRUE Then
mProt.proteinHasBeenQuantified = True
End If
'Write back protein
mFrmProtVal.updateProtein(mProteinListIndex, mProt)
End Sub 'proteinRatiosUpdate
'Changed PM_VISUAL_COLUMNSORT 2006-02-24
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub lvPept_ColumnClick( _
ByVal aSender As System.Object, _
ByVal anEvent As System.Windows.Forms.ColumnClickEventArgs) _
Handles lvPept.ColumnClick
Dim physicalIndex As Integer = anEvent.Column
Dim ID As quantPeptTbItmColEnum2 = _
CType(mPeptColumnMapper.columnIndex2itemID(physicalIndex), _
quantPeptTbItmColEnum2)
Dim keylist As List(Of sortKeyStructure) = Nothing
If mColumnSortSpecificationHash.TryGetValue(ID, keylist) Then
mListViewColumnSorter.prepareSort(keylist)
lvPept.Sort()
Else
'We have not defined sorting for the column in question.
'Simply ignore the request.
Dim peter1 As Integer = 1
End If
End Sub 'lvPept_ColumnClick
'Changed PM_REFACTOR 2006-03-07
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub updateStatusBar(ByRef aMsg As String)
StatusBar1.Text = aMsg
'Refresh() required/useful?
End Sub 'updateStatusBar
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub frmQuantWindow_Disposed( _
ByVal aSender As Object, ByVal anEvent As System.EventArgs) _
Handles Me.Disposed
Dim peter1 As Integer = 1 'When is this called??
End Sub 'frmQuantWindow_Disposed
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub frmQuantWindow_FormClosed( _
ByVal aSender As Object, _
ByVal anEvent As System.Windows.Forms.FormClosedEventArgs) _
Handles Me.FormClosed
Dim peter1 As Integer = 1
End Sub 'frmQuantWindow_FormClosed
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub frmQuantWindow_FormClosing( _
ByVal aSender As Object, _
ByVal anEvent As System.Windows.Forms.FormClosingEventArgs) _
Handles Me.FormClosing
'Override closing form and call Dispose() on mLCG. Ref:
' http://www.samspublishing.com/articles/article.asp?p=25357&rl=1 (
' Drawing and Printing in C#. From the book "Sams Teach
' Yourself C# in 24 Hours".
'
' Includes: "When you're finished with a Graphics
' object, you should call its Dispose() method to
' ensure that all resources used by the Graphics
' object are freed. Simply letting an object variable
' go out of scope doesn't ensure that the resources
' used by the object are freed."
' )
'Changed PM_MEMORY_EFFICIENCY 2007-02-25
If Not mLCG Is Nothing Then
mLCG.Dispose()
End If
End Sub 'frmQuantWindow_FormClosing
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub mnuDumpLogger_Click( _
ByVal aSender As System.Object, ByVal anEvent As System.EventArgs) _
Handles mnuDumpLogger.Click
mLogger.readOutTimeLog()
End Sub 'mnuDumpLogger_Click
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub mnuTest_Zoom1_Click( _
ByVal aSender As System.Object, ByVal anEvent As System.EventArgs) _
Handles mnuTest_Zoom1.Click
'Set zoom 511.0 to 516.4
'asdads()
Trace.Assert(False, "Stop!", _
"PIL ASSERT. Internal/development assert for stopping execution......")
End Sub 'mnuTest_Zoom1_Click
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub mnuDumpAnalystCOM_Click( _
ByVal aSender As System.Object, ByVal anEvent As System.EventArgs) _
Handles mnuDumpAnalystCOM.Click
Dim COMlogger As SDUPlogger = mMSdisplay.getCOMlogger()
Trace.Assert(Not COMlogger Is Nothing, _
"PIL ASSERT. COMlogger is Nothing...")
COMlogger.readOutTimeLog()
COMlogger.resetTimeLog()
End Sub 'mnuDumpAnalystCOM_Click
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub newPlotType(ByVal aPlotType As LCplotTypeEnum)
pbLCpeak.Visible = False
retTplots_ZedGraph.Visible = False
Select Case aPlotType
Case LCplotTypeEnum.enumLCprofileClassic
pbLCpeak.Visible = True
Case LCplotTypeEnum.enumLCprofileZedGraph
retTplots_ZedGraph.Visible = True
mRetentionTimePlotting.setDisplayType( _
retTplotTypeEnum.enumLCprofilePlot)
Case LCplotTypeEnum.enumQuantRatiosZedGraph
retTplots_ZedGraph.Visible = True
mRetentionTimePlotting.setDisplayType( _
retTplotTypeEnum.enumQuantRatiosPlot)
Case Else
Trace.Assert(False, _
"PIL ASSERT. Select Case never fall-through")
End Select
End Sub 'newPlotType
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub displayAkindOfLCplot()
Dim oldVis As Boolean = False
Dim newVis As Boolean = False
If Not mStartingUp Then
If rbLCclassicPlot.Checked Then 'Reading off from
' the GUI. Is this bad?
oldVis = True
End If
If rbNewLCplot.Checked Then 'Reading off from
' the GUI. Is this bad?
newVis = True
mRetentionTimePlotting.setDisplayType( _
retTplotTypeEnum.enumLCprofilePlot)
End If
If rbRatiosPlot.Checked Then 'Reading off from
' the GUI. Is this bad?
newVis = True
mRetentionTimePlotting.setDisplayType( _
retTplotTypeEnum.enumQuantRatiosPlot)
End If
Else
Dim peter2 As Integer = 2
End If 'Starting up check.
If pbLCpeak.Visible <> oldVis Then
pbLCpeak.Visible = oldVis
End If
If retTplots_ZedGraph.Visible <> newVis Then
retTplots_ZedGraph.Visible = newVis
End If
End Sub 'displayAkindOfLCplot
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub rbLCclassicPlot_CheckedChanged( _
ByVal aSender As System.Object, ByVal anEvent As System.EventArgs) _
Handles rbLCclassicPlot.CheckedChanged
displayAkindOfLCplot()
'Delete at any time.
'If Not mStartingUp Then
' 'How do we get it from the event?
' Dim newVal As Boolean = rbLCclassicPlot.Checked
' If newVal = True Then
' newPlotType(LCplotTypeEnum.enumLCprofileClassic)
' End If
'Else
' Dim peter2 As Integer = 2
'End If
End Sub 'rbLCclassicPlot_CheckedChanged
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub rbNewLCplot_CheckedChanged( _
ByVal aSender As System.Object, ByVal anEvent As System.EventArgs) _
Handles rbNewLCplot.CheckedChanged
displayAkindOfLCplot()
'Delete at any time.
'If Not mStartingUp Then
' 'How do we get it from the event?
' Dim newVal As Boolean = rbNewLCplot.Checked
' If newVal = True Then
' newPlotType(LCplotTypeEnum.enumLCprofileZedGraph)
' End If
'Else
' Dim peter2 As Integer = 2
'End If
End Sub 'rbNewLCplot_CheckedChanged
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub rbRatiosPlot_CheckedChanged( _
ByVal aSender As System.Object, ByVal anEvent As System.EventArgs) _
Handles rbRatiosPlot.CheckedChanged
displayAkindOfLCplot()
'Delete at any time.
'If Not mStartingUp Then
' 'How do we get it from the event?
' Dim newVal As Boolean = rbRatiosPlot.Checked
' If newVal = True Then
' newPlotType(LCplotTypeEnum.enumQuantRatiosZedGraph)
' End If
'Else
' Dim peter2 As Integer = 2
'End If
'For <http://labs.developerfusion.co.uk/convert/vb-to-csharp.aspx> ...
If False Then 'Delete at any time.
If True Then
Dim checkBoxInfoList As List(Of Double) = _
New List(Of Double)
Dim someItem As Double
For Each someItem In checkBoxInfoList
Dim yDiff As Double = someItem
Next 'Through checkBoxInfoList
End If
If True Then
Dim testVectorSize As Integer = 7
Dim someNewItem As Double = 12.09
Dim checkBoxInfoList2 As List(Of Double) = _
New List(Of Double)
Dim lastIndex As Integer = testVectorSize - 1
Dim j As Integer
For j = 0 To lastIndex Step 1
checkBoxInfoList2.Add(someNewItem)
Next j
End If
If True Then
Dim keyWithMass As String = "xyz_2"
Dim oldValue As Double
Dim someBestScore As Double = 23.81
Dim bestScoreHash2 As Dictionary( _
Of String, Double) = _
New Dictionary( _
Of String, Double)
If bestScoreHash2.TryGetValue(keyWithMass, oldValue) Then
bestScoreHash2(keyWithMass) = someBestScore
Else
bestScoreHash2.Add(keyWithMass, someBestScore)
End If
Dim hashEnumerator2 As Dictionary( _
Of String, Double).Enumerator = _
bestScoreHash2.GetEnumerator()
While hashEnumerator2.MoveNext()
Dim curKey As String = hashEnumerator2.Current.Key
Dim curValue As Double = _
hashEnumerator2.Current.Value
End While 'Hash iteration.
End If
End If
End Sub 'rbRatiosPlot_CheckedChanged
'Changed PM_QUANTWINDOWS_SELECTION 2008-04-30
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub mnuQuantSelected_Click( _
ByVal aSender As System.Object, ByVal anEvent As System.EventArgs) _
Handles mnuQuantSelected.Click
'Ought to always be true as it should be greyed out if no peptides
'are selected... - ASSERT it? Or eliminate?
Dim selected As Integer = lvPept.SelectedIndices.Count
If selected > 0 Then
startMenuCommand()
'Old, for all peptides:
' QuantifyProtein()
' Me.setQuantitationCommandsStatus(False) 'We can only do this once.
Dim visualSelection3 As List(Of Integer) = _
quantApplication.copySelectedIndices2(lvPept.SelectedIndices)
quantifyVisualSelection(visualSelection3)
stopMenuCommand("Quantitation (" & selected & " peptides)")
End If 'Non-empty selection
End Sub 'mnuQuantSelected_Click
'Changed PM_QUANTWINDOWS_SELECTION 2008-05-01
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub mnuEditUncheck_Click( _
ByVal aSender As System.Object, ByVal anEvent As System.EventArgs) _
Handles mnuEditUncheck.Click
startMenuCommand()
quantApplication.setCheckedStatusForSelected( _
DirectCast(lvPept, ListView), False)
stopMenuCommand("Uncheck")
End Sub 'mnuEditUncheck_Click()
'Changed PM_QUANTWINDOWS_SELECTION 2008-05-01
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub mnuEditCheck_Click( _
ByVal aSender As System.Object, ByVal anEvent As System.EventArgs) _
Handles mnuEditCheck.Click
startMenuCommand()
quantApplication.setCheckedStatusForSelected( _
DirectCast(lvPept, ListView), True)
stopMenuCommand("Check")
End Sub 'mnuEditCheck_Click()
'Changed PM_QUANTWINDOWS_SELECTION 2008-05-01
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub mnuEditToggleChecked_Click( _
ByVal aSender As System.Object, ByVal anEvent As System.EventArgs) _
Handles mnuEditToggleChecked.Click
startMenuCommand()
quantApplication.toggleCheckedStatusForSelected( _
DirectCast(lvPept, ListView))
stopMenuCommand("Toggle Checked")
End Sub 'mnuEditToggleChecked_Click()
'Changed PM_QUANTWINDOWS_SELECTION 2008-05-01
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub mnuEditSelectAll_Click( _
ByVal aSender As System.Object, ByVal anEvent As System.EventArgs) _
Handles mnuEditSelectAll.Click
startMenuCommand()
quantApplication.selectAllOrSome( _
DirectCast(lvPept, ListView), False)
stopMenuCommand("Select All")
End Sub 'mnuEditSelectAll_Click()
'Changed PM_QUANTWINDOWS_SELECTION 2008-05-01
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub mnuEditSelectChecked_Click( _
ByVal aSender As System.Object, ByVal anEvent As System.EventArgs) _
Handles mnuEditSelectChecked.Click
startMenuCommand()
quantApplication.selectAllOrSome( _
DirectCast(lvPept, ListView), True)
stopMenuCommand("Select Checked")
End Sub 'mnuEditSelectChecked_Click()
'Changed PM_QUANTWINDOWS_SELECTION 2008-05-01
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub mnuEditInvertSelection_Click( _
ByVal aSender As System.Object, ByVal anEvent As System.EventArgs) _
Handles mnuEditInvertSelection.Click
startMenuCommand()
quantApplication.invertSelection(DirectCast(lvPept, ListView))
stopMenuCommand("Invert Selection")
End Sub 'mnuEditInvertSelection_Click()
'Changed PM_QUANTWINDOWS_SELECTION 2008-05-01
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub startMenuCommand()
Me.updateStatusBar("Menu command started") 'Empty string instead??
mApplication.startStopWatch()
End Sub 'startMenuCommand
'Changed PM_QUANTWINDOWS_SELECTION 2008-05-01
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub stopMenuCommand(ByRef anInCommandStr As String)
Dim memDiff_MB As Double
Dim parseTimeSecs As Double = mApplication.stopStopWatch(memDiff_MB)
Dim msg As String = _
"""" & anInCommandStr & """ menu command completed. Time: " & _
parseTimeSecs.ToString("0.00") & " seconds."
Me.updateStatusBar(msg)
End Sub 'stopMenuCommand
'Changed PM_SPECTRAEXPORT_GENERALISED 2008-05-06
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub startExportOrSavePeptidesAndProteins(ByVal aType As tagEnum)
'Changed PM_PEPTIDEFILTER_GENERALISED 2007-08-29
'mProteinAndPeptidesFilter2.tag = aType
Dim protPepFilter As proteinAndPeptidesFilterStructure2 = _
mOptions.exportSettings
protPepFilter.tag = aType
Dim extraText As String = _
"For " & lvPept.SelectedIndices.Count & _
" selected ***peptides*** in protein " & mProt.accNum & "."
mExportFiltersForm = New frmExportFilters( _
protPepFilter, _
extraText, _
mApplication, _
mOptions.peptideFilters(peptideFilterEnum.enumExport2), _
mRawFiles)
mExportFiltersForm.Show()
End Sub 'startExportOrSavePeptidesAndProteins
'Changed PM_SPECTRAEXPORT_GENERALISED 2008-05-06
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub mnuSaveProteinsAndPeptides_Click( _
ByVal aSender As System.Object, ByVal anEvent As System.EventArgs) _
Handles mnuSaveProteinsAndPeptides.Click
Me.startExportOrSavePeptidesAndProteins(tagEnum.enumTag2) 'User
' selects a file after the export dialog has been OK'ed.
' Call-back/event handler is mExportFiltersForm_dialogDismissed().
End Sub 'mnuSaveProteinsAndPeptides_Click
'Changed PM_SPECTRAEXPORT_GENERALISED 2008-05-06
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub mnuExportProteinsAndPeptides_Click( _
ByVal aSender As System.Object, ByVal anEvent As System.EventArgs) _
Handles mnuExportProteinsAndPeptides.Click
Me.startExportOrSavePeptidesAndProteins(tagEnum.enumTag1) 'Use export.
'The actual export will take place when the user is done
'with the ***export*** dialog.
' Call-back/event handler is mExportFiltersForm_dialogDismissed().
End Sub 'mnuExportProteinsAndPeptides_Click
'Changed PM_SPECTRAEXPORT_GENERALISED 2008-05-06
'From export/save protein/peptide/spectra-dialog.
'****************************************************************************
'* <placeholder for header> *
'* Call-back from peptide filter form. *
'****************************************************************************
Private Sub mExportFiltersForm_dialogDismissed( _
ByVal aSender As Object, _
ByVal anEvent As exportFilterEventArgs) _
Handles mExportFiltersForm.exportFilterDismissed
Dim newValues As exportFilterValuesStructure = anEvent.getFilter()
Me.setProteinAndPeptidesFilter_export2( _
newValues.proteinAndPeptidesFilter, newValues.peptideFilter)
End Sub 'mExportFiltersForm_dialogDismissed
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Function selectedPeptides2Tokens( _
ByRef anInVisualIndices As List(Of Integer)) _
As List(Of Integer)
Dim toReturn As List(Of Integer) = New List(Of Integer)
Dim peptideFilter As peptideFilterStructure = _
mOptions.peptideFilters(peptideFilterEnum.enumExport2)
Dim pept3 As PeptideHitStructure = _
helper.blankPeptide() 'Keep compiler happy.
Dim visualIndex As Integer
For Each visualIndex In anInVisualIndices
Dim someToken As Integer = _
Me.getPeptideTokenFromVisualIndex(visualIndex)
mProt.peptides.peptideByToken(someToken, pept3)
Dim updateModHash As Boolean
Dim filteredOut As Boolean = _
PILpeptides.simpleFilteredOut( _
pept3, peptideFilter, updateModHash)
If Not filteredOut Then
toReturn.Add(someToken)
Else
Dim peter2 As Integer = 2
End If
Next
Dim len As Integer = toReturn.Count 'For debugging - we can not
' see the length in the debugger...
Return toReturn
End Function 'selectedPeptides2Tokens
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Function exportProteinsAndPeptides_Common( _
ByVal aInProteinAndPeptidesFilter2 As proteinAndPeptidesFilterStructure2) _
As String
Dim toReturn As String = ""
Dim selLen As Integer = -1
Try
Dim peptideSelection_visualIndices As List(Of Integer) = _
quantApplication.copySelectedIndices2( _
lvPept.SelectedIndices)
selLen = peptideSelection_visualIndices.Count 'For debugging
' only, debugger problem with "Generic.".
Dim tokensForSelectedPeptides As List(Of Integer) = _
Me.selectedPeptides2Tokens(peptideSelection_visualIndices)
'Changed PM_SPECTRAEXPORT_GENERALISED 2008-05-06
'We should not be here if nothing is selected...
Trace.Assert(tokensForSelectedPeptides.Count > 0, _
"PIL ASSERT. No peptides selected!!!")
'Changed PM_SPECTRAEXPORT_GENERALISED 2008-05-06
'Adapt to the existing function, as least for now.
Dim singleProteinList As List(Of ProteinHitStructure) = _
New List(Of ProteinHitStructure)
singleProteinList.Add(mProt)
Dim protein_datastructureIndices As List(Of Integer) = _
New List(Of Integer)
protein_datastructureIndices.Add(0) '0 is the index of the
' single protein above.
toReturn = quantApplication.xxFormatTextPeptides2( _
aInProteinAndPeptidesFilter2, _
protein_datastructureIndices, singleProteinList, _
mRecalibrator, mOptions.quantModeCode, mApplication, _
mOptions, _
tokensForSelectedPeptides)
Catch exceptionObject As Exception
MSQuantCommon2.displayStandardExceptionInfo( _
exceptionObject, _
"Could not export the selected " & selLen & " proteins.")
End Try
Return toReturn
End Function 'exportProteinsAndPeptides_Common
'Changed PM_SPECTRAEXPORT_GENERALISED 2008-05-06
'Is called when the dialog ends..........
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Private Sub setProteinAndPeptidesFilter_export2( _
ByVal aInProteinAndPeptidesFilter2 As proteinAndPeptidesFilterStructure2, _
ByVal aPeptideFilter As peptideFilterStructure)
If True Then 'Saving copies here.
mOptions.exportSettings = aInProteinAndPeptidesFilter2
'Updated here, but it should also be updated in another class from
'where it is loaded/saved.
mOptions.peptideFilters(peptideFilterEnum.enumExport2) = _
aPeptideFilter
End If
'Use our mark that we sat when we initiated the export dialog: should
'the result be exported to Excel or saved to a file.
Select Case aInProteinAndPeptidesFilter2.tag
Case tagEnum.enumTag1
PILInputOutput.pushToExcel( _
Me.exportProteinsAndPeptides_Common( _
aInProteinAndPeptidesFilter2))
Case tagEnum.enumTag2
'Changed PM_SAVEDIALOG_TITLE 2005-12-01
SaveFileDialog1.Title = "Saving protein and peptide information"
'Use return value for some text reporting to GUI?
Dim wasSaved As Boolean = _
PILInputOutput.pushToUserSelectedFile2( _
Me.exportProteinsAndPeptides_Common( _
aInProteinAndPeptidesFilter2), _
SaveFileDialog1, _
"xyz", _
"Saved some peptides to file", _
"")
Case Else
Trace.Assert(False, "PIL ASSERT. Select Case never fall-through")
End Select
'Perhaps the new settings from the export dialog should not be
'persisted if the user cancelled the save dialog?.
' 'Pass on to the global and most recent version of options...
' '
' 'Note that we only pass on what has been changed here and not the
' ' entire options (that we have a copy of and that may not be up-to-date;
' ' the user may have changed some settings after we got the copy).
mFrmProtVal.setProteinAndPeptidesFilter( _
aInProteinAndPeptidesFilter2, _
aPeptideFilter)
End Sub 'setProteinAndPeptidesFilter_export
End Class 'frmQuantWindow
Generated by script codePublish.pl at 2008-09-23T11:59:18.