Esempio n. 1
0
        /// <summary>
        ///     Reconstructions a UMC
        /// </summary>
        /// <param name="feature"></param>
        /// <param name="providers"></param>
        public static void ReconstructUMC(this UMCLight feature, FeatureDataAccessProviders providers, bool getMsMs)
        {
            // This is easy to grab all ms features for this feature.
            var msFeatures = providers.MSFeatureCache.FindByFeatureId(feature.GroupId, feature.Id);


            foreach (var msFeature in msFeatures)
            {
                feature.AddChildFeature(msFeature);
            }

            if (getMsMs)
            {
                feature.ReconstructMSFeature(providers, getMsMs);
            }
        }
Esempio n. 2
0
        public void TestChargeStateSplit(string path)
        {
            var data = File.ReadAllLines(path);
            var map  = new Dictionary <int, List <MSFeatureLight> >();

            for (var i = 1; i < data.Length; i++)
            {
                var feature       = new MSFeatureLight();
                var msFeatureData = data[i].Split(',');

                feature.ChargeState      = Convert.ToInt32(msFeatureData[0]);
                feature.MassMonoisotopic = Convert.ToDouble(msFeatureData[1]);
                feature.Scan             = Convert.ToInt32(msFeatureData[2]);
                feature.Abundance        = Convert.ToInt64(msFeatureData[3]);

                if (!map.ContainsKey(feature.ChargeState))
                {
                    map.Add(feature.ChargeState, new List <MSFeatureLight>());
                }
                map[feature.ChargeState].Add(feature);
            }


            var features = new List <UMCLight>();

            foreach (var charge in map.Keys)
            {
                var feature = new UMCLight();
                foreach (var msFeature in map[charge])
                {
                    feature.AddChildFeature(msFeature);
                }
                feature.CalculateStatistics(ClusterCentroidRepresentation.Median);
                features.Add(feature);
            }

            var finder     = new MsFeatureTreeClusterer <MSFeatureLight, UMCLight>();
            var comparison = finder.CompareMonoisotopic(features[0], features[1]);

            Assert.AreNotEqual(comparison, 0);
        }
Esempio n. 3
0
        public void TestChargeStateSplit(string path)
        {
            var data = File.ReadAllLines(path);
            var map = new Dictionary<int, List<MSFeatureLight>>();

            for (var i = 1; i < data.Length; i++)
            {
                var feature = new MSFeatureLight();
                var msFeatureData = data[i].Split(',');

                feature.ChargeState = Convert.ToInt32(msFeatureData[0]);
                feature.MassMonoisotopic = Convert.ToDouble(msFeatureData[1]);
                feature.Scan = Convert.ToInt32(msFeatureData[2]);
                feature.Abundance = Convert.ToInt64(msFeatureData[3]);

                if (!map.ContainsKey(feature.ChargeState))
                {
                    map.Add(feature.ChargeState, new List<MSFeatureLight>());
                }
                map[feature.ChargeState].Add(feature);
            }

            var features = new List<UMCLight>();

            foreach (var charge in map.Keys)
            {
                var feature = new UMCLight();
                foreach (var msFeature in map[charge])
                {
                    feature.AddChildFeature(msFeature);
                }
                feature.CalculateStatistics(ClusterCentroidRepresentation.Median);
                features.Add(feature);
            }

            var finder = new MsFeatureTreeClusterer<MSFeatureLight, UMCLight>();
            var comparison = finder.CompareMonoisotopic(features[0], features[1]);

            Assert.AreNotEqual(comparison, 0);
        }