summaryrefslogtreecommitdiff
path: root/reach_reports
diff options
context:
space:
mode:
authormguetlein <martin.guetlein@gmail.com>2010-09-02 14:25:02 +0200
committermguetlein <martin.guetlein@gmail.com>2010-09-02 14:25:02 +0200
commitf04a500388557a34d782c5310c009f559e47d046 (patch)
tree5243fb4cfc76ea03478fa436bc1269f54991b92c /reach_reports
parent51613854268453746d33fbb16d6406cde4963e12 (diff)
fixing rakefile, adding some more content to reach qmrf report, fix :model-name for relations
Diffstat (limited to 'reach_reports')
-rw-r--r--reach_reports/reach_persistance.rb38
-rw-r--r--reach_reports/reach_service.rb22
2 files changed, 37 insertions, 23 deletions
diff --git a/reach_reports/reach_persistance.rb b/reach_reports/reach_persistance.rb
index a96c0e6..6c80503 100644
--- a/reach_reports/reach_persistance.rb
+++ b/reach_reports/reach_persistance.rb
@@ -40,7 +40,7 @@ class Symbol
:qsar_endpoint => "QSAR_Endpoint", :qmrf_author => "qmrf_authors", :qsar_algorithm => "QSAR_Algorithm",
:qsar_applicability_domain => "QSAR_Applicability_domain", :qsar_robustness => "QSAR_Robustness",
:qsar_predictivity => "QSAR_Predictivity", :qsar_interpretation => "QSAR_Interpretation",
- :qsar_miscelaneous => "QSAR_Miscelaneous", :qmrf_summary => "QMRF_Summary", :qmrf_number => "QMRF_number" }
+ :qsar_miscellaneous => "QSAR_Miscelaneous", :qmrf_summary => "QMRF_Summary", :qmrf_number => "QMRF_number" }
def xml_alias
XML_ALIAS[self] ? XML_ALIAS[self] : self.to_s
@@ -325,7 +325,7 @@ module DataMapper::Resource
#puts "new prop "+xml_info.xml_prop
self.send( xml_info.prop ).each do |elem|
#puts "elem "+elem.to_yaml
- elem_node = REXML::Element.new(xml_info.list_element )
+ elem_node = REXML::Element.new( xml_info.list_element.xml_alias )
elem.to_XML( elem_node )
prop_node << elem_node
end
@@ -620,7 +620,7 @@ module ReachReports
property :related_models, Text
# type is needed to distinguish between authors
- # (the datamapper creates a table "Atuhors", the relation is defined by QsarGeneral.id and Author.id)
+ # (the datamapper creates a table "Authors", the relation is defined by QsarGeneral.id and Author.id)
has n, :qmrf_authors, :type => "QmrfAuthor"
has n, :model_authors, :type => "ModelAuthor"
has n, :references
@@ -827,7 +827,7 @@ module ReachReports
property :bootstrap, Text
property :other_statistics, Text
- has 1, :training_set_data
+ has 1, :training_set_data, :model => "TrainingSetData"
def xml_infos
[ SingleAttributeNodeProperty.new(:training_set_availability, "answer"),
@@ -870,7 +870,7 @@ module ReachReports
property :validation_assessment, Text
property :validation_comments, Text
- has 1, :validation_set_data
+ has 1, :validation_set_data, :model => "ValidationSetData"
def xml_infos
[ SingleAttributeNodeProperty.new(:validation_set_availability, "answer"),
@@ -908,8 +908,8 @@ module ReachReports
class Bibliography < Publication
- #belongs_to :qsar_miscelaneous
- property :qsar_miscelaneous_id, Integer
+ #belongs_to :qsar_miscellaneous
+ property :qsar_miscellaneous_id, Integer
end
class Attachment
@@ -927,7 +927,7 @@ module ReachReports
]
end
- belongs_to :qsar_miscelaneous
+ belongs_to :qsar_miscellaneous
end
class AttachmentTrainingData < Attachment
@@ -943,7 +943,7 @@ module ReachReports
end
- class QsarMiscelaneous
+ class QsarMiscellaneous
include DataMapper::Resource
property :id, Serial
@@ -953,8 +953,8 @@ module ReachReports
# type is needed to distinguish between attachments
# (the datamapper creates a table "Attachments", the relation is defined by QsarMisc.id and Attachment.id)
- has n, :attachment_training_data, :type => "AttachmentTrainingData"
- has n, :attachment_validation_data, :type => "AttachmentValidationData"
+ has n, :attachment_training_data, :model => "AttachmentValidationData", :type => "AttachmentTrainingData"
+ has n, :attachment_validation_data, :model => "AttachmentValidationData", :type => "AttachmentValidationData"
has n, :attachment_documents, :type => "AttachmentDocument"
def xml_infos
@@ -997,7 +997,7 @@ module ReachReports
CHAPTERS = [ :qsar_identifier, :qsar_general_information, :qsar_endpoint, :qsar_algorithm,
:qsar_applicability_domain, :qsar_robustness, :qsar_predictivity, :qsar_interpretation,
- :qsar_miscelaneous, :qmrf_summary ]
+ :qsar_miscellaneous, :qmrf_summary ]
CHAPTERS.each{ |c,clazz| has 1, c }
@@ -1065,21 +1065,21 @@ module ReachReports
# puts "XXXXXXXxxxxx"
#
# puts "1"
-# puts report.qsar_miscelaneous.attachment_training_data.inspect
+# puts report.qsar_miscellaneous.attachment_training_data.inspect
# puts "2"
-# puts report.qsar_miscelaneous.attachment_validation_data.inspect
+# puts report.qsar_miscellaneous.attachment_validation_data.inspect
# puts "3"
-# puts report.qsar_miscelaneous.attachment_documents.inspect
+# puts report.qsar_miscellaneous.attachment_documents.inspect
#
#
# r = QmrfReport.get(report.id)
#
# puts "1"
-# puts r.qsar_miscelaneous.attachment_training_data.inspect
+# puts r.qsar_miscellaneous.attachment_training_data.inspect
# puts "2"
-# puts r.qsar_miscelaneous.attachment_validation_data.inspect
+# puts r.qsar_miscellaneous.attachment_validation_data.inspect
# puts "3"
-# puts r.qsar_miscelaneous.attachment_documents.inspect
+# puts r.qsar_miscellaneous.attachment_documents.inspect
#
# exit
@@ -1218,7 +1218,7 @@ module ReachReports
AttachmentTrainingData.auto_upgrade!
AttachmentValidationData.auto_upgrade!
AttachmentDocument.auto_upgrade!
- QsarMiscelaneous.auto_upgrade!
+ QsarMiscellaneous.auto_upgrade!
QmrfSummary.auto_upgrade!
diff --git a/reach_reports/reach_service.rb b/reach_reports/reach_service.rb
index 9fe79e6..f7b899c 100644
--- a/reach_reports/reach_service.rb
+++ b/reach_reports/reach_service.rb
@@ -73,12 +73,11 @@ module ReachReports
# chapter 3
# TODO "model_species" ?
r.qsar_endpoint = QsarEndpoint.new
-
model.predictedVariables.each do |p|
r.qsar_endpoint.model_endpoint << ModelEndpoint.new( :name => p )
end
# TODO "endpoint_comments" => "3.3", "endpoint_units" => "3.4",
- r.qsar_endpoint.endpoint_variable = model.dependentVariables if model.dependentVariables
+ r.qsar_endpoint.endpoint_variable = model.dependentVariables if model.dependentVariables
# TODO "endpoint_protocol" => "3.6", "endpoint_data_quality" => "3.7",
# chapter 4
@@ -90,10 +89,18 @@ module ReachReports
# chapter 5
# TODO app_domain_description, app_domain_method, app_domain_software, applicability_limits
+ dataset = model.trainingDataset ? OpenTox::Dataset.find(model.trainingDataset) : nil
+
# chapter 6
- # "training_set_availability" => "6.1", "training_set_data" => "6.2","training_set_descriptors" => "6.3",
+ r.qsar_robustness = QsarRobustness.new
+ r.qsar_robustness.training_set_availability = dataset ? "Yes" : "No"
+ #TODO "training_set_data" => "6.2",
+ # "training_set_descriptors" => "6.3",
# "dependent_var_availability" => "6.4", "other_info" => "6.5", "preprocessing" => "6.6", "goodness_of_fit" => "6.7",
- # "loo" => "6.8", "lmo" => "6.9", "yscrambling" => "6.10", "bootstrap" => "6.11", "other_statistics" => "6.12",
+ # "loo" => "6.8",
+ puts Lib::Crossvalidation.find(:all, :conditions => {:algorithm_uri => model.algorithm}).inspect if model.algorithm
+ #exit
+ # "lmo" => "6.9", "yscrambling" => "6.10", "bootstrap" => "6.11", "other_statistics" => "6.12",
# chapter 7
# "validation_set_availability" => "7.1", "validation_set_data" => "7.2", "validation_set_descriptors" => "7.3",
@@ -105,6 +112,13 @@ module ReachReports
# chapter 9
# "comments" => "9.1", "bibliography" => "9.2", "attachments" => "9.3",
+ r.qsar_miscellaneous = QsarMiscellaneous.new
+ r.qsar_miscellaneous.attachment_training_data << AttachmentTrainingData.new(
+ { :description => dataset.title,
+ :filetype => "owl-dl",
+ :url => dataset.uri} ) if dataset
+
+
r.save
end