Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Peak alignment #786

Open
wants to merge 65 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
4fe3343
Predict Retention Time function added
Alexander-Sol Oct 23, 2023
742ac30
breaking up mbr function, cont'd
Alexander-Sol Oct 23, 2023
e51a740
Decoy search is working
Alexander-Sol Oct 31, 2023
dc4493e
Merge branch 'master' into MbrRefactor
Alexander-Sol Jan 30, 2024
31ff285
Removed decoy toggle from GetIsotopicEnvelopes
Alexander-Sol Jan 30, 2024
dda57b6
About to start MbrScorer refactor
Alexander-Sol Jan 30, 2024
ca9928a
Refactor of MBR is working succesfully
Alexander-Sol Jan 30, 2024
15efaac
Deleted unused code
Alexander-Sol Jan 30, 2024
48239cc
got those decoys decoying naw mean
Alexander-Sol Jan 31, 2024
add08ab
refactore MBR to use concurrent dictionaries
Alexander-Sol Jan 31, 2024
1da0e13
Test method with output
Alexander-Sol Feb 2, 2024
03efb21
Deleted unused fields and references to PearsonCorrelation in isotopi…
Alexander-Sol Feb 2, 2024
5eb2637
Deleted unused using statements in FlashLFQ engine
Alexander-Sol Feb 2, 2024
1aeeb96
Commented + removed unused variables for PredicteRetentionTime method
Alexander-Sol Feb 2, 2024
112ae41
Added comments, removed unused using statements
Alexander-Sol Feb 2, 2024
7703b75
Merge branch 'master' into MbrRefactor
Alexander-Sol Feb 2, 2024
e3fe1e2
Deleted unused variables
Alexander-Sol Feb 2, 2024
8993a25
Merge branch 'MbrRefactor' of https://github.com/Alexander-Sol/mzLib …
Alexander-Sol Feb 2, 2024
7d9b6b1
fixed merge conflicts
Alexander-Sol Feb 2, 2024
40d5f45
Tests are still passing, but I'm about to break things
Alexander-Sol Feb 2, 2024
4f3fc9d
Edited scoring method
Alexander-Sol Feb 2, 2024
79b2890
Umm, edited scoring, increased ppm tolerance, changed minimum rt widt…
Alexander-Sol Feb 6, 2024
5d5c1ee
Did some weird filtering of donor files that should probably be reverted
Alexander-Sol Feb 7, 2024
4a9149c
Peak Organism fix
Alexander-Sol Feb 12, 2024
d8a7a0c
fixed merge conflicts
Alexander-Sol Feb 13, 2024
61fac1c
Basically works, QValue still underestimates
Alexander-Sol Feb 15, 2024
363c457
Minor changes to peakfinding
Alexander-Sol Feb 19, 2024
c4720ba
MSMS double checking
Alexander-Sol Feb 29, 2024
9ade14a
Removed msms double checking
Alexander-Sol Feb 29, 2024
e595cd4
Add check for MBR/MSMS peak collision
Alexander-Sol Mar 1, 2024
c88e32e
Changed peak decoy selection method
Alexander-Sol Mar 7, 2024
b6dbc8c
Optional PeptidesForMbr argument added, not covered in previous commi…
Alexander-Sol Mar 7, 2024
b12c44c
5.3.2.4 - Changed randomRT selection method
Alexander-Sol Mar 7, 2024
6d96aa7
5.3.2.5 - Minimum rtWindowWidth = 30 seconds
Alexander-Sol Mar 7, 2024
8bb7cbe
Actually updated nuget
Alexander-Sol Mar 7, 2024
42e922c
5.3.2.6 - Fixed decoy search. 2.4 and 2.5 are junk
Alexander-Sol Mar 7, 2024
12f3f34
Changed MBR RT prediction method
Alexander-Sol Mar 8, 2024
175e0a7
Fixed bug in rtPrediction
Alexander-Sol Mar 8, 2024
bcf8d7c
Changed decoy search method and fixed issues with decoy rt scoring
Alexander-Sol Mar 9, 2024
768b921
small changes to double check procedure
Alexander-Sol Mar 9, 2024
b324efe
Fixed merge conflicts
Alexander-Sol Mar 9, 2024
9d13eb2
Finished Merging in MbrFdr - mzLib 5341
Alexander-Sol Mar 9, 2024
b147e3b
minor
Alexander-Sol Mar 9, 2024
01482fc
Actually changed nuspec
Alexander-Sol Mar 9, 2024
5ee1d21
Increased Rt Range
Alexander-Sol Mar 9, 2024
7e32625
Increased doublecheck count to 2500. mzLib 5343
Alexander-Sol Mar 9, 2024
3ceb447
reduced window slightly. mzLib 5344
Alexander-Sol Mar 9, 2024
1d5422f
amended rt scoring distribution in mbr scorer
Alexander-Sol Apr 18, 2024
5cbb1c5
Mostly deleted stuff that will be introduced in a different commit
Alexander-Sol Apr 18, 2024
c5249aa
Fixed all tests but one
Alexander-Sol Apr 18, 2024
95f9281
Fixed final test
Alexander-Sol Apr 18, 2024
e6294a9
minor
Alexander-Sol Apr 18, 2024
1fe4112
fixed merge conflicts
Alexander-Sol Apr 18, 2024
3d8a6e9
Merge branch 'master' into MbrPart1
Alexander-Sol Apr 23, 2024
afae344
Increased number of anchor peptides
Alexander-Sol Apr 23, 2024
871c832
Merge branch 'MbrPart1' of https://github.com/Alexander-Sol/mzLib int…
Alexander-Sol Apr 23, 2024
6d44e98
Changed anchors, updated test
Alexander-Sol Apr 23, 2024
f08cba1
nuspec revert
Alexander-Sol Apr 23, 2024
f8394f3
Addressed MRS comments, minor refactor so that scores are calculated …
Alexander-Sol Apr 24, 2024
a5b421c
Merge branch 'master' into MbrPart1
Alexander-Sol Apr 24, 2024
2c00ebc
minor
Alexander-Sol Apr 24, 2024
4bcdc0d
first commit
RayMSMS Jun 12, 2024
618f8c4
example commit
RayMSMS Jun 12, 2024
1da1161
update 7/15/2024
RayMSMS Jul 15, 2024
aa37dda
update the flashLFQ
RayMSMS Sep 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -250,3 +250,4 @@ ModelManifest.xml
# Macintosh files
**/.DS_Store

