Esempio n. 1
0
        public override bool Equals(object o)
        {
            ModificationMotif m = o as ModificationMotif;

            return(m != null &&
                   m.motifString == motifString);
        }
Esempio n. 2
0
 public ModificationWithLocation(string id, Tuple <string, string> accession, ModificationMotif motif, ModificationSites terminusLocalization, IDictionary <string, IList <string> > linksToOtherDbs, string modificationType) : base(id, modificationType)
 {
     this.accession            = accession;
     this.motif                = motif;
     this.terminusLocalization = terminusLocalization;
     this.linksToOtherDbs      = linksToOtherDbs;
 }
Esempio n. 3
0
        public ModificationWithLocation(string id, string modificationType, ModificationMotif motif, TerminusLocalization terminusLocalization, IDictionary <string, IList <string> > linksToOtherDbs = null, List <string> keywords = null) : base(id, modificationType)
        {
            this.motif = motif;
            this.terminusLocalization = terminusLocalization;

            // Optional
            this.linksToOtherDbs = linksToOtherDbs ?? new Dictionary <string, IList <string> >();
            this.keywords        = keywords ?? new List <string>();
        }
Esempio n. 4
0
 /// <summary>
 /// Only upper and lower case letters allowed, must have a single upper case letter
 /// </summary>
 /// <param name="motifString"></param>
 /// <param name="motif"></param>
 /// <returns></returns>
 public static bool TryGetMotif(string motifString, out ModificationMotif motif)
 {
     motif = null;
     if (ModificationMotifRegex.IsMatch(motifString) && motifString.Count(b => char.IsUpper(b)) == 1)
     {
         motif = new ModificationMotif(motifString);
         return(true);
     }
     return(false);
 }
Esempio n. 5
0
 public ModificationWithMass(string id, Tuple <string, string> accession, ModificationMotif motif, ModificationSites modificationSites, double monoisotopicMass, IDictionary <string, IList <string> > externalDatabaseReferences, IEnumerable <double> neutralLosses, IEnumerable <double> diagnosticIons, string modificationType)
     : base(id, accession, motif, modificationSites, externalDatabaseReferences, modificationType)
 {
     this.monoisotopicMass = monoisotopicMass;
     if (neutralLosses == null || neutralLosses.Count() == 0)
     {
         neutralLosses = new List <double> {
             0
         }
     }
     ;
     this.neutralLosses  = neutralLosses;
     this.diagnosticIons = diagnosticIons;
 }
Esempio n. 6
0
        public ModificationWithMass(string id, string modificationType, ModificationMotif motif, TerminusLocalization terminusLocalization, double monoisotopicMass, IDictionary <string, IList <string> > externalDatabaseReferences = null, List <string> keywords = null, List <double> neutralLosses = null, List <double> diagnosticIons = null)
            : base(id, modificationType, motif, terminusLocalization, externalDatabaseReferences, keywords)
        {
            this.monoisotopicMass = monoisotopicMass;

            // Optional
            this.neutralLosses = neutralLosses ?? new List <double> {
                0
            };
            this.diagnosticIons = diagnosticIons ?? new List <double>();

            this.neutralLosses  = this.neutralLosses.OrderBy(b => b).ToList();
            this.diagnosticIons = this.diagnosticIons.OrderBy(b => b).ToList();
        }
Esempio n. 7
0
        public Modification(string _originalId        = null, string _accession = null, string _modificationType = null, string _featureType = null,
                            ModificationMotif _target = null, string _locationRestriction = "Unassigned.", ChemicalFormula _chemicalFormula = null,
                            double?_monoisotopicMass  = null, Dictionary <string, IList <string> > _databaseReference    = null,
                            Dictionary <string, IList <string> > _taxonomicRange         = null, List <string> _keywords = null,
                            Dictionary <DissociationType, List <double> > _neutralLosses = null, Dictionary <DissociationType, List <double> > _diagnosticIons = null,
                            string _fileOrigin = null)
        {
            if (_originalId != null)
            {
                if (_originalId.Contains(" on "))
                {
                    this.IdWithMotif = _originalId;
                    this.OriginalId  = _originalId.Split(new[] { " on " }, StringSplitOptions.None)[0];
                }
                else if (_originalId.Contains(" of "))
                {
                    this.IdWithMotif = _originalId.Replace(" of ", " on ");
                    this.OriginalId  = _originalId.Split(new[] { " of ", " on " }, StringSplitOptions.None)[0];
                }
                else if (_target != null)
                {
                    this.IdWithMotif = _originalId + " on " + _target.ToString();
                    this.OriginalId  = _originalId;
                }
                else
                {
                    this.OriginalId = _originalId;
                }
            }

            this.Accession           = _accession;
            this.ModificationType    = _modificationType;
            this.FeatureType         = _featureType;
            this.Target              = _target;
            this.LocationRestriction = ModLocationOnPeptideOrProtein(_locationRestriction);
            this.ChemicalFormula     = _chemicalFormula;
            this.MonoisotopicMass    = _monoisotopicMass;
            this.DatabaseReference   = _databaseReference;
            this.TaxonomicRange      = _taxonomicRange;
            this.Keywords            = _keywords;
            this.NeutralLosses       = _neutralLosses;
            this.DiagnosticIons      = _diagnosticIons;
            this.FileOrigin          = _fileOrigin;

            if (this.MonoisotopicMass == null && this.ChemicalFormula != null)
            {
                this.MonoisotopicMass = this.ChemicalFormula.MonoisotopicMass;
            }
        }
Esempio n. 8
0
 public ModificationWithMassAndCf(string id, string modificationType, ModificationMotif motif, TerminusLocalization terminusLocalization, ChemicalFormula chemicalFormula, double?mm = null, IDictionary <string, IList <string> > linksToOtherDbs = null, List <string> keywords = null, List <double> neutralLosses = null, List <double> diagnosticIons = null)
     : base(id, modificationType, motif, terminusLocalization, mm ?? chemicalFormula.MonoisotopicMass, linksToOtherDbs, keywords, neutralLosses, diagnosticIons)
 {
     this.chemicalFormula = chemicalFormula;
 }
Esempio n. 9
0
 public ModificationWithMassAndCf(string id, Tuple <string, string> accession, ModificationMotif motif, ModificationSites site, ChemicalFormula chemicalFormula, double mm, IDictionary <string, IList <string> > linksToOtherDbs, IEnumerable <double> neutralLosses, IEnumerable <double> diagnosticIons, string modificationType)
     : base(id, accession, motif, site, mm, linksToOtherDbs, neutralLosses, diagnosticIons, modificationType)
 {
     this.chemicalFormula = chemicalFormula;
 }