Source code for MSQuant: frmPeptideFilters.vb, MSQuant/msquant/src/GUI/forms/frmPeptideFilters.vb.

Table of contents page.

Home page for MSQuant.

'****************************************************************************
'* 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: Windows dialog for peptide filter (restricted sequence 
'*          length, charges, etc.)                               *
'*                                                                          *
'****************************************************************************

'****************************************************************************
'*                               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:   frmPeptideFilters.vb                                      *
'*    TYPE:  VISUAL_BASIC                                                   *
'*                                                                          *
'* CREATED: PM 2006-03-07   Vrs 1.0.                                      *
'* UPDATED: PM 2006-xx-xx                                                   *
'*                                                                          *
'****************************************************************************

Option Strict On
Option Explicit On 

Imports System.IO 'For Path class/functions


Imports massSpectrometryBase 'For peptideFilterSpecificationStructure
Imports massSpectrometryBase.quantitation 'For QuantitationModes_moreGeneral.
Imports MolecularSharedStructures  'For quantModificationStructure.

Imports MSQuant 'For class quantApplication


'****************************************************************************
'*    <placeholder for header>                                              *
'****************************************************************************
Public Class frmPeptideFilters
    Inherits System.Windows.Forms.Form

    'Not used.
    ''Private mParentForm As frmOptions
    'Private mParentForm As System.Windows.Forms.Form

    'Changed PM_PEPTIDEFILTER_GENERALISED 2007-08-27
    Public Event pepFilterDismissed( _
      ByVal aSender As Object, _
      ByVal anEvent As pepFilterEventArgs)

    Friend WithEvents txtEndMass As System.Windows.Forms.TextBox
    Friend WithEvents txtStartMass As System.Windows.Forms.TextBox
    Friend WithEvents Label6 As System.Windows.Forms.Label
    Friend WithEvents chkPeptidesQuantified As System.Windows.Forms.CheckBox
    Friend WithEvents chkPeptidesVerified As System.Windows.Forms.CheckBox
    Friend WithEvents chkOnlyHighestScoringUniquelyModified As System.Windows.Forms.CheckBox
    Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox

    Private mPeptideFilterSpecification As peptideFilterStructure
    Private mProgramDefaultFilter As peptideFilterStructure

    Friend WithEvents lblModFilter As System.Windows.Forms.Label

    'Changed PM_PEPTIDEFILTER_GENERALISED 2007-08-24
    'For storing result from the sub-dialog, modification filter.
    Private mModIDlist As Generic.List(Of Integer)
    Friend WithEvents txtEndMassAccuracy As System.Windows.Forms.TextBox
    Friend WithEvents txtStartMassAccuracy As System.Windows.Forms.TextBox
    Friend WithEvents Label5 As System.Windows.Forms.Label
    Friend WithEvents btnProgramDefaults As System.Windows.Forms.Button
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents cbxRawFile As System.Windows.Forms.ComboBox

    Private mApplication As quantApplication

    'Changed PM_RAWFILE_PEPFILTER 2007-11-16
    Private mRawFiles() As fileSpecStructure


    'Changed PM_RAWFILE_PEPFILTER 2007-11-17
    'For raw file filter.
    Private mGUIindex2code As Generic.List(Of Integer) 'Code is either
    '  raw file ID or a code for all.



