From 6117375fdc800fd071fc4983896c26700bf2acd7 Mon Sep 17 00:00:00 2001 From: gebele Date: Mon, 21 Mar 2016 09:50:12 +0000 Subject: added install script for R packages, updated README with install instructions; changed plot format from svg to png --- lib/crossvalidation.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'lib/crossvalidation.rb') diff --git a/lib/crossvalidation.rb b/lib/crossvalidation.rb index 08a5ad3..29e208c 100644 --- a/lib/crossvalidation.rb +++ b/lib/crossvalidation.rb @@ -132,7 +132,7 @@ module OpenTox def confidence_plot unless confidence_plot_id - tmpfile = "/tmp/#{id.to_s}_confidence.svg" + tmpfile = "/tmp/#{id.to_s}_confidence.png" accuracies = [] confidences = [] correct_predictions = 0 @@ -149,7 +149,7 @@ module OpenTox R.assign "confidence", confidences R.eval "image = qplot(confidence,accuracy)+ylab('accumulated accuracy')+scale_x_reverse()" R.eval "ggsave(file='#{tmpfile}', plot=image)" - file = Mongo::Grid::File.new(File.read(tmpfile), :filename => "#{self.id.to_s}_confidence_plot.svg") + file = Mongo::Grid::File.new(File.read(tmpfile), :filename => "#{self.id.to_s}_confidence_plot.png") plot_id = $gridfs.insert_one(file) update(:confidence_plot_id => plot_id) end @@ -244,7 +244,7 @@ module OpenTox end def confidence_plot - tmpfile = "/tmp/#{id.to_s}_confidence.svg" + tmpfile = "/tmp/#{id.to_s}_confidence.png" sorted_predictions = predictions.collect{|p| [(Math.log10(p[1])-Math.log10(p[2])).abs,p[3]] if p[1] and p[2]}.compact R.assign "error", sorted_predictions.collect{|p| p[0]} R.assign "confidence", sorted_predictions.collect{|p| p[1]} @@ -252,7 +252,7 @@ module OpenTox R.eval "image = qplot(confidence,error)" R.eval "image = image + stat_smooth(method='lm', se=FALSE)" R.eval "ggsave(file='#{tmpfile}', plot=image)" - file = Mongo::Grid::File.new(File.read(tmpfile), :filename => "#{self.id.to_s}_confidence_plot.svg") + file = Mongo::Grid::File.new(File.read(tmpfile), :filename => "#{self.id.to_s}_confidence_plot.png") plot_id = $gridfs.insert_one(file) update(:confidence_plot_id => plot_id) $gridfs.find_one(_id: confidence_plot_id).data @@ -260,7 +260,7 @@ module OpenTox def correlation_plot unless correlation_plot_id - tmpfile = "/tmp/#{id.to_s}_correlation.svg" + tmpfile = "/tmp/#{id.to_s}_correlation.png" x = predictions.collect{|p| p[1]} y = predictions.collect{|p| p[2]} attributes = Model::Lazar.find(self.model_id).attributes @@ -273,7 +273,7 @@ module OpenTox R.eval "image = qplot(-log(prediction),-log(measurement),main='#{self.name}',asp=1,xlim=range, ylim=range)" R.eval "image = image + geom_abline(intercept=0, slope=1)" R.eval "ggsave(file='#{tmpfile}', plot=image)" - file = Mongo::Grid::File.new(File.read(tmpfile), :filename => "#{self.id.to_s}_correlation_plot.svg") + file = Mongo::Grid::File.new(File.read(tmpfile), :filename => "#{self.id.to_s}_correlation_plot.png") plot_id = $gridfs.insert_one(file) update(:correlation_plot_id => plot_id) end -- cgit v1.2.3