Пример #1
0
        private DataTypes.CompoundGroup getICompoundGroup(Agilent.MassSpectrometry.DataAnalysis.ICompoundGroup cpdGroup, List <string> analysisFiles)
        {
            DataTypes.CompoundGroup compoundGroup = new DataTypes.CompoundGroup();
            if (cpdGroup == null)
            {
                return(null);
            }

            compoundGroup.Group  = cpdGroup.CompoundGroupName;
            compoundGroup.RTTgt  = cpdGroup.TargetRetentionTime;
            compoundGroup.RTMed  = cpdGroup.RetentionTimeMedian;
            compoundGroup.Found  = cpdGroup.FrequencyFound;
            compoundGroup.Missed = cpdGroup.FrequencyMissed;
            //compoundGroup.ScoreTgtMax = cpdGroup.TgtScoreMax;
            //compoundGroup.TgtScorePctRSD = cpdGroup.TgtScorePctRSD;
            compoundGroup.ScoreMFEMax              = cpdGroup.QScoreMax;
            compoundGroup.HeightMed                = cpdGroup.HeightMedian;
            compoundGroup.MassAvg                  = cpdGroup.MassAverage;
            compoundGroup.RTAvg                    = cpdGroup.RetentionTimeAverage;
            compoundGroup.TargetMass               = cpdGroup.TargetMass;
            compoundGroup.MassMedian               = cpdGroup.MassMedian;
            compoundGroup.MassPpmRSD               = cpdGroup.MassPpmRSD;
            compoundGroup.Saturated                = cpdGroup.SaturationWarning;
            compoundGroup.RetentionTimeSpan        = cpdGroup.RetentionTimeSpan;
            compoundGroup.SingleIonFeatures        = cpdGroup.SingleIonFeatures;
            compoundGroup.RetentionTimeWidthAtBase = cpdGroup.RetentionTimeWidthAtBase;
            compoundGroup.AreaAvg                  = cpdGroup.AreaAverage;
            compoundGroup.HeightAvg                = cpdGroup.HeightAverage;
            compoundGroup.VolumeAvg                = cpdGroup.VolumeAverage;
            compoundGroup.RetentionTimeDifference  = cpdGroup.RetentionTimeDifference;
            //TODO dnt know about sigma(A^2)
            compoundGroup.TimeSegment = cpdGroup.TimeSegment;

            var vals = cpdGroup.Values;
            IDictionary <string, DataTypes.ICompound> sampleWiseDict         = new Dictionary <string, DataTypes.ICompound>();
            ConcurrentDictionary <int, ProfinderLogic.Strcuctplots> plotDict = getPlots(cpdGroup, analysisFiles);
            int ind = 0;

            foreach (var element in plotDict)
            {
                Agilent.MassSpectrometry.DataAnalysis.ICompound curCompound = vals.ElementAt(ind);
                DataTypes.ICompound compound = getCompound(curCompound, element);
                sampleWiseDict.Add(curCompound.DataFileName, compound);
                ind++;
            }
            compoundGroup.SampleWiseDataDictionary = sampleWiseDict;
            return(compoundGroup);
        }
Пример #2
0
        public List <DataTypes.CompoundGroup> GetCompoundGroups(List <string> analysisFiles)
        {
            try
            {
                qualAppLogic.AppExecutionMode = AppExecutionMode.WorkListAutomation;
                CmdInitializeApplication cmdInit = new CmdInitializeApplication(qualAppLogic);
                ExecuteCommand(qualAppLogic, cmdInit);

                QualFeatureConfig.InitRegistryFromAppConfig();
                qualAppLogic.AppProgressEvent += new AppProgressEventHandler(OnAppProgressEvent);
                IAppState appState = qualAppLogic as IAppState;

                //appState.ThreadErrorReporter = m_messageReporter;

                AnalysisMethodLoadOptions loadMethod = GetAnalysisMethodLoadOptions(null);
                //if (analysisFiles.Count > 0)
                //{
                bool loadResults        = false;
                bool runLoadTimeScripts = false;

                CmdOpenAnalysisFile cmdOpenAnalysis = new CmdOpenAnalysisFile
                                                          (qualAppLogic,
                                                          analysisFiles.ToArray(),
                                                          loadMethod,
                                                          loadResults,
                                                          runLoadTimeScripts);

                ExecuteCommand(qualAppLogic, cmdOpenAnalysis);

                RunScript(qualAppLogic, analysisFiles);
                IEnumerable <Agilent.MassSpectrometry.DataAnalysis.ICompoundGroup> cpdGroups = qualAppLogic.DataStore.CompoundGroups;
                List <DataTypes.CompoundGroup> compoundGroups = new List <DataTypes.CompoundGroup>();
                foreach (Agilent.MassSpectrometry.DataAnalysis.ICompoundGroup cpdGroup in cpdGroups)
                {
                    DataTypes.CompoundGroup compoundGroup = getICompoundGroup(cpdGroup, analysisFiles) as DataTypes.CompoundGroup;
                    compoundGroups.Add(compoundGroup);
                }
                Console.ReadKey();
            }
            catch (MSDAApplicationException msdaExep)
            {
                Console.WriteLine(msdaExep.Message);
            }
            catch (Exception e)
            {
                string analysisName = "";
                for (int analysisInd = 0; analysisInd < analysisFiles.Count; analysisInd++)
                {
                    if (analysisName == "")
                    {
                        analysisName = analysisFiles[analysisInd];
                    }
                    else
                    {
                        analysisName = analysisName + " , " + analysisFiles[analysisInd];
                    }
                }

                Console.WriteLine(e.StackTrace);
            }
            return(null);
        }