From 5d4ab5553e1928e573aa6671ba6a273308b24e21 Mon Sep 17 00:00:00 2001 From: "helma@in-silico.ch" Date: Wed, 10 Oct 2018 14:58:44 +0200 Subject: more differentiated feature classes --- lib/feature.rb | 62 ++++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 41 insertions(+), 21 deletions(-) (limited to 'lib/feature.rb') 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 -- cgit v1.2.3