示例#1
0
 public GroupComparisonResult(GroupComparisonSelector selector, int replicateCount, LinearFitResult linearFitResult, IEnumerable <GroupComparer.RunAbundance> runAbundances)
 {
     Selector        = selector;
     LinearFitResult = linearFitResult;
     ReplicateCount  = replicateCount;
     RunAbundances   = ImmutableList.ValueOf(runAbundances);
 }
示例#2
0
 public FoldChangeResult(double confidenceLevel, double adjustedPValue, LinearFitResult linearFitResult, double criticalValue) : this()
 {
     ConfidenceLevel = confidenceLevel;
     LinearFit       = linearFitResult;
     AdjustedPValue  = adjustedPValue;
     _criticalValue  = criticalValue;
 }
示例#3
0
        private void TestGroupComparison(TextReader textReader, bool includeInteraction, IDictionary <string, LinearFitResult> expectedResults)
        {
            var csvReader         = new DsvFileReader(textReader, ',');
            var dataRowsByProtein = ToDataRows(ReadCsvFile(csvReader));

            Assert.AreNotEqual(0, dataRowsByProtein.Count);
            var cache = new QrFactorizationCache();

            foreach (var entry in dataRowsByProtein)
            {
                FoldChangeDataSet dataSet      = FoldChangeCalculator.MakeDataSet(entry.Value);
                var             designMatrix   = DesignMatrix.GetDesignMatrix(dataSet, includeInteraction);
                var             foldChange     = designMatrix.PerformLinearFit(cache).First();
                LinearFitResult expectedResult = null;
                if (null != expectedResults)
                {
                    Assert.IsTrue(expectedResults.TryGetValue(entry.Key, out expectedResult));
                }
                if (null != expectedResult)
                {
                    Assert.AreEqual(expectedResult.EstimatedValue, foldChange.EstimatedValue, 1E-6);
                    Assert.AreEqual(expectedResult.DegreesOfFreedom, foldChange.DegreesOfFreedom);
                    Assert.AreEqual(expectedResult.StandardError, foldChange.StandardError, 1E-6);
                    Assert.AreEqual(expectedResult.TValue, foldChange.TValue, 1E-6);
                    Assert.AreEqual(expectedResult.PValue, foldChange.PValue, 1E-6);
                }
            }
        }
示例#4
0
 private LinearFitResult(LinearFitResult linearFitResult)
 {
     EstimatedValue   = linearFitResult.EstimatedValue;
     StandardError    = linearFitResult.StandardError;
     TValue           = linearFitResult.TValue;
     DegreesOfFreedom = linearFitResult.DegreesOfFreedom;
     PValue           = linearFitResult.PValue;
 }
示例#5
0
 private LinearFitResult(LinearFitResult linearFitResult)
 {
     EstimatedValue = linearFitResult.EstimatedValue;
     StandardError = linearFitResult.StandardError;
     TValue = linearFitResult.TValue;
     DegreesOfFreedom = linearFitResult.DegreesOfFreedom;
     PValue = linearFitResult.PValue;
 }
示例#6
0
        public static IDictionary <string, LinearFitResult> ReadExpectedResults(Type type, string resourceName)
        {
            var result = new Dictionary <string, LinearFitResult>();

            using (var reader = GetTextReaderForManifestResource(type, resourceName))
            {
                var csvReader = new DsvFileReader(reader, ',');
                while (null != csvReader.ReadLine())
                {
                    string protein         = csvReader.GetFieldByName("Protein");
                    var    linearFitResult = new LinearFitResult(Convert.ToDouble(csvReader.GetFieldByName("log2FC"), CultureInfo.InvariantCulture))
                                             .SetStandardError(Convert.ToDouble(csvReader.GetFieldByName("SE"), CultureInfo.InvariantCulture))
                                             .SetTValue(Convert.ToDouble(csvReader.GetFieldByName("Tvalue"), CultureInfo.InvariantCulture))
                                             .SetDegreesOfFreedom(Convert.ToInt32(csvReader.GetFieldByName("DF"), CultureInfo.InvariantCulture))
                                             .SetPValue(Convert.ToDouble(csvReader.GetFieldByName("pvalue"), CultureInfo.InvariantCulture));
                    result.Add(protein, linearFitResult);
                }
            }
            return(result);
        }
示例#7
0
 private bool Equals(LinearFitResult other)
 {
     return(EstimatedValue.Equals(other.EstimatedValue) && StandardError.Equals(other.StandardError) && TValue.Equals(other.TValue) && DegreesOfFreedom == other.DegreesOfFreedom && PValue.Equals(other.PValue));
 }
示例#8
0
 public GroupComparisonResult(GroupComparisonSelector selector, int replicateCount, LinearFitResult linearFitResult)
 {
     Selector        = selector;
     LinearFitResult = linearFitResult;
     ReplicateCount  = replicateCount;
 }
示例#9
0
 private bool Equals(LinearFitResult other)
 {
     return EstimatedValue.Equals(other.EstimatedValue) && StandardError.Equals(other.StandardError) && TValue.Equals(other.TValue) && DegreesOfFreedom == other.DegreesOfFreedom && PValue.Equals(other.PValue);
 }