/// <summary> /// /// </summary> /// <param name="abbreviation"></param> /// <param name="toBase"></param> /// <param name="fromBase"></param> /// <param name="mass"></param> /// <param name="acceleration"></param> protected ForceBase(string abbreviation, IUnitConversion toBase, IUnitConversion fromBase, IMass mass, IAcceleration acceleration) : base(abbreviation, toBase, fromBase, mass, acceleration) { VerifyDimensions(); }
public static int Compare(this IMass mass1, IMass mass2, double epsilon = MassEqualityEpsilon) { double difference = mass1.MonoisotopicMass - mass2.MonoisotopicMass; if (difference < -epsilon) return -1; return difference > epsilon ? 1 : 0; }
public static HashSet <QuantitationChannelSet> GetQuantChannelModifications(Peptide peptide) { HashSet <QuantitationChannelSet> sets = new HashSet <QuantitationChannelSet>(); IMass[] mods = peptide.Modifications; int modLength = mods.Length; for (int i = 0; i < modLength; i++) { if (mods[i] != null) { IMass mod = mods[i]; QuantitationChannelSet quantSetMod; ModificationCollection modCol; if ((modCol = mod as ModificationCollection) != null) { foreach (IMass mod2 in modCol) { if ((quantSetMod = mod2 as QuantitationChannelSet) != null) { sets.Add(quantSetMod); } } } else if ((quantSetMod = mod as QuantitationChannelSet) != null) { sets.Add(quantSetMod); } } } return(sets); }
/// <summary> /// /// </summary> /// <param name="abbreviation"></param> /// <param name="toBase"></param> /// <param name="fromBase"></param> /// <param name="mass"></param> /// <param name="acceleration"></param> protected ForceBase(string abbreviation, IUnitConversion toBase, IUnitConversion fromBase, IMass mass, IAcceleration acceleration) : base(abbreviation, toBase, fromBase, mass, acceleration) { VerifyDimensions(); }
public static bool MassEquals(this IMass mass1, IMass mass2, double epsilon = MassEqualityEpsilon) { if (mass1 == null || mass2 == null) { return(false); } return(Math.Abs(mass1.MonoisotopicMass - mass2.MonoisotopicMass) < epsilon); }
public MzFeature(Fragment fragment, int charge) { this.feature = fragment; this.charge = charge; this.mzRange = new MzRange(this.feature.ToMz(this.charge), massTolerance); this.intensities = new List <double>(); this.spectrumNumbers = new List <int>(); this.spectrumTICs = new List <double>(); }
public MzFeature(Peptide precursor, int charge) { this.feature = precursor; this.charge = charge; this.mzRange = new MzRange(this.feature.ToMz(this.charge), massTolerance); this.intensities = new List <double>(); this.spectrumNumbers = new List <int>(); this.spectrumTICs = new List <double>(); }
private static string GetLocalizedString(LocalizedHit hit) { StringBuilder sb = new StringBuilder(); IMass[] mods = hit.LocalizedIsoform.GetModifications(); bool first = false; for (int resNumber = 1; resNumber < mods.Length - 1; resNumber++) { IMass mod = mods[resNumber]; if (mod == null) { continue; } ModificationCollection modCollection = mod as ModificationCollection; if (modCollection != null) { IMass trueMod = mod; bool passes = false; foreach (IMass mod2 in modCollection) { if (Lotor.QuantifiedModifications.Contains(mod2)) { trueMod = mod2; passes = true; break; } } if (!passes) { continue; } mod = trueMod; } else { if (Lotor.FixedModifications.Contains(mod) || !Lotor.QuantifiedModifications.Contains(mod)) { continue; } } int fullResidueNumber = hit.PSM.StartResidue + resNumber - 1; char res = hit.LocalizedIsoform.Sequence[resNumber - 1]; if (first) { sb.Append(" & "); } sb.Append(res); sb.Append(fullResidueNumber); sb.Append("[" + mod + "]"); first = true; } return(sb.ToString()); }
public static int Compare(this IMass mass1, IMass mass2, double epsilon = MassEqualityEpsilon) { double difference = mass1.MonoisotopicMass - mass2.MonoisotopicMass; if (difference < -epsilon) { return(-1); } return(difference > epsilon ? 1 : 0); }
/// <summary> /// Assigns mass per unit length to objects. /// </summary> /// <param name="app">The application.</param> /// <param name="value">The mass per unit length assigned to the object. [M/L]</param> /// <param name="replace">True: All existing mass assignments to the object are removed before assigning the specified mass. /// False: The specified mass is added to any existing mass already assigned to the object.</param> /// <exception cref="CSiException"><see cref="CSiApiBase.API_DEFAULT_ERROR_CODE" /></exception> protected void setMass(IMass app, double value, bool replace) { app.SetMass(Name, value, replace); if (replace) { _mass = value; } else { _mass += value; } }
public void WriteModification(IMass modification, ModificationSites sites, bool fixedModification = true) { if (CurrentStage != Stage.SearchSummary) { throw new ArgumentException("You must be in the Search Summary stage to write modifications"); } foreach (ModificationSites singleSite in sites.GetActiveSites()) { double basemass = 0; if (singleSite >= ModificationSites.NPep) { _writer.WriteStartElement("terminal_modification"); if (singleSite.HasFlag(ModificationSites.NPep) || singleSite.HasFlag(ModificationSites.NProt)) { _writer.WriteAttributeString("terminus", "N"); basemass += AminoAcidPolymer.DefaultNTerminus.MonoisotopicMass; } else { _writer.WriteAttributeString("terminus", "C"); basemass += AminoAcidPolymer.DefaultCTerminus.MonoisotopicMass; } _writer.WriteAttributeString("protein_terminus", (singleSite.HasFlag(ModificationSites.NProt) || singleSite.HasFlag(ModificationSites.ProtC)) ? "Y" : "N"); } else { string letter = Enum.GetName(typeof(ModificationSites), singleSite); AminoAcid aa = AminoAcid.GetResidue(letter); _writer.WriteStartElement("aminoacid_modification"); _writer.WriteAttributeString("aminoacid", letter); basemass += aa.MonoisotopicMass; } double massshift = modification.MonoisotopicMass; _writer.WriteAttributeString("variable", (fixedModification) ? "N" : "Y"); _writer.WriteAttributeString("mass", (basemass + massshift).ToString()); _writer.WriteAttributeString("massdiff", massshift.ToString()); _writer.WriteAttributeString("description", modification.ToString()); _writer.WriteEndElement(); } }
private MassDensity(IMass mass, IVolume volume) : base(mass, volume) { }
public static bool TryParse(string input, out IMass output) { #region Prepare Variables string capInput = input.ToUpperInvariant(); string extraction = input.ExtractNumberComponentFromMeasurementString(); double conversion = 0; #endregion #region Convert To Double bool failed = !double.TryParse(extraction, out conversion); if (failed) { Debug.AddDetailMessage("Measurement Input not successfully converted."); Debug.AddDetailMessage("----" + capInput); output = new Masses.KiloGram(0); return(false); } #endregion #endregion #region Convert To Mass if (capInput.EndsWithAny(Suffixes.Carat)) { output = new Masses.Carat(conversion); return(true); } if (capInput.EndsWithAny(Suffixes.CentiGram)) { output = new Masses.CentiGram(conversion); return(true); } if (capInput.EndsWithAny(Suffixes.DecaGram)) { output = new Masses.DecaGram(conversion); return(true); } if (capInput.EndsWithAny(Suffixes.Gram)) { output = new Masses.Gram(conversion); return(true); } if (capInput.EndsWithAny(Suffixes.HectoGram)) { output = new Masses.HectoGram(conversion); return(true); } if (capInput.EndsWithAny(Suffixes.KiloGram)) { output = new Masses.KiloGram(conversion); return(true); } if (capInput.EndsWithAny(Suffixes.MetricTonne)) { output = new Masses.MetricTonne(conversion); return(true); } if (capInput.EndsWithAny(Suffixes.Ounce)) { output = new Masses.Ounce(conversion); return(true); } if (capInput.EndsWithAny(Suffixes.Pound)) { output = new Masses.Pound(conversion); return(true); } if (capInput.EndsWithAny(Suffixes.Stone)) { output = new Masses.Stone(conversion); return(true); } if (capInput.EndsWithAny(Suffixes.UKLongTon)) { output = new Masses.UKLongTon(conversion); return(true); } if (capInput.EndsWithAny(Suffixes.USShortTon)) { output = new Masses.USShortTon(conversion); return(true); } #endregion #region ... Conversion #region Type Unrecognised Debug.AddDetailMessage("No Type for input Mass conversion. Break here for details..."); Debug.AddDetailMessage("----" + capInput); output = new Masses.KiloGram(0); return(false); #endregion }
public static bool TryParse(string value, out IMass output) => objectFactory.TryParse(value, out output);
/// <summary> /// /// </summary> /// <param name="mass"></param> /// <param name="volume"></param> protected MassDensityBase(IMass mass, IVolume volume) : base(mass, volume) { VerifyDimensions(); }
public void AddVariableModification(IMass modification, string name) { _variableMods.Add(name, modification); }
public Pounds(IMass mass) : this(mass.To <Pounds>().Value) { }
public Kilograms(IMass mass) : this(mass.To <Kilograms>().Value) { }
public void AddVariableModification(IMass modificaiton, IAminoAcid aminoAcid) { }
public static bool MassEquals(this IMass mass1, IMass mass2, double epsilon = MassEqualityEpsilon) { if (mass1 == null || mass2 == null) return false; return Math.Abs(mass1.MonoisotopicMass - mass2.MonoisotopicMass) < epsilon; }
public void AddVariableModification(IMass modificaiton, Terminus terminus) { }
public AccountController(RoleMaster rm, PasswdHesher <IHesh> ph, IRepositoryBuilder rb, IMass sm) : base(rb, rm) { MailSender = sm; PasswdHesh = ph; }
public Mass(IMass item) : this(item.MonoisotopicMass) { }
private Force(string abbreviation, IUnitConversion toBase, IUnitConversion fromBase, IMass mass, IAcceleration acceleration) : base(abbreviation, toBase, fromBase, mass, acceleration) { }
public void AddVariableModification(IMass modification, string name) { _variableMods.Add(name, modification); }
public bool TryParse(string value, out IMass output) => throw new NotImplementedException();
public static IEnumerable <Peptide> GetUniquePeptides(Peptide peptide) { HashSet <QuantitationChannelSet> sets = new HashSet <QuantitationChannelSet>(); Dictionary <IQuantitationChannel, HashSet <int> > locations = new Dictionary <IQuantitationChannel, HashSet <int> >(); IMass[] mods = peptide.Modifications; int modLength = mods.Length; for (int i = 0; i < modLength; i++) { if (mods[i] != null) { IMass mod = mods[i]; List <QuantitationChannelSet> channelsets = new List <QuantitationChannelSet>(); QuantitationChannelSet quantSetMod; ModificationCollection modCol; if ((modCol = mod as ModificationCollection) != null) { foreach (IMass mod2 in modCol) { if ((quantSetMod = mod2 as QuantitationChannelSet) != null) { channelsets.Add(quantSetMod); } } } else if ((quantSetMod = mod as QuantitationChannelSet) != null) { channelsets.Add(quantSetMod); } foreach (QuantitationChannelSet channelset in channelsets) { sets.Add(channelset); foreach (IQuantitationChannel channel in channelset.GetChannels()) { HashSet <int> residues; if (locations.TryGetValue(channel, out residues)) { residues.Add(i); } else { residues = new HashSet <int> { i }; locations.Add(channel, residues); } } } } } if (sets.Count == 0) { yield return(new Peptide(peptide, true)); } else if (sets.Count == 1) { foreach (QuantitationChannelSet set in sets) { foreach (IQuantitationChannel channel in set.GetChannels()) { Peptide toReturn = new Peptide(peptide, true); foreach (int residue in locations[channel]) { toReturn.SetModification(channel, residue); } yield return(toReturn); } } } else { List <HashSet <IQuantitationChannel> > quantChannels = new List <HashSet <IQuantitationChannel> >(); GetUniquePeptides_helper(sets.ToList(), 0, new HashSet <IQuantitationChannel>(), quantChannels); foreach (HashSet <IQuantitationChannel> channelset in quantChannels) { Peptide toReturn = new Peptide(peptide, true); Dictionary <int, IMass> modsToAdd = new Dictionary <int, IMass>(); foreach (IQuantitationChannel channel in channelset) { foreach (int residue in locations[channel]) { IMass modToAdd; if (modsToAdd.TryGetValue(residue, out modToAdd)) { ModificationCollection col = new ModificationCollection(channel, modToAdd); modsToAdd[residue] = col; } else { modsToAdd.Add(residue, channel); } } } foreach (KeyValuePair <int, IMass> kvp in modsToAdd) { toReturn.SetModification(kvp.Value, kvp.Key); } yield return(toReturn); } } }
public void AddVariableModification(IMass modificaiton, ModificationSites sites) { }
public void WriteModification(IMass modification, ModificationSites sites, bool fixedModification = true) { if (CurrentStage != Stage.SearchSummary) throw new ArgumentException("You must be in the Search Summary stage to write modifications"); foreach (ModificationSites singleSite in sites.GetActiveSites()) { double basemass = 0; if (singleSite >= ModificationSites.NPep) { _writer.WriteStartElement("terminal_modification"); if (singleSite.HasFlag(ModificationSites.NPep) || singleSite.HasFlag(ModificationSites.NProt)) { _writer.WriteAttributeString("terminus", "N"); basemass += AminoAcidPolymer.DefaultNTerminus.MonoisotopicMass; } else { _writer.WriteAttributeString("terminus", "C"); basemass += AminoAcidPolymer.DefaultCTerminus.MonoisotopicMass; } _writer.WriteAttributeString("protein_terminus", (singleSite.HasFlag(ModificationSites.NProt) || singleSite.HasFlag(ModificationSites.ProtC)) ? "Y" : "N"); } else { string letter = Enum.GetName(typeof(ModificationSites), singleSite); AminoAcid aa = AminoAcid.GetResidue(letter); _writer.WriteStartElement("aminoacid_modification"); _writer.WriteAttributeString("aminoacid", letter); basemass += aa.MonoisotopicMass; } double massshift = modification.MonoisotopicMass; _writer.WriteAttributeString("variable", (fixedModification) ? "N" : "Y"); _writer.WriteAttributeString("mass", (basemass + massshift).ToString()); _writer.WriteAttributeString("massdiff", massshift.ToString()); _writer.WriteAttributeString("description", modification.ToString()); _writer.WriteEndElement(); } }
public void AddVariableModification(IMass modificaiton, IAminoAcid aminoAcid) { }
private MassDensity(IMass mass, ILength cubicLength) : base(mass, cubicLength) { }
public Mass(IMass massToConvertFrom) { mMass = (TDataType)(Convert.ChangeType(massToConvertFrom.Value * massToConvertFrom.UnitOfMeasure.GetCompleteMultiplier <TUnitOfMeasure>(1), typeof(TDataType))); }
/// <summary> /// Private Constructor /// </summary> /// <param name="abbreviation"></param> /// <param name="toBase"></param> /// <param name="fromBase"></param> /// <param name="mass"></param> /// <param name="acceleration"></param> private Force(string abbreviation, IUnitConversion toBase, IUnitConversion fromBase, IMass mass, IAcceleration acceleration) : base(abbreviation, toBase, fromBase, mass, acceleration) { }
private MassDensity(IMass mass, IVolume volume) : base(mass, volume) { }
/// <summary> /// /// </summary> /// <param name="mass"></param> /// <param name="volume"></param> protected MassDensityBase(IMass mass, IVolume volume) : base(mass, volume) { VerifyDimensions(); }
private MassDensity(IMass mass, ILength cubicLength) : base(mass, cubicLength) { }
public void AddVariableModification(IMass modification, char residue) { }
/// <summary> /// Converts the object that has a m/z into a mass value based on the charge state /// </summary> /// <param name="mz"></param> /// <param name="charge"></param> /// <param name="c13Isotope"></param> /// <returns></returns> public static double ToMass(this IMass mz, int charge, int c13Isotope = 0) { return(Mass.MassFromMz(mz.MonoisotopicMass + c13Isotope * Constants.C13C12Difference, charge)); }
public void AddVariableModification(IMass modificaiton, Terminus terminus) { }
private Pressure(string abbreviation, IMass mass, ILength length, ITime time) : base(abbreviation, mass, length, time) { VerifyDimensions(); }
/// <summary> /// Returns the mass per unit length assignment from objects. [M/L] /// </summary> /// <param name="app">The application.</param> /// <exception cref="CSiException"><see cref="CSiApiBase.API_DEFAULT_ERROR_CODE" /></exception> protected void getMass(IMass app) { _mass = app.GetMass(Name); }
/// <summary> /// Assigns mass per unit length to objects. /// </summary> /// <param name="app">The application.</param> /// <param name="value">The mass per unit length assigned to the object. [M/L]</param> /// <param name="replace">True: All existing mass assignments to the object are removed before assigning the specified mass. /// False: The specified mass is added to any existing mass already assigned to the object.</param> /// <exception cref="CSiException"><see cref="CSiApiBase.API_DEFAULT_ERROR_CODE" /></exception> protected void setMass(IMass app, double value, bool replace) { app.SetMass(Name, value, replace); }
public bool TryParse(string value, out IMass output) => Mass.TryParse(value, out output);
private Pressure(string abbreviation, IMass mass, ILength length, ITime time) : base(abbreviation, mass, length, time) { VerifyDimensions(); }