Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4645


Ignore:
Timestamp:
10/25/10 15:07:05 (14 years ago)
Author:
swagner
Message:

Worked on allele frequency analysis (#1234)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Analysis/3.3/AlleleFrequencyAnalyzer.cs

    r4641 r4645  
    123123
    124124        // calculate dummy allele frequencies of alleles of best known solution which did not occur
    125         var bestKnownFrequencies = bestKnownAlleles.Select(x => new AlleleFrequency(x.Id, 0, x.Impact, 0, true, false)).Except(frequencies, new AlleleFrequencyIdEqualityComparer());
     125        if (bestKnownAlleles != null) {
     126          var bestKnownFrequencies = bestKnownAlleles.Select(x => new AlleleFrequency(x.Id, 0, x.Impact, 0, true, false)).Except(frequencies, new AlleleFrequencyIdEqualityComparer());
     127          frequencies = frequencies.Concat(bestKnownFrequencies);
     128        }
    126129
    127130        // fetch results collection
     
    135138
    136139        // store allele frequencies
    137         AlleleFrequencyCollection frequenciesCollection = new AlleleFrequencyCollection(bestKnownFrequencies.Concat(frequencies));
     140        AlleleFrequencyCollection frequenciesCollection = new AlleleFrequencyCollection(frequencies);
    138141        if (!results.ContainsKey("Allele Frequencies"))
    139142          results.Add(new Result("Allele Frequencies", frequenciesCollection));
     
    158161          results.Add(new Result("Alleles", allelesTable));
    159162          allelesTable.Rows.Add(new DataRow("Unique Alleles"));
     163          DataRowVisualProperties visualProperties = new DataRowVisualProperties();
     164          visualProperties.ChartType = DataRowVisualProperties.DataRowChartType.Line;
     165          visualProperties.SecondYAxis = true;
     166          allelesTable.Rows.Add(new DataRow("Unique Alleles of Best Known Solution", null, visualProperties));
     167          allelesTable.Rows.Add(new DataRow("Fixed Alleles", null, visualProperties));
     168          allelesTable.Rows.Add(new DataRow("Fixed Alleles of Best Known Solution", null, visualProperties));
     169          allelesTable.Rows.Add(new DataRow("Lost Alleles of Best Known Solution", null, visualProperties));
    160170        } else {
    161171          allelesTable = (DataTable)results["Alleles"].Value;
    162172        }
     173
     174        int fixedAllelesCount = frequenciesCollection.Where(x => x.Frequency == 1).Count();
     175        var relevantAlleles = frequenciesCollection.Where(x => x.ContainedInBestKnownSolution);
     176        int relevantAllelesCount = relevantAlleles.Count();
     177        int fixedRelevantAllelesCount = relevantAlleles.Where(x => x.Frequency == 1).Count();
     178        int lostRelevantAllelesCount = relevantAlleles.Where(x => x.Frequency == 0).Count();
     179        int uniqueRelevantAllelesCount = relevantAllelesCount - lostRelevantAllelesCount;
    163180        allelesTable.Rows["Unique Alleles"].Values.Add(frequenciesCollection.Count);
     181        allelesTable.Rows["Unique Alleles of Best Known Solution"].Values.Add(uniqueRelevantAllelesCount);
     182        allelesTable.Rows["Fixed Alleles"].Values.Add(fixedAllelesCount);
     183        allelesTable.Rows["Fixed Alleles of Best Known Solution"].Values.Add(fixedRelevantAllelesCount);
     184        allelesTable.Rows["Lost Alleles of Best Known Solution"].Values.Add(lostRelevantAllelesCount);
    164185      }
    165186      return base.Apply();
Note: See TracChangeset for help on using the changeset viewer.