Skip to content

Commit c616914

Browse files
author
stefanks
authored
Co-isolation detection, and some GUI sugar
Stefan branch
2 parents 4bf1e0f + c9acde9 commit c616914

File tree

5 files changed

+89
-8
lines changed

5 files changed

+89
-8
lines changed

EngineLayer/PsmWithMultiplePossiblePeptides.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ public class PsmWithMultiplePossiblePeptides
1717

1818
#endregion Public Fields
1919

20+
#region Private Fields
21+
22+
private double? precursorScanBestMass;
23+
24+
#endregion Private Fields
25+
2026
#region Public Constructors
2127

2228
public PsmWithMultiplePossiblePeptides(PsmParent newPsm, HashSet<PeptideWithSetModifications> peptidesWithSetModifications, Tolerance fragmentTolerance, IMsDataFile<IMsDataScan<IMzSpectrum<IMzPeak>>> myMsDataFile, List<ProductType> lp)
@@ -63,6 +69,13 @@ public PsmWithMultiplePossiblePeptides(PsmParent newPsm, HashSet<PeptideWithSetM
6369

6470
PeptideMonoisotopicMass = representative.MonoisotopicMass;
6571

72+
// Look for better match in MS1 spectrum!!!
73+
if (myMsDataFile != null && !precursorScanBestMass.HasValue)
74+
{
75+
var precursorScan = myMsDataFile.GetOneBasedScan(newPsm.precursorScanNumber);
76+
precursorScanBestMass = precursorScan.MassSpectrum.GetClosestPeakXvalue(this.PeptideMonoisotopicMass.ToMz(this.newPsm.scanPrecursorCharge)).ToMass(this.newPsm.scanPrecursorCharge);
77+
}
78+
6679
FullSequence = representative.Sequence;
6780
BaseSequence = representative.BaseSequence;
6881
MissedCleavages = representative.MissedCleavages;
@@ -142,6 +155,9 @@ internal static string TabSeparatedHeader
142155
sb.Append("PeptideMonoisotopicMass" + '\t');
143156
sb.Append("MassDiff (Da)" + '\t');
144157
sb.Append("MassDiff (ppm)" + '\t');
158+
sb.Append("BestMassInPrecursor" + '\t');
159+
sb.Append("MassDiffToBestMass (Da)" + '\t');
160+
sb.Append("MassDiffToBestMass (ppm)" + '\t');
145161
sb.Append("Decoy/Contaminant/Target");
146162
return sb.ToString();
147163
}
@@ -170,6 +186,11 @@ public override string ToString()
170186
sb.Append(PeptideMonoisotopicMass.ToString("F5", CultureInfo.InvariantCulture) + '\t');
171187
sb.Append((ScanPrecursorMass - PeptideMonoisotopicMass).ToString("F5", CultureInfo.InvariantCulture) + '\t');
172188
sb.Append(((ScanPrecursorMass - PeptideMonoisotopicMass) / PeptideMonoisotopicMass * 1e6).ToString("F5", CultureInfo.InvariantCulture) + '\t');
189+
190+
sb.Append(precursorScanBestMass.Value.ToString("F5", CultureInfo.InvariantCulture) + '\t');
191+
sb.Append((precursorScanBestMass - PeptideMonoisotopicMass).Value.ToString("F5", CultureInfo.InvariantCulture) + '\t');
192+
sb.Append(((precursorScanBestMass - PeptideMonoisotopicMass) / PeptideMonoisotopicMass * 1e6).Value.ToString("F5", CultureInfo.InvariantCulture) + '\t');
193+
173194
if (IsDecoy)
174195
sb.Append("D");
175196
else if (IsContaminant)

