Пример #1
0
        public void SetupMassAndNetAlignment(string alignmentFolder = "")
        {
            WorkflowExecutorBaseParameters massNetAlignerParameters = new BasicTargetedWorkflowExecutorParameters();


            IqMassAndNetAligner = new IqMassAndNetAligner(massNetAlignerParameters, Run);
            IqMassAndNetAligner.LoessBandwidthNetAlignment = 0.1;

            //check if alignment info exists already

            SetupAlignmentFolder(alignmentFolder);

            var expectedAlignmentFilename = Path.Combine(_alignmentFolder, Run.DatasetName + "_iqAlignmentResults.txt");
            var alignmentResultsExist     = (File.Exists(expectedAlignmentFilename));

            if (alignmentResultsExist)
            {
                IqLogger.Log.Info("Using the IQ alignment results from here: " + expectedAlignmentFilename);
                IqMassAndNetAligner.LoadPreviousIqResults(expectedAlignmentFilename);

                SetMassTagReferencesForNetAlignment();
                return;
            }

            //Get a suitable targets file for alignment. These are grabbed from the ..\AlignmentInfo folder.
            var targetFileForAlignment = GetTargetFilePathForIqAlignment();


            if (string.IsNullOrEmpty(targetFileForAlignment))
            {
                IqLogger.Log.Info("Alignment not performed - No suitable target file found for use in alignment.");
                return;
            }

            if (!File.Exists(targetFileForAlignment))
            {
                IqLogger.Log.Info("Alignment not performed - Target file for alignment has been specified but a FILE NOT FOUND error has occured.");
                return;
            }

            var isFirstHitsFile = targetFileForAlignment.EndsWith("_fht.txt");

            if (!isFirstHitsFile)
            {
                IqLogger.Log.Info("Alignment not performed - target file for alignment must be a first hits file (_fht.txt)");
                return;
            }

            IqMassAndNetAligner.LoadAndInitializeTargets(targetFileForAlignment);

            SetMassTagReferencesForNetAlignment();
        }
Пример #2
0
        /// <summary>
        /// A factory method for creating the WorkflowParameters class. Based on the 'WorkflowType' parameter of the xml file.
        /// </summary>
        /// <param name="xmlFilepath"></param>
        /// <returns></returns>
        public static WorkflowParameters CreateParameters(string xmlFilepath)
        {
            Check.Require(File.Exists(xmlFilepath), "Workflow parameter file could not be loaded. File not found: " + xmlFilepath);
            var doc      = XDocument.Load(xmlFilepath);
            var xElement = doc.Element("WorkflowParameters");

            if (xElement == null)
            {
                throw new Exception("WorkflowParameters element not found in " + xmlFilepath);
            }

            var query = xElement.Elements();

            var parameterTableFromXML = new Dictionary <string, string>();

            foreach (var item in query)
            {
                var paramName  = item.Name.ToString();
                var paramValue = item.Value;

                if (!parameterTableFromXML.ContainsKey(paramName))
                {
                    parameterTableFromXML.Add(paramName, paramValue);
                }
            }

            Globals.TargetedWorkflowTypes workflowType;

            var successfulEnum = Enum.TryParse(parameterTableFromXML["WorkflowType"], out workflowType);

            WorkflowParameters workflowParameters;

            if (successfulEnum)
            {
                switch (workflowType)
                {
                case Globals.TargetedWorkflowTypes.Undefined:
                    workflowParameters = new BasicTargetedWorkflowParameters();
                    break;

                case Globals.TargetedWorkflowTypes.UnlabelledTargeted1:
                    workflowParameters = new BasicTargetedWorkflowParameters();
                    break;

                case Globals.TargetedWorkflowTypes.O16O18Targeted1:
                    workflowParameters = new O16O18WorkflowParameters();
                    break;

                case Globals.TargetedWorkflowTypes.N14N15Targeted1:
                    workflowParameters = new N14N15Workflow2Parameters();
                    break;

                case Globals.TargetedWorkflowTypes.SipperTargeted1:
                    workflowParameters = new SipperTargetedWorkflowParameters();
                    break;

                case Globals.TargetedWorkflowTypes.TargetedAlignerWorkflow1:
                    workflowParameters = new TargetedAlignerWorkflowParameters();
                    break;

                case Globals.TargetedWorkflowTypes.BasicTargetedWorkflowExecutor1:
                    workflowParameters = new BasicTargetedWorkflowExecutorParameters();
                    break;

                case Globals.TargetedWorkflowTypes.LcmsFeatureTargetedWorkflowExecutor1:
                    workflowParameters = new LcmsFeatureTargetedWorkflowExecutorParameters();
                    break;

                case Globals.TargetedWorkflowTypes.SipperWorkflowExecutor1:
                    workflowParameters = new SipperWorkflowExecutorParameters();
                    break;

                case Globals.TargetedWorkflowTypes.TopDownTargeted1:
                    workflowParameters = new TopDownTargetedWorkflowParameters();
                    break;

                case Globals.TargetedWorkflowTypes.TopDownTargetedWorkflowExecutor1:
                    workflowParameters = new TopDownTargetedWorkflowExecutorParameters();
                    break;

                case Globals.TargetedWorkflowTypes.UIMFTargetedMSMSWorkflowCollapseIMS:
                    workflowParameters = new UIMFTargetedMSMSWorkflowCollapseIMSParameters();
                    break;

                default:
                    workflowParameters = new BasicTargetedWorkflowParameters();
                    break;
                }
            }
            else
            {
                throw new ArgumentOutOfRangeException(
                          "Tried to create WorkflowParameter object. But WorkflowType is unknown.");
            }

            workflowParameters.LoadParameters(xmlFilepath);

            return(workflowParameters);
        }