Exemplo n.º 1
0
        protected override void ParseSpecial(SequestParam result, List <String> contents,
                                             Dictionary <string, Pair <string, string> > parameters)
        {
            result.Normalize_Score = int.Parse(parameters["normalize_xcorr"].First);

            ParseEnzyme(result, contents, parameters);
        }
 public void TestAminoacidToModification()
 {
     Assert.AreEqual(SequestStaticModification.add_G_Glycine, SequestParam.AminoacidToModification('G'));
     Assert.AreEqual(SequestStaticModification.add_A_Alanine, SequestParam.AminoacidToModification('A'));
     Assert.AreEqual(SequestStaticModification.add_S_Serine, SequestParam.AminoacidToModification('S'));
     Assert.AreEqual(SequestStaticModification.add_P_Proline, SequestParam.AminoacidToModification('P'));
     Assert.AreEqual(SequestStaticModification.add_V_Valine, SequestParam.AminoacidToModification('V'));
     Assert.AreEqual(SequestStaticModification.add_T_Threonine, SequestParam.AminoacidToModification('T'));
     Assert.AreEqual(SequestStaticModification.add_C_Cysteine, SequestParam.AminoacidToModification('C'));
     Assert.AreEqual(SequestStaticModification.add_L_Leucine, SequestParam.AminoacidToModification('L'));
     Assert.AreEqual(SequestStaticModification.add_I_Isoleucine, SequestParam.AminoacidToModification('I'));
     Assert.AreEqual(SequestStaticModification.add_X_LorI, SequestParam.AminoacidToModification('X'));
     Assert.AreEqual(SequestStaticModification.add_N_Asparagine, SequestParam.AminoacidToModification('N'));
     Assert.AreEqual(SequestStaticModification.add_O_Ornithine, SequestParam.AminoacidToModification('O'));
     Assert.AreEqual(SequestStaticModification.add_B_avg_NandD, SequestParam.AminoacidToModification('B'));
     Assert.AreEqual(SequestStaticModification.add_D_Aspartic_Acid, SequestParam.AminoacidToModification('D'));
     Assert.AreEqual(SequestStaticModification.add_Q_Glutamine, SequestParam.AminoacidToModification('Q'));
     Assert.AreEqual(SequestStaticModification.add_K_Lysine, SequestParam.AminoacidToModification('K'));
     Assert.AreEqual(SequestStaticModification.add_Z_avg_QandE, SequestParam.AminoacidToModification('Z'));
     Assert.AreEqual(SequestStaticModification.add_E_Glutamic_Acid, SequestParam.AminoacidToModification('E'));
     Assert.AreEqual(SequestStaticModification.add_M_Methionine, SequestParam.AminoacidToModification('M'));
     Assert.AreEqual(SequestStaticModification.add_H_Histidine, SequestParam.AminoacidToModification('H'));
     Assert.AreEqual(SequestStaticModification.add_F_Phenylalanine, SequestParam.AminoacidToModification('F'));
     Assert.AreEqual(SequestStaticModification.add_R_Arginine, SequestParam.AminoacidToModification('R'));
     Assert.AreEqual(SequestStaticModification.add_Y_Tyrosine, SequestParam.AminoacidToModification('Y'));
     Assert.AreEqual(SequestStaticModification.add_W_Tryptophan, SequestParam.AminoacidToModification('W'));
 }
Exemplo n.º 3
0
        private void ParseEnzyme(SequestParam result, List <string> contents,
                                 Dictionary <string, Pair <string, string> > parameters)
        {
            bool bFound = false;

            foreach (String line in contents)
            {
                if (line.StartsWith("enzyme_info"))
                {
                    String[] parts = line.Split('=');

                    String[] parts2 = Regex.Split(parts[1].Trim(), @"\s+");
                    result.Protease = new Protease(parts2[0],
                                                   parts2[2].Equals("1"),
                                                   parts2[3].Equals("-") ? "" : parts2[3],
                                                   parts2[4].Equals("-") ? "" : parts2[4]);
                    bFound = true;
                    break;
                }
            }

            if (!bFound)
            {
                throw new Exception("Cannot find enzyme information, are you sure it was generated from Bioworks 3.2 or upper?");
            }
        }
