public void InitializeRun(string dataset) { string runFilename; if (this.ExecutorParameters.CopyRawFileLocal) { ReportGeneralProgress("Started copying raw data to local folder: " + this.ExecutorParameters.FolderPathForCopiedRawDataset); var attr = File.GetAttributes(dataset); DirectoryInfo sourceDirInfo; DirectoryInfo targetDirInfo; if ((attr & FileAttributes.Directory) == FileAttributes.Directory) { sourceDirInfo = new DirectoryInfo(dataset); runFilename = Path.Combine(this.ExecutorParameters.FolderPathForCopiedRawDataset, sourceDirInfo.Name); targetDirInfo = new DirectoryInfo(runFilename); FileUtilities.CopyAll(sourceDirInfo, targetDirInfo); ReportGeneralProgress("Copying complete."); } else { var fileinfo = new FileInfo(dataset); sourceDirInfo = fileinfo.Directory; runFilename = Path.Combine(this.ExecutorParameters.FolderPathForCopiedRawDataset, Path.GetFileName(dataset)); targetDirInfo = new DirectoryInfo(this.ExecutorParameters.FolderPathForCopiedRawDataset); if (!File.Exists(runFilename)) { FileUtilities.CopyAll(fileinfo, targetDirInfo); ReportGeneralProgress("Copying complete."); } else { ReportGeneralProgress("Datafile already exists on local drive. Using existing datafile."); } } } else { runFilename = dataset; } //create Run var rf = new RunFactory(); Run = rf.CreateRun(runFilename); var runInstantiationFailed = (Run == null); if (runInstantiationFailed) { ReportGeneralProgress("Run initialization FAILED. Likely a filename problem. Or missing manufacturer .dlls"); return; } else { ReportGeneralProgress("Run initialized successfully."); } //Retrieve alignment data if it exists CopyAlignmentInfoIfExists(); //check and load chrom source data (_peaks.txt) var peaksFileExists = CheckForPeaksFile(); if (!peaksFileExists) { ReportGeneralProgress("Creating _Peaks.txt file for extracted ion chromatogram (XIC) source data ... takes 1-5 minutes"); CreatePeaksForChromSourceData(); ReportGeneralProgress("Done creating _Peaks.txt file"); } else { ReportGeneralProgress("Using existing _Peaks.txt file"); } ReportGeneralProgress("Peak loading started..."); var baseFileName = Path.Combine(this.Run.DataSetPath, this.Run.DatasetName); var possibleFilename1 = baseFileName + "_peaks.txt"; if (File.Exists(possibleFilename1)) { //create background worker so that updates don't go out to console. //BackgroundWorker bw = new BackgroundWorker(); //bw.WorkerSupportsCancellation = true; //bw.WorkerReportsProgress = true; //TODO: keep an eye on errors connected to background worker here. var peakImporter = new PeakImporterFromText(possibleFilename1, _backgroundWorker); peakImporter.ImportPeaks(this.Run.ResultCollection.MSPeakResultList); } else { ReportGeneralProgress("CRITICAL FAILURE. Chrom source data (_peaks.txt) file not loaded."); return; } // Grab the primary LC Scan numbers if they are not already filled out if (!Run.PrimaryLcScanNumbers.Any()) { Run.PrimaryLcScanNumbers = RunUtilities.FindPrimaryLcScanNumbers(this.Run.ResultCollection.MSPeakResultList); } ReportGeneralProgress("Peak Loading complete."); return; }