Beispiel #1
0
        /// <summary>
        /// Aligns a dataset to a mass tag database
        /// </summary>
        /// <param name="massTagDatabase"></param>
        /// <param name="features"></param>
        /// <param name="progress"></param>
        /// <returns></returns>
        public AlignmentData Align(MassTagDatabase massTagDatabase,
                                   IEnumerable <UMCLight> features,
                                   IProgress <ProgressData> progress = null)
        {
            var alignmentProcessor = new LcmsWarpAlignmentProcessor(_options);

            alignmentProcessor.Progress += AlignmentProcessor_Progress;

            var umcLights   = features as IList <UMCLight> ?? features.ToList();
            var featureTest = umcLights.ToList().Find(x => x.DriftTime > 0);

            if (featureTest != null && !massTagDatabase.DoesContainDriftTime)
            {
                OnStatus("Warning! Data contains drift time information and the database does not.");
            }

            OnStatus("Configuring features as mass tags.");

            OnStatus("Setting reference features using mass tags.");
            alignmentProcessor.SetReferenceDatasetFeatures(massTagDatabase.MassTags);
            var data = AlignFeatures(alignmentProcessor,
                                     umcLights,
                                     _options,
                                     progress);

            return(data);
        }
Beispiel #2
0
        /// <summary>
        /// Align a dataset to a baseline dataset
        /// </summary>
        /// <param name="baselineFeatures">baseline dataset features</param>
        /// <param name="features">alignee dataset features</param>
        /// <param name="progress"></param>
        /// <returns></returns>
        public AlignmentData Align(IEnumerable <UMCLight> baselineFeatures,
                                   IEnumerable <UMCLight> features,
                                   IProgress <ProgressData> progress = null)
        {
            var alignmentProcessor = new LcmsWarpAlignmentProcessor(_options);

            alignmentProcessor.Progress += AlignmentProcessor_Progress;

            OnStatus("Setting features from baseline dataset.");

            var umcLights = baselineFeatures as List <UMCLight> ?? baselineFeatures.ToList();

            var filteredFeatures = FilterFeaturesByAbundance(umcLights, _options);

            alignmentProcessor.SetReferenceDatasetFeatures(filteredFeatures);
            var alignmentData = AlignFeatures(alignmentProcessor,
                                              features,
                                              _options,
                                              progress);

            var minScanReference = int.MaxValue;
            var maxScanReference = int.MinValue;

            foreach (var feature in umcLights)
            {
                minScanReference = Math.Min(minScanReference, feature.Scan);
                maxScanReference = Math.Max(maxScanReference, feature.Scan);
            }

            alignmentData.MaxMTDBNET = maxScanReference;
            alignmentData.MinMTDBNET = minScanReference;

            return(alignmentData);
        }
Beispiel #3
0
        /// <summary>
        /// Align a UMCLight Enumerable to a MassTagLight enumerable.
        /// The MassTagLight Enumerable is used as the baseline to align the
        /// UMCLight enumerable.
        /// </summary>
        /// <param name="baseline">Base dataset or AMT tags to align to</param>
        /// <param name="features">LC-MS Features to align to the baseline</param>
        /// <param name="progress"></param>
        /// <returns></returns>
        public AlignmentData Align(IEnumerable <MassTagLight> baseline, IEnumerable <UMCLight> features,
                                   IProgress <ProgressData> progress = null)
        {
            var alignmentProcessor = new LcmsWarpAlignmentProcessor(_options);

            alignmentProcessor.Progress += AlignmentProcessor_Progress;

            var baselineMassTags = baseline as List <MassTagLight> ?? baseline.ToList();
            var aligneeFeatures  = features as List <UMCLight> ?? features.ToList();

            var featureTest = aligneeFeatures.Find(x => x.DriftTime > 0);
            var massTagTest = baselineMassTags.Find(x => x.DriftTime > 0);

            if (featureTest != null && massTagTest == null)
            {
                Console.WriteLine("Warning! Data has drift time info, but the mass tags do not.");
            }

            alignmentProcessor.SetReferenceDatasetFeatures(baselineMassTags);

            var data = AlignFeatures(alignmentProcessor, aligneeFeatures, _options, progress);

            return(data);
        }