Esempio n. 1
0
        public double MakeComparison(Comparison comparison, ValueType typeOfValue)
        {
            double        returnlog2ratio = 0;
            List <double> outList         = null;

            if (typeOfValue == ValueType.MeanNormalizedFoldChange || typeOfValue == ValueType.MeanNormalizedLog2Change)
            {
                if (MeanNormValuesByGroup.TryGetValue(comparison.NumeratorGroupString, out outList))
                {
                    double numeratorValue   = MeanNormValuesByGroup[comparison.NumeratorGroupString].Average();
                    double denominatorValue = MeanNormValuesByGroup[comparison.DenominatorGroupString].Average();

                    double log2ratio = numeratorValue - denominatorValue;
                    returnlog2ratio = log2ratio;
                }
            }
            else
            {
                outList = null;
                if (Log2IntValuesByGroup.TryGetValue(comparison.NumeratorGroupString, out outList))
                {
                    double numeratorValue   = Log2IntValuesByGroup[comparison.NumeratorGroupString].Average();
                    double denominatorValue = Log2IntValuesByGroup[comparison.DenominatorGroupString].Average();

                    double log2ratio = numeratorValue - denominatorValue;
                    returnlog2ratio = log2ratio;
                }
            }

            double realReturnvalue = 0;

            if (typeOfValue == ValueType.IntensityFoldChange || typeOfValue == ValueType.MeanNormalizedFoldChange)
            {
                if (returnlog2ratio > 0)
                {
                    realReturnvalue = Math.Pow(2, returnlog2ratio);
                }
                else
                {
                    realReturnvalue = -1 / Math.Pow(2, returnlog2ratio);
                }
            }
            else
            {
                realReturnvalue = returnlog2ratio;
            }

            ComparisonToPrintAverage.Add(comparison.ComparisonName, realReturnvalue);

            return(realReturnvalue);
        }
Esempio n. 2
0
        public void GroupQuantData()
        {
            foreach (KeyValuePair <string, double> kvp in CombinedMeanNormalizedSampleValues)
            {
                string        groupNumber = UniqueHeaderToGroupString[kvp.Key];
                List <double> outList     = new List <double>();
                if (MeanNormValuesByGroup.TryGetValue(groupNumber, out outList))
                {
                    outList.Add(kvp.Value);
                }
                else
                {
                    List <double> addList        = new List <double>();
                    List <double> addAverageList = new List <double>();
                    addList.Add(kvp.Value);
                    addAverageList.Add(kvp.Value);
                    MeanNormValuesByGroup.Add(groupNumber, addList);
                }
            }

            foreach (KeyValuePair <string, double> kvp in CombinedLog2NormalizedSampleValues)
            {
                string        groupNumber = UniqueHeaderToGroupString[kvp.Key];
                List <double> outList     = new List <double>();
                if (Log2IntValuesByGroup.TryGetValue(groupNumber, out outList))
                {
                    outList.Add(kvp.Value);
                }
                else
                {
                    List <double> addList = new List <double>();
                    addList.Add(kvp.Value);
                    Log2IntValuesByGroup.Add(groupNumber, addList);
                }
            }
        }