#Region " Windows Form Designer generated code "


    '****************************************************************************
    '*    <placeholder for header>                                              *
    '****************************************************************************
    Public Sub New( _
        ByVal anInPeptideFilterSpecification As peptideFilterStructure, _
        ByRef anApp As quantApplication, _
        ByVal aChangableQuantVer As Boolean, _
        ByVal aChangableMassAcc As Boolean, _
        ByVal anInProgramDefaultFilter As peptideFilterStructure, _
        ByRef anInFilterTypeStr As String, _
        ByRef anInRawFiles() As fileSpecStructure _
        )

        '  ByRef aParentForm As System.Windows.Forms.Form, _

        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

        Me.Init( _
          anInPeptideFilterSpecification, _
          anApp, _
          aChangableQuantVer, _
          aChangableMassAcc, _
          anInProgramDefaultFilter, _
          anInFilterTypeStr, _
          anInRawFiles)
    End Sub 'New


    'Form overrides dispose to clean up the component list.
    '****************************************************************************
    '*    <placeholder for header>                                              *
    '****************************************************************************
    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 Label1 As System.Windows.Forms.Label
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents btnOK As System.Windows.Forms.Button
    Friend WithEvents btnCancel As System.Windows.Forms.Button
    Friend WithEvents btnChangeModificationFilter As System.Windows.Forms.Button
    Friend WithEvents txtStartSeqLen As System.Windows.Forms.TextBox
    Friend WithEvents txtEndSeqLen As System.Windows.Forms.TextBox
    Friend WithEvents txtEndCharge As System.Windows.Forms.TextBox
    Friend WithEvents txtStartCharge As System.Windows.Forms.TextBox
    Friend WithEvents Label4 As System.Windows.Forms.Label
    Friend WithEvents txtEndScore As System.Windows.Forms.TextBox
    Friend WithEvents txtStartScore As System.Windows.Forms.TextBox
    Friend WithEvents CheckBox1 As System.Windows.Forms.CheckBox
    Friend WithEvents CheckBox2 As System.Windows.Forms.CheckBox
    Friend WithEvents CheckBox3 As System.Windows.Forms.CheckBox
    Friend WithEvents CheckBox4 As System.Windows.Forms.CheckBox
    Friend WithEvents CheckBox5 As System.Windows.Forms.CheckBox
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.Label1 = New System.Windows.Forms.Label
        Me.txtStartSeqLen = New System.Windows.Forms.TextBox
        Me.txtEndSeqLen = New System.Windows.Forms.TextBox
        Me.txtEndCharge = New System.Windows.Forms.TextBox
        Me.txtStartCharge = New System.Windows.Forms.TextBox
        Me.Label2 = New System.Windows.Forms.Label
        Me.btnOK = New System.Windows.Forms.Button
        Me.btnCancel = New System.Windows.Forms.Button
        Me.btnChangeModificationFilter = New System.Windows.Forms.Button
        Me.Label4 = New System.Windows.Forms.Label
        Me.txtEndScore = New System.Windows.Forms.TextBox
        Me.txtStartScore = New System.Windows.Forms.TextBox
        Me.CheckBox1 = New System.Windows.Forms.CheckBox
        Me.CheckBox2 = New System.Windows.Forms.CheckBox
        Me.CheckBox3 = New System.Windows.Forms.CheckBox
        Me.CheckBox4 = New System.Windows.Forms.CheckBox
        Me.CheckBox5 = New System.Windows.Forms.CheckBox
        Me.txtEndMass = New System.Windows.Forms.TextBox
        Me.txtStartMass = New System.Windows.Forms.TextBox
        Me.Label6 = New System.Windows.Forms.Label
        Me.chkPeptidesQuantified = New System.Windows.Forms.CheckBox
        Me.chkPeptidesVerified = New System.Windows.Forms.CheckBox
        Me.chkOnlyHighestScoringUniquelyModified = New System.Windows.Forms.CheckBox
        Me.GroupBox1 = New System.Windows.Forms.GroupBox
        Me.lblModFilter = New System.Windows.Forms.Label
        Me.txtEndMassAccuracy = New System.Windows.Forms.TextBox
        Me.txtStartMassAccuracy = New System.Windows.Forms.TextBox
        Me.Label5 = New System.Windows.Forms.Label
        Me.btnProgramDefaults = New System.Windows.Forms.Button
        Me.Label3 = New System.Windows.Forms.Label
        Me.cbxRawFile = New System.Windows.Forms.ComboBox
        Me.GroupBox1.SuspendLayout()
        Me.SuspendLayout()
        '
        'Label1
        '
        Me.Label1.Location = New System.Drawing.Point(16, 207)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(128, 16)
        Me.Label1.TabIndex = 0
        Me.Label1.Text = "Sequence length range:"
        '
        'txtStartSeqLen
        '
        Me.txtStartSeqLen.Location = New System.Drawing.Point(152, 207)
        Me.txtStartSeqLen.Name = "txtStartSeqLen"
        Me.txtStartSeqLen.Size = New System.Drawing.Size(48, 20)
        Me.txtStartSeqLen.TabIndex = 5
        '
        'txtEndSeqLen
        '
        Me.txtEndSeqLen.Location = New System.Drawing.Point(224, 207)
        Me.txtEndSeqLen.Name = "txtEndSeqLen"
        Me.txtEndSeqLen.Size = New System.Drawing.Size(48, 20)
        Me.txtEndSeqLen.TabIndex = 6
        '
        'txtEndCharge
        '
        Me.txtEndCharge.Location = New System.Drawing.Point(224, 247)
        Me.txtEndCharge.Name = "txtEndCharge"
        Me.txtEndCharge.Size = New System.Drawing.Size(48, 20)
        Me.txtEndCharge.TabIndex = 8
        '
        'txtStartCharge
        '
        Me.txtStartCharge.Location = New System.Drawing.Point(152, 247)
        Me.txtStartCharge.Name = "txtStartCharge"
        Me.txtStartCharge.Size = New System.Drawing.Size(48, 20)
        Me.txtStartCharge.TabIndex = 7
        '
        'Label2
        '
        Me.Label2.Location = New System.Drawing.Point(16, 247)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(128, 24)
        Me.Label2.TabIndex = 3
        Me.Label2.Text = "Charge range:"
        '
        'btnOK
        '
        Me.btnOK.Location = New System.Drawing.Point(183, 432)
        Me.btnOK.Name = "btnOK"
        Me.btnOK.Size = New System.Drawing.Size(72, 24)
        Me.btnOK.TabIndex = 15
        Me.btnOK.Text = "&OK"
        '
        'btnCancel
        '
        Me.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel
        Me.btnCancel.Location = New System.Drawing.Point(271, 432)
        Me.btnCancel.Name = "btnCancel"
        Me.btnCancel.Size = New System.Drawing.Size(72, 24)
        Me.btnCancel.TabIndex = 16
        Me.btnCancel.Text = "&Cancel"
        '
        'btnChangeModificationFilter
        '
        Me.btnChangeModificationFilter.Location = New System.Drawing.Point(19, 19)
        Me.btnChangeModificationFilter.Name = "btnChangeModificationFilter"
        Me.btnChangeModificationFilter.Size = New System.Drawing.Size(95, 24)
        Me.btnChangeModificationFilter.TabIndex = 1
        Me.btnChangeModificationFilter.Text = "&Modifications:"
        '
        'Label4
        '
        Me.Label4.Location = New System.Drawing.Point(16, 284)
        Me.Label4.Name = "Label4"
        Me.Label4.Size = New System.Drawing.Size(104, 16)
        Me.Label4.TabIndex = 10
        Me.Label4.Text = "Mascot score range:"
        '
        'txtEndScore
        '
        Me.txtEndScore.Location = New System.Drawing.Point(224, 284)
        Me.txtEndScore.Name = "txtEndScore"
        Me.txtEndScore.Size = New System.Drawing.Size(48, 20)
        Me.txtEndScore.TabIndex = 10
        Me.txtEndScore.Text = "200"
        '
        'txtStartScore
        '
        Me.txtStartScore.Location = New System.Drawing.Point(152, 284)
        Me.txtStartScore.Name = "txtStartScore"
        Me.txtStartScore.Size = New System.Drawing.Size(48, 20)
        Me.txtStartScore.TabIndex = 9
        Me.txtStartScore.Text = "1"
        '
        'CheckBox1
        '
        Me.CheckBox1.Checked = True
        Me.CheckBox1.CheckState = System.Windows.Forms.CheckState.Checked
        Me.CheckBox1.Enabled = False
        Me.CheckBox1.Location = New System.Drawing.Point(420, 19)
        Me.CheckBox1.Name = "CheckBox1"
        Me.CheckBox1.Size = New System.Drawing.Size(152, 24)
        Me.CheckBox1.TabIndex = 14
        Me.CheckBox1.Text = "Exclude ZZZZ peptides"
        Me.CheckBox1.Visible = False
        '
        'CheckBox2
        '
        Me.CheckBox2.Checked = True
        Me.CheckBox2.CheckState = System.Windows.Forms.CheckState.Checked
        Me.CheckBox2.Enabled = False
        Me.CheckBox2.Location = New System.Drawing.Point(18, 19)
        Me.CheckBox2.Name = "CheckBox2"
        Me.CheckBox2.Size = New System.Drawing.Size(58, 16)
        Me.CheckBox2.TabIndex = 16
        Me.CheckBox2.Text = "CID"
        '
        'CheckBox3
        '
        Me.CheckBox3.Checked = True
        Me.CheckBox3.CheckState = System.Windows.Forms.CheckState.Checked
        Me.CheckBox3.Enabled = False
        Me.CheckBox3.Location = New System.Drawing.Point(18, 43)
        Me.CheckBox3.Name = "CheckBox3"
        Me.CheckBox3.Size = New System.Drawing.Size(58, 16)
        Me.CheckBox3.TabIndex = 17
        Me.CheckBox3.Text = "MPD"
        '
        'CheckBox4
        '
        Me.CheckBox4.Checked = True
        Me.CheckBox4.CheckState = System.Windows.Forms.CheckState.Checked
        Me.CheckBox4.Enabled = False
        Me.CheckBox4.Location = New System.Drawing.Point(18, 67)
        Me.CheckBox4.Name = "CheckBox4"
        Me.CheckBox4.Size = New System.Drawing.Size(58, 16)
        Me.CheckBox4.TabIndex = 18
        Me.CheckBox4.Text = "ECD"
        '
        'CheckBox5
        '
        Me.CheckBox5.Checked = True
        Me.CheckBox5.CheckState = System.Windows.Forms.CheckState.Checked
        Me.CheckBox5.Enabled = False
        Me.CheckBox5.Location = New System.Drawing.Point(18, 91)
        Me.CheckBox5.Name = "CheckBox5"
        Me.CheckBox5.Size = New System.Drawing.Size(58, 16)
        Me.CheckBox5.TabIndex = 19
        Me.CheckBox5.Text = "MS3"
        '
        'txtEndMass
        '
        Me.txtEndMass.Location = New System.Drawing.Point(224, 322)
        Me.txtEndMass.Name = "txtEndMass"
        Me.txtEndMass.Size = New System.Drawing.Size(48, 20)
        Me.txtEndMass.TabIndex = 12
        Me.txtEndMass.Text = "4000"
        '
        'txtStartMass
        '
        Me.txtStartMass.Location = New System.Drawing.Point(152, 322)
        Me.txtStartMass.Name = "txtStartMass"
        Me.txtStartMass.Size = New System.Drawing.Size(48, 20)
        Me.txtStartMass.TabIndex = 11
        Me.txtStartMass.Text = "1"
        '
        'Label6
        '
        Me.Label6.Location = New System.Drawing.Point(16, 322)
        Me.Label6.Name = "Label6"
        Me.Label6.Size = New System.Drawing.Size(104, 16)
        Me.Label6.TabIndex = 21
        Me.Label6.Text = "Mass range [Da]:"
        '
        'chkPeptidesQuantified
        '
        Me.chkPeptidesQuantified.Location = New System.Drawing.Point(19, 105)
        Me.chkPeptidesQuantified.Name = "chkPeptidesQuantified"
        Me.chkPeptidesQuantified.Size = New System.Drawing.Size(104, 16)
        Me.chkPeptidesQuantified.TabIndex = 4
        Me.chkPeptidesQuantified.Text = "Quantified only"
        '
        'chkPeptidesVerified
        '
        Me.chkPeptidesVerified.Location = New System.Drawing.Point(19, 83)
        Me.chkPeptidesVerified.Name = "chkPeptidesVerified"
        Me.chkPeptidesVerified.Size = New System.Drawing.Size(104, 16)
        Me.chkPeptidesVerified.TabIndex = 3
        Me.chkPeptidesVerified.Text = "Verified only"
        '
        'chkOnlyHighestScoringUniquelyModified
        '
        Me.chkOnlyHighestScoringUniquelyModified.Location = New System.Drawing.Point(19, 53)
        Me.chkOnlyHighestScoringUniquelyModified.Name = "chkOnlyHighestScoringUniquelyModified"
        Me.chkOnlyHighestScoringUniquelyModified.Size = New System.Drawing.Size(224, 24)
        Me.chkOnlyHighestScoringUniquelyModified.TabIndex = 2
        Me.chkOnlyHighestScoringUniquelyModified.Text = "Only highest scoring uniquely modified"
        '
        'GroupBox1
        '
        Me.GroupBox1.Controls.Add(Me.CheckBox2)
        Me.GroupBox1.Controls.Add(Me.CheckBox3)
        Me.GroupBox1.Controls.Add(Me.CheckBox4)
        Me.GroupBox1.Controls.Add(Me.CheckBox5)
        Me.GroupBox1.Enabled = False
        Me.GroupBox1.Location = New System.Drawing.Point(420, 53)
        Me.GroupBox1.Name = "GroupBox1"
        Me.GroupBox1.Size = New System.Drawing.Size(166, 118)
        Me.GroupBox1.TabIndex = 27
        Me.GroupBox1.TabStop = False
        Me.GroupBox1.Text = "Identification spectrum type"
        '
        'lblModFilter
        '
        Me.lblModFilter.AutoSize = True
        Me.lblModFilter.Location = New System.Drawing.Point(120, 25)
        Me.lblModFilter.Name = "lblModFilter"
        Me.lblModFilter.Size = New System.Drawing.Size(19, 13)
        Me.lblModFilter.TabIndex = 17
        Me.lblModFilter.Text = "<>"
        '
        'txtEndMassAccuracy
        '
        Me.txtEndMassAccuracy.Location = New System.Drawing.Point(224, 361)
        Me.txtEndMassAccuracy.Name = "txtEndMassAccuracy"
        Me.txtEndMassAccuracy.Size = New System.Drawing.Size(48, 20)
        Me.txtEndMassAccuracy.TabIndex = 14
        Me.txtEndMassAccuracy.Text = "99999"
        '
        'txtStartMassAccuracy
        '
        Me.txtStartMassAccuracy.Location = New System.Drawing.Point(152, 361)
        Me.txtStartMassAccuracy.Name = "txtStartMassAccuracy"
        Me.txtStartMassAccuracy.Size = New System.Drawing.Size(48, 20)
        Me.txtStartMassAccuracy.TabIndex = 13
        Me.txtStartMassAccuracy.Text = "0"
        '
        'Label5
        '
        Me.Label5.Location = New System.Drawing.Point(16, 361)
        Me.Label5.Name = "Label5"
        Me.Label5.Size = New System.Drawing.Size(130, 31)
        Me.Label5.TabIndex = 29
        Me.Label5.Text = "Post-recalibration mass accuracy range [ppm]:"
        '
        'btnProgramDefaults
        '
        Me.btnProgramDefaults.Location = New System.Drawing.Point(19, 432)
        Me.btnProgramDefaults.Name = "btnProgramDefaults"
        Me.btnProgramDefaults.Size = New System.Drawing.Size(120, 24)
        Me.btnProgramDefaults.TabIndex = 30
        Me.btnProgramDefaults.Text = "Program &defaults"
        '
        'Label3
        '
        Me.Label3.Location = New System.Drawing.Point(16, 134)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(104, 16)
        Me.Label3.TabIndex = 31
        Me.Label3.Text = "Raw file:"
        '
        'cbxRawFile
        '
        Me.cbxRawFile.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cbxRawFile.Location = New System.Drawing.Point(37, 161)
        Me.cbxRawFile.MaxDropDownItems = 20
        Me.cbxRawFile.Name = "cbxRawFile"
        Me.cbxRawFile.Size = New System.Drawing.Size(235, 21)
        Me.cbxRawFile.TabIndex = 32
        '
        'frmPeptideFilters
        '
        Me.AcceptButton = Me.btnOK
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.CancelButton = Me.btnCancel
        Me.ClientSize = New System.Drawing.Size(356, 462)
        Me.Controls.Add(Me.cbxRawFile)
        Me.Controls.Add(Me.Label3)
        Me.Controls.Add(Me.btnProgramDefaults)
        Me.Controls.Add(Me.txtEndMassAccuracy)
        Me.Controls.Add(Me.txtStartMassAccuracy)
        Me.Controls.Add(Me.Label5)
        Me.Controls.Add(Me.lblModFilter)
        Me.Controls.Add(Me.GroupBox1)
        Me.Controls.Add(Me.chkOnlyHighestScoringUniquelyModified)
        Me.Controls.Add(Me.chkPeptidesQuantified)
        Me.Controls.Add(Me.chkPeptidesVerified)
        Me.Controls.Add(Me.txtEndMass)
        Me.Controls.Add(Me.txtStartMass)
        Me.Controls.Add(Me.Label6)
        Me.Controls.Add(Me.CheckBox1)
        Me.Controls.Add(Me.txtEndScore)
        Me.Controls.Add(Me.txtStartScore)
        Me.Controls.Add(Me.Label4)
        Me.Controls.Add(Me.btnChangeModificationFilter)
        Me.Controls.Add(Me.btnCancel)
        Me.Controls.Add(Me.btnOK)
        Me.Controls.Add(Me.txtEndCharge)
        Me.Controls.Add(Me.txtStartCharge)
        Me.Controls.Add(Me.txtEndSeqLen)
        Me.Controls.Add(Me.txtStartSeqLen)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.Label1)
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
        Me.MaximizeBox = False
        Me.MinimizeBox = False
        Me.Name = "frmPeptideFilters"
        Me.Text = "Peptide filter"
        Me.GroupBox1.ResumeLayout(False)
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub

