summaryrefslogtreecommitdiff
path: root/lib/feature.rb
diff options
context:
space:
mode:
authorhelma@in-silico.ch <helma@in-silico.ch>2018-10-10 14:58:44 +0200
committerhelma@in-silico.ch <helma@in-silico.ch>2018-10-10 14:58:44 +0200
commit5d4ab5553e1928e573aa6671ba6a273308b24e21 (patch)
treeeb7ec29c1356cf4ef1a88f0b9da36d273a99ef8c /lib/feature.rb
parent3f793a7be36355f7a14d0fcb4198715124b4c2b9 (diff)
more differentiated feature classes
Diffstat (limited to 'lib/feature.rb')
-rw-r--r--lib/feature.rb62
1 files changed, 41 insertions, 21 deletions
diff --git a/lib/feature.rb b/lib/feature.rb
index 1d18a00..e6fede6 100644
--- a/lib/feature.rb
+++ b/lib/feature.rb
@@ -2,23 +2,11 @@ module OpenTox
# Basic feature class
class Feature
- field :measured, type: Boolean
- field :calculated, type: Boolean
- field :category, type: String
- field :unit, type: String
- field :conditions, type: Hash
-
- # Is it a nominal feature
- # @return [TrueClass,FalseClass]
- def nominal?
- self.class == NominalFeature
- end
+ end
- # Is it a numeric feature
- # @return [TrueClass,FalseClass]
- def numeric?
- self.class == NumericFeature
- end
+ # Original ID (e.g. from CSV input)
+ class OriginalId < Feature
+ field :dataset_id, type: BSON::ObjectId
end
# Feature for categorical variables
@@ -28,10 +16,46 @@ module OpenTox
# Feature for quantitative variables
class NumericFeature < Feature
+ field :unit, type: String
+ end
+
+ # Nominal biological activity
+ class NominalBioActivity < NominalFeature
+ field :original_feature_id, type: BSON::ObjectId
+ field :transformation, type: Hash
+ end
+
+ # Numeric biological activity
+ class NumericBioActivity < NumericFeature
+ field :original_feature_id, type: BSON::ObjectId
+ field :transformation, type: String
+ end
+
+ # Nominal lazar prediction
+ class NominalLazarPrediction < NominalFeature
+ field :model_id, type: BSON::ObjectId
+ field :training_feature_id, type: BSON::ObjectId
+ end
+
+ # Numeric lazar prediction
+ class NumericLazarPrediction < NumericFeature
+ field :model_id, type: BSON::ObjectId
+ field :training_feature_id, type: BSON::ObjectId
+ end
+
+ class NominalSubstanceProperty < NominalFeature
+ end
+
+ class NumericSubstanceProperty < NumericFeature
+ end
+
+ class NanoParticleProperty < NumericSubstanceProperty
+ field :category, type: String
+ field :conditions, type: Hash
end
# Feature for SMARTS fragments
- class Smarts < NominalFeature
+ class Smarts < Feature
field :smarts, type: String
index "smarts" => 1
# Create feature from SMARTS string
@@ -42,8 +66,4 @@ module OpenTox
end
end
- class OriginalId < Feature
- field :dataset_id, type: BSON::ObjectId
- end
-
end