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

PTM Stoichiometry #797

Draft
wants to merge 62 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
8bf52b1
Bug fix. Previous ParseModifications implementation could give negati…
pcruzparri Aug 27, 2024
dcede87
Saving draft implementation of a site-occupancy calculation.
pcruzparri Aug 27, 2024
0e59e82
Merge branch 'master' of https://github.com/smith-chem-wisc/mzLib int…
pcruzparri Sep 12, 2024
41ef6f4
Saving some initial progress on the occupancy calculation. Started Mx…
pcruzparri Sep 13, 2024
f06af28
temp
pcruzparri Sep 17, 2024
2ebe188
Merge branch 'master' of https://github.com/smith-chem-wisc/mzLib int…
pcruzparri Oct 11, 2024
b8fb4cb
PTM calculation implemented into FlashLFQ engine. Base method exists …
pcruzparri Oct 11, 2024
8d8658d
Removed the sandbox test Peter and changed the default arguments of P…
pcruzparri Oct 11, 2024
8fb7360
Added fixes to the FlashLFQResults and PositionFrequencyAnalysis impl…
pcruzparri Oct 11, 2024
74ed705
Fixed flipped logic in FlashLFQ/Peptide.GetTotalIntensity(). Cleaned …
pcruzparri Oct 14, 2024
6c18e9f
Transcriptomics Digestion and Fragmentation (#801)
nbollis Oct 15, 2024
68165b0
Refactored the PositionFrequencyAnalysis code to eliminate the nested…
pcruzparri Oct 18, 2024
58e6346
Bug fix. Previous ParseModifications implementation could give negati…
pcruzparri Aug 27, 2024
f0d67d0
Saving draft implementation of a site-occupancy calculation.
pcruzparri Aug 27, 2024
7b04937
Saving some initial progress on the occupancy calculation. Started Mx…
pcruzparri Sep 13, 2024
d2c240e
temp
pcruzparri Sep 17, 2024
af278f0
PTM calculation implemented into FlashLFQ engine. Base method exists …
pcruzparri Oct 11, 2024
ef3ec35
Removed the sandbox test Peter and changed the default arguments of P…
pcruzparri Oct 11, 2024
f577298
Added fixes to the FlashLFQResults and PositionFrequencyAnalysis impl…
pcruzparri Oct 11, 2024
f21d365
Fixed flipped logic in FlashLFQ/Peptide.GetTotalIntensity(). Cleaned …
pcruzparri Oct 14, 2024
f6caa30
Refactored the PositionFrequencyAnalysis code to eliminate the nested…
pcruzparri Oct 18, 2024
b146768
Merge branch 'ptm_stoich' of https://github.com/pcruzparri/mzLib into…
pcruzparri Oct 18, 2024
dc20e44
Neutral Mass Spectrum (#806)
nbollis Oct 29, 2024
7dcf9a9
Updated SpectraFileAveraging.cs to include the ScanFilter parameter (…
nbollis Oct 29, 2024
cb08d67
MSFragger Results Folder Reader (#792)
mzhastings Oct 30, 2024
b055693
Get Modifications from Full Sequence (#796)
nbollis Oct 30, 2024
e5cf73e
Changes to MBR within FlashLFQ (#802)
Alexander-Sol Nov 5, 2024
6411360
Fixed decoy order (#809)
Alexander-Sol Nov 18, 2024
848413d
saving progress on PeptideToProteinPTMOccupancy and updated Regex mod…
pcruzparri Dec 6, 2024
fed869f
Averaging slight adjustement for ensured thread safety (#810)
nbollis Dec 12, 2024
21c1702
Extended IBioPolymerWithSetMods interface, changed hashcodes (#811)
Alexander-Sol Dec 12, 2024
d98326b
IEquality Hotfix (#817)
nbollis Dec 16, 2024
90bd259
Changing the github actions workflow to test integration with MetaMor…
Alexander-Sol Dec 17, 2024
dc44773
IEquality hot fix hot fix (#819)
nbollis Dec 18, 2024
264521b
Db writer fix (#820)
Alexander-Sol Jan 10, 2025
5443e36
IsoDec Deconvolution Algorithm (#791)
nbollis Jan 10, 2025
331ee1d
Object Pooling (#822)
nbollis Jan 15, 2025
1b8b950
Digestion Consolidation and Optimization (#823)
nbollis Jan 17, 2025
5d9671a
Digestion: Fixed mod terminal fix and variable mod ordering (#825)
nbollis Jan 18, 2025
98ea879
Mzml writer now rounds to 4 decimal places (#821)
Alexander-Sol Jan 18, 2025
e33a478
Tims tof reader (#812)
Alexander-Sol Jan 19, 2025
de68239
Put those mods back where they came from or so help me (#827)
nbollis Jan 22, 2025
5d2b774
Changed rounding method (#826)
Alexander-Sol Jan 22, 2025
981fc57
Undo Rounding (#831)
Alexander-Sol Jan 31, 2025
6ed70c6
Change github action workflow to upload MM installer artifact (#829)
Alexander-Sol Jan 31, 2025
9835b78
Updated nuspec (#830)
Alexander-Sol Jan 31, 2025
7cdd05d
enable reading of lipid mods from protein xml with test (#828)
trishorts Jan 31, 2025
03f462b
Bug fix. Previous ParseModifications implementation could give negati…
pcruzparri Aug 27, 2024
e4d2853
Saving draft implementation of a site-occupancy calculation.
pcruzparri Aug 27, 2024
741dbd6
Saving some initial progress on the occupancy calculation. Started Mx…
pcruzparri Sep 13, 2024
82af7a6
temp
pcruzparri Sep 17, 2024
def5faa
PTM calculation implemented into FlashLFQ engine. Base method exists …
pcruzparri Oct 11, 2024
29ca983
Removed the sandbox test Peter and changed the default arguments of P…
pcruzparri Oct 11, 2024
282c1b5
Added fixes to the FlashLFQResults and PositionFrequencyAnalysis impl…
pcruzparri Oct 11, 2024
aa1aaec
Fixed flipped logic in FlashLFQ/Peptide.GetTotalIntensity(). Cleaned …
pcruzparri Oct 14, 2024
91dddfd
Refactored the PositionFrequencyAnalysis code to eliminate the nested…
pcruzparri Oct 18, 2024
cb3afd5
temp
pcruzparri Sep 17, 2024
4b3e4b9
PTM calculation implemented into FlashLFQ engine. Base method exists …
pcruzparri Oct 11, 2024
b81d218
Added fixes to the FlashLFQResults and PositionFrequencyAnalysis impl…
pcruzparri Oct 11, 2024
43f525b
saving progress on PeptideToProteinPTMOccupancy and updated Regex mod…
pcruzparri Dec 6, 2024
463d65a
rebased onto updated master
pcruzparri Feb 5, 2025
320dcd6
cleaning for tests.
pcruzparri Feb 10, 2025
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
62 changes: 62 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,65 @@ jobs:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
verbose: true
files: mzLib/Test*/TestResults/*/coverage.cobertura.xml
integration:
runs-on: windows-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v2
- name: Set up .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: cd mzLib && dotnet restore
- name: Build
run: cd mzLib && dotnet build --no-restore --configuration Release
- name: Change mzLib version, pack, add source
run: |
cd mzLib;
(Get-Content mzLib.nuspec) -replace "\<version\>(.*)\</version\>", "<version>9.9.9</version>" | Set-Content mzLib.nuspec;
$mzlibMatch = Select-String -Path mzLib.nuspec -Pattern "(?<=\<version\>)(.*)(?=\</version)";
$mzlibVersion = $mzlibMatch.Matches[0].Value;
echo "mzLib version number changed to: $mzlibVersion";
nuget pack;
$currentFolder = pwd;
dotnet nuget add source $currentFolder;
dotnet nuget list source;
- name: Clone MetaMorpheus
uses: actions/checkout@master
with:
path: ./MetaMorpheus
repository: smith-chem-wisc/MetaMorpheus
ref: master
- name: Change MetaMorpheus mzLib version and restore
run: |
cd ./MetaMorpheus/MetaMorpheus;
dotnet remove CMD package mzLib;
dotnet add CMD package mzLib -v 9.9.9;
dotnet remove GUI package mzLib;
dotnet add GUI package mzLib -v 9.9.9;
dotnet remove GuiFunctions package mzLib;
dotnet add GuiFunctions package mzLib -v 9.9.9;
dotnet remove EngineLayer package mzLib;
dotnet add EngineLayer package mzLib -v 9.9.9;
dotnet remove Test package mzLib;
dotnet add Test package mzLib -v 9.9.9;
dotnet remove TaskLayer package mzLib;
dotnet add TaskLayer package mzLib -v 9.9.9;
dotnet restore;
- name: Build MetaMorpheus
run: cd ./MetaMorpheus/MetaMorpheus && dotnet build --no-restore
- name: Test
run: cd ./MetaMorpheus/MetaMorpheus && dotnet test --no-build --verbosity normal
- name: Upload artifact (installer)
uses: actions/upload-artifact@v4
with:
name: MetaMorpheusInstaller
path: ./MetaMorpheus/MetaMorpheus/MetaMorpheusSetup/bin/Debug/MetaMorpheusInstaller.msi
compression-level: 0
- name: Upload artifact (GUI)
uses: actions/upload-artifact@v4
with:
name: MetaMorpheusGUI
path: ./MetaMorpheus/MetaMorpheus/GUI/bin/Debug/net8.0-windows/

1 change: 1 addition & 0 deletions mzLib/Chemistry/ClassExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public static double ToMass(this double massToChargeRatio, int charge)
return Math.Abs(charge) * massToChargeRatio - charge * Constants.ProtonMass;
}

public static double? RoundedDouble(this double myNumber, int places = 9) => RoundedDouble(myNumber as double?, places);
public static double? RoundedDouble(this double? myNumber, int places = 9)
{
if (myNumber != null)
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class SinglePeakDeconvolutionTestCase
public SinglePeakDeconvolutionTestCase(DeconvolutionParameters deconParameters, string sampleInformation, string spectrumPath, int scanNumber,
double expectedMostAbundantObservedIsotopicMass, int expectedIonChargeState, double selectedIonMz, double precursorPpmMassTolerance)
{

DeconvolutionParameters = deconParameters;
SampleInformation = sampleInformation;
ExpectedMostAbundantObservedIsotopicMass = expectedMostAbundantObservedIsotopicMass;
ExpectedIonChargeState = expectedIonChargeState;
Expand Down
6 changes: 3 additions & 3 deletions mzLib/Development/Development.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
</ItemGroup>

<ItemGroup>
<None Update="Deconvolution\TestData\Averaged_221110_CytoOnly.mzML">
<None Update="DeconvolutionDevelopment\TestData\Averaged_221110_CytoOnly.mzML">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Deconvolution\TestData\Averaged_221110_HGHOnly.mzML">
<None Update="DeconvolutionDevelopment\TestData\Averaged_221110_HGHOnly.mzML">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Deconvolution\TestData\Averaged_221110_UbiqOnly.mzML">
<None Update="DeconvolutionDevelopment\TestData\Averaged_221110_UbiqOnly.mzML">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
Expand Down
88 changes: 38 additions & 50 deletions mzLib/FlashLFQ/ChromatographicPeak.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using MzLibUtil;
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ClassExtensions = Chemistry.ClassExtensions;
using FlashLFQ.PEP;

namespace FlashLFQ
{
Expand All @@ -16,20 +16,23 @@ public class ChromatographicPeak
public int ScanCount => IsotopicEnvelopes.Count;
public double SplitRT;
public readonly bool IsMbrPeak;
public double PredictedRetentionTime { get; init; }

public double MbrScore;
public double PpmScore { get; set; }
public double IntensityScore { get; set; }
public double RtScore { get; set; }
public double ScanCountScore { get; set; }
public double IsotopicDistributionScore { get; set; }
/// <summary>
/// A score bounded by 100 and 0, with more confident MBR-detections receiving higher scores
/// Stores the pearson correlation between the apex isotopic envelope and the theoretical isotopic distribution
/// </summary>
public double MbrScore { get; private set; }

/// The four scores below are bounded by 0 and 1, with higher scores being better
public double PpmScore { get; private set; }
public double IntensityScore { get; private set; }
public double RtScore { get; private set; }
public double ScanCountScore { get; private set; }

public ChromatographicPeak(Identification id, bool isMbrPeak, SpectraFileInfo fileInfo)
public double IsotopicPearsonCorrelation => Apex?.PearsonCorrelation ?? -1;
public double RtPredictionError { get; set; }
public List<int> ChargeList { get; set; }
internal double MbrQValue { get; set; }
public ChromatographicPeakData PepPeakData { get; set; }
public double? MbrPep { get; set; }

public ChromatographicPeak(Identification id, bool isMbrPeak, SpectraFileInfo fileInfo, bool randomRt = false)
{
SplitRT = 0;
NumChargeStatesObserved = 0;
Expand All @@ -40,12 +43,14 @@ public ChromatographicPeak(Identification id, bool isMbrPeak, SpectraFileInfo fi
IsotopicEnvelopes = new List<IsotopicEnvelope>();
IsMbrPeak = isMbrPeak;
SpectraFileInfo = fileInfo;
RandomRt = randomRt;
}

public ChromatographicPeak(Identification id, bool isMbrPeak, SpectraFileInfo fileInfo, double predictedRetentionTime) :
this(id, isMbrPeak, fileInfo)
public bool Equals(ChromatographicPeak peak)
{
PredictedRetentionTime = predictedRetentionTime;
return SpectraFileInfo.Equals(peak.SpectraFileInfo)
&& Identifications.First().ModifiedSequence.Equals(peak.Identifications.First().ModifiedSequence)
&& ApexRetentionTime == peak.ApexRetentionTime;
}

public IsotopicEnvelope Apex { get; private set; }
Expand All @@ -54,13 +59,18 @@ public ChromatographicPeak(Identification id, bool isMbrPeak, SpectraFileInfo fi
public int NumIdentificationsByBaseSeq { get; private set; }
public int NumIdentificationsByFullSeq { get; private set; }
public double MassError { get; private set; }
/// <summary>
/// Bool that describes whether the retention time of this peak was randomized
/// If true, implies that this peak is a decoy peak identified by the MBR algorithm
/// </summary>
public bool RandomRt { get; }
public bool DecoyPeptide => Identifications.First().IsDecoy;

public void CalculateIntensityForThisFeature(bool integrate)
{
if (IsotopicEnvelopes.Any())
{
double maxIntensity = IsotopicEnvelopes.Max(p => p.Intensity);
Apex = IsotopicEnvelopes.First(p => p.Intensity == maxIntensity);
Apex = IsotopicEnvelopes.MaxBy(p => p.Intensity);

if (integrate)
{
Expand Down Expand Up @@ -123,25 +133,6 @@ public void ResolveIdentifications()
this.NumIdentificationsByBaseSeq = Identifications.Select(v => v.BaseSequence).Distinct().Count();
this.NumIdentificationsByFullSeq = Identifications.Select(v => v.ModifiedSequence).Distinct().Count();
}

/// <summary>
/// Calculates four component scores and one overarching Mbr score for an MBR peak.
/// MBR Score is equal to 100 * the geometric mean of the four component scores.
/// </summary>
/// <param name="scorer"> An MbrScorer specific to the file where this peak was found </param>
/// <param name="donorPeak"> The donor peak used as the basis for the MBR identification. </param>
internal void CalculateMbrScore(MbrScorer scorer, ChromatographicPeak donorPeak)
{
if (SpectraFileInfo != scorer.AcceptorFile) throw new MzLibException("Error when performing match-between-runs: Mismatch between scorer and peak.");

IntensityScore = scorer.CalculateIntensityScore(this, donorPeak);
RtScore = scorer.CalculateRetentionTimeScore(this, donorPeak);
PpmScore = scorer.CalculatePpmErrorScore(this);
ScanCountScore = scorer.CalculateScanCountScore(this);

MbrScore = 100 * Math.Pow(IntensityScore * RtScore * PpmScore * ScanCountScore, 0.25);
}

public static string TabSeparatedHeader
{
get
Expand All @@ -164,20 +155,18 @@ public static string TabSeparatedHeader
sb.Append("Peak Charge" + "\t");
sb.Append("Num Charge States Observed" + "\t");
sb.Append("Peak Detection Type" + "\t");
sb.Append("MBR Score" + "\t");
sb.Append("Ppm Score" + "\t");
sb.Append("Intensity Score" + "\t");
sb.Append("Rt Score" + "\t");
sb.Append("Scan Count Score" + "\t");
sb.Append("PIP Q-Value" + "\t");
sb.Append("PIP PEP" + "\t");
sb.Append("PSMs Mapped" + "\t");
sb.Append("Base Sequences Mapped" + "\t");
sb.Append("Full Sequences Mapped" + "\t");
sb.Append("Peak Split Valley RT" + "\t");
sb.Append("Peak Apex Mass Error (ppm)");
sb.Append("Peak Apex Mass Error (ppm)" + "\t");
sb.Append("Decoy Peptide" + "\t");
sb.Append("Random RT");
return sb.ToString();
}
}

public override string ToString()
{
StringBuilder sb = new StringBuilder();
Expand Down Expand Up @@ -260,17 +249,16 @@ public override string ToString()
sb.Append("" + "MSMS" + "\t");
}

sb.Append("" + (IsMbrPeak ? MbrScore.ToString() : "") + "\t");
sb.Append("" + (IsMbrPeak ? PpmScore.ToString() : "") + "\t");
sb.Append("" + (IsMbrPeak ? IntensityScore.ToString() : "") + "\t");
sb.Append("" + (IsMbrPeak ? RtScore.ToString() : "") + "\t");
sb.Append("" + (IsMbrPeak ? ScanCountScore.ToString() : "") + "\t");
sb.Append("" + (IsMbrPeak ? MbrQValue.ToString() : "") + "\t");
sb.Append("" + (IsMbrPeak ? MbrPep.ToString() : "") + "\t");

sb.Append("" + Identifications.Count + "\t");
sb.Append("" + NumIdentificationsByBaseSeq + "\t");
sb.Append("" + NumIdentificationsByFullSeq + "\t");
sb.Append("" + SplitRT + "\t");
sb.Append("" + MassError);
sb.Append("\t" + DecoyPeptide);
sb.Append("\t" + RandomRt);

return sb.ToString();
}
Expand Down
2 changes: 2 additions & 0 deletions mzLib/FlashLFQ/FlashLFQ.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
<ItemGroup>
<PackageReference Include="CsvHelper" Version="32.0.3" />
<PackageReference Include="MathNet.Numerics" Version="5.0.0" />
<PackageReference Include="Microsoft.ML" Version="3.0.1" />
<PackageReference Include="Microsoft.ML.FastTree" Version="3.0.1" />
<PackageReference Include="NetSerializer" Version="4.1.2" />
<PackageReference Include="SharpLearning.Optimization" Version="[0.28.0]" />
</ItemGroup>
Expand Down
Loading
Loading