Exemple #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ProFormaTagGroup" /> class.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="key">The key.</param>
 /// <param name="evidenceType">Type of the evidence.</param>
 /// <param name="value">The value.</param>
 /// <param name="members">The members.</param>
 public ProFormaTagGroup(string name, ProFormaKey key, ProFormaEvidenceType evidenceType, string value,
                         IList <ProFormaMembershipDescriptor> members)
 {
     this.Name         = name;
     this.Key          = key;
     this.EvidenceType = evidenceType;
     this.Value        = value;
     this.Members      = members;
 }
Exemple #2
0
        public void ModificationAccessionNumbers_4_2_2(string proFormaString, ProFormaEvidenceType modType)
        {
            var term = _parser.ParseString(proFormaString);

            Assert.AreEqual("EMEVEESPEK", term.Sequence);
            Assert.AreEqual(2, term.Tags.Count);

            var desc1 = term.Tags[0].Descriptors.Single();
            var desc2 = term.Tags[1].Descriptors.Single();

            Assert.AreEqual(modType, desc1.EvidenceType);
            Assert.AreEqual(modType, desc2.EvidenceType);
        }
        private void FindById(IProteoformModificationLookup lookup, ProFormaKey key, ProFormaEvidenceType evidenceType,
                              int correctId, string extraPrefix)
        {
            Assert.IsNotNull(lookup.GetModification(new ProFormaDescriptor(key, evidenceType, $"{extraPrefix}{correctId}")));
            Assert.IsNotNull(lookup.GetModification(new ProFormaDescriptor(key, evidenceType, $"{correctId}")));

            Assert.Throws <ProteoformModificationLookupException>(
                () => lookup.GetModification(new ProFormaDescriptor(key, evidenceType, "-1")));
            Assert.Throws <ProteoformModificationLookupException>(
                () => lookup.GetModification(new ProFormaDescriptor(key, evidenceType, $"{extraPrefix}0")));
            Assert.Throws <ProteoformModificationLookupException>(
                () => lookup.GetModification(new ProFormaDescriptor(key, evidenceType, $"{extraPrefix}2200")));
        }
        private void FindByName(IProteoformModificationLookup lookup, ProFormaEvidenceType evidenceType,
                                bool isDefault, string correctName)
        {
            if (isDefault)
            {
                Assert.IsNotNull(lookup.GetModification(new ProFormaDescriptor(ProFormaKey.Name, ProFormaEvidenceType.None, correctName)));
            }

            Assert.IsNotNull(lookup.GetModification(new ProFormaDescriptor(ProFormaKey.Name, evidenceType, correctName)));

            Assert.Throws <ProteoformModificationLookupException>(
                () => lookup.GetModification(new ProFormaDescriptor(ProFormaKey.Name, ProFormaEvidenceType.None, "Something")));
            Assert.Throws <ProteoformModificationLookupException>(
                () => lookup.GetModification(new ProFormaDescriptor(ProFormaKey.Name, evidenceType, "Something")));
        }
        private void DescriptorHandling(IProteoformModificationLookup lookup, ProFormaEvidenceType key, bool isDefault)
        {
            // If the key is a specific mod type, always handle
            Assert.IsTrue(lookup.CanHandleDescriptor(new ProFormaDescriptor(ProFormaKey.Name, key, "Anything")));
            Assert.IsTrue(lookup.CanHandleDescriptor(new ProFormaDescriptor(ProFormaKey.Name, key, "")));
            Assert.IsTrue(lookup.CanHandleDescriptor(new ProFormaDescriptor(ProFormaKey.Name, key, null)));

            // If using modification name, must have no ending or end in proper ending
            Assert.IsTrue(lookup.CanHandleDescriptor(new ProFormaDescriptor(ProFormaKey.Name, key, "Something")));
            Assert.IsFalse(lookup.CanHandleDescriptor(new ProFormaDescriptor(ProFormaKey.Name, "Something")));
            Assert.IsFalse(lookup.CanHandleDescriptor(new ProFormaDescriptor(ProFormaKey.Name, ProFormaEvidenceType.Brno, "Something")));

            // This is malformed and must be interpreted as a mod "name" ... will fail when looking up modification
            //Assert.AreEqual(lookup.CanHandleDescriptor(new ProFormaDescriptor(ProFormaKey.Name, $"Something [{key}]")), isDefault);
        }
Exemple #6
0
        public void Crosslinks_4_2_3_Disulfides(string proFormaString, ProFormaKey proFormaKey, ProFormaEvidenceType evidenceType, string value)
        {
            var term = _parser.ParseString(proFormaString);

            Assert.IsNull(term.Tags);
            Assert.AreEqual(1, term.TagGroups?.Count);

            var tagGroup = term.TagGroups.Single();

            Assert.AreEqual("XL1", tagGroup.Name);
            Assert.AreEqual(proFormaKey, tagGroup.Key);
            Assert.AreEqual(evidenceType, tagGroup.EvidenceType);
            Assert.AreEqual(value, tagGroup.Value);
            Assert.AreEqual(2, tagGroup.Members.Count);
            Assert.AreEqual(6, tagGroup.Members[0].ZeroBasedStartIndex);
            Assert.AreEqual(11, tagGroup.Members[1].ZeroBasedStartIndex);
        }
Exemple #7
0
 public ProFormaTagGroupChangingValue(string name, ProFormaKey key, ProFormaEvidenceType evidenceType,
                                      IList <ProFormaMembershipDescriptor> members) : base(name, key, evidenceType, string.Empty, members)
 {
 }
 private void InvalidIdHandling(string id, IProteoformModificationLookup lookup, ProFormaKey key,
                                ProFormaEvidenceType evidenceType = ProFormaEvidenceType.None)
 {
     Assert.Throws <ProteoformModificationLookupException>(
         () => lookup.GetModification(new ProFormaDescriptor(key, evidenceType, id)));
 }
Exemple #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ProFormaDescriptor" /> class.
 /// </summary>
 /// <param name="key">The key.</param>
 /// <param name="evidenceType">Type of the evidence.</param>
 /// <param name="value">The value.</param>
 public ProFormaDescriptor(ProFormaKey key, ProFormaEvidenceType evidenceType, string value)
 {
     this.Key          = key;
     this.EvidenceType = evidenceType;
     this.Value        = value;
 }