Ejemplo n.º 1
0
        public void HandleTerminalModificationNameTag()
        {
            const string sequence           = "SEQVENCE";
            var          modificationLookup = new BrnoModificationLookup(_elementProvider);

            ProFormaDescriptor descriptor = this.CreateBrnoDescriptor("ac");
            var term       = new ProFormaTerm(sequence, null, new[] { descriptor }, null, null);
            var proteoform = _factory.CreateProteoformGroup(term, modificationLookup);

            Assert.IsNull(proteoform.LocalizedModifications);
            Assert.IsNotNull(proteoform.NTerminalModification);
            Assert.IsNull(proteoform.CTerminalModification);

            // Residue masses plus modification plus water (approx)
            Assert.AreEqual(978.36, proteoform.GetMass(MassType.Monoisotopic), 0.01);
            Assert.AreEqual(978.98, proteoform.GetMass(MassType.Average), 0.01);

            // C terminal case
            term       = new ProFormaTerm(sequence, null, null, new[] { descriptor }, null);
            proteoform = _factory.CreateProteoformGroup(term, modificationLookup);

            Assert.IsNull(proteoform.LocalizedModifications);
            Assert.IsNull(proteoform.NTerminalModification);
            Assert.IsNotNull(proteoform.CTerminalModification);

            // Residue masses plus modification plus water (approx)
            Assert.AreEqual(978.36, proteoform.GetMass(MassType.Monoisotopic), 0.01);
            Assert.AreEqual(978.98, proteoform.GetMass(MassType.Average), 0.01);
        }
Ejemplo n.º 2
0
        public void InvalidIntegerHandling()
        {
            var descriptor = new ProFormaDescriptor(ProFormaKey.Name, ProFormaEvidenceType.Unimod, "abc");

            // I want this to return true and then throw an exception later.
            // This gives me an opportunity to give a meaningful error (and not just return false)

            // In this case, it is also obvious that the Unimod handler was intended, so an attempt to create
            //  a modification should be made.
            Assert.True(_unimodLookup.CanHandleDescriptor(descriptor));
            Assert.Throws <ProteoformModificationLookupException>(() => _unimodLookup.GetModification(descriptor));
        }
Ejemplo n.º 3
0
        public void FormulaLookup()
        {
            string             formulaString      = "C2H2O";
            ProFormaDescriptor proFormaDescriptor = new ProFormaDescriptor(ProFormaKey.Formula, formulaString);
            ChemicalFormula    chemicalFormula    = new ChemicalFormula(new IEntityCardinality <IElement>[]
            {
                new EntityCardinality <IElement>(_elementProvider.GetElement("C"), 2),
                new EntityCardinality <IElement>(_elementProvider.GetElement("H"), 2),
                new EntityCardinality <IElement>(_elementProvider.GetElement("O"), 1),
            });

            var proteoformModification = _formulaLookup.GetModification(proFormaDescriptor);

            Assert.IsInstanceOf(typeof(IHasChemicalFormula), proteoformModification);
            var formulaMod = (IHasChemicalFormula)proteoformModification;

            Assert.AreEqual(chemicalFormula, formulaMod.GetChemicalFormula());
        }