GUI/SearchTaskWindow.xaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<Expander x:Name="SearchModeExpander" Collapsed="ApmdExpander_Collapsed">
1313
<Expander.Style>
1414
<Style TargetType="Expander">
15-
<Setter Property="Header" Value="{Binding ExpanderTitle}"/>
15+
<Setter Property="Header" Value="{Binding SearchModeExpanderTitle}"/>
1616
<Style.Triggers>
1717
<Trigger Property="IsExpanded" Value="True">
1818
<Setter Property="Header" Value="Hide"/>
@@ -119,7 +119,7 @@
119119
<Expander x:Name="AnalysisExpander" Collapsed="ApmdExpander_Collapsed">
120120
<Expander.Style>
121121
<Style TargetType="Expander">
122-
<Setter Property="Header" Value="{Binding ExpanderTitle}"/>
122+
<Setter Property="Header" Value="{Binding AnalysisExpanderTitle}"/>
123123
<Style.Triggers>
124124
<Trigger Property="IsExpanded" Value="True">
125125
<Setter Property="Header" Value="Hide"/>
@@ -163,7 +163,7 @@
163163
<Expander x:Name="ModExpander" Collapsed="ApmdExpander_Collapsed" Expanded="ModExpander_Expanded">
164164
<Expander.Style>
165165
<Style TargetType="Expander">
166-
<Setter Property="Header" Value="{Binding ExpanderTitle}"/>
166+
<Setter Property="Header" Value="{Binding ModExpanderTitle}"/>
167167
<Style.Triggers>
168168
<Trigger Property="IsExpanded" Value="True">
169169
<Setter Property="Header" Value="Hide"/>

GUI/SearchTaskWindow.xaml.cs

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,16 @@ public SearchTaskWindow()
4343

4444
dataContextForSearchTaskWindow = new DataContextForSearchTaskWindow()
4545
{
46-
ExpanderTitle = string.Join(", ", SearchModesForThisTask.Where(b => b.Use).Select(b => b.Name))
46+
ExpanderTitle = string.Join(", ", SearchModesForThisTask.Where(b => b.Use).Select(b => b.Name)),
47+
ModExpanderTitle =
48+
"fixed: "
49+
+ string.Join(",", ModFileListInWindow.Where(b => b.Fixed).Select(b => b.FileName))
50+
+ " variable: "
51+
+ string.Join(",", ModFileListInWindow.Where(b => b.Variable).Select(b => b.FileName))
52+
+ " localize: "
53+
+ string.Join(",", ModFileListInWindow.Where(b => b.Localize).Select(b => b.FileName)),
54+
AnalysisExpanderTitle = "Some analysis properties...",
55+
SearchModeExpanderTitle = "Some search properties..."
4756
};
4857
this.DataContext = dataContextForSearchTaskWindow;
4958
}
@@ -58,7 +67,16 @@ public SearchTaskWindow(SearchTask task)
5867

5968
dataContextForSearchTaskWindow = new DataContextForSearchTaskWindow()
6069
{
61-
ExpanderTitle = string.Join(", ", SearchModesForThisTask.Where(b => b.Use).Select(b => b.Name))
70+
ExpanderTitle = string.Join(", ", SearchModesForThisTask.Where(b => b.Use).Select(b => b.Name)),
71+
ModExpanderTitle =
72+
"fixed: "
73+
+ string.Join(",", ModFileListInWindow.Where(b => b.Fixed).Select(b => b.FileName))
74+
+ " variable: "
75+
+ string.Join(",", ModFileListInWindow.Where(b => b.Variable).Select(b => b.FileName))
76+
+ " localize: "
77+
+ string.Join(",", ModFileListInWindow.Where(b => b.Localize).Select(b => b.FileName)),
78+
AnalysisExpanderTitle = "Some analysis properties...",
79+
SearchModeExpanderTitle = "Some search properties..."
6280
};
6381
this.DataContext = dataContextForSearchTaskWindow;
6482
}
@@ -204,6 +222,15 @@ private void AddNewAllowedPrecursorMassDiffsButton_Click(object sender, RoutedEv
204222
private void ApmdExpander_Collapsed(object sender, RoutedEventArgs e)
205223
{
206224
dataContextForSearchTaskWindow.ExpanderTitle = string.Join(", ", SearchModesForThisTask.Where(b => b.Use).Select(b => b.Name));
225+
dataContextForSearchTaskWindow.ModExpanderTitle =
226+
"fixed: "
227+
+ string.Join(",", ModFileListInWindow.Where(b => b.Fixed).Select(b => b.FileName))
228+
+ " variable: "
229+
+ string.Join(",", ModFileListInWindow.Where(b => b.Variable).Select(b => b.FileName))
230+
+ " localize: "
231+
+ string.Join(",", ModFileListInWindow.Where(b => b.Localize).Select(b => b.FileName));
232+
dataContextForSearchTaskWindow.AnalysisExpanderTitle = "Some analysis properties...";
233+
dataContextForSearchTaskWindow.SearchModeExpanderTitle = "Some search properties...";
207234
}
208235

209236
private void writePrunedDatabaseCheckBox_Checked(object sender, RoutedEventArgs e)
@@ -252,6 +279,9 @@ public class DataContextForSearchTaskWindow : INotifyPropertyChanged
252279
#region Private Fields
253280

254281
private string expanderTitle;
282+
private string searchModeExpanderTitle;
283+
private string modExpanderTitle;
284+
private string analysisExpanderTitle;
255285

256286
#endregion Private Fields
257287

@@ -273,6 +303,36 @@ public string ExpanderTitle
273303
}
274304
}
275305

