Ejemplo n.º 1
0
        public void EmpiricalFormulaCalculatorTest()
        {
            var parser = new IqCodeParser();

            var exampleSequence  = @"A.ADLEDNMDILNDNLKVVEKTDSAPELKAALTKMRAAALDAQKATPPKLEDKAPDSPEMKDFRHGFDILVGQIDGALKLANEGNVKEAKAAAEALKTTRNTYHKKYR.";
            var empiricalFormula = parser.GetEmpiricalFormulaFromSequence(exampleSequence);

            Console.WriteLine(empiricalFormula);
            Assert.AreEqual("C507H832N144O163S3", empiricalFormula);
        }
Ejemplo n.º 2
0
        public void ProteinSequenceToMassHugePTMTest()
        {
            var parser = new IqCodeParser();

            var proteoform =
                "M.V(HLTPEEKSAVTALWGKVNVDEVGGEALGRLLVVYPWTQRFFESFGDLSTPDAVMGNPKVKAHGKKVLGAFSDGLAHLDNLKGTFATLSELHCDKLHVDPENFRLLGNVLVC)[-11849.17]VLAHHFGKEFTPPVQAAYQKVVAGVANALAHKYH.";
            var trueMass             = 4008.08; // only one significant decimal really.  could be 4008.07 or .08 Can't tell yet
            var unmodifiedProteoform =
                "M.VHLTPEEKSAVTALWGKVNVDEVGGEALGRLLVVYPWTQRFFESFGDLSTPDAVMGNPKVKAHGKKVLGAFSDGLAHLDNLKGTFATLSELHCDKLHVDPENFRLLGNVLVCVLAHHFGKEFTPPVQAAYQKVVAGVANALAHKYH.";
            var ptm = "[-11849.17]";

            var proteoformComposition = parser.GetEmpiricalFormulaFromSequence(proteoform);

            var unmodifiedProteoformComposition = parser.GetEmpiricalFormulaFromSequence(unmodifiedProteoform);

            var ptmComposition = parser.GetEmpiricalFormulaFromSequence(ptm);

            var difference = EmpiricalFormulaUtilities.SubtractFormula(unmodifiedProteoformComposition, ptmComposition);

            Console.WriteLine(proteoformComposition);
            Console.WriteLine(difference);

            Assert.AreEqual(proteoformComposition, difference);

            var differenceMass = EmpiricalFormulaUtilities.GetMonoisotopicMassFromEmpiricalFormula(difference);
            var proteformMass  = EmpiricalFormulaUtilities.GetMonoisotopicMassFromEmpiricalFormula(proteoformComposition);

            var unmodifiedProteoformMass = EmpiricalFormulaUtilities.GetMonoisotopicMassFromEmpiricalFormula(unmodifiedProteoformComposition);

            Console.WriteLine(unmodifiedProteoformMass);
            var ptmMass = EmpiricalFormulaUtilities.GetMonoisotopicMassFromEmpiricalFormula(ptmComposition);

            Console.WriteLine(ptmMass);

            var conversionFirst = unmodifiedProteoformMass - ptmMass;

            Console.WriteLine(conversionFirst);

            Assert.AreEqual(trueMass, conversionFirst, 0.1);
            Assert.AreEqual(trueMass, differenceMass, .1);
            Assert.AreEqual(trueMass, proteformMass, .1);
        }
Ejemplo n.º 3
0
        public void MsAlignCodeParserTest()
        {
            var parser     = new IqCodeParser();
            var examplemod =
                "A.AENVVHHKLDGMPISEAVEINAGNNLVF(LSGKVPTKKSADAPEGELASYGNTE)[713.72]EQTINVLEQIKTNLNNLGLDMKDVVKMQVFLVGGEENNGTMDFKGFMNGYSKFYDASKTNQLPARSAFQVA(K)[1.02]LANPAWRVEIEVIAVRPAK.";
            var checkmass    = "[714.74]";
            var examplenomod = "A.AENVVHHKLDGMPISEAVEINAGNNLVLSGKVPTKKSADAPEGELASYGNTEFEQTINVLEQIKTNLNNLGLDMKDVVKMQVFLVGGEENNGTMDFKGFMNGYSKFYDASKTNQLPARSAFQVAKLANPAWRVEIEVIAVRPAK.";

            var examplemodresult   = parser.GetEmpiricalFormulaFromSequence(examplemod);
            var checkmassresult    = parser.GetEmpiricalFormulaFromSequence(checkmass);
            var examplenomodresult = parser.GetEmpiricalFormulaFromSequence(examplenomod);

            Console.WriteLine(examplemodresult);
            Console.WriteLine(checkmassresult);
            Console.WriteLine(examplenomodresult);

            var difference = EmpiricalFormulaUtilities.SubtractFormula(examplemodresult, checkmassresult);

            Assert.AreEqual(examplenomodresult, difference);
        }
Ejemplo n.º 4
0
        public void MsgfCodeParserTest()
        {
            var parser     = new IqCodeParser();
            var examplemod =
                "+144.102PRYRK+144.102RTPVSLY+79.966QK+144.102T+79.966PNGEK+144.102PYEC+57.021GEC+57.021GK+144.102-202";
            var checkmass    = "+792.484";
            var examplenomod = "PRYRKRTPVSLYQKTPNGEKPYECGECGK";

            var examplemodresult   = parser.GetEmpiricalFormulaFromSequence(examplemod);
            var checkmassresult    = parser.GetEmpiricalFormulaFromSequence(checkmass);
            var examplenomodresult = parser.GetEmpiricalFormulaFromSequence(examplenomod);

            Console.WriteLine(examplemodresult);
            Console.WriteLine(checkmassresult);
            Console.WriteLine(examplenomodresult);

            var difference = EmpiricalFormulaUtilities.SubtractFormula(examplemodresult, checkmassresult);

            Assert.AreEqual(examplenomodresult, difference);
        }
Ejemplo n.º 5
0
        public void EmpiricalFormulaCalculatorRoundingTest()
        {
            var parser = new IqCodeParser();

            var testSequence = @".MITGIQITKA(AN)[1.02]DDLLNSFWLLDSEKGEARCIVAKAGYAEDEVVAVSKLGDIEYREVPVEVKPEVRVEGGQHLNVNVLRRETLEDAVKHPEKYPQLTI(RV)[-.99]S.G";

            var empiricalFormula = parser.GetEmpiricalFormulaFromSequence(testSequence);

            Console.WriteLine(empiricalFormula);
            Assert.IsTrue(!empiricalFormula.Contains("E"));
        }
Ejemplo n.º 6
0
        public void AveragineRoundTripTest()
        {
            var parser = new IqCodeParser();

            var ptmDouble    = -11849.17;
            var ptmMass      = "[" + ptmDouble.ToString() + "]"; // this is done just for formatting of the function call below
            var absPtmDouble = Math.Abs(ptmDouble);              //this is done because the emperical formula returns a positive amount of atoms (not negative)
            //so in the assert comparison we have to use the positive mass value

            var empiricalFormula = parser.GetEmpiricalFormulaFromSequence(ptmMass);

            Console.WriteLine("This is my emperical formula:" + empiricalFormula + ":");

            var returnedMass = EmpiricalFormulaUtilities.GetMonoisotopicMassFromEmpiricalFormula(empiricalFormula);

            Console.WriteLine(empiricalFormula);
            Console.WriteLine(returnedMass);
            Assert.AreEqual(absPtmDouble, returnedMass, .0001);
        }
Ejemplo n.º 7
0
        protected TopDownIqTarget CreateParentTarget(List <List <string> > processedGroup)
        {
            var target = new TopDownIqTarget();
            var parser = new IqCodeParser();

            target.DatabaseReference = ParseStringField(processedGroup[0], ProteinNameHeader);
            target.Code             = ParseStringField(processedGroup[0], PeptideHeader);
            target.EmpiricalFormula = parser.GetEmpiricalFormulaFromSequence(target.Code);
            target.PTMList          = parser.GetPTMList(target.Code);
            target.MonoMassTheor    = ParseDoubleField(processedGroup[0], AdjustedPrecursorMassHeader);
            var children = new List <IqTarget>();

            foreach (var line in processedGroup)
            {
                children.Add(ConvertTextToIqTarget(line));
            }

            target.AddTargetRange(children);
            return(target);
        }
Ejemplo n.º 8
0
        public virtual void UpdateTargetMissingInfo(IqTarget target, bool calcAveragineForMissingEmpiricalFormula = true, bool cysteinesAreModified = false)
        {
            var isMissingMonoMass = target.MonoMassTheor <= 0;

            if (String.IsNullOrEmpty(target.EmpiricalFormula))
            {
                if (!String.IsNullOrEmpty(target.Code))
                {
                    //Create empirical formula based on code. Assume it is an unmodified peptide
                    //target.EmpiricalFormula = _peptideUtils.GetEmpiricalFormulaForPeptideSequence(target.Code);
                    target.EmpiricalFormula = IqCodeParser.GetEmpiricalFormulaFromSequence(target.Code, cysteinesAreModified);
                }
                else
                {
                    if (isMissingMonoMass)
                    {
                        throw new ApplicationException(
                                  "Trying to fill in missing data on target, but Target is missing both the 'Code' and the Monoisotopic Mass. One or the other is needed.");
                    }
                    target.Code             = "AVERAGINE";
                    target.EmpiricalFormula =
                        IsotopicDistributionCalculator.GetAveragineFormulaAsString(target.MonoMassTheor);
                }
            }

            if (isMissingMonoMass)
            {
                target.MonoMassTheor =
                    EmpiricalFormulaUtilities.GetMonoisotopicMassFromEmpiricalFormula(target.EmpiricalFormula);
            }

            if (target.ChargeState != 0)
            {
                target.MZTheor = target.MonoMassTheor / target.ChargeState + DeconTools.Backend.Globals.PROTON_MASS;
            }
        }