RunLibraryMatchWorkflow() public method

The run library match workflow.
public RunLibraryMatchWorkflow ( IEnumerable targetList ) : LibraryMatchResult>.IDictionary
targetList IEnumerable dD /// The Target list. ///
return LibraryMatchResult>.IDictionary
        public void TestMixedSampleLibraryMatching()
        {
            // TODO Import AMT library instead of manually add them
            IList<DriftTimeTarget> imsTargets = new List<DriftTimeTarget>();
            DriftTimeTarget t1 = new DriftTimeTarget("BPS protonated", 23.22, "C12H10O4S", IonizationMethod.Protonated);
            DriftTimeTarget t2 = new DriftTimeTarget("BPS sodiated", 31.8506, "C12H10O4S", IonizationMethod.Sodiumated);
            DriftTimeTarget t3 = new DriftTimeTarget("I made it up", 15, "C14H14O4S", IonizationMethod.Sodiumated);
            DriftTimeTarget t4 = new DriftTimeTarget("I made it up again", 15, "C12H11O4S", IonizationMethod.Sodiumated);

            imsTargets.Add(t3);
            imsTargets.Add(t1);
            imsTargets.Add(t2);
            imsTargets.Add(t4);

            LibraryMatchWorkflow workflow = new LibraryMatchWorkflow(BPSPostive, "output", "result.txt", new LibraryMatchParameters());
            IDictionary<DriftTimeTarget, LibraryMatchResult> results = workflow.RunLibraryMatchWorkflow(imsTargets);
            Assert.AreEqual(results[t1].AnalysisStatus, AnalysisStatus.Positive);
            Assert.AreEqual(results[t2].AnalysisStatus, AnalysisStatus.Positive);
            Assert.AreEqual(results[t3].AnalysisStatus, AnalysisStatus.Negative);
            Assert.AreEqual(results[t4].AnalysisStatus, AnalysisStatus.Negative);
        }
Exemplo n.º 2
0
        /// <summary>
        /// The execute match.
        /// </summary>
        /// <param name="options">
        /// The options.
        /// </param>
        /// <returns>
        /// The <see cref="int"/>.
        /// </returns>
        private static int ExecuteMatch(MatchOptions options)
        {
            string inputPath = options.InputPath;  // get the UIMF file
            string libraryPath = options.LibraryPath; 
            string datasetName = Path.GetFileNameWithoutExtension(inputPath);
            string libraryFlieName = Path.GetFileNameWithoutExtension(libraryPath);
            string resultName = datasetName + "_" + libraryFlieName + "_MatchResult.txt";
            string resultPath = Path.Combine(options.OutputPath, resultName);
            string outputDirectory = options.OutputPath;

            if (outputDirectory == string.Empty)
            {
                outputDirectory = Directory.GetCurrentDirectory();
            } 
            
            if (!Directory.Exists(outputDirectory))
            {
                try
                {
                    Directory.CreateDirectory(outputDirectory);
                }
                catch (Exception)
                {
                    Console.WriteLine(string.Format("Failed to create directory {0}", outputDirectory));
                    throw;
                }
            }

            // Delete the result file if it already exists
            if (File.Exists(resultPath))
            {
                File.Delete(resultPath);
            }

            IList<DriftTimeTarget> importDriftTimeLibrary = DriftTimeLibraryImporter.ImportDriftTimeLibrary(libraryPath);
            var parameters = new LibraryMatchParameters(options.DriftTimeError, 250, 9, options.PeakShapeScoreThreshold, options.IsotopicScoreThreshold, 0.25, options.MassError, options.DriftTubeLength);
            LibraryMatchWorkflow workflow = new LibraryMatchWorkflow(inputPath, outputDirectory, resultName, parameters);
            IDictionary<DriftTimeTarget, LibraryMatchResult> results = workflow.RunLibraryMatchWorkflow(importDriftTimeLibrary);

            // Write out the target / result pairs as serialized objects

            if (options.PauseWhenDone)
            {
                PauseProgram();
            }

            return 1;
        }