diff options
author | gebele <gebele@in-silico.ch> | 2017-05-04 10:09:36 +0000 |
---|---|---|
committer | gebele <gebele@in-silico.ch> | 2017-05-04 10:09:36 +0000 |
commit | b4a6b825c12b4aab1c661cf653e734291f365c6a (patch) | |
tree | 9aee4abff56f13180ad7cb88f9289b12257196e9 | |
parent | 534f148aeb26e80ec6faa9410df7e0f193c2ab2c (diff) |
small adjustments
-rw-r--r-- | create_prediction_models.rb | 8 | ||||
-rw-r--r-- | lazar_validation_reports.rb | 5 | ||||
-rw-r--r-- | update_prediction_models.rb | 5 |
3 files changed, 12 insertions, 6 deletions
diff --git a/create_prediction_models.rb b/create_prediction_models.rb index d58728e..3cfc59e 100644 --- a/create_prediction_models.rb +++ b/create_prediction_models.rb @@ -22,7 +22,7 @@ def delete_models type m.crossvalidations.each{|cv| cv.delete} m.model.delete m.delete - end + end unless models.empty? end puts CENTRAL_MONGO_IP.blank? ? "Use local mongodb on port: 127.0.0.1" : "Use central mongodb on port: #{CENTRAL_MONGO_IP}" @@ -31,7 +31,7 @@ puts CENTRAL_MONGO_IP.blank? ? "Use local mongodb on port: 127.0.0.1" : "Use cen # classification models #delete_models "classification" Dir["classification/*csv"].each do |file| - unless file.match(/hamster/) + unless file.match(/hamster|mutagenicity/i)#until mutagenicity is refined puts "### #{file} ###\n" Model::Validation.from_csv_file file end @@ -92,8 +92,10 @@ feature_categories.each do |category| end =end +# remove existing local dump +`rm -r dump/#{ENV["LAZAR_ENV"]}` # store local dump but git ignored -`mongodump -h #{CENTRAL_MONGO_IP.blank? ? "127.0.0.1" : CENTRAL_MONGO_IP} -d production` +`mongodump -h #{CENTRAL_MONGO_IP.blank? ? "127.0.0.1" : CENTRAL_MONGO_IP} -d #{ENV["LAZAR_ENV"]}` # build reports and users dump eval File.read('./lazar_validation_reports.rb') diff --git a/lazar_validation_reports.rb b/lazar_validation_reports.rb index 742fb62..85e9888 100644 --- a/lazar_validation_reports.rb +++ b/lazar_validation_reports.rb @@ -20,7 +20,8 @@ models.each_with_index do |model, idx| type = model.regression? ? "regression" : "classification" #name = model.model.name.gsub!(/[^0-9A-Za-z.\-]/, '_') date = model.created_at.to_s.split.first - name = (model.endpoint + "_" + model.species).gsub!(/[^0-9A-Za-z.\-]/, '_') + dataset_name = model.training_dataset.source.split("/").last + name = (model.endpoint + "_" + model.species + "_" + dataset_name).gsub!(/[^0-9A-Za-z.\-]/, '_') branch = model.model.version["branch"] commit = model.model.version["commit"] filename = [date,type,branch,commit,name].join("_") @@ -29,7 +30,7 @@ models.each_with_index do |model, idx| @json["endpoint"] = model.endpoint @json["species"] = model.species @json["source"] = model.source - @json["training_dataset"] = model.training_dataset.source + @json["training_dataset"] = dataset_name @json["training_compounds"] = model.training_dataset.data_entries.size @json["algorithms"] = model.algorithms @json["name"] = model.model.name diff --git a/update_prediction_models.rb b/update_prediction_models.rb index 496f7dc..31baa77 100644 --- a/update_prediction_models.rb +++ b/update_prediction_models.rb @@ -5,4 +5,7 @@ include OpenTox $mongo.database.drop $gridfs = $mongo.database.fs # recreate GridFS indexes -`mongorestore --host 127.0.0.1` +# uncomment to load in particular to local mongodb +#mongorestore --host 127.0.0.1 + +`mongorestore --host #{ CENTRAL_MONGO_IP.blank? ? "127.0.0.1" : CENTRAL_MONGO_IP}` |