summaryrefslogtreecommitdiff
path: root/lib/feature.rb
blob: de8e4c95f62e40c395b17dfc2a67b7bca6a13560 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
module OpenTox

  class Feature
    field :name, as: :title, type: String
    field :nominal, type: Boolean
    field :numeric, type: Boolean
    field :measured, type: Boolean
    field :calculated, type: Boolean
    field :supervised, type: Boolean
    field :source, as: :title, type: String
    #belongs_to :dataset
    #belongs_to :data_entry
  end

  class NominalFeature < Feature
    field :accept_values, type: Array
    def initialize params
      super params
      nominal = true
    end
  end

  class NumericFeature < Feature
    def initialize params
      super params
      numeric = true
    end
  end

  class Smarts < NominalFeature
    field :name, as: :smarts, type: String # causes warnings
    field :algorithm, type: String, default: "OpenTox::Algorithm::Descriptors.smarts_match"
    field :parameters, type: Hash, default: {:count => false}
    def initialize params
      super params
      nominal = true
    end
  end

  class FminerSmarts < Smarts
    field :pValue, type: Float
    field :effect, type: String
    field :dataset_id 
    def initialize params
      super params
      supervised = true
    end
  end

  class NominalBioAssay < NominalFeature
    field :description, type: String
  end

  class NumericBioAssay < NumericFeature
    field :description, type: String
  end

  class PhysChemDescriptor < NumericFeature
    field :algorithm, type: String
    field :parameters, type: Hash
  end

end