/mzLib/TestFlashLFQ/XicTest.cs
78 changes: 78 additions & 0 deletions mzLib/FlashLFQ/Alex project/Extremum.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
using MzLibUtil;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FlashLFQ.Alex_project
{

public enum ExtremumType { Minimum, Maximum }; //The spectra file the XIC came from

public class Extremum : IComparable<Extremum>, IEquatable<Extremum>
{
public readonly double Intensity; //The aligned intensity of the Extremum point
public readonly double RetentionTime; //The interpolated intensity of the Extremum point
public readonly ExtremumType Type; //The type of the Extremum point

public Extremum(double intensity, double retentionTime, ExtremumType type)
{
Intensity = intensity;
RetentionTime = retentionTime;
Type = type;
}




public int CompareTo(Extremum others)
{
if (others == null)
{
return 1;
}

if (this - others > 0)
{
return 1;
}

else if (this - others < 0)
{
return -1;
}

else
{
return 0;
}

}

public bool Equals(Extremum others)
{
if (this.Intensity == others.Intensity && Math.Abs(this - others) < 0.006 && this.Type == others.Type)
{
return true;
}

return false;
}

public override bool Equals(Object obj)
{
return Equals(this, (Extremum)obj);
}

public static double operator - (Extremum extremun1, Extremum extrenum2)
{
double rtDiff = extremun1.RetentionTime - extrenum2.RetentionTime;
return rtDiff;
}




}
}
136 changes: 136 additions & 0 deletions mzLib/FlashLFQ/Alex project/ParallelSearch.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
using Easy.Common.Extensions;
using SharpLearning.InputOutput.Csv;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Runtime.ExceptionServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Plotly.NET;
using Plotly.NET.CSharp;
using Chart = Plotly.NET.CSharp.Chart;
using GenericChartExtensions = Plotly.NET.CSharp.GenericChartExtensions;
using System;
using System.Collections.Generic;
using System.Linq;
using Plotly.NET.LayoutObjects;
using Plotly.NET.TraceObjects;
using System.ComponentModel;
using System.Drawing;
using Color = Plotly.NET.Color;



