CSMSL.Examples.Examples.PeptideExamples C# (CSharp) Method

PeptideExamples() private static method

Basic overview of how peptides can be used and modified
private static PeptideExamples ( ) : void
return void
        private static void PeptideExamples()
        {
            Console.WriteLine("**Peptide Examples**");

            // Simple Peptide creation
            Peptide peptide1 = new Peptide("ACDEFGHIKLMNPQRSTVWY");
            WritePeptideToConsole(peptide1);

            // Fragmenting a peptide is simple, you can include as many fragment types as you want
            Console.WriteLine("{0,-4} {1,-20} {2,-10} {3,-10} {4,-5}", "Type", "Formula", "Mass", "m/z +1", "Sequence");
            foreach (Fragment fragment in peptide1.Fragment(FragmentTypes.b | FragmentTypes.y))
            {
                WriteFragmentToConsole(fragment);
            }

            // Modifications can be applied to any residue or termini
            Console.WriteLine("Lets add some Iron to our peptide...");
            peptide1.SetModification(new ChemicalFormula("Fe"), Terminus.C | Terminus.N);
            WritePeptideToConsole(peptide1);

            // A chemicalmodification is a simple wrapper for a chemical formula. You can name your mods if you want
            Console.WriteLine("Add a modification of Oxygen with the name \"Oxidation\" to all Methionines");
            ChemicalFormulaModification oxMod = new ChemicalFormulaModification("O", "Oxidation");
            peptide1.SetModification(oxMod, 'M');
            WritePeptideToConsole(peptide1);

            // If you fragment a modified peptide, the modifications stay part of the fragments
            Console.WriteLine("{0,-4} {1,-20} {2,-20} {3,-5}", "Type", "Formula", "Mass", "m/z +1");
            foreach (Fragment fragment in peptide1.Fragment(FragmentTypes.b | FragmentTypes.y, 2))
            {
                WriteFragmentToConsole(fragment);
            }
        }