Example #1
0
        /// <summary>
        /// Thread operation to calculate statistics for [cluster].
        ///
        /// [cluster] is guarenteed to be unique, so needn't be locked.
        /// </summary>
        private static void Thread_CalculateClusterStatistics([Const] Core core, [Const] EClustererStatistics statistics, [MutableSafe] Cluster cluster, [MutableSafe] ProgressParallelHandler prog)
        {
            prog.SafeIncrement();
            cluster.CalculateAveragedStatistics();
            cluster.CalculateCommentFlags();

            Dictionary <string, double> clusterStatistics = cluster.ClusterStatistics;
            List <Assignment>           assignments       = cluster.Assignments.List;

            int hcomp, numcomp, hpeak, numpath;

            ClustererStatisticsHelper.CalculateHighestCompounds(cluster, out hcomp, out numcomp);
            ClustererStatisticsHelper.CalculateHighestPeaks(cluster, out hpeak, out numpath);
            clusterStatistics[STAT_CLUSTER_AVERAGE_HIGHEST_NUM_COMPOUNDS] = hcomp;
            clusterStatistics[STAT_CLUSTER_AVERAGE_NUM_COMPOUNDS]         = numcomp;
            clusterStatistics[STAT_CLUSTER_AVERAGE_HIGHEST_NUM_PEAKS]     = hpeak;
            clusterStatistics[STAT_CLUSTER_AVERAGE_NUM_PATHWAYS]          = numpath;

            //////////////////////////
            // GROUP STATS (cluster)
            if (statistics.HasFlag(EClustererStatistics.ClusterAverages))
            {
                AddAveragedStatistics(core, clusterStatistics, assignments);
            }
        }