namespace FlashLFQ.Alex_project
{
public class ParallelSearch
{

readonly int threadNumber = Environment.ProcessorCount-1;
readonly int[] threads;
Dictionary<int, XIC> xicDict;
XICGroups[] xicGroups;

public ParallelSearch(Dictionary<int, XIC> xicDict)
{
threads = Enumerable.Range(0, threadNumber).ToArray();
this.xicDict = xicDict;
xicGroups = new XICGroups[threadNumber];
}

public void run()
{
Parallel.ForEach(threads, (currentThread) =>
{
List<XIC> xics = GroupedXIC(xicDict, currentThread);
if (xics.Count() != 0)
{
xicGroups[currentThread] = new XICGroups(xics, 0.5, 0.1);
draw(currentThread, xicGroups[currentThread]);
}

});

Console.WriteLine("The total sum is ");

}

/// <summary>
/// Try to group the XICs from a Big XIC data set. If we met the reference XIC, we will build the XICGroups.
/// </summary>
/// <param name="xicDict"></param>
public static List<XIC> GroupedXIC(Dictionary<int, XIC> xicDict, int thread)
{
Dictionary<int, XIC> xicsToGroup = new Dictionary<int, XIC>();

lock (xicDict)
{
foreach (var xic in xicDict)
{
if (xic.Value.Reference == true && xicsToGroup.Where(p => p.Value.Reference).Count() > 0)
{
break;
}

else
{
xicsToGroup.Add(xic.Key, xic.Value);
xicDict.Remove(xic.Key);
}
}
}

return xicsToGroup.Select(p => p.Value).ToList();

}

public static void draw(int currentThread, XICGroups xicGroup)
{
XIC referenceXIC = xicGroup.reference;

var plotStack = Chart.Combine(
xicGroup.XICs.Select(xic =>
Chart.Scatter<double, double, string>(
xic.Ms1Peaks.Select(p => p.RetentionTime).ToArray(),
xic.Ms1Peaks.Select(p => p.Intensity).ToArray(),
StyleParam.Mode.Lines_Markers,
Name: "No" + currentThread
)
).ToArray()

)
.WithTitle("XIC_differentTime")
.WithXAxisStyle<double, double, string>(Title: Title.init("Times"))
.WithYAxisStyle<double, double, string>(Title: Title.init("Intensities"))
.WithSize(1200, 400);


var plot_extrema = Chart.Combine(new[]
{
Chart.Scatter<double, double, string>(referenceXIC.Ms1Peaks.Select(P=>P.RetentionTime), referenceXIC.Ms1Peaks.Select(P=>P.Intensity),
StyleParam.Mode.Lines_Markers, MarkerSymbol: StyleParam.MarkerSymbol.Circle, Name: "refernece"),
Chart.Scatter<double, double, string>(xicGroup.ExtremaInRef.Select(p=>
p.Key), xicGroup.ExtremaInRef.Select(p=> p.Value),
StyleParam.Mode.Markers, MarkerSymbol: StyleParam.MarkerSymbol.Star, Name: "shared Extrema").WithMarkerStyle(Size: 15),
})

.WithTitle("XIC_sharedExtrema")
.WithXAxisStyle<double, double, string>(Title: Title.init("Times"))
.WithYAxisStyle<double, double, string>(Title: Title.init("Intensities"))
.WithSize(1200, 400);


var stack = Chart.Grid(new[] { plotStack, plot_extrema }, 2, 1)
.WithSize(1200, 800);

GenericChartExtensions.Show(stack);

}

}
}
Loading