306+
public string AnalysisExpanderTitle
307+
{
308+
get { return analysisExpanderTitle; }
309+
set
310+
{
311+
analysisExpanderTitle = value;
312+
RaisePropertyChanged("AnalysisExpanderTitle");
313+
}
314+
}
315+
316+
public string ModExpanderTitle
317+
{
318+
get { return modExpanderTitle; }
319+
set
320+
{
321+
modExpanderTitle = value;
322+
RaisePropertyChanged("ModExpanderTitle");
323+
}
324+
}
325+
326+
public string SearchModeExpanderTitle
327+
{
328+
get { return searchModeExpanderTitle; }
329+
set
330+
{
331+
searchModeExpanderTitle = value;
332+
RaisePropertyChanged("SearchModeExpanderTitle");
333+
}
334+
}
335+
276336
#endregion Public Properties
277337

278338
#region Protected Methods

Test/CalibrationEngineTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public static void TestCalibrationEngine()
3333
Tolerance fragmentTolerance = new Tolerance(ToleranceUnit.Absolute, 0.01);
3434

3535
List<NewPsmWithFdr> identifications = new List<NewPsmWithFdr>();
36-
PsmParent newPsm = new TestParentSpectrumMatch(2, 2);
36+
PsmParent newPsm = new TestParentSpectrumMatch(2, 2, 1);
3737
PsmWithMultiplePossiblePeptides thisPSM = new PsmWithMultiplePossiblePeptides(newPsm, new HashSet<PeptideWithSetModifications>() { pepWithSetMods }, fragmentTolerance, myMsDataFile, new List<ProductType> { ProductType.B, ProductType.Y });
3838
NewPsmWithFdr thePsmwithfdr = new NewPsmWithFdr(thisPSM);
3939
thePsmwithfdr.SetValues(1, 0, 0, 1, 0, 0);
@@ -58,7 +58,7 @@ public static void TestQuadratic()
5858

5959
Tolerance fragmentTolerance = new Tolerance(ToleranceUnit.Absolute, 0.1);
6060

61-
NewPsmWithFdr thePsmwithfdr = new NewPsmWithFdr(new PsmWithMultiplePossiblePeptides(new TestParentSpectrumMatch(2, 2), new HashSet<PeptideWithSetModifications>() { pepWithSetMods }, fragmentTolerance, myMsDataFile, new List<ProductType> { ProductType.B, ProductType.Y }));
61+
NewPsmWithFdr thePsmwithfdr = new NewPsmWithFdr(new PsmWithMultiplePossiblePeptides(new TestParentSpectrumMatch(2, 2, 1), new HashSet<PeptideWithSetModifications>() { pepWithSetMods }, fragmentTolerance, myMsDataFile, new List<ProductType> { ProductType.B, ProductType.Y }));
6262
thePsmwithfdr.SetValues(1, 0, 0, 1, 0, 0);
6363

6464
var res = new CalibrationEngine(myMsDataFile, fragmentTolerance, new List<NewPsmWithFdr> { thePsmwithfdr }, 3, 2, 10, new Tolerance(ToleranceUnit.PPM, 10), FragmentTypes.b | FragmentTypes.y, (List<LabeledMs1DataPoint> theList, string s) => {; }, (List<LabeledMs2DataPoint> theList, string s) => {; }, true, new List<string>()).Run();

Test/TestParentSpectrumMatch.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ internal class TestParentSpectrumMatch : PsmParent
1010

1111
#region Public Constructors
1212

13-
public TestParentSpectrumMatch(int scanNumber, int scanPrecursorCharge) : base(null, double.NaN, double.NaN, double.NaN, scanNumber, 0, scanPrecursorCharge, 0, double.NaN, double.NaN, double.NaN, 1)
13+
public TestParentSpectrumMatch(int scanNumber, int scanPrecursorCharge, int precursorScanNumber) : base(null, double.NaN, double.NaN, double.NaN, scanNumber, precursorScanNumber, scanPrecursorCharge, 0, double.NaN, double.NaN, double.NaN, 1)
1414
{
1515
}
1616

0 commit comments

Comments
 (0)