bio-incanter 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. data/Gemfile +14 -0
  2. data/Gemfile.lock +35 -0
  3. data/LICENSE.txt +20 -0
  4. data/README.rdoc +26 -0
  5. data/Rakefile +51 -0
  6. data/VERSION +1 -0
  7. data/bio-incanter.gemspec +136 -0
  8. data/doc/AreaChart.html +473 -0
  9. data/doc/BarChart.html +519 -0
  10. data/doc/BlandAltman.html +453 -0
  11. data/doc/BoxPlot.html +474 -0
  12. data/doc/FunctionPlot.html +496 -0
  13. data/doc/HeatMap.html +554 -0
  14. data/doc/Histogram.html +444 -0
  15. data/doc/LICENSE_txt.html +130 -0
  16. data/doc/LineChart.html +479 -0
  17. data/doc/Object.html +278 -0
  18. data/doc/PieChart.html +455 -0
  19. data/doc/README_rdoc.html +152 -0
  20. data/doc/ScatterPlot.html +489 -0
  21. data/doc/TimeChart.html +473 -0
  22. data/doc/TracePlot.html +416 -0
  23. data/doc/XyPlot.html +477 -0
  24. data/doc/created.rid +18 -0
  25. data/doc/images/add.png +0 -0
  26. data/doc/images/brick.png +0 -0
  27. data/doc/images/brick_link.png +0 -0
  28. data/doc/images/bug.png +0 -0
  29. data/doc/images/bullet_black.png +0 -0
  30. data/doc/images/bullet_toggle_minus.png +0 -0
  31. data/doc/images/bullet_toggle_plus.png +0 -0
  32. data/doc/images/date.png +0 -0
  33. data/doc/images/delete.png +0 -0
  34. data/doc/images/find.png +0 -0
  35. data/doc/images/loadingAnimation.gif +0 -0
  36. data/doc/images/macFFBgHack.png +0 -0
  37. data/doc/images/package.png +0 -0
  38. data/doc/images/page_green.png +0 -0
  39. data/doc/images/page_white_text.png +0 -0
  40. data/doc/images/page_white_width.png +0 -0
  41. data/doc/images/plugin.png +0 -0
  42. data/doc/images/ruby.png +0 -0
  43. data/doc/images/tag_blue.png +0 -0
  44. data/doc/images/tag_green.png +0 -0
  45. data/doc/images/transparent.png +0 -0
  46. data/doc/images/wrench.png +0 -0
  47. data/doc/images/wrench_orange.png +0 -0
  48. data/doc/images/zoom.png +0 -0
  49. data/doc/index.html +106 -0
  50. data/doc/js/darkfish.js +153 -0
  51. data/doc/js/jquery.js +18 -0
  52. data/doc/js/navigation.js +142 -0
  53. data/doc/js/search.js +94 -0
  54. data/doc/js/search_index.js +1 -0
  55. data/doc/js/searcher.js +228 -0
  56. data/doc/rdoc.css +543 -0
  57. data/doc/table_of_contents.html +295 -0
  58. data/lib/area_chart/area_chart.rb +106 -0
  59. data/lib/bar_chart/bar_chart.rb +142 -0
  60. data/lib/bio-incanter.rb +108 -0
  61. data/lib/bland_altman/bland_altman.rb +120 -0
  62. data/lib/box_plot/box_plot.rb +136 -0
  63. data/lib/function_plot/function_plot.rb +137 -0
  64. data/lib/histogram/histogram.rb +139 -0
  65. data/lib/java/clocomics-1.0.0-standalone.jar +0 -0
  66. data/lib/line_chart/line_chart.rb +148 -0
  67. data/lib/pie_chart/pie_chart.rb +121 -0
  68. data/lib/qq_plot/qq_plot.rb +105 -0
  69. data/lib/scatter_plot/scatter_plot.rb +162 -0
  70. data/lib/time_chart/time_chart.rb +142 -0
  71. data/lib/trace_plot/trace_plot.rb +108 -0
  72. data/lib/xy_plot/xy_plot.rb +149 -0
  73. data/spec/bar_chart_spec.rb +25 -0
  74. data/spec/bland_altman_spec.rb +26 -0
  75. data/spec/box_plot_spec.rb +25 -0
  76. data/spec/function_plot_spec.rb +27 -0
  77. data/spec/histogram_spec.rb +24 -0
  78. data/spec/line_chart_spec.rb +25 -0
  79. data/spec/pie_chart_spec.rb +25 -0
  80. data/spec/qq_plot_spec.rb +24 -0
  81. data/spec/scatter_plot_spec.rb +26 -0
  82. data/spec/spec_helper.rb +13 -0
  83. data/spec/time_chart_spec.rb +26 -0
  84. data/spec/trace_plot_spec.rb +24 -0
  85. data/spec/xy_plot_spec.rb +25 -0
  86. metadata +196 -0