Exemplo n.º 4
0
        private void ParseEnzyme(SequestParam result, List <string> contents,
                                 Dictionary <string, Pair <string, string> > parameters)
        {
            bool   bFound       = false;
            int    enzymeNumber = 0;
            String enzymeLine   = enzymeNumber + ".";

            foreach (String line in contents)
            {
                if (line.StartsWith("enzyme_number"))
                {
                    String[] parts = line.Split('=');
                    enzymeNumber = int.Parse(parts[1].Trim());
                    enzymeLine   = enzymeNumber + ".";
                }
                else if (line.StartsWith(enzymeLine))
                {
                    String[] parts = Regex.Split(line, @"\s+");
                    result.Protease = new Protease(parts[1],
                                                   parts[2].Equals("1"),
                                                   parts[3].Equals("-") ? "" : parts[3],
                                                   parts[4].Equals("-") ? "" : parts[4]);
                    bFound = true;
                    break;
                }
            }

            if (!bFound)
            {
                throw new Exception("Cannot find enzyme information, are you sure it was generated from Bioworks 3.1 or lower?");
            }
        }
 public void TestModificationToAminoacid()
 {
     Assert.AreEqual(' ', SequestParam.ModificationToAminoacid(SequestStaticModification.add_Cterm_peptide));
     Assert.AreEqual(' ', SequestParam.ModificationToAminoacid(SequestStaticModification.add_Cterm_protein));
     Assert.AreEqual(' ', SequestParam.ModificationToAminoacid(SequestStaticModification.add_Nterm_peptide));
     Assert.AreEqual(' ', SequestParam.ModificationToAminoacid(SequestStaticModification.add_Nterm_protein));
     Assert.AreEqual('G', SequestParam.ModificationToAminoacid(SequestStaticModification.add_G_Glycine));
     Assert.AreEqual('A', SequestParam.ModificationToAminoacid(SequestStaticModification.add_A_Alanine));
     Assert.AreEqual('S', SequestParam.ModificationToAminoacid(SequestStaticModification.add_S_Serine));
     Assert.AreEqual('P', SequestParam.ModificationToAminoacid(SequestStaticModification.add_P_Proline));
     Assert.AreEqual('V', SequestParam.ModificationToAminoacid(SequestStaticModification.add_V_Valine));
     Assert.AreEqual('T', SequestParam.ModificationToAminoacid(SequestStaticModification.add_T_Threonine));
     Assert.AreEqual('C', SequestParam.ModificationToAminoacid(SequestStaticModification.add_C_Cysteine));
     Assert.AreEqual('L', SequestParam.ModificationToAminoacid(SequestStaticModification.add_L_Leucine));
     Assert.AreEqual('I', SequestParam.ModificationToAminoacid(SequestStaticModification.add_I_Isoleucine));
     Assert.AreEqual('X', SequestParam.ModificationToAminoacid(SequestStaticModification.add_X_LorI));
     Assert.AreEqual('N', SequestParam.ModificationToAminoacid(SequestStaticModification.add_N_Asparagine));
     Assert.AreEqual('O', SequestParam.ModificationToAminoacid(SequestStaticModification.add_O_Ornithine));
     Assert.AreEqual('B', SequestParam.ModificationToAminoacid(SequestStaticModification.add_B_avg_NandD));
     Assert.AreEqual('D', SequestParam.ModificationToAminoacid(SequestStaticModification.add_D_Aspartic_Acid));
     Assert.AreEqual('Q', SequestParam.ModificationToAminoacid(SequestStaticModification.add_Q_Glutamine));
     Assert.AreEqual('K', SequestParam.ModificationToAminoacid(SequestStaticModification.add_K_Lysine));
     Assert.AreEqual('Z', SequestParam.ModificationToAminoacid(SequestStaticModification.add_Z_avg_QandE));
     Assert.AreEqual('E', SequestParam.ModificationToAminoacid(SequestStaticModification.add_E_Glutamic_Acid));
     Assert.AreEqual('M', SequestParam.ModificationToAminoacid(SequestStaticModification.add_M_Methionine));
     Assert.AreEqual('H', SequestParam.ModificationToAminoacid(SequestStaticModification.add_H_Histidine));
     Assert.AreEqual('F', SequestParam.ModificationToAminoacid(SequestStaticModification.add_F_Phenylalanine));
     Assert.AreEqual('R', SequestParam.ModificationToAminoacid(SequestStaticModification.add_R_Arginine));
     Assert.AreEqual('Y', SequestParam.ModificationToAminoacid(SequestStaticModification.add_Y_Tyrosine));
     Assert.AreEqual('W', SequestParam.ModificationToAminoacid(SequestStaticModification.add_W_Tryptophan));
 }
 public void TestNameToModification()
 {
     Assert.AreEqual(SequestStaticModification.add_Cterm_peptide, SequestParam.NameToModification("add_Cterm_peptide"));
     Assert.AreEqual(SequestStaticModification.add_Cterm_protein, SequestParam.NameToModification("add_Cterm_protein"));
     Assert.AreEqual(SequestStaticModification.add_Nterm_peptide, SequestParam.NameToModification("add_Nterm_peptide"));
     Assert.AreEqual(SequestStaticModification.add_Nterm_protein, SequestParam.NameToModification("add_Nterm_protein"));
     Assert.AreEqual(SequestStaticModification.add_G_Glycine, SequestParam.NameToModification("add_G_Glycine"));
     Assert.AreEqual(SequestStaticModification.add_A_Alanine, SequestParam.NameToModification("add_A_Alanine"));
     Assert.AreEqual(SequestStaticModification.add_S_Serine, SequestParam.NameToModification("add_S_Serine"));
     Assert.AreEqual(SequestStaticModification.add_P_Proline, SequestParam.NameToModification("add_P_Proline"));
     Assert.AreEqual(SequestStaticModification.add_V_Valine, SequestParam.NameToModification("add_V_Valine"));
     Assert.AreEqual(SequestStaticModification.add_T_Threonine, SequestParam.NameToModification("add_T_Threonine"));
     Assert.AreEqual(SequestStaticModification.add_C_Cysteine, SequestParam.NameToModification("add_C_Cysteine"));
     Assert.AreEqual(SequestStaticModification.add_L_Leucine, SequestParam.NameToModification("add_L_Leucine"));
     Assert.AreEqual(SequestStaticModification.add_I_Isoleucine, SequestParam.NameToModification("add_I_Isoleucine"));
     Assert.AreEqual(SequestStaticModification.add_X_LorI, SequestParam.NameToModification("add_X_LorI"));
     Assert.AreEqual(SequestStaticModification.add_N_Asparagine, SequestParam.NameToModification("add_N_Asparagine"));
     Assert.AreEqual(SequestStaticModification.add_O_Ornithine, SequestParam.NameToModification("add_O_Ornithine"));
     Assert.AreEqual(SequestStaticModification.add_B_avg_NandD, SequestParam.NameToModification("add_B_avg_NandD"));
     Assert.AreEqual(SequestStaticModification.add_D_Aspartic_Acid,
                     SequestParam.NameToModification("add_D_Aspartic_Acid"));
     Assert.AreEqual(SequestStaticModification.add_Q_Glutamine, SequestParam.NameToModification("add_Q_Glutamine"));
     Assert.AreEqual(SequestStaticModification.add_K_Lysine, SequestParam.NameToModification("add_K_Lysine"));
     Assert.AreEqual(SequestStaticModification.add_Z_avg_QandE, SequestParam.NameToModification("add_Z_avg_QandE"));
     Assert.AreEqual(SequestStaticModification.add_E_Glutamic_Acid,
                     SequestParam.NameToModification("add_E_Glutamic_Acid"));
     Assert.AreEqual(SequestStaticModification.add_M_Methionine, SequestParam.NameToModification("add_M_Methionine"));
     Assert.AreEqual(SequestStaticModification.add_H_Histidine, SequestParam.NameToModification("add_H_Histidine"));
     Assert.AreEqual(SequestStaticModification.add_F_Phenylalanine,
                     SequestParam.NameToModification("add_F_Phenylalanine"));
     Assert.AreEqual(SequestStaticModification.add_R_Arginine, SequestParam.NameToModification("add_R_Arginine"));
     Assert.AreEqual(SequestStaticModification.add_Y_Tyrosine, SequestParam.NameToModification("add_Y_Tyrosine"));
     Assert.AreEqual(SequestStaticModification.add_W_Tryptophan, SequestParam.NameToModification("add_W_Tryptophan"));
 }
Exemplo n.º 7
0
        protected override void ParseSpecial(SequestParam result, List <string> contents,
                                             Dictionary <string, Pair <string, string> > parameters)
        {
            if (parameters.ContainsKey("normalize_Score"))
            {
                result.Normalize_Score = int.Parse(parameters["normalize_Score"].First);
            }
            else if (parameters.ContainsKey("normalize_score"))
            {
                result.Normalize_Score = int.Parse(parameters["normalize_score"].First);
            }

            ParseEnzyme(result, contents, parameters);
        }
        public SequestParam ReadFromFile(String paramFilename)
        {
            List <String> contents = ReadSequestParamContents(paramFilename);

            Dictionary <string, Pair <string, string> > parameters = InitParameters(contents);

            var result = new SequestParam();

            ParseCommon(result, contents, parameters);

            ParseSpecial(result, contents, parameters);

            return(result);
        }
 public void TestAminoacidToModificationException()
 {
     SequestParam.AminoacidToModification(' ');
 }
 public void TestNameToModificationException()
 {
     SequestParam.NameToModification("");
 }
        private void ParseCommon(SequestParam result, List <String> contents,
                                 Dictionary <string, Pair <string, string> > parameters)
        {
            result.First_database_name        = parameters["first_database_name"].First;
            result.Peptide_mass_tolerance     = MyConvert.ToDouble(parameters["peptide_mass_tolerance"].First);
            result.Ion_series                 = parameters["ion_series"].First;
            result.Fragment_ion_tolerance     = MyConvert.ToDouble(parameters["fragment_ion_tolerance"].First);
            result.Num_output_lines           = int.Parse(parameters["num_output_lines"].First);
            result.Num_results                = int.Parse(parameters["num_results"].First);
            result.Num_description_lines      = int.Parse(parameters["num_description_lines"].First);
            result.Show_fragment_ions         = int.Parse(parameters["show_fragment_ions"].First);
            result.Print_duplicate_references = int.Parse(parameters["print_duplicate_references"].First);
            if (parameters.ContainsKey("max_num_differential_per_peptide"))
            {
                result.Max_num_differential_AA_per_mod = int.Parse(parameters["max_num_differential_per_peptide"].First);
            }
            else
            {
                result.Max_num_differential_AA_per_mod = int.Parse(parameters["max_num_differential_AA_per_mod"].First);
            }

            string diff_search_options = parameters["diff_search_options"].First;

            result.Diff_search_options.Clear();
            Match m = Regex.Match(diff_search_options, @"([\d.-]+)\s+(\S+)");

            if (m.Success)
            {
                do
                {
                    double addMass = MyConvert.ToDouble(m.Groups[1].Value);
                    if (addMass != 0.0)
                    {
                        result.Diff_search_options[m.Groups[2].Value] = addMass;
                    }
                    m = m.NextMatch();
                } while (m.Success);
            }

            string term_diff_search_options = parameters["term_diff_search_options"].First;

            String[] parts1 = Regex.Split(term_diff_search_options, @"\s+");
            result.Term_diff_search_options.First  = MyConvert.ToDouble(parts1[0]);
            result.Term_diff_search_options.Second = MyConvert.ToDouble(parts1[1]);

            result.Nucleotide_reading_frame        = int.Parse(parameters["nucleotide_reading_frame"].First);
            result.Mass_type_parent                = int.Parse(parameters["mass_type_parent"].First);
            result.Mass_type_fragment              = int.Parse(parameters["mass_type_fragment"].First);
            result.Remove_precursor_peak           = int.Parse(parameters["remove_precursor_peak"].First);
            result.Ion_cutoff_percentage           = MyConvert.ToDouble(parameters["ion_cutoff_percentage"].First);
            result.Max_num_internal_cleavage_sites = int.Parse(parameters["max_num_internal_cleavage_sites"].First);

            string protein_mass_filter = parameters["protein_mass_filter"].First;

            String[] parts2 = Regex.Split(protein_mass_filter, @"\s+");
            result.Protein_mass_filter.First  = MyConvert.ToDouble(parts2[0]);
            result.Protein_mass_filter.Second = MyConvert.ToDouble(parts2[1]);

            result.Match_peak_count         = int.Parse(parameters["match_peak_count"].First);
            result.Match_peak_allowed_error = int.Parse(parameters["match_peak_allowed_error"].First);
            result.Match_peak_tolerance     = MyConvert.ToDouble(parameters["match_peak_tolerance"].First);
            result.Partial_sequence         = parameters["partial_sequence"].First;
            result.Sequence_header_filter   = parameters["sequence_header_filter"].First;

            foreach (string ssm in Enum.GetNames(typeof(SequestStaticModification)))
            {
                if (parameters.ContainsKey(ssm))
                {
                    result.StaticModification[SequestParam.NameToModification(ssm)] = MyConvert.ToDouble(parameters[ssm].First);
                }
            }
        }
 protected abstract void ParseSpecial(SequestParam result, List <String> contents,
                                      Dictionary <string, Pair <string, string> > parameters);