예제 #1
0
        public new void InitializeWorkflow()
        {
            var executorParams = (LcmsFeatureTargetedWorkflowExecutorParameters)ExecutorParameters;

            //_loggingFileName = GetLogFileName(ExecutorParameters.LoggingFolder);
            _resultsFolder = GetResultsFolder(ExecutorParameters.OutputFolderBase);

            Targets = GetLcmsFeatureTargets(ExecutorParameters.TargetsFilePath);

            MassTagsForReference = GetMassTagTargets(executorParams.MassTagsForReference);

            UpdateTargetsWithMassTagInfo(Targets, MassTagsForReference);

            Check.Ensure(Targets != null && Targets.TargetList.Count > 0,
                         "Target massTags is empty. Check the path to the massTag data file.");


            _workflowParameters = WorkflowParameters.CreateParameters(ExecutorParameters.WorkflowParameterFile);
            _workflowParameters.LoadParameters(ExecutorParameters.WorkflowParameterFile);

            //TargetedAlignmentWorkflowParameters = new TargetedAlignerWorkflowParameters();
            //TargetedAlignmentWorkflowParameters.LoadParameters(ExecutorParameters.TargetedAlignmentWorkflowParameterFile);

            TargetedWorkflow = TargetedWorkflow.CreateWorkflow(_workflowParameters);
        }
        protected TargetedWorkflowExecutor(WorkflowExecutorBaseParameters parameters, WorkflowParameters workflowParameters, string datasetPath, BackgroundWorker backgroundWorker = null)
        {
            this.DatasetPath = datasetPath;
            RunIsDisposed    = true;

            _backgroundWorker = backgroundWorker;

            this.WorkflowParameters = parameters;
            _workflowParameters     = workflowParameters;

            ResultRepository = new TargetedResultRepository();
            InitializeWorkflow();
        }