#End Region


    '****************************************************************************
    '*    <placeholder for header>                                              *
    '****************************************************************************
    Private Sub Init( _
      ByVal anInFilter As peptideFilterStructure, _
      ByRef anApp As quantApplication, _
      ByVal aChangableQuantAndVer As Boolean, _
      ByVal aChangableMassAcc As Boolean, _
      ByVal anInProgramDefaultFilter As peptideFilterStructure, _
      ByRef anInFilterTypeStr As String, _
      ByRef anInRawFiles() As fileSpecStructure)

        'ByRef aParentForm As frmOptions
        'Old:
        '  ByRef aParentForm As System.Windows.Forms.Form, _


        mPeptideFilterSpecification = anInFilter

        'mParentForm = aParentForm

        mApplication = anApp

        'Changed PM_RAWFILE_PEPFILTER 2007-11-17
        mRawFiles = anInRawFiles 'Note: can be Nothing when it does
        '  not apply, e.g. before parsing.

        mProgramDefaultFilter = anInProgramDefaultFilter

        'Changed PM_RAWFILE_PEPFILTER 2007-11-17
        mGUIindex2code = Nothing 'Flag if it does not apply (e.g.
        '  before parsing).


        'Dialog title line.
        Me.Text = "Peptide filter for " & anInFilterTypeStr & "."

        'Why do we do this effectively in constructor? Is it too earlier. Do
        'in Load event handler instead?
        fillInForm(anInFilter, anApp, anInRawFiles) 'Has side-effect...

        If Not aChangableQuantAndVer Then
            'E.g. filter for parsing.
            chkPeptidesVerified.Enabled = False
            chkPeptidesQuantified.Enabled = False
        Else
            'E.g. filter for export.
            Dim peter2 As Integer = 2
        End If

        If Not aChangableMassAcc Then
            'E.g. filter for parsing.
            txtStartMassAccuracy.Enabled = False
            txtEndMassAccuracy.Enabled = False
        Else
            'E.g. filter for export.
            Dim peter2 As Integer = 2
        End If
    End Sub 'Init


    '****************************************************************************
    '*    <placeholder for header>                                              *
    '****************************************************************************
    Private Shared Sub makeRawListIncludingAll( _
      ByRef anInRawFiles() As fileSpecStructure, _
      ByRef anOutGUIstrings() As String, _
      ByRef anOutGUIindex2code As Generic.List(Of Integer) _
      )

        'Later: mapping from GUI index (selected by user) and raw file ID.

        Dim rawFiles As Integer = anInRawFiles.Length()
        Dim outLen As Integer = rawFiles + 1 '1: space for the all option.
        Dim outLastIndex As Integer = outLen - 1
        ReDim anOutGUIstrings(outLastIndex)

        anOutGUIindex2code = New Generic.List(Of Integer)(outLen)

        anOutGUIstrings(0) = "All raw files"
        anOutGUIindex2code.Add(-389) 'Some negative value.

        Dim idx As Integer = 1
        Dim someRawFile As fileSpecStructure
        For Each someRawFile In anInRawFiles

            Dim fileName As String = Path.GetFileName(someRawFile.path)

            anOutGUIstrings(idx) = fileName

            anOutGUIindex2code.Add(someRawFile.tag2)

            idx += 1
        Next 'Through raw files.

    End Sub 'makeRawListIncludingAll


    '****************************************************************************
    '*    <placeholder for header>                                              *
    '****************************************************************************
    Private Sub fillInForm( _
      ByVal anInFilter As peptideFilterStructure, _
      ByRef anApp As quantApplication, _
      ByRef anInRawFiles() As fileSpecStructure _
      )

        'Changed PM_PEPTIDEFILTER_GENERALISED 2007-08-24
        'Changed by sub dialog. 
        'mModIDlist = anInFilterSpecification.peptideModificationFilter
        '
        'We need to make a deep copy as it should only be changed in the client
        'if this dialog is OK'ed - it is not enough that the sub-dialog is OK'ed.
        mModIDlist = peptideFilterStructure.deepCopyModList( _
          anInFilter.pepModFilter3)

        lblModFilter.Text = someStatic.formatShortModStr(mModIDlist, anApp)

        txtStartCharge.Text = anInFilter.chargeMin.ToString
        txtEndCharge.Text = anInFilter.chargeMax.ToString

        txtStartSeqLen.Text = anInFilter.seqLengthMin.ToString
        txtEndSeqLen.Text = anInFilter.seqLengthMax.ToString

        'Changed PM_PEPTIDEFILTER_GENERALISED 2007-08-28
        txtStartMass.Text = anInFilter.massMin.ToString
        txtEndMass.Text = anInFilter.massMax.ToString

        'Changed PM_PEPTIDEFILTER_HIGHESTSCORING 2006-05-19
        chkOnlyHighestScoringUniquelyModified.Checked = _
          anInFilter.highestScoringUniquelyModified

        'Changed PM_PEPTIDEFILTER_GENERALISED 2007-08-25
        txtStartScore.Text = anInFilter.scoreMin.ToString
        txtEndScore.Text = anInFilter.scoreMax2.ToString
        chkPeptidesVerified.Checked = anInFilter.verifiedOnly
        chkPeptidesQuantified.Checked = anInFilter.quantifiedOnly

        'Changed PM_MASSACC_PEPFILTER 2007-09-05
        txtStartMassAccuracy.Text = anInFilter.massAccuracyMin.ToString
        txtEndMassAccuracy.Text = anInFilter.massAccuracyMax.ToString

        'Changed PM_RAWFILE_PEPFILTER 2007-11-16
        If Not anInRawFiles Is Nothing Then

            Dim len As Integer = anInRawFiles.Length()
            Dim strs As String() = Nothing

            'Note: adds item for all (raw files).
            makeRawListIncludingAll(anInRawFiles, strs, mGUIindex2code)

            Me.cbxRawFile.Items.Clear()
            Dim someString As String
            For Each someString In strs
                Me.cbxRawFile.Items.Add(someString)
            Next

            If True Then 'Select the drop-down value
                Dim itemToSelectIndex As Integer = 0 'Default if not set below. For
                '  all raw files (no raw file filter). Assumes it is the first 
                '  in the values returned by makeRawListIncludingAll().

                Dim lastIndex As Integer = anInRawFiles.Length() - 1
                Dim j As Integer
                For j = 0 To lastIndex
                    Dim rawFileID As Integer = anInRawFiles(j).tag2

                    If rawFileID = anInFilter.rawFileID Then
                        itemToSelectIndex = j + 1 '1 as it is assumed the
                        '  first item is for all raw files.
                        Exit For 'No need to continue.
                    End If
                Next j
                Me.cbxRawFile.SelectedIndex = itemToSelectIndex
            End If
        Else
            Me.cbxRawFile.Enabled = False
        End If
    End Sub 'fillInForm


    '****************************************************************************
    '*    <placeholder for header>                                              *
    '****************************************************************************
    Private Sub btnOK_Click( _
      ByVal aSender As System.Object, _
      ByVal anEvent As System.EventArgs) _
      Handles btnOK.Click

        'No validation for now....
        Try
            Dim newValues As peptideFilterStructure = _
              peptideFilterStructure.noPepFilter()

            newValues.chargeMin = CInt(txtStartCharge.Text)
            newValues.chargeMax = CInt(txtEndCharge.Text)

            newValues.seqLengthMin = CInt(txtStartSeqLen.Text)
            newValues.seqLengthMax = CInt(txtEndSeqLen.Text)

            'Changed PM_PEPTIDEFILTER_GENERALISED 2007-08-28
            newValues.massMin = CDbl(txtStartMass.Text)
            newValues.massMax = CDbl(txtEndMass.Text)

            'Changed PM_PEPTIDEFILTER_HIGHESTSCORING 2006-05-19
            newValues.highestScoringUniquelyModified = _
              chkOnlyHighestScoringUniquelyModified.Checked

            'Changed PM_PEPTIDEFILTER_GENERALISED 2007-08-24
            newValues.pepModFilter3 = mModIDlist

            'Changed PM_PEPTIDEFILTER_GENERALISED 2007-08-25
            newValues.scoreMin = CDbl(txtStartScore.Text)
            newValues.scoreMax2 = CDbl(txtEndScore.Text)
            newValues.verifiedOnly = chkPeptidesVerified.Checked
            newValues.quantifiedOnly = chkPeptidesQuantified.Checked

            'Changed PM_MASSACC_PEPFILTER 2007-09-05
            newValues.massAccuracyMin = CDbl(txtStartMassAccuracy.Text)
            newValues.massAccuracyMax = CDbl(txtEndMassAccuracy.Text)

            'Changed PM_PEPTIDEFILTER_GENERALISED 2007-08-27
            newValues.tag2 = 0 'A non-negative value... Meaning a filter
            '  is in effect.

            newValues.tag1 = 0 'Not permanent. It is up to client to change this.

            'Changed PM_RAWFILE_PEPFILTER 2007-11-17
            newValues.rawFileID = -389 'Some negative value.
            If Not mGUIindex2code Is Nothing Then
                Dim GUIindex As Integer = cbxRawFile.SelectedIndex()
                newValues.rawFileID = mGUIindex2code(GUIindex)
            End If

            'Changed PM_PEPTIDEFILTER_GENERALISED 2007-08-27
            'mParentForm.setPeptideFilterSpecification(newValues)
            RaiseEvent pepFilterDismissed( _
              aSender, New pepFilterEventArgs(newValues))

            Me.Close()

        Catch exceptionObject As Exception
            MSQuantCommon2.displayStandardExceptionInfo( _
              exceptionObject, _
              "Could not read values dialog in dialog. Some numeric fields may hold letters, etc.")
            Exit Sub
        End Try

    End Sub 'btnOK_Click


    '****************************************************************************
    '*    <placeholder for header>                                              *
    '****************************************************************************
    Private Sub btnCancel_Click( _
      ByVal aSender As System.Object, _
      ByVal anEvent As System.EventArgs) _
      Handles btnCancel.Click

        Me.Close()
    End Sub 'btnCancel_Click


    '****************************************************************************
    '*    <placeholder for header>                                              *
    '****************************************************************************
    Private Sub btnChangeModificationFilter_Click( _
      ByVal aSender As System.Object, ByVal anEvent As System.EventArgs) _
      Handles btnChangeModificationFilter.Click

        Dim modFilterForm As New frmModificationFilter( _
          mModIDlist, Me, mApplication)
        modFilterForm.Show()
    End Sub 'btnChangeModificationFilter_Click


    'Changed PM_PEPTIDEFILTER_GENERALISED 2007-08-24. Moved from file frmOptions.vb.
    '****************************************************************************
    '*    <placeholder for header>                                              *
    '****************************************************************************
    Public Sub newModFilterList2( _
      ByRef anInModIDlist2 As Generic.List(Of Integer))

        'Store it here for now...
        mModIDlist = anInModIDlist2

        lblModFilter.Text = _
           someStatic.formatShortModStr(anInModIDlist2, mApplication)
    End Sub 'newModFilterList


    '****************************************************************************
    '*    <placeholder for header>                                              *
    '****************************************************************************
    Private Sub btnProgramDefaults_Click( _
      ByVal aSender As System.Object, ByVal anEvent As System.EventArgs) _
      Handles btnProgramDefaults.Click

        fillInForm(mProgramDefaultFilter, mApplication, mRawFiles) 'Has
        '  side-effect...
    End Sub 'btnProgramDefaults_Click


End Class 'frmPeptideFilters


'Helper class for pepFilterDismissed event.
'****************************************************************************
'*    <placeholder for header>                                              *
'****************************************************************************
Public Class pepFilterEventArgs
    Inherits System.EventArgs

    Private mFilter As peptideFilterStructure

    '****************************************************************************
    '*    <placeholder for header>                                              *
    '****************************************************************************
    Public Sub New(ByVal aSomeValue As peptideFilterStructure)
        mFilter = aSomeValue
    End Sub


    '****************************************************************************
    '*    <placeholder for header>                                              *
    '****************************************************************************
    Public Function getFilter() _
    As peptideFilterStructure

        Return mFilter 'What about deep copy???
    End Function 'getFilter


End Class 'pepFilterDismissedEventArgs



    

    

Generated by script codePublish.pl at 2008-09-23T11:59:18.