public void SaveFeaturesToTextfile(string outputFolder)
        {
            var exportTargetedFeaturesFile = Path.Combine(outputFolder, Run.DatasetName + "_alignedFeatures.txt");

            var exporter = new UnlabelledTargetedResultToTextExporter(exportTargetedFeaturesFile);

            exporter.ExportResults(_targetedResultRepository.Results);
        }
示例#2
0
        public void exporterTest1()
        {
            var testFile      = DeconTools.UnitTesting2.FileRefs.RawDataMSFiles.OrbitrapStdFile1;
            var peaksTestFile = DeconTools.UnitTesting2.FileRefs.PeakDataFiles.OrbitrapPeakFile_scans5500_6500;
            var massTagFile   = @"\\protoapps\UserData\Slysz\Data\MassTags\qcshew_standard_file_NETVals0.3-0.33.txt";

            var exportedResultFile = Path.Combine(FileRefs.OutputFolderPath, "UnlabelledTargetedResultsExporterOutput1.txt");

            if (File.Exists(exportedResultFile))
            {
                File.Delete(exportedResultFile);
            }


            var run = RunUtilities.CreateAndAlignRun(testFile, peaksTestFile);


            var mtc        = new TargetCollection();
            var mtimporter = new MassTagFromTextFileImporter(massTagFile);

            mtc = mtimporter.Import();


            var selectedMassTags = mtc.TargetList.OrderBy(p => p.ID).Take(10).ToList();


            TargetedWorkflowParameters parameters = new BasicTargetedWorkflowParameters();
            var workflow = new BasicTargetedWorkflow(run, parameters);

            foreach (var mt in selectedMassTags)
            {
                run.CurrentMassTag = mt;
                workflow.Execute();
            }

            var repo = new TargetedResultRepository();

            repo.AddResults(run.ResultCollection.GetMassTagResults());



            var exporter = new UnlabelledTargetedResultToTextExporter(exportedResultFile);

            exporter.ExportResults(repo.Results);
        }
示例#3
0
        public void Execute()
        {
            Check.Require(_run != null, "Run has not been defined.");



            //Use Features file if it exists; if not, find the quality Features
            List <MassTagResultBase> resultsPassingCriteria;

            _targetedResultRepository = new TargetedResultRepository();

            if (ImportedFeaturesFilename == null || ImportedFeaturesFilename.Length == 0)
            {
                Check.Require(_run.ResultCollection.MSPeakResultList != null && _run.ResultCollection.MSPeakResultList.Count > 0, "Dataset's Peak-level data is empty. This is needed for chromatogram generation.");


                resultsPassingCriteria = FindTargetsThatPassCriteria();
                _targetedResultRepository.AddResults(resultsPassingCriteria);

                if (AreFeaturesSavedToTextFile)
                {
                    string outputfolder;

                    if (ExportAlignmentFolder == null || ExportAlignmentFolder.Length == 0)
                    {
                        outputfolder = _run.DataSetPath;
                    }
                    else
                    {
                        outputfolder = ExportAlignmentFolder;
                    }


                    string exportTargetedFeaturesFile = Path.Combine(outputfolder, _run.DatasetName + "_alignedFeatures.txt");

                    UnlabelledTargetedResultToTextExporter exporter = new UnlabelledTargetedResultToTextExporter(exportTargetedFeaturesFile);
                    exporter.ExportResults(_targetedResultRepository.Results);
                }
            }
            else
            {
                //load them from the Features file

                UnlabelledTargetedResultFromTextImporter importer = new UnlabelledTargetedResultFromTextImporter(ImportedFeaturesFilename);
                TargetedResultRepository repo = importer.Import();
                _targetedResultRepository.Results = repo.Results;
            }


            //do alignment
            NETAndMassAligner aligner = new NETAndMassAligner();

            aligner.SetFeaturesToBeAligned(_targetedResultRepository.Results);
            aligner.SetReferenceMassTags(this.MassTagList);
            aligner.Execute(this._run);

            //save the alignment data
            if (IsAlignmentInfoExported)
            {
                string outputfolder;

                if (ExportAlignmentFolder == null || ExportAlignmentFolder.Length == 0)
                {
                    outputfolder = _run.DataSetPath;
                }
                else
                {
                    outputfolder = ExportAlignmentFolder;
                }

                string exportNETAlignmentFilename = Path.Combine(outputfolder, _run.DatasetName + "_NETAlignment.txt");
                string exportMZAlignmentFilename  = Path.Combine(outputfolder, _run.DatasetName + "_MZAlignment.txt");

                MassAlignmentInfoToTextExporter mzAlignmentExporter = new MassAlignmentInfoToTextExporter(exportMZAlignmentFilename);
                mzAlignmentExporter.ExportAlignmentInfo(_run.AlignmentInfo);

                NETAlignmentInfoToTextExporter netAlignmentExporter = new NETAlignmentInfoToTextExporter(exportNETAlignmentFilename);
                netAlignmentExporter.ExportAlignmentInfo(_run.AlignmentInfo);
            }
        }