public void IgnoreMultipleTags() { var modificationLookup = new CompositeModificationLookup(new[] { new IgnoreKeyModificationLookup(ProFormaKey.Mass), new IgnoreKeyModificationLookup(ProFormaKey.Info) }); var term = new ProFormaTerm("SEQVENCE", tags: new List <ProFormaTag> { new ProFormaTag(3, new[] { new ProFormaDescriptor(ProFormaKey.Mass, "14.05") }), new ProFormaTag(5, new[] { new ProFormaDescriptor(ProFormaKey.Info, "not important") }) });; var proteoform = _factory.CreateProteoformGroup(term, modificationLookup); Assert.IsNull(proteoform.LocalizedModifications); term = new ProFormaTerm("SEQVENCE", tags: new List <ProFormaTag> { new ProFormaTag(3, new[] { new ProFormaDescriptor(ProFormaKey.Mass, "14.05"), new ProFormaDescriptor(ProFormaKey.Info, "not important") }) }); proteoform = _factory.CreateProteoformGroup(term, modificationLookup); Assert.IsNull(proteoform.LocalizedModifications); }
public void MultipleDefaultLookups() { var lookup = new CompositeModificationLookup(new[] { _psiModLookup, _unimodLookup }); var mod_psi = lookup.GetModification(new ProFormaDescriptor(ProFormaKey.Name, "3-hydroxy-L-proline")); Assert.IsNotNull(mod_psi); var mod_uni = lookup.GetModification(new ProFormaDescriptor(ProFormaKey.Name, "Trimethyl")); Assert.IsNotNull(mod_uni); }
public void MultipleModsOneSite() { var modificationLookup = new CompositeModificationLookup(new IProteoformModificationLookup[] { new IgnoreKeyModificationLookup(ProFormaKey.Mass), new IgnoreKeyModificationLookup(ProFormaKey.Info), new BrnoModificationLookup(_elementProvider), _residLookup }); // Modifications have same chemical formula ... OK var term = new ProFormaTerm("SEQVKENCE", tags: new List <ProFormaTag> { new ProFormaTag(4, new[] { this.CreateBrnoDescriptor("ph"), new ProFormaDescriptor(ProFormaKey.Identifier, ProFormaEvidenceType.Resid, "AA0038") }) }); var proteoform = _factory.CreateProteoformGroup(term, modificationLookup); Assert.IsNotNull(proteoform.LocalizedModifications); Assert.AreEqual(1, proteoform.LocalizedModifications.Count); Assert.AreEqual(4, ((IProteoformLocalizedModification)proteoform.LocalizedModifications.Single()).ZeroBasedStartIndex); // Modifications have different chemical formulas ... throw! term = new ProFormaTerm("SEQVKENCE", tags: new List <ProFormaTag> { new ProFormaTag(4, new[] { this.CreateBrnoDescriptor("me1"), this.CreateBrnoDescriptor("ac") }) }); Assert.Throws <ProteoformGroupCreateException>(() => _factory.CreateProteoformGroup(term, modificationLookup)); // What about different mods at different indexes? term = new ProFormaTerm("SEQVKENCE", tags: new List <ProFormaTag> { new ProFormaTag(4, new[] { this.CreateBrnoDescriptor("ac") }), new ProFormaTag(7, new[] { this.CreateBrnoDescriptor("me1"), }) }); proteoform = _factory.CreateProteoformGroup(term, modificationLookup); Assert.IsNotNull(proteoform.LocalizedModifications); Assert.AreEqual(2, proteoform.LocalizedModifications.Count); // What about descriptors that don't have chemical formulas? term = new ProFormaTerm("SEQVKENCE", tags: new List <ProFormaTag> { new ProFormaTag(7, new[] { this.CreateBrnoDescriptor("me1"), new ProFormaDescriptor(ProFormaKey.Info, "hello!") }) }); proteoform = _factory.CreateProteoformGroup(term, modificationLookup); Assert.IsNotNull(proteoform.LocalizedModifications); Assert.AreEqual(1, proteoform.LocalizedModifications.Count); Assert.AreEqual(7, ((IProteoformLocalizedModification)proteoform.LocalizedModifications.Single()).ZeroBasedStartIndex); // Multiple N terminal mods. term = new ProFormaTerm("SEQVKENCE", null, new[] { this.CreateBrnoDescriptor("ph"), new ProFormaDescriptor(ProFormaKey.Identifier, ProFormaEvidenceType.Resid, "AA0038") }, null, null ); proteoform = _factory.CreateProteoformGroup(term, modificationLookup); Assert.IsNull(proteoform.LocalizedModifications); Assert.IsNotNull(proteoform.NTerminalModification); term = new ProFormaTerm("SEQVKENCE", null, new[] { this.CreateBrnoDescriptor("me1"), this.CreateBrnoDescriptor("ac") }, null, null ); Assert.Throws <ProteoformGroupCreateException>(() => _factory.CreateProteoformGroup(term, modificationLookup)); // Multiple C terminal mods. term = new ProFormaTerm("SEQVKENCE", null, null, new[] { this.CreateBrnoDescriptor("ph"), new ProFormaDescriptor(ProFormaKey.Identifier, ProFormaEvidenceType.Resid, "AA0038") }, null ); proteoform = _factory.CreateProteoformGroup(term, modificationLookup); Assert.IsNull(proteoform.LocalizedModifications); Assert.IsNotNull(proteoform.CTerminalModification); term = new ProFormaTerm("SEQVKENCE", null, null, new[] { this.CreateBrnoDescriptor("me1"), this.CreateBrnoDescriptor("ac") }, null ); Assert.Throws <ProteoformGroupCreateException>(() => _factory.CreateProteoformGroup(term, modificationLookup)); }