Example #1
0
 /// <summary>
 /// Calculate all the statistics for this collection
 /// </summary>
 /// <param name="stat"></param>
 /// <param name="inputData"></param>
 /// <param name="isMasterResult"></param>
 public void Calculate(STATCONNECTORSRVLib.StatConnector stat, double[] inputData, bool isMasterResult)
 {
     foreach (StatisticsEntry statEntry in _arEntries)
     {
         if (statEntry.Perform)
         {
             statEntry.Calculate(stat, inputData, isMasterResult);
         }
     }
 }
Example #2
0
 /// <summary>
 /// Calculate the statistics for this set of assay results, comparing it to the master list if relevant
 /// If this method is called on a master result list, it will call CalculateStatistics on all of its
 /// child sub-results.
 /// </summary>
 /// <param name="stat">The StatConnector used to calculate statistics</param>
 public void CalculateStatistics(STATCONNECTORSRVLib.StatConnector stat)
 {
     _stats.Calculate(stat, _results, _isMasterResults);
     if (_isMasterResults)
     {
         // now go through the list of subresults and call CalculateStatistics on the subresults
         foreach (AssayResults ar in _subResultList)
         {
             ar.StatCollection = _stats.Copy();
             ar.CalculateStatistics(stat);
         }
     }
 }
Example #3
0
 /// <summary>
 /// Calculate the statistics for this set of assay results, comparing it to the master list if relevant
 /// Returns after each call to its subresults calculatestatistics
 /// </summary>
 /// <param name="stat">The StatConnector used to calculate statistics</param>
 public bool CalculateStatisticsInteractive(STATCONNECTORSRVLib.StatConnector stat)
 {
     if (_enum.MoveNext())
     {
         _currResults = (AssayResults)_enum.Current;
         _currResults.StatCollection = _stats.Copy();
         _currResults.CalculateStatistics(stat);
         return(true);
     }
     else
     {
         return(false);
     }
 }
Example #4
0
        public void Calculate(STATCONNECTORSRVLib.StatConnector stat, double[] inputData, bool isMasterResult)
        {
            string symbol = "subresults";

            if (isMasterResult)
            {
                symbol = "masterresults";
            }
            // simple use of the StatConnector - SetSymbol associates a name with an array of values
            // Evaluate can be passed any piece of R code.  A single StatConnector instance acts as
            // a single R session, so any variables set within the instance may be accessed later in the session.
            stat.SetSymbol(symbol, inputData);
            string RExp = _RCall.Replace(INPUT_1, symbol);

            // if this is a comparison statistic, set up the other vector
            // TODO - extend this to an arbitrary number of inputs
            if (_numInputs > 1)
            {
                RExp = _RCall.Replace(INPUT_1, "masterresults");
                if (isMasterResult)
                {
                    RExp = RExp.Replace(INPUT_2, "masterresults");
                }
                else
                {
                    RExp = RExp.Replace(INPUT_2, "subresults");
                }
            }
            // Evaluate the result - do not evaluate if it is trying to compare the master results to the master results
            if (_numInputs > 1 && isMasterResult)
            {
                _result = "";
            }
            else
            {
                try
                {
                    _result = stat.Evaluate(RExp);
                }
                catch (Exception ex)
                {
                    _result = "ERROR";
                }
            }
        }
Example #5
0
 public RFunctions(string dir, STATCONNECTORSRVLib.StatConnector stat)
 {
     _dir  = dir;
     _stat = stat;
 }
Example #6
0
 // prepare for an interactive statistics run
 public void PrepInteractiveStatisticsRun(STATCONNECTORSRVLib.StatConnector stat)
 {
     // we can assume we are the master list in this case, so we calculate our overall statistics
     _stats.Calculate(stat, _results, _isMasterResults);
     _enum = _subResultList.GetEnumerator();
 }