@@ -0,0 +1,108 @@
1
+ require 'java'
2
+
3
+ jars_dir = File.join(File.dirname(__FILE__), 'java')
4
+ for jar in Dir["#{jars_dir}/*.jar"]
5
+ require jar
6
+ end
7
+
8
+ #require for customer class
9
+ require 'pie_chart/pie_chart.rb'
10
+ require 'area_chart/area_chart.rb'
11
+ require 'bar_chart/bar_chart.rb'
12
+ require 'bland_altman/bland_altman.rb'
13
+ require 'box_plot/box_plot.rb'
14
+ require 'function_plot/function_plot.rb'
15
+ require 'histogram/histogram.rb'
16
+ require 'line_chart/line_chart.rb'
17
+ require 'qq_plot/qq_plot.rb'
18
+ require 'scatter_plot/scatter_plot.rb'
19
+ require 'time_chart/time_chart.rb'
20
+ require 'xy_plot/xy_plot.rb'
21
+ require 'trace_plot/trace_plot.rb'
22
+
23
+ java_import "java.util.HashMap"
24
+
25
+
26
+ def check_grp(grp)
27
+ grp.each{ |item|
28
+ if item.class!= String
29
+ raise "Error : Vector of class must be String"
30
+ end
31
+ }
32
+ return grp
33
+ end
34
+
35
+ def check_val(value)
36
+ value.each {|item|
37
+ if item.class!= Float
38
+ raise "Error : Vector of point must be Double"
39
+ end
40
+ }
41
+ return value
42
+ end
43
+
44
+
45
+ def check_val_int(value)
46
+ value.each {|item|
47
+ if item.class!= Fixnum
48
+ raise "Error : Vector of point must be Integer"
49
+ end
50
+ }
51
+ return value
52
+ end
53
+
54
+
55
+
56
+ =begin
57
+ def check_par(params)
58
+ hash = Hash.new
59
+ permitted = ["title","vertical","legend","width","height","file_name"]
60
+ keys = params.keys
61
+ keys.each{ |key|
62
+ if permitted.include?(key)==false
63
+ raise "Error : Permitted key are title,vertical,legend,width,height"
64
+ end
65
+ }
66
+ if params["title"]==nil
67
+ hash["title"]="A sample Graph"
68
+ else
69
+ hash["title"]=params["title"]
70
+ end
71
+
72
+ if params["vertical"]==nil
73
+ hash["vertical"]=false
74
+ else
75
+ hash["vertical"]=params["vertical"]
76
+ end
77
+
78
+ if params["legend"]==nil
79
+ hash["legend"]=false
80
+ else
81
+ hash["legend"]=params["legend"]
82
+ end
83
+
84
+ if params["width"]==nil
85
+ hash["width"]=1500
86
+ else
87
+ hash["width"]=params["width"]
88
+ end
89
+
90
+ if params["height"]==nil
91
+ hash["height"]=800
92
+ else
93
+ hash["height"]=params["height"]
94
+ end
95
+
96
+ if params["file_name"]==nil
97
+ hash["file_name"]="sample.jpg"
98
+ else
99
+ hash["file_name"]=params["file_name"]
100
+ end
101
+
102
+
103
+
104
+ params_map = HashMap.new(hash)
105
+ return params_map
106
+
107
+ end
108
+ =end
@@ -0,0 +1,120 @@
1
+ class BlandAltman
2
+ # ==== Attributes
3
+ #
4
+ # * +x_1+ - a vector of Float numeric value
5
+ # * +x_2+ - a vector of Float numeric value
6
+ # * +parms+ - an Hash whit parametrs value
7
+ #
8
+ # ==== Parms
9
+ #
10
+ # This Hash contain parmas .
11
+ # List of key permitted .
12
+ #
13
+ #
14
+ #
15
+ # * +:title+ - (default "A sample Graph") Graph main title
16
+ # * +:legend+ - (default false) Prints legend
17
+ # * +:vertical+ - (default true) The orientation of the plot
18
+ # * +:height+ - (default 1500) Graph height
19
+ # * +:width+ - (default 800) Graph width
20
+ # * +:file_name+ - (default sample.jpg) Graph File Name/Path to save plot. You can chose jpg or pdf
21
+ #
22
+ # ==== Examples
23
+ #
24
+ # Class Usage:
25
+ #
26
+ # values_1= [6.0,2.0,8.4]
27
+ # values_2 = [1.0,2.0,3.0]
28
+ # params = {"title" => "My_PLot"}
29
+ # plot = BlandAltman.new(values_1,values_2,params)
30
+ # #To view
31
+ # plot.view
32
+ # #to save
33
+ # plot.save
34
+
35
+ def initialize(x_1,x_2,params)
36
+ @group=check_val(x_1)
37
+ @value=check_val(x_2)
38
+ @params=self.check_par(params)
39
+ end
40
+
41
+ def check_par(params)
42
+ hash = Hash.new
43
+ permitted = ["title","vertical","legend","width","height","file_name"]
44
+ keys = params.keys
45
+ keys.each{ |key|
46
+ if permitted.include?(key)==false
47
+ raise "Error : Permitted key are title,vertical,legend,width,height"
48
+ end
49
+ }
50
+
51
+ if params["title"]==nil
52
+ hash["title"]="A sample Graph"
53
+ else
54
+ hash["title"]=params["title"]
55
+ end
56
+
57
+ if params["vertical"]==nil
58
+ hash["vertical"]=false
59
+ else
60
+ hash["vertical"]=params["vertical"]
61
+ end
62
+
63
+ if params["legend"]==nil
64
+ hash["legend"]=false
65
+ else
66
+ hash["legend"]=params["legend"]
67
+ end
68
+
69
+ if params["width"]==nil
70
+ hash["width"]=1500
71
+ else
72
+ hash["width"]=params["width"]
73
+ end
74
+
75
+ if params["height"]==nil
76
+ hash["height"]=800
77
+ else
78
+ hash["height"]=params["height"]
79
+ end
80
+
81
+ if params["file_name"]==nil
82
+ hash["file_name"]="sample.jpg"
83
+ else
84
+ hash["file_name"]=params["file_name"]
85
+ end
86
+
87
+ params_map = HashMap.new(hash)
88
+ return params_map
89
+ end
90
+
91
+ def getGroup
92
+ @group
93
+ end
94
+
95
+ def getValue
96
+ @value
97
+ end
98
+
99
+ def getParams
100
+ @params
101
+ end
102
+
103
+
104
+ def save
105
+ begin
106
+ a = Java::ComDomain::clocomics
107
+ a.save_altman(self.getGroup,self.getValue,self.getParams)
108
+ rescue Exception => ex
109
+ end
110
+ end
111
+ def view
112
+ begin
113
+ a = Java::ComDomain::clocomics
114
+ a.view_altman(self.getGroup,self.getValue,self.getParams)
115
+ rescue Exception => ex
116
+ end
117
+ end
118
+
119
+
120
+ end
@@ -0,0 +1,136 @@
1
+ class BoxPlot
2
+ # ==== Attributes
3
+ #
4
+ # * +value+ - a vector of Float numeric value
5
+ # * +parms+ - an Hash whit parametrs value
6
+ #
7
+ # ==== Parms
8
+ #
9
+ # This Hash contain parmas .
10
+ # List of key permitted .
11
+ #
12
+ #
13
+ # * +:title+ - (default "A sample Graph") Graph main title
14
+ # * +:x_label+ - (default 'Categories') Label of x ass
15
+ # * +:y_label+ - (default 'Value') Label of y ass
16
+ # * +:legend+ - (default false) Prints legend
17
+ # * +:vertical+ - (default true) The orientation of the plot
18
+ # * +:group_by+ - (default nil) A vector of values used to group the values into series within each category.
19
+ # * +:height+ - (default 1500) Graph height
20
+ # * +:width+ - (default 800) Graph width
21
+ # * +:file_name+ - (default sample.jpg) Graph File Name/Path to save plot. You can chose jpg or pdf
22
+ #
23
+ # ==== Examples
24
+ #
25
+ # Class Usage:
26
+ #
27
+ # values = [1.0,2.0,3.0]
28
+ # params = {"title" => "Popolation of middle heart","x_label"=>"Popolation","y_label"=>"greed"}
29
+ # plot = BoxPlot.new(categories,values,params)
30
+ # #To view
31
+ # plot.view
32
+ # #to save
33
+ # plot.save
34
+
35
+
36
+ def initialize(value,params)
37
+ @value=check_val(value)
38
+ @params=self.check_par(params)
39
+ end
40
+
41
+ def check_par(params)
42
+ hash = Hash.new
43
+ permitted = ["title","x_label","y_label","vertical","group_by","legend","width","height","file_name"]
44
+ keys = params.keys
45
+ keys.each{ |key|
46
+ if permitted.include?(key)==false
47
+ raise "Error : Permitted key are title,x_label,y_label,vertical,group_by,legend,width,height"
48
+ end
49
+ }
50
+
51
+ if params["title"]==nil
52
+ hash["title"]="A sample Graph"
53
+ else
54
+ hash["title"]=params["title"]
55
+ end
56
+
57
+ if params["x_label"]==nil
58
+ hash["x_label"]="Categories"
59
+ else
60
+ hash["x_label"]=params["x_label"]
61
+ end
62
+
63
+ if params["y_label"]==nil
64
+ hash["y_label"]="Values"
65
+ else
66
+ hash["y_label"]=params["y_label"]
67
+ end
68
+
69
+ if params["vertical"]==nil
70
+ hash["vertical"]=true
71
+ else
72
+ hash["vertical"]=params["vertical"]
73
+ end
74
+
75
+ if params["legend"]==nil
76
+ hash["legend"]=false
77
+ else
78
+ hash["legend"]=params["legend"]
79
+ end
80
+
81
+ if params["gruop_by"]==nil
82
+ hash["group_by"]=nil
83
+ else
84
+ hash["group_by"]=params["group_by"]
85
+ end
86
+
87
+ if params["width"]==nil
88
+ hash["width"]=1500
89
+ else
90
+ hash["width"]=params["width"]
91
+ end
92
+
93
+ if params["height"]==nil
94
+ hash["height"]=800
95
+ else
96
+ hash["height"]=params["height"]
97
+ end
98
+
99
+ if params["file_name"]==nil
100
+ hash["file_name"]="sample.jpg"
101
+ else
102
+ hash["file_name"]=params["file_name"]
103
+ end
104
+
105
+ params_map = HashMap.new(hash)
106
+ return params_map
107
+ end
108
+
109
+
110
+ def getValue
111
+ @value
112
+ end
113
+
114
+ def getParams
115
+ @params
116
+ end
117
+
118
+
119
+ def save
120
+ begin
121
+ a = Java::ComDomain::clocomics
122
+ a.save_box(self.getValue,self.getParams)
123
+ rescue Exception => ex
124
+ end
125
+ end
126
+ def view
127
+ begin
128
+ a = Java::ComDomain::clocomics
129
+ a.view_box(self.getValue,self.getParams)
130
+ rescue Exception => ex
131
+ end
132
+
133
+
134
+ end
135
+
136
+ end
@@ -0,0 +1,137 @@
1
+ class FunctionPlot
2
+ # ==== Attributes
3
+ #
4
+ # * +function+ - a String function in Clojure Style
5
+ # * +min+ - Lower Bound
6
+ # * +max+ - Upper Bound
7
+ # * +parms+ - an Hash whit parametrs value
8
+ #
9
+ # ==== Parms
10
+ #
11
+ # This Hash contain parmas .
12
+ # List of key permitted .
13
+ #
14
+ #
15
+ #
16
+ # * +:title+ - (default "A sample Graph") Graph main title
17
+ # * +:x_label+ - (default 'Categories') Label of x ass
18
+ # * +:y_label+ - (default 'Value') Label of y ass
19
+ # * +:legend+ - (default false) Prints legend
20
+ # * +:height+ - (default 1500) Graph height
21
+ # * +:width+ - (default 800) Graph width
22
+ # * +:file_name+ - (default sample.jpg) Graph File Name/Path to save plot. You can chose jpg or pdf
23
+ #
24
+ # ==== Examples
25
+ #
26
+ # Class Usage:
27
+ #
28
+ # function = "(defn cubic [x] (+ (* x x x) (* 2 x x) (* 2 x) 3))"
29
+ # min = 0
30
+ # max = 50
31
+ # params = {"title" => "Plot my Function"}
32
+ # plot = FunctionPlot.new(function,min,max,params)
33
+ # #To view
34
+ # plot.view
35
+ # #to save
36
+ # plot.save
37
+
38
+ def initialize(function,min,max,params)
39
+ @params=self.check_par(params)
40
+ @function=function
41
+ @min=min
42
+ @max=max
43
+ end
44
+
45
+ def check_par(params)
46
+ hash = Hash.new
47
+ permitted = ["title","x_label","y_label","legend","width","height","file_name"]
48
+ keys = params.keys
49
+ keys.each{ |key|
50
+ if permitted.include?(key)==false
51
+ raise "Error : Permitted key are title,x_label,y_label,legend,width,height,file_name"
52
+ end
53
+ }
54
+
55
+ if params["title"]==nil
56
+ hash["title"]="A sample Graph"
57
+ else
58
+ hash["title"]=params["title"]
59
+ end
60
+
61
+ if params["x_label"]==nil
62
+ hash["x_label"]="Categories"
63
+ else
64
+ hash["x_label"]=params["x_label"]
65
+ end
66
+
67
+ if params["y_label"]==nil
68
+ hash["y_label"]="Values"
69
+ else
70
+ hash["y_label"]=params["y_label"]
71
+ end
72
+
73
+
74
+ if params["legend"]==nil
75
+ hash["legend"]=false
76
+ else
77
+ hash["legend"]=params["legend"]
78
+ end
79
+
80
+
81
+ if params["width"]==nil
82
+ hash["width"]=1500
83
+ else
84
+ hash["width"]=params["width"]
85
+ end
86
+
87
+ if params["height"]==nil
88
+ hash["height"]=800
89
+ else
90
+ hash["height"]=params["height"]
91
+ end
92
+
93
+ if params["file_name"]==nil
94
+ hash["file_name"]="sample.jpg"
95
+ else
96
+ hash["file_name"]=params["file_name"]
97
+ end
98
+
99
+ params_map = HashMap.new(hash)
100
+ return params_map
101
+ end
102
+
103
+ def getFunction
104
+ @function
105
+ end
106
+
107
+ def getMin
108
+ @min
109
+ end
110
+
111
+ def getMax
112
+ @max
113
+ end
114
+
115
+ def getParams
116
+ @params
117
+ end
118
+
119
+
120
+ def save
121
+ begin
122
+ a = Java::ComDomain::clocomics
123
+ a.save_function(self.getFunction,self.getMin,self.getMax,self.getParams)
124
+ rescue Exception => ex
125
+ end
126
+ end
127
+ def view
128
+ begin
129
+ a = Java::ComDomain::clocomics
130
+ a.view_function(self.getFunction,self.getMin,self.getMax,self.getParams)
131
+ rescue Exception => ex
132
+ end
133
+
134
+
135
+ end
136
+
137
+ end