diff options
Diffstat (limited to 'lib/feature.rb')
-rw-r--r-- | lib/feature.rb | 113 |
1 files changed, 94 insertions, 19 deletions
diff --git a/lib/feature.rb b/lib/feature.rb index f811aef..296a174 100644 --- a/lib/feature.rb +++ b/lib/feature.rb @@ -1,37 +1,112 @@ 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 + # Original ID (e.g. from CSV input) + class OriginalId < Feature + field :dataset_id, type: BSON::ObjectId + end - # Is it a nominal feature - # @return [TrueClass,FalseClass] - def nominal? - self.class == NominalFeature - end + # Original SMILES (e.g. from CSV input) + class OriginalSmiles < Feature + field :dataset_id, type: BSON::ObjectId + end - # Is it a numeric feature - # @return [TrueClass,FalseClass] - def numeric? - self.class == NumericFeature + # Warnings + class Warnings < Feature + field :dataset_id, type: BSON::ObjectId + end + + # Confidence + class Confidence < Feature + field :dataset_id, type: BSON::ObjectId + def name + "Confidence" end end - # Feature for categorical variables + # Categorical variables class NominalFeature < Feature field :accept_values, type: Array end - # Feature for quantitative variables + # Quantitative variables class NumericFeature < Feature + field :unit, type: String + end + + # Nominal biological activity + class NominalBioActivity < NominalFeature + end + + # Numeric biological activity + class NumericBioActivity < NumericFeature + end + + # Merged nominal biological activity + class MergedNominalBioActivity < NominalBioActivity + field :original_feature_ids, type: Array + field :transformations, type: Array + end + + # Merged numeric biological activity + class MergedNumericBioActivity < NumericBioActivity + field :original_feature_ids, type: Array + end + + # Transformed nominal biological activity + class TransformedNominalBioActivity < NominalFeature + field :original_feature_id, type: BSON::ObjectId + field :transformation, type: Hash + end + + # Transformed numeric biological activity + class TransformedNumericBioActivity < 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 + def name + "Prediction: #{self[:name]}" + end + end + + class LazarPredictionProbability < NominalLazarPrediction + def name + "Probability: #{self[:name]}" + end + end + + # Numeric lazar prediction + class NumericLazarPrediction < NumericFeature + field :model_id, type: BSON::ObjectId + field :training_feature_id, type: BSON::ObjectId + def name + "Prediction: #{self[:name]}" + end + end + + class LazarPredictionInterval < NumericLazarPrediction + def name + "#{self[:name].capitalize} prediction interval" + end + 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 |