Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Analysis/3.3/AlleleFrequency.cs @ 4670

Last change on this file since 4670 was 4623, checked in by swagner, 14 years ago

Added first version of allele frequency analysis (#1234)

File size: 4.4 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using HeuristicLab.Common;
23using HeuristicLab.Core;
24using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
25
26namespace HeuristicLab.Analysis {
27  /// <summary>
28  /// Represents the frequency of an allele.
29  /// </summary>
30  [Item("AlleleFrequency", "Represents the frequency of an allele.")]
31  [StorableClass]
32  public class AlleleFrequency : Item {
33    private string id;
34    public string Id {
35      get { return id; }
36    }
37    private double frequency;
38    public double Frequency {
39      get { return frequency; }
40    }
41    private double averageImpact;
42    public double AverageImpact {
43      get { return averageImpact; }
44    }
45    private double averageSolutionQuality;
46    public double AverageSolutionQuality {
47      get { return averageSolutionQuality; }
48    }
49    private bool containedInBestKnownSolution;
50    public bool ContainedInBestKnownSolution {
51      get { return containedInBestKnownSolution; }
52    }
53    private bool containedInBestSolution;
54    public bool ContainedInBestSolution {
55      get { return containedInBestSolution; }
56    }
57
58    #region Storable Properties
59    [Storable(Name = "Id")]
60    private string StorableId {
61      get { return id; }
62      set { id = value; }
63    }
64    [Storable(Name = "Frequency")]
65    private double StorableFrequency {
66      get { return frequency; }
67      set { frequency = value; }
68    }
69    [Storable(Name = "AverageImpact")]
70    private double StorableAverageImpact {
71      get { return averageImpact; }
72      set { averageImpact = value; }
73    }
74    [Storable(Name = "AverageSolutionQuality")]
75    private double StorableAverageSolutionQuality {
76      get { return averageSolutionQuality; }
77      set { averageSolutionQuality = value; }
78    }
79    [Storable(Name = "ContainedInBestKnownSolution")]
80    private bool StorableContainedInBestKnownSolution {
81      get { return containedInBestKnownSolution; }
82      set { containedInBestKnownSolution = value; }
83    }
84    [Storable(Name = "ContainedInBestSolution")]
85    private bool StorableContainedInBestSolution {
86      get { return containedInBestSolution; }
87      set { containedInBestSolution = value; }
88    }
89    #endregion
90
91    public AlleleFrequency()
92      : base() {
93      id = string.Empty;
94      frequency = 0;
95      averageImpact = 0;
96      averageSolutionQuality = 0;
97      containedInBestKnownSolution = false;
98      containedInBestSolution = false;
99    }
100    public AlleleFrequency(string id, double frequency, double averageImpact, double averageSolutionQuality, bool containedInBestKnownSolution, bool containedInBestSolution)
101      : base() {
102      this.id = id;
103      this.frequency = frequency;
104      this.averageImpact = averageImpact;
105      this.averageSolutionQuality = averageSolutionQuality;
106      this.containedInBestKnownSolution = containedInBestKnownSolution;
107      this.containedInBestSolution = containedInBestSolution;
108    }
109    [StorableConstructor]
110    protected AlleleFrequency(bool deserializing) : base(deserializing) { }
111
112    public override IDeepCloneable Clone(Cloner cloner) {
113      AlleleFrequency clone = (AlleleFrequency)base.Clone(cloner);
114      clone.id = id;
115      clone.frequency = frequency;
116      clone.averageImpact = averageImpact;
117      clone.averageSolutionQuality = averageSolutionQuality;
118      clone.containedInBestKnownSolution = containedInBestKnownSolution;
119      clone.containedInBestSolution = containedInBestSolution;
120      return clone;
121    }
122
123    public override string ToString() {
124      return id;
125    }
126  }
127}
Note: See TracBrowser for help on using the repository browser.