'****************************************************************************
'* 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: Holds Class QuantitationModes, see below for documentation. *
'* *
'****************************************************************************
'****************************************************************************
'* 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: QuantitationModes.vb *
'* TYPE: VISUAL_BASIC *
'* *
'* CREATED: PM 2003-12-08 Vrs 1.0. *
'* UPDATED: PM 2003-xx-xx *
'* *
'****************************************************************************
Option Strict On
Option Explicit On
Imports System.Text 'For StringBuilder
Imports massSpectrometryBase.quantitation 'For QuantitationModes_moreGeneral.
Imports MolecularSharedStructures 'For quantModificationStructure
Imports utilityStatic 'For numbersClose
'Imports System.Runtime.Serialization 'For <Serializable()>
'Imports System.xyz
'****************************************************************************
'd$ <summary>
'd$ Purpose: Namespace for lower layers of mass spectrometric
'd$ applications: raw data file handling, descriptive statistics,
'd$ fragment masses, digestion, file associations, etc.
'd$ <see cref="T:VBXMLDoc.CVBXMLDoc" />.
'd$ <isUnitTest></isUnitTest>
'd$ <applicationname>test_rawDataFileHandling</applicationname>
'd$ <author>Peter Mortensen</author>
'd$ <seealso>http://www.cebi.sdu.dk/</seealso>
'd$ <codetype>PLATFORM independent</codetype>
'd$ </summary>
Namespace massSpectrometryBase
'Changed PM_QUANT_MODE_REORG 2004-01-05. Moved to clsQuerySQL.vb
Public Class someStatic
'Changed PM_PEPTIDEFILTER_GENERALISED 2007-08-24. Moved here,
'outside any (GUI) dialog.
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Public Shared Function formatShortModStr( _
ByVal aFilterMods2 As Generic.List(Of Integer), _
ByRef anInApplication As MSQuant.quantApplication) _
As String
Dim displayStr As String = ""
'Trace.Assert(Not aFilterMods2 Is Nothing, _
' "PIL ASSERT. aFilterMods2 is nothing...")
'Changed PM_PEPTIDEFILTER_GENERALISED 2007-08-29
'We now accept Nothing as input. Handled as if
'empty input list.
If Not aFilterMods2 Is Nothing Then
'Changed PM_EVENMORE_GENERALISED_QUANTMODES 2005-04-08
'Dim quantitationModesObject As QuantitationModes = _
' mApplication.getQuantitationModesObject()
Dim quantModes As QuantitationModes_moreGeneral = _
anInApplication.getQuantModes()
'Changed PM_TYPESAFE 2007-08-02
'Dim definedMods As ArrayList = quantModes.getModifications()
Dim definedMods2 As Generic.List(Of quantModificationStructure) = _
quantModes.getModifications()
Dim modID As Integer
For Each modID In aFilterMods2
Dim modItem As quantModificationStructure
For Each modItem In definedMods2
If modItem.quantModificationID = modID Then
'Dim fullStr As String = modItem.modificationName
'shortStr &= fullStr.Substring(0, 3)
Dim shortStr As String = modItem.formattedString
displayStr &= shortStr
displayStr &= ","
End If
Next
Next
Else
'Input list is Nothing.
Dim peter2 As Integer = 2
End If
If displayStr = "" Then
displayStr = "No mod filter"
End If
Return displayStr
End Function 'formatShortModStr
'****************************************************************************
'* <placeholder for header> *
'****************************************************************************
Public Shared Function pepFilterShortSummary( _
ByVal aFilter As peptideFilterStructure, _
ByRef anInApplication As MSQuant.quantApplication) _
As String
Dim toReturn As String = Nothing
Dim summSB As StringBuilder = New StringBuilder(80)
'Note: in the tests below we check for change of range
' size. This can fail, e.g. if the user specifies
' charge [2,100].
If (aFilter.seqLengthMax - aFilter.seqLengthMin) <> 98 Then
summSB.Append(aFilter.seqLengthMin)
summSB.Append("-")
summSB.Append(aFilter.seqLengthMax)
summSB.Append("AAs")
summSB.Append(",")
End If
If (aFilter.chargeMax - aFilter.chargeMin) <> 19 Then
summSB.Append("ch")
summSB.Append(aFilter.chargeMin)
summSB.Append("-")
summSB.Append(aFilter.chargeMax)
summSB.Append(",")
End If
If Not numbersClose( _
aFilter.scoreMax2 - aFilter.scoreMin, 199.0, 0.001) Then
summSB.Append("sc")
summSB.Append(aFilter.scoreMin)
summSB.Append("-")
summSB.Append(aFilter.scoreMax2)
summSB.Append(",")
End If
If Not numbersClose( _
aFilter.massMax - aFilter.massMin, 8888.0, 0.001) Then
summSB.Append(aFilter.massMin.ToString("0.0"))
summSB.Append("-")
summSB.Append(aFilter.massMax.ToString("0.0"))
summSB.Append("Da,")
End If
If aFilter.highestScoringUniquelyModified Then
summSB.Append("uModH")
summSB.Append(",")
End If
'Changed PM_PEPTIDEFILTER_GENERALISED 2007-08-25
If aFilter.quantifiedOnly Then
summSB.Append("quant")
summSB.Append(",")
End If
If aFilter.verifiedOnly Then
summSB.Append("ver")
summSB.Append(",")
End If
'Changed PM_MASSACC_PEPFILTER 2007-09-05
If Not numbersClose( _
aFilter.massAccuracyMax - aFilter.massAccuracyMin, _
2 * 99999.0, 0.001) Then
summSB.Append(aFilter.massAccuracyMin.ToString("0.0"))
summSB.Append("-")
summSB.Append(aFilter.massAccuracyMax.ToString("0.0"))
summSB.Append("ppm,")
End If
'Note: if called from the main window/options then it should
' forever stay on the default value, code for all raw files.
' Then the summary string will always be empty and that
' is what we want.
If aFilter.rawFileID >= 0 Then
'For now: selected raw file name is NOT displayed.
'Perhaps later: add parameter to this
'function, ByRef anInRawFiles() As fileSpecStructure
summSB.Append("OneRf")
summSB.Append(",")
End If
'Relies on short-curcuit boolean logic.
Dim hasModFilter As Boolean = _
Not aFilter.pepModFilter3 Is Nothing AndAlso _
aFilter.pepModFilter3.Count > 0
'Perhaps this detection should be
'in peptideFilterSpecificationStructure instead?
Dim noFilter As Boolean = _
summSB.Length = 0 AndAlso _
Not hasModFilter
Dim modStr As String = _
someStatic.formatShortModStr( _
aFilter.pepModFilter3, anInApplication)
summSB.Append(modStr)
'If noFilter Then
' toReturn = "No mod filter"
'Else
' toReturn = summSB.ToString()
'End If
toReturn = summSB.ToString()
Return toReturn
End Function 'pepFilterShortSummary()
End Class 'someStatic
End Namespace 'massSpectrometryBase
Generated by script codePublish.pl at 2008-09-23T11:59:18.