Ejemplo n.º 1
0
 public static AminoAcid GetAminoAcid(char c)
 {
     if (!AminoAcids.IsStandardAminoAcid(c))
     {
         return(null);
     }
     return(AminoAcidList[c]);
 }
Ejemplo n.º 2
0
        static public bool CheckPeptideList(List <string> peptides, int length, out List <string> warnings, out List <string> errors)
        {
            warnings = new List <string>();
            errors   = new List <string>();
            bool ret = true;

            try
            {
                foreach (string p in peptides)
                {
                    if (Regex.Matches(p, @"[a-zA-Z]").Count < p.Length)
                    {
                        errors.Add("Invalid characters in " + p);
                    }
                    else
                    {
                        if (p.Length < length)
                        {
                            warnings.Add("Length inconsistency in " + p);
                        }
                        foreach (char c in p.Substring(0, Math.Min(p.Length, length)))
                        {
                            if (!AminoAcids.IsStandardAminoAcid(c))
                            {
                                warnings.Add("Non-standard amino acid in " + p);
                                break;
                            }
                        }
                    }
                }
                return(ret);
            }
            catch (Exception exc)
            {
                errors.Add("Unhandled exception: " + exc.Message);
                return(false);
            }
        }