public void Test1()
        {
            var filename =
                @"\\proto-7\VOrbi05\2013_2\mhp_plat_test_1_14April13_Frodo_12-12-04\MSG201305011339_Auto939903\mhp_plat_test_1_14April13_Frodo_12-12-04_msgfdb_fht.txt";

            var importer = new IqTargetsFromFirstHitsFileImporter(filename);

            var targets = importer.Import().Take(50).ToList();

            foreach (IqTargetMsgfFirstHit iqTarget in targets)
            {
                Console.WriteLine(iqTarget.ID + "\t" + iqTarget.ScanLC + "\t" + iqTarget.MassError);
            }
        }
Exemplo n.º 2
0
        public override void LoadAndInitializeTargets(string targetsFilePath)
        {
            if (string.IsNullOrEmpty(targetsFilePath))
            {
                IqLogger.Log.Info("IqMassAndNetAligner - no alignment targets were loaded. The inputted targets file path is NULL.");
                return;
            }

            if (!File.Exists(targetsFilePath))
            {
                IqLogger.Log.Info("IqMassAndNetAligner - no alignment targets were loaded. The inputted targets file path is does not exist.");
                return;
            }

            var importer = new IqTargetsFromFirstHitsFileImporter(targetsFilePath);

            Targets = importer.Import().Where(p => p.QualityScore < 0.01).OrderBy(p => p.ID).ToList();

            //Targets = Targets.Where(p => p.Code.Contains("FEQDGENYTGTIDGNMGAYAR")).ToList();

            var filteredList = new List <IqTarget>();

            //calculate empirical formula for targets using Code and then monoisotopic mass

            foreach (var iqTarget in Targets)
            {
                iqTarget.Code = _peptideUtils.CleanUpPeptideSequence(iqTarget.Code);

                if (_peptideUtils.ValidateSequence(iqTarget.Code))
                {
                    iqTarget.EmpiricalFormula = _peptideUtils.GetEmpiricalFormulaForPeptideSequence(iqTarget.Code, true, true);
                    var calcMonoMass = EmpiricalFormulaUtilities.GetMonoisotopicMassFromEmpiricalFormula(iqTarget.EmpiricalFormula);
                    var monoMassFromFirstHitsFile = iqTarget.MonoMassTheor;

                    var massCalculationsAgree = Math.Abs(monoMassFromFirstHitsFile - calcMonoMass) < 0.02;
                    if (massCalculationsAgree)
                    {
                        iqTarget.MonoMassTheor    = calcMonoMass;
                        iqTarget.ElutionTimeTheor = iqTarget.ScanLC / (double)Run.MaxLCScan;

                        filteredList.Add(iqTarget);
                        _targetUtilities.UpdateTargetMissingInfo(iqTarget, true);

                        var chargeStateTarget = new IqTargetMsgfFirstHit();

                        _targetUtilities.CopyTargetProperties(iqTarget, chargeStateTarget);

                        iqTarget.AddTarget(chargeStateTarget);
                    }
                }
            }

            filteredList = (from n in filteredList
                            group n by new
            {
                n.Code,
                n.ChargeState
            }
                            into grp
                            select grp.OrderBy(p => p.QualityScore).First()
                            ).ToList();


            Targets = filteredList;

            TargetedWorkflowParameters workflowParameters = new BasicTargetedWorkflowParameters();

            workflowParameters.ChromNETTolerance = 0.005;
            workflowParameters.ChromGenTolerance = 50;

            //define workflows for parentTarget and childTargets
            var parentWorkflow = new ChromPeakDeciderIqWorkflow(Run, workflowParameters);
            var childWorkflow  = new ChargeStateChildIqWorkflow(Run, workflowParameters);

            var workflowAssigner = new IqWorkflowAssigner();

            workflowAssigner.AssignWorkflowToParent(parentWorkflow, Targets);
            workflowAssigner.AssignWorkflowToChildren(childWorkflow, Targets);


            if (Targets.Count > 0)
            {
                IqLogger.Log.Info("IqMassAndNetAligner - Loaded " + Targets.Count + " targets for use in mass and net alignment");
            }
            else
            {
                IqLogger.Log.Info("IqMassAndNetAligner - NOTE - no targets have been loaded.");
            }



            //IqWorkflowAssigner workflowAssigner = new IqWorkflowAssigner();
            //workflowAssigner.AssignWorkflowToParent(workflow, Targets);
        }