public void TestAddDigestFeatures() { Sequence seq = new Sequence("Test", "AAANESAARBBBNPSBBKFFFNITFFRGGGNDTGGR"); Digest digest = new Digest(); digest.DigestProtease = ProteaseManager.CreateProtease("Trypsin_TestAddDigestFeatures", true, "RK", "P"); digest.ProteinSequence = seq; digest.MaxMissedCleavages = 0; digest.AddDigestFeatures(); List <DigestPeptideInfo> peptides = (List <DigestPeptideInfo>)seq.Annotation[Digest.PEPTIDE_FEATURE_TYPE]; Assert.AreEqual(4, peptides.Count); digest.MaxMissedCleavages = 1; digest.AddDigestFeatures(); List <DigestPeptideInfo> missedPeptides = (List <DigestPeptideInfo>)seq.Annotation[Digest.PEPTIDE_FEATURE_TYPE]; Assert.AreEqual(7, missedPeptides.Count); IRangeLocationFilter nglycanFilter = new NGlycanFilter(); digest.MaxMissedCleavages = 0; digest.Filter = nglycanFilter; digest.AddDigestFeatures(); List <DigestPeptideInfo> nglycanPeptides = (List <DigestPeptideInfo>)seq.Annotation[Digest.PEPTIDE_FEATURE_TYPE]; Assert.AreEqual(2, nglycanPeptides.Count); Assert.AreEqual("AAANESAAR", nglycanPeptides[0].PeptideSeq); Assert.AreEqual("FFFNITFFR", nglycanPeptides[1].PeptideSeq); }
public void TestLoadFromFile() { ProteaseManager.LoadFromFile(@TestContext.CurrentContext.TestDirectory + "/../../../data//proteases.xml"); Assert.IsTrue(ProteaseManager.Registered("Trypsin")); Assert.IsTrue(ProteaseManager.Registered("Chymotrypsin")); Assert.IsTrue(ProteaseManager.Registered("LysC/P+AspC")); Assert.IsFalse(ProteaseManager.Registered("ProteaseNotExist")); Protease trypsin = ProteaseManager.GetProteaseByName("Trypsin"); Assert.AreEqual("Trypsin", trypsin.Name); Assert.AreEqual(true, trypsin.IsEndoProtease); Assert.AreEqual("KR", trypsin.CleaveageResidues); Assert.AreEqual("P", trypsin.NotCleaveResidues); }
private void Read(string filename) { this.dtaProteaseMap = new Dictionary <string, Protease>(); using (var filein = new StreamReader(new FileStream(filename, FileMode.Open, FileAccess.Read))) { var enzymeMap = new Dictionary <string, Protease>(); string sline; while ((sline = filein.ReadLine()) != null && sline.Length > 0) { Protease enzyme = ProteaseManager.ValueOf(sline); string[] lines = Regex.Split(sline, "\t"); enzymeMap[lines[0]] = enzyme; } while ((sline = filein.ReadLine()) != null) { if (sline.StartsWith("DEFAULT_ENZYME")) { string[] lines = Regex.Split(sline, "\t"); this.defaultProtease = enzymeMap[lines[1]]; break; } } while ((sline = filein.ReadLine()) != null) { if (sline.Length == 0) { continue; } string[] lines = Regex.Split(sline, "\t"); if (lines.Length < 2) { break; } this.dtaProteaseMap[lines[0]] = enzymeMap[lines[1]]; } } }
/// <summary> /// Retrieves a reference to the named Protease.(Internally calls ProteaseManager.getProteaseByName()) /// </summary> /// <param name="proteaseName">A protease name that is registered in the ProteaseManager (case sensitive)</param> /// <returns> A Protease instance for the given protease name</returns> public static Protease GetProteaseByName(string proteaseName) { return(ProteaseManager.GetProteaseByName(proteaseName)); }
/// <summary> /// Get the list of Protease names defined in the ProteaseManager (Internally calls ProteaseManager). /// </summary> /// <returns>A string array of protease names</returns> public static List <string> GetProteaseList() { return(ProteaseManager.GetNames()); }