-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into eliminateExtraTabFromChromatographicPeak
- Loading branch information
Showing
69 changed files
with
8,794 additions
and
272 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Omics.Fragmentation | ||
{ | ||
public enum FragmentationTerminus | ||
{ | ||
Both, //N- and C-terminus | ||
N, //N-terminus only | ||
C, //C-terminus only | ||
None //used for internal fragments, could be used for top down intact mass? | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 1 addition & 5 deletions
6
...mentation/TerminusSpecificProductTypes.cs → ...n/Peptide/TerminusSpecificProductTypes.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<Platforms>x64</Platforms> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Chemistry\Chemistry.csproj" /> | ||
<ProjectReference Include="..\MassSpectrometry\MassSpectrometry.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
using System.Text; | ||
using Easy.Common.Extensions; | ||
using MassSpectrometry; | ||
using MassSpectrometry.MzSpectra; | ||
using Omics.Fragmentation; | ||
|
||
namespace Omics.SpectrumMatch | ||
{ | ||
public class LibrarySpectrum : MzSpectrum | ||
{ | ||
public string Sequence { get; set; } | ||
public double? RetentionTime { get; set; } | ||
public double PrecursorMz { get; set; } | ||
public int ChargeState { get; set; } | ||
public List<MatchedFragmentIon> MatchedFragmentIons { get; set; } | ||
public bool IsDecoy { get; set; } | ||
|
||
public string Name | ||
{ | ||
get { return Sequence + "/" + ChargeState; } | ||
} | ||
|
||
public LibrarySpectrum(string sequence, double precursorMz, int chargeState, List<MatchedFragmentIon> peaks, double? rt, bool isDecoy = false) : base(peaks.Select(p => p.Mz).ToArray(), peaks.Select(p => p.Intensity).ToArray(), false) | ||
{ | ||
Sequence = sequence; | ||
PrecursorMz = precursorMz; | ||
MatchedFragmentIons = peaks; | ||
ChargeState = chargeState; | ||
IsDecoy = isDecoy; | ||
RetentionTime = rt; | ||
Array.Sort(XArray, YArray); | ||
} | ||
|
||
/// <summary> | ||
/// This function enables the spectrum angle to be computed between an individual experimental spectrum and the loaded library spectrum within MetaDraw | ||
/// </summary> | ||
/// <param name="librarySpectrum"></param> | ||
/// <returns></returns> | ||
public string CalculateSpectralAngleOnTheFly(List<MatchedFragmentIon> spectrumMatchFragments) | ||
{ | ||
if (!spectrumMatchFragments.Any()) | ||
{ | ||
return "N/A"; | ||
} | ||
|
||
if (spectrumMatchFragments.IsNotNullOrEmpty()) { } | ||
SpectralSimilarity spectraComparison = new SpectralSimilarity( | ||
spectrumMatchFragments.Select(f => f.Mz).ToArray(), | ||
spectrumMatchFragments.Select(f => f.Intensity).ToArray(), | ||
MatchedFragmentIons.Select(f => f.Mz).ToArray(), | ||
MatchedFragmentIons.Select(f => f.Intensity).ToArray(), | ||
SpectralSimilarity.SpectrumNormalizationScheme.mostAbundantPeak, | ||
toleranceInPpm: 20, | ||
allPeaks: true); | ||
double? spectralContrastAngle = spectraComparison.SpectralContrastAngle(); | ||
|
||
return spectralContrastAngle == null | ||
? "N/A" | ||
: ((double)spectralContrastAngle).ToString("F4"); | ||
} | ||
|
||
public override string ToString() | ||
{ | ||
StringBuilder spectrum = new StringBuilder(); | ||
spectrum.Append("Name: " + Name); | ||
spectrum.Append("\nMW: " + PrecursorMz); | ||
spectrum.Append("\nComment: "); | ||
spectrum.Append("Parent=" + PrecursorMz); | ||
spectrum.Append(" RT=" + RetentionTime); | ||
spectrum.Append("\nNum peaks: " + MatchedFragmentIons.Count); | ||
|
||
double maxIntensity = MatchedFragmentIons.Select(b => b.Intensity).Max(); | ||
|
||
foreach (MatchedFragmentIon matchedIon in MatchedFragmentIons) | ||
{ | ||
double intensityFraction = matchedIon.Intensity / maxIntensity; | ||
|
||
string neutralLoss = null; | ||
if (matchedIon.NeutralTheoreticalProduct.NeutralLoss != 0) | ||
{ | ||
neutralLoss = "-" + matchedIon.NeutralTheoreticalProduct.NeutralLoss; | ||
} | ||
|
||
spectrum.Append("\n" + matchedIon.Mz + "\t" + intensityFraction + "\t" + "\"" + | ||
matchedIon.NeutralTheoreticalProduct.ProductType.ToString() + | ||
matchedIon.NeutralTheoreticalProduct.FragmentNumber.ToString() + "^" + | ||
matchedIon.Charge + neutralLoss + "/" + 0 + "ppm" + "\""); | ||
} | ||
|
||
return spectrum.ToString(); | ||
} | ||
} | ||
} |
Oops, something went wrong.