예제 #3
0
        /// <summary>
        /// Factory method for creating the Workflow object using the WorkflowType information in the parameter object
        /// </summary>
        /// <param name="workflowParameters"></param>
        /// <returns></returns>
        public static TargetedWorkflow CreateWorkflow(WorkflowParameters workflowParameters)
        {
            TargetedWorkflow wf;

            switch (workflowParameters.WorkflowType)
            {
            case Globals.TargetedWorkflowTypes.Undefined:
                wf = new BasicTargetedWorkflow(workflowParameters as TargetedWorkflowParameters);
                break;

            case Globals.TargetedWorkflowTypes.UnlabelledTargeted1:
                wf = new BasicTargetedWorkflow(workflowParameters as TargetedWorkflowParameters);
                break;

            case Globals.TargetedWorkflowTypes.O16O18Targeted1:
                wf = new O16O18Workflow(workflowParameters as TargetedWorkflowParameters);
                break;

            case Globals.TargetedWorkflowTypes.N14N15Targeted1:
                wf = new N14N15Workflow2(workflowParameters as TargetedWorkflowParameters);
                break;

            case Globals.TargetedWorkflowTypes.SipperTargeted1:
                wf = new SipperTargetedWorkflow(workflowParameters as TargetedWorkflowParameters);
                break;

            case Globals.TargetedWorkflowTypes.TargetedAlignerWorkflow1:
                wf = new TargetedAlignerWorkflow(workflowParameters as TargetedWorkflowParameters);
                break;

            case Globals.TargetedWorkflowTypes.TopDownTargeted1:
                wf = new TopDownTargetedWorkflow(workflowParameters as TargetedWorkflowParameters);
                break;

            case Globals.TargetedWorkflowTypes.PeakDetectAndExportWorkflow1:
                throw new System.NotImplementedException("Cannot create this workflow type here.");

            case Globals.TargetedWorkflowTypes.BasicTargetedWorkflowExecutor1:
                throw new System.NotImplementedException("Cannot create this workflow type here.");

            case Globals.TargetedWorkflowTypes.UIMFTargetedMSMSWorkflowCollapseIMS:
                wf = new UIMFTargetedMSMSWorkflowCollapseIMS(workflowParameters as TargetedWorkflowParameters);
                break;

            default:
                wf = new BasicTargetedWorkflow(workflowParameters as TargetedWorkflowParameters);
                break;
            }

            return(wf);
        }
        public new void InitializeWorkflow()
        {
            _resultsFolder = string.IsNullOrEmpty(ExecutorParameters.OutputFolderBase) ? RunUtilities.GetDatasetParentFolder(DatasetPath) : GetResultsFolder(ExecutorParameters.OutputFolderBase);

            MassTagsForTargetedAlignment = GetMassTagTargets(GetTargetFilePathForIqAlignment());

            var targetsFilePathIsEmpty = (String.IsNullOrEmpty(ExecutorParameters.TargetsFilePath));

            var currentTargetsFilePath = targetsFilePathIsEmpty ? TryFindTargetsForCurrentDataset() : ExecutorParameters.TargetsFilePath;

            Targets = CreateTargets(ExecutorParameters.TargetType, currentTargetsFilePath);

            if (ExecutorParameters.TargetType == Globals.TargetType.LcmsFeature)
            {
                UpdateTargetMissingInfo();
            }

            if (_workflowParameters == null)
            {
                _workflowParameters = WorkflowParameters.CreateParameters(ExecutorParameters.WorkflowParameterFile);
                _workflowParameters.LoadParameters(ExecutorParameters.WorkflowParameterFile);
            }

            if (ExecutorParameters.TargetedAlignmentIsPerformed)
            {
                if (string.IsNullOrEmpty(ExecutorParameters.TargetedAlignmentWorkflowParameterFile))
                {
                    throw new FileNotFoundException(
                              "Cannot initialize workflow. TargetedAlignment is requested but TargetedAlignmentWorkflowParameter file is not found. Check path for the 'TargetedAlignmentWorkflowParameterFile' ");
                }


                TargetedAlignmentWorkflowParameters = new TargetedAlignerWorkflowParameters();
                TargetedAlignmentWorkflowParameters.LoadParameters(ExecutorParameters.TargetedAlignmentWorkflowParameterFile);
            }

            TargetedWorkflow = TargetedWorkflow.CreateWorkflow(_workflowParameters);
        }
 public BasicTargetedWorkflowExecutor(WorkflowExecutorBaseParameters workflowExecutorParameters, WorkflowParameters workflowParameters, string datasetPath) : base(workflowExecutorParameters, workflowParameters, datasetPath)
 {
 }
        public new void InitializeWorkflow()
        {
            //_loggingFileName = GetLogFileName(ExecutorParameters.LoggingFolder);

            Check.Require(WorkflowParameters is SipperWorkflowExecutorParameters, "Parameters are not of the right type.");


            var db     = ((SipperWorkflowExecutorParameters)WorkflowParameters).DbName;
            var server = ((SipperWorkflowExecutorParameters)WorkflowParameters).DbServer;
            var table  = ((SipperWorkflowExecutorParameters)WorkflowParameters).DbTableName;


            var massTagIDsForFiltering =
                GetMassTagsToFilterOn(((SipperWorkflowExecutorParameters)WorkflowParameters).TargetsToFilterOn).Distinct().ToList();

            _loggingFileName = Path.Combine(ExecutorParameters.OutputFolderBase, "Logs", RunUtilities.GetDatasetName(DatasetPath) + "_log.txt");


            TargetsAreFromPeakMatchingDataBase = (!String.IsNullOrEmpty(db) && !String.IsNullOrEmpty(server));

            var targetsFilePathIsEmpty = (String.IsNullOrEmpty(ExecutorParameters.TargetsFilePath));


            if (TargetsAreFromPeakMatchingDataBase)
            {
                Targets = LoadTargetsFromPeakMatchingResultsForGivenDataset(RunUtilities.GetDatasetName(DatasetPath));
            }
            else
            {
                if (targetsFilePathIsEmpty)
                {
                    var currentTargetsFilePath = TryFindTargetsForCurrentDataset();     //check for a _targets file specifically associated with dataset

                    if (String.IsNullOrEmpty(currentTargetsFilePath))
                    {
                        Targets = null;
                    }
                    else
                    {
                        Targets = GetLcmsFeatureTargets(currentTargetsFilePath);
                    }
                }
                else
                {
                    Targets = GetLcmsFeatureTargets(ExecutorParameters.TargetsFilePath);
                }
            }

            Check.Ensure(Targets != null && Targets.TargetList.Count > 0, "Failed to initialize - Target list is empty. Please check parameter file.");


            if (massTagIDsForFiltering.Count > 0)
            {
                Targets.TargetList =
                    (from n in Targets.TargetList
                     where massTagIDsForFiltering.Contains(((LcmsFeatureTarget)n).FeatureToMassTagID)
                     select n).ToList();
            }



            MassTagIDsinTargets = Targets.TargetList.Select(p => (long)((LcmsFeatureTarget)p).FeatureToMassTagID).Where(n => n > 0).ToList();

            if (TargetsAreFromPeakMatchingDataBase)
            {
                var mtImporter = new MassTagFromSqlDbImporter(db, server, MassTagIDsinTargets);
                MassTagsForReference = mtImporter.Import();
            }
            else
            {
                MassTagsForReference = GetMassTagTargets(((SipperWorkflowExecutorParameters)WorkflowParameters).ReferenceDataForTargets, MassTagIDsinTargets.Select(p => (int)p).ToList());
            }

            MassTagsForReference.TargetList = (from n in MassTagsForReference.TargetList
                                               group n by new
            {
                n.ID,
                n.ChargeState
            }
                                               into grp
                                               select grp.First()).ToList();



            UpdateTargetMissingInfo();


            _resultsFolder = GetResultsFolder(ExecutorParameters.OutputFolderBase);


            _workflowParameters = WorkflowParameters.CreateParameters(ExecutorParameters.WorkflowParameterFile);
            _workflowParameters.LoadParameters(ExecutorParameters.WorkflowParameterFile);

            TargetedWorkflow = TargetedWorkflow.CreateWorkflow(_workflowParameters);
        }
        public void InitializeWorkflow()
        {
            if (string.IsNullOrEmpty(ExecutorParameters.OutputFolderBase))
            {
                _resultsFolder = RunUtilities.GetDatasetParentFolder(DatasetPath);
            }
            else
            {
                _resultsFolder = GetResultsFolder(ExecutorParameters.OutputFolderBase);
            }

            if (ExecutorParameters.TargetedAlignmentIsPerformed)
            {
                MassTagsForTargetedAlignment = GetMassTagTargets(GetTargetFilePathForIqAlignment());
            }


            var targetsFilePathIsEmpty = (String.IsNullOrEmpty(ExecutorParameters.TargetsFilePath));

            string currentTargetsFilePath;

            if (targetsFilePathIsEmpty)
            {
                currentTargetsFilePath = TryFindTargetsForCurrentDataset();   //check for a _targets file specifically associated with dataset
            }
            else
            {
                currentTargetsFilePath = ExecutorParameters.TargetsFilePath;
            }

            Targets = CreateTargets(ExecutorParameters.TargetType, currentTargetsFilePath);

            Check.Ensure(Targets != null && Targets.TargetList.Count > 0,
                         "Target massTags is empty (or all peptides contain unknown modifications). Check the path to the massTag data file.");

            IqLogger.Log.Info("Total targets loaded= " + Targets.TargetList.Count);


            if (ExecutorParameters.TargetType == Globals.TargetType.LcmsFeature)
            {
                UpdateTargetMissingInfo();
            }

            if (TargetedWorkflow == null)
            {
                if (_workflowParameters == null)
                {
                    _workflowParameters = WorkflowParameters.CreateParameters(ExecutorParameters.WorkflowParameterFile);
                    _workflowParameters.LoadParameters(ExecutorParameters.WorkflowParameterFile);
                }
                TargetedWorkflow = TargetedWorkflow.CreateWorkflow(_workflowParameters);
            }
            else
            {
                _workflowParameters = TargetedWorkflow.WorkflowParameters;
            }

            if (ExecutorParameters.TargetedAlignmentIsPerformed)
            {
                if (string.IsNullOrEmpty(ExecutorParameters.TargetedAlignmentWorkflowParameterFile))
                {
                    throw new FileNotFoundException(
                              "Cannot initialize workflow. TargetedAlignment is requested but TargetedAlignmentWorkflowParameter file is not found. Check path for the 'TargetedAlignmentWorkflowParameterFile' ");
                }


                TargetedAlignmentWorkflowParameters = new TargetedAlignerWorkflowParameters();
                TargetedAlignmentWorkflowParameters.LoadParameters(ExecutorParameters.TargetedAlignmentWorkflowParameterFile);
            }
        }
 public TopDownTargetedWorkflowExecutor(WorkflowExecutorBaseParameters parameters, WorkflowParameters workflowParameters, string datasetPath, BackgroundWorker backgroundWorker = null)
     : base(parameters, workflowParameters, datasetPath, backgroundWorker)
 {
 }