private static void MyTaskEngine_finishedWritingFileHandler(object sender, SingleFileEventArgs e) { if (InProgress) { MyWriter.WriteLine(); } InProgress = false; WriteMultiLineIndented("Finished writing file: " + e.WrittenFile); }
public static void SingleEventArgsTest() { Protein parentProteinForMatch = new Protein("MEK", null); CommonParameters commonParameters = new CommonParameters(digestionParams: new DigestionParams(minPeptideLength: 1)); var fsp = new List <(string fileName, CommonParameters fileSpecificParameters)>(); fsp.Add(("", commonParameters)); ModificationMotif.TryGetMotif("E", out ModificationMotif motif); List <Modification> variableModifications = new List <Modification> { new Modification(_originalId: "21", _target: motif, _locationRestriction: "Anywhere.", _monoisotopicMass: 21.981943) }; List <PeptideWithSetModifications> allPeptidesWithSetModifications = parentProteinForMatch.Digest(commonParameters.DigestionParams, new List <Modification>(), variableModifications).ToList(); Assert.AreEqual(4, allPeptidesWithSetModifications.Count()); PeptideWithSetModifications ps = allPeptidesWithSetModifications.First(); PeptideWithSetModifications pepWithSetModsForSpectrum = allPeptidesWithSetModifications[1]; MsDataFile myMsDataFile = new TestDataFile(new List <PeptideWithSetModifications> { pepWithSetModsForSpectrum }); Tolerance fragmentTolerance = new AbsoluteTolerance(0.01); Ms2ScanWithSpecificMass scan = new Ms2ScanWithSpecificMass(myMsDataFile.GetAllScansList().Last(), pepWithSetModsForSpectrum.MonoisotopicMass.ToMz(1), 1, null, new CommonParameters()); var theoreticalProducts = new List <Product>(); ps.Fragment(DissociationType.HCD, FragmentationTerminus.Both, theoreticalProducts); var matchedIons = MetaMorpheusEngine.MatchFragmentIons(scan, theoreticalProducts, new CommonParameters()); PeptideSpectralMatch newPsm = new PeptideSpectralMatch(ps, 0, 0, 2, scan, commonParameters, matchedIons); LocalizationEngine f = new LocalizationEngine(new List <PeptideSpectralMatch> { newPsm }, myMsDataFile, new CommonParameters(), fsp, new List <string>()); var singleEngine = new SingleEngineEventArgs(f); Assert.That(singleEngine.MyEngine.Equals(f)); var singleFile = new SingleFileEventArgs("", new List <string>()); Assert.That(singleFile.WrittenFile.Equals("")); var stringList = new StringListEventArgs(new List <string>()); var rr = (stringList.StringList.DefaultIfEmpty().First()); Assert.That(stringList.StringList.DefaultIfEmpty().First() == null); }
private static void MyTaskEngine_finishedWritingFileHandler(object sender, SingleFileEventArgs e) { if (InProgress) { if (CommandLineSettings.Verbosity == CommandLineSettings.VerbosityType.normal) { MyWriter.WriteLine(); } } InProgress = false; if (CommandLineSettings.Verbosity == CommandLineSettings.VerbosityType.normal) { WriteMultiLineIndented("Finished writing file: " + e.WrittenFile); } }
private void NewSuccessfullyFinishedWritingFile(object sender, SingleFileEventArgs v) { if (!Dispatcher.CheckAccess()) { Dispatcher.BeginInvoke(new Action(() => NewSuccessfullyFinishedWritingFile(sender, v))); } else { ForTreeView AddWrittenFileToThisOne = dynamicTasksObservableCollection.First(b => b.Id.Equals(v.nestedIDs[0])); foreach (var hm in v.nestedIDs.Skip(1)) { try { AddWrittenFileToThisOne = AddWrittenFileToThisOne.Children.First(b => b.Id.Equals(hm)); } catch { } } AddWrittenFileToThisOne.Children.Add(new OutputFileForTreeView(v.writtenFile, Path.GetFileName(v.writtenFile))); } }