always render new correlation plot; keep same handling as for probability plot
authorgebele <gebele@in-silico.ch>
Tue, 16 Jul 2019 14:03:03 +0000 (14:03 +0000)
committergebele <gebele@in-silico.ch>
Tue, 16 Jul 2019 14:03:03 +0000 (14:03 +0000)
lib/validation-statistics.rb

index 4910573a71f50a484eb07bb8f32f6e992721749a..5fd9985a0e125b88518186bb0a6631b93bf49fef 100644 (file)
@@ -178,8 +178,12 @@ module OpenTox
       # @param [String,nil] format
       # @return [Blob]
       def correlation_plot format: "png"
       # @param [String,nil] format
       # @return [Blob]
       def correlation_plot format: "png"
-        unless correlation_plot_id
-          tmpfile = "/tmp/#{id.to_s}_correlation.#{format}"
+        #unless correlation_plot_id
+          #tmpfile = "/tmp/#{id.to_s}_correlation.#{format}"
+          tmpdir = "/tmp"
+          #p tmpdir
+          FileUtils.mkdir_p tmpdir
+          tmpfile = File.join(tmpdir,"#{id.to_s}_correlation.#{format}")
           x = []
           y = []
           feature = Feature.find(predictions.first.last["prediction_feature_id"])
           x = []
           y = []
           feature = Feature.find(predictions.first.last["prediction_feature_id"])
@@ -203,7 +207,7 @@ module OpenTox
           file = Mongo::Grid::File.new(File.read(tmpfile), :filename => "#{id.to_s}_correlation_plot.#{format}")
           plot_id = $gridfs.insert_one(file)
           update(:correlation_plot_id => plot_id)
           file = Mongo::Grid::File.new(File.read(tmpfile), :filename => "#{id.to_s}_correlation_plot.#{format}")
           plot_id = $gridfs.insert_one(file)
           update(:correlation_plot_id => plot_id)
-        end
+        #end
         $gridfs.find_one(_id: correlation_plot_id).data
       end
 
         $gridfs.find_one(_id: correlation_plot_id).data
       end