summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md3
-rw-r--r--ext/lazar/rinstall.R7
-rw-r--r--lib/crossvalidation.rb12
3 files changed, 15 insertions, 7 deletions
diff --git a/README.md b/README.md
index e0b17d1..4de5a12 100644
--- a/README.md
+++ b/README.md
@@ -8,7 +8,7 @@ Dependencies
lazar depends on a couple of external programs and libraries. On Debian 7 "Wheezy" systems you can install them with
- `sudo apt-get install build-essential ruby ruby-dev git cmake swig r-base r-base-dev r-cran-rserve openjdk-7-jre libgsl0-dev libxml2-dev zlib1g-dev libcairo2-dev`
+ `sudo apt-get install build-essential ruby ruby-dev git cmake swig r-base r-base-dev openjdk-7-jre libgsl0-dev libxml2-dev zlib1g-dev libcairo2-dev`
You will also need at least mongodb version 3.0, but Debian "Wheezy" provides version 2.4. Please follow the instructions at http://docs.mongodb.org/manual/tutorial/install-mongodb-on-debian/:
@@ -30,6 +30,7 @@ Installation
git clone https://github.com/opentox/lazar.git
cd lazar
ruby ext/lazar/extconf.rb
+ sudo Rscript ext/lazar/rinstall.R
bundle install
```
diff --git a/ext/lazar/rinstall.R b/ext/lazar/rinstall.R
new file mode 100644
index 0000000..7c1510d
--- /dev/null
+++ b/ext/lazar/rinstall.R
@@ -0,0 +1,7 @@
+chooseCRANmirror(ind=19);
+install.packages("Rserve");
+install.packages("gridExtra");
+install.packages("ggplot2");
+install.packages("pls");
+install.packages("caret");
+install.packages("doMC");
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