public static void TestGlycanCompositionHypothesis()
 {
     String testGlycanCompositionFile = @"TestData\Glycresoft glycan hypothesis.csv";
     CompositionHypothesis glycanHypothesis = new CompositionHypothesis();
     glycanHypothesis.ParseCompositionHypothesisCsv<GlycanComposition>(testGlycanCompositionFile);
     Console.WriteLine(glycanHypothesis);
 }
 public static void TestGlycoPeptideHypothesis()
 {
     String testGlycopeptideCompositionFile = @"TestData\HA-USSR-Glycopeptide hypothesis.csv";
     CompositionHypothesis glycopeptideHypothesis = new CompositionHypothesis();
     glycopeptideHypothesis.ParseCompositionHypothesisCsv<GlycopeptideComposition>(testGlycopeptideCompositionFile);
     Console.WriteLine(glycopeptideHypothesis);
 }
 public static void TestBuildGlycoPeptideHypothesis()
 {
     String testGlycanCompositionFile = @"TestData\Glycresoft glycan hypothesis.csv";
     CompositionHypothesis glycanHypothesis = new CompositionHypothesis();
     glycanHypothesis.ParseCompositionHypothesisCsv<GlycanComposition>(testGlycanCompositionFile);
     String testMSDigestFile = @"TestData\KK-USSR-digest-Prospector output.xml";
     MSDigestReport msdigest = MSDigestReport.Load(testMSDigestFile);
     int counter = 0;
     foreach (MSDigestPeptide pep in msdigest.Peptides)
     {
         counter += pep.NumGlycosylations;
         if (counter > 30)
         {
             pep.NumGlycosylations = 0;
         }
     }
     try
     {
         GlycopeptideCompositionHypothesisBuilder builder = new GlycopeptideCompositionHypothesisBuilder(glycanHypothesis, msdigest.Peptides);
         Console.WriteLine("Building Hypothesis");
         builder.BuildCompositionHypothesis();
         Console.WriteLine(builder.GlycopeptideComposition);
         builder.GlycopeptideComposition.WriteCompositionHypothesisCsv("TestData/TestOutputHypothesis.csv");
     }
     catch (OutOfMemoryException ex)
     {
         Console.WriteLine("\n\n\n!!!!!!!!!!!!!!!!Combinatorics exceeded memory size!", ex.Message, "\n\n\n!!!!!!!!!!!!!!!!!!!!!!!!!!");
     }
 }
 public GlycopeptideCompositionHypothesisBuilder(CompositionHypothesis glycanCompositionHypothesis, List<MSDigestPeptide> peptides)
 {
     this.GlycanCompositions = glycanCompositionHypothesis;
     this.Peptides = peptides;
     this.GlycopeptideComposition = new CompositionHypothesis();
     GlycopeptideComposition.ElementNames = GlycanCompositions.ElementNames;
     GlycopeptideComposition.MoleculeNames = GlycanCompositions.MoleculeNames;
 }
        private DataTable BuildCompositionHypothesisDataTable(CompositionHypothesis.CompositionHypothesis hypothesis)
        {
            DataTable hypothesisTable = new DataTable();
            hypothesisTable.Columns.Add("Molecular Weight", typeof(Double));
            foreach (string element in hypothesis.ElementNames)
            {
                hypothesisTable.Columns.Add(element, typeof(Int32));
            }
            hypothesisTable.Columns.Add("Compositions", typeof(String));
            foreach (string molecule in hypothesis.MoleculeNames)
            {
                hypothesisTable.Columns.Add(molecule, typeof(String));
            }
            hypothesisTable.Columns.Add("Adduct/Replacement", typeof(String));
            hypothesisTable.Columns.Add("Adduct Amount", typeof(Int32));
            hypothesisTable.Columns.Add("Peptide Sequence", typeof(String));
            hypothesisTable.Columns.Add("Peptide Modification", typeof(String));
            hypothesisTable.Columns.Add("Peptide Missed Cleavage Number", typeof(Int32));
            hypothesisTable.Columns.Add("Number of Glycan Attachment to Peptide", typeof(Int32));
            hypothesisTable.Columns.Add("Start AA", typeof(Int32));
            hypothesisTable.Columns.Add("End AA", typeof(Int32));
            hypothesisTable.Columns.Add("Protein ID", typeof(String));

            foreach (GlycopeptideComposition entry in hypothesis.Compositions)
            {
                DataRow row = hypothesisTable.NewRow();
                string glycanTuple = entry.GlycanCompositionTuple(hypothesis.MoleculeNames);
                row["Molecular Weight"] = entry.MassWeight;
                foreach (string element in hypothesis.ElementNames)
                {
                    if (entry.ElementalComposition.ContainsKey(element))
                    {
                        row[element] = entry.ElementalComposition[element];
                    }
                    else
                    {
                        row[element] = 0;
                    }
                }
                row["Compositions"] = glycanTuple;
                foreach (string molecule in hypothesis.MoleculeNames)
                {
                    if (entry.MolecularComposition.ContainsKey(molecule))
                    {
                        row[molecule] = entry.MolecularComposition[molecule];
                    }
                    else
                    {
                        row[molecule] = 0;
                    }

                }
                row["Adduct/Replacement"] = entry.AdductReplaces;
                row["Adduct Amount"] = entry.AdductAmount;
                row["Peptide Sequence"] = entry.PeptideSequence;
                row["Peptide Modification"] = entry.PeptideModification;
                row["Peptide Missed Cleavage Number"] = entry.MissedCleavages;
                row["Number of Glycan Attachment to Peptide"] = entry.GlycosylationCount;
                row["Start AA"] = entry.StartAA;
                row["End AA"] = entry.EndAA;
                row["Protein ID"] = entry.ProteinID;

                hypothesisTable.Rows.Add(row);
            }

            for (int i = 0; i < hypothesisTable.Columns.Count; i++ )
            {
                hypothesisTable.Columns[i].SetOrdinal(i);
            }
            return hypothesisTable;
        }