//Properly handles removing a protein and updating FDR's, peptide lists, scan lists public void RemoveProtein(List <MyProtein> proteins) { //For each of this protein's peptide lets see if this peptide still maps to some other protein, or else we should remove it. foreach (MyProtein p in proteins) { MyProteins.MyProteinList.Remove(p); List <string> remainingProteins = MyProteins.MyProteinList.Select(a => a.Locus).ToList(); List <PeptideResult> peptidesToRemove = new List <PeptideResult>(); foreach (PeptideResult pr in p.PeptideResults) { if (pr.MyMapableProteins.Intersect(remainingProteins).ToList().Count == 0) { peptidesToRemove.Add(pr); } } foreach (PeptideResult pr in peptidesToRemove) { PeptideResult pr2 = MyProteins.MyPeptideList.Find(a => a.PeptideSequence.Equals(pr.CleanedPeptideSequence)); bool removed = MyProteins.MyPeptideList.Remove(pr2); } } MyProteins.RebuildScansFromProteins(); MyFDRResult = FDRStatistics.GenerateFDRStatistics(MyProteins, MyParameters); NotifyPropertyChanged("MyProteinList"); }
public void Save(string fileName) { //Refresh statistics in case anything has changed MyFDRResult = FDRStatistics.GenerateFDRStatistics(MyProteins, MyParameters); //Serialize it! System.IO.FileStream flStream = new System.IO.FileStream(fileName, System.IO.FileMode.Create, System.IO.FileAccess.Write); BinaryFormatter bf = new BinaryFormatter(); bf.AssemblyFormat = System.Runtime.Serialization.Formatters.FormatterAssemblyStyle.Simple; bf.TypeFormat = System.Runtime.Serialization.Formatters.FormatterTypeStyle.TypesAlways; bf.Serialize(flStream, this); flStream.Close(); }
public ResultPackage (ProteinManager myProteins, Parameters parameters, string databaseUsed, string sqtDirectory, bool lockMass ) { this.lockMass = lockMass; this.MyProteins = myProteins; this.MyParameters = parameters; this.Database = databaseUsed; this.SQTDirectory = sqtDirectory; this.MyFDRResult = FDRStatistics.GenerateFDRStatistics(myProteins, MyParameters); }