Skip to content

Commit

Permalink
not working
Browse files Browse the repository at this point in the history
  • Loading branch information
trishorts committed Nov 15, 2023
1 parent 8991e14 commit 02bf807
Show file tree
Hide file tree
Showing 16 changed files with 1,034 additions and 936 deletions.
53 changes: 0 additions & 53 deletions mzLib/Omics/Fragmentation/IProduct.cs

This file was deleted.

6 changes: 3 additions & 3 deletions mzLib/Omics/Fragmentation/MatchedFragmentIon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ namespace Omics.Fragmentation
{
public class MatchedFragmentIon
{
public readonly IProduct NeutralTheoreticalProduct;
public readonly Product NeutralTheoreticalProduct;
public readonly double Mz;
public readonly double Intensity;
public readonly int Charge;

/// <summary>
/// Constructs a new MatchedFragmentIon given information about a theoretical and an experimental fragment mass spectral peak
/// </summary>
public MatchedFragmentIon(ref IProduct neutralTheoreticalProduct, double experMz, double experIntensity, int charge)
public MatchedFragmentIon(ref Product neutralTheoreticalProduct, double experMz, double experIntensity, int charge)
{
NeutralTheoreticalProduct = neutralTheoreticalProduct;
Mz = experMz;
Expand All @@ -23,7 +23,7 @@ public MatchedFragmentIon(ref IProduct neutralTheoreticalProduct, double experMz
/// <summary>
/// Constructs a new MatchedFragmentIon given information about a theoretical and an experimental fragment mass spectral peak
/// </summary>
public MatchedFragmentIon(IProduct neutralTheoreticalProduct, double experMz, double experIntensity, int charge)
public MatchedFragmentIon(Product neutralTheoreticalProduct, double experMz, double experIntensity, int charge)
{
NeutralTheoreticalProduct = neutralTheoreticalProduct;
Mz = experMz;
Expand Down
110 changes: 110 additions & 0 deletions mzLib/Omics/Fragmentation/Product.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Chemistry;

namespace Omics.Fragmentation
{
public class Product : IHasMass
{
public double NeutralMass { get; }
public ProductType ProductType { get; }
public double NeutralLoss { get; }
public FragmentationTerminus Terminus { get; }
public int FragmentNumber { get; }
public int ResiduePosition { get; }
public int AminoAcidPosition => ResiduePosition;
public ProductType? SecondaryProductType { get; } //used for internal fragment ions
public int SecondaryFragmentNumber { get; } //used for internal fragment ions
public double MonoisotopicMass => NeutralMass;

/// <summary>
/// A product is the individual neutral fragment from an MS dissociation. A fragmentation product here contains one of the two termini (N- or C-).
/// The ProductType describes where along the backbone the fragmentaiton occurred (e.g. b-, y-, c-, zdot-). The neutral loss mass (if any) that
/// occurred from a mod on the fragment is listed as a mass. Finally the neutral mass of the whole fragment is provided.
/// </summary>
public Product(ProductType productType, FragmentationTerminus terminus, double neutralMass,
int fragmentNumber, int residuePosition, double neutralLoss, ProductType? secondaryProductType = null,
int secondaryFragmentNumber = 0)
{
NeutralMass = neutralMass;
ProductType = productType;
NeutralLoss = neutralLoss;
Terminus = terminus;
FragmentNumber = fragmentNumber;
ResiduePosition = residuePosition;
SecondaryProductType = secondaryProductType;
SecondaryFragmentNumber = secondaryFragmentNumber;
}

public string Annotation
{
get
{
StringBuilder sb = new StringBuilder();

if (SecondaryProductType == null)
{
sb.Append(ProductType);

// for "normal" fragments this is just the fragment number (e.g., the 3 in the b3 ion)
// for diagnostic ions, it's the m/z assuming z=1
// (e.g., a diagnostic ion with neutral mass 100 Da will be reported as the D101 fragment)
sb.Append(FragmentNumber);
}
else
{
//internal fragment ion, annotation used here: 10.1007/s13361-015-1078-1
//example: yIb[18-36]
sb.Append(ProductType + "I" + SecondaryProductType.Value + "[" + FragmentNumber + "-" + SecondaryFragmentNumber + "]");
}
if (NeutralLoss != 0)
{
sb.Append("-");
sb.Append(NeutralLoss.ToString("F2"));
}

return sb.ToString();
}
}

/// <summary>
/// Summarizes a Product into a string for debug purposes
/// </summary>
public override string ToString()
{
if (SecondaryProductType == null)
{
return ProductType + "" + FragmentNumber + ";" + NeutralMass.ToString("F5") + "-" +
string.Format("{0:0.##}", NeutralLoss);
}
else
{
return ProductType + "I" + SecondaryProductType.Value + "[" + FragmentNumber + "-" +
SecondaryFragmentNumber + "]" + ";" + NeutralMass.ToString("F5") + "-" +
string.Format("{0:0.##}", NeutralLoss);
}
}

public override bool Equals(object obj)

Check warning on line 90 in mzLib/Omics/Fragmentation/Product.cs

View workflow job for this annotation

GitHub Actions / build

Nullability of type of parameter 'obj' doesn't match overridden member (possibly because of nullability attributes).
{
return obj is Product other && Equals(other);
}

public bool Equals(Product product)
{
return this.ProductType.Equals(product.ProductType)
&& this.NeutralMass.Equals(product.NeutralMass)
&& this.FragmentNumber == product.FragmentNumber
&& this.NeutralLoss.Equals(product.NeutralLoss)
&& this.SecondaryFragmentNumber == product.SecondaryFragmentNumber
&& this.SecondaryProductType == product.SecondaryProductType;
}

public override int GetHashCode()
{
return NeutralMass.GetHashCode();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using Omics.Fragmentation;

namespace Proteomics.Fragmentation
namespace Omics.Fragmentation
{
public class TerminusSpecificProductTypes
{
Expand Down
52 changes: 0 additions & 52 deletions mzLib/Omics/ISpectrumMatch.cs

This file was deleted.

1 change: 1 addition & 0 deletions mzLib/Omics/Omics.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Platforms>x64</Platforms>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
1 change: 1 addition & 0 deletions mzLib/Omics/SpectrumMatch/LibrarySpectrum.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Text;
using Easy.Common.Extensions;
using MassSpectrometry.MzSpectra;
using Omics.Fragmentation;

namespace Omics.SpectrumMatch
Expand Down
Loading

0 comments on commit 02bf807

Please sign in to comment.