Exemple #1
0
        public string GetEmpiricalFormulaForPeptideSequence(string peptideSequence, bool includeAmineHydrogenAndFreeAcid = true, bool cysteinesAreModified = false)
        {
            peptideSequence = CleanUpPeptideSequence(peptideSequence);

            var sequenceIsValid = ValidateSequence(peptideSequence);

            if (!sequenceIsValid)
            {
                return(string.Empty);
            }

            var outputEmpiricalFormula = "";

            foreach (var aminoAcid in peptideSequence)
            {
                var aminoAcidFormula = GetEmpiricalFormulaForAminoAcidResidue(aminoAcid);

                outputEmpiricalFormula = EmpiricalFormulaUtilities.AddFormula(outputEmpiricalFormula, aminoAcidFormula);

                if (cysteinesAreModified && aminoAcid == 'C')
                {
                    outputEmpiricalFormula = EmpiricalFormulaUtilities.AddFormula(outputEmpiricalFormula, "H3C2NO");
                }
            }

            if (includeAmineHydrogenAndFreeAcid)
            {
                var nterminalHydrogen = "H";
                var cterminalFreeAcid = "OH";

                outputEmpiricalFormula = EmpiricalFormulaUtilities.AddFormula(outputEmpiricalFormula, nterminalHydrogen);
                outputEmpiricalFormula = EmpiricalFormulaUtilities.AddFormula(outputEmpiricalFormula, cterminalFreeAcid);
            }
            return(outputEmpiricalFormula);
        }
Exemple #2
0
 public Dictionary <string, int> ParseEmpiricalFormulaString(string empiricalFormula)
 {
     return(EmpiricalFormulaUtilities.ParseEmpiricalFormulaString(empiricalFormula));
 }