119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
|
# File 'lib/MARQ/MADB.rb', line 119
def self.saveGPL(platform)
datasets = Object::GEO.platform_datasets(platform).sort
return if datasets.empty?
puts "Saving #{ platform }, #{datasets.length} datasets"
codes = File.open(File.join(Object::GEO.platform_path(platform),'codes')).collect{|l| l.chomp.downcase}
DBcache.save(platform, codes)
Progress.monitor("Saving #{ platform }")
datasets.sort.each{|dataset|
path = Object::GEO.dataset_path(dataset)
experiments = File.open(path + '.experiments').collect{|l| l.chomp}
orders = File.open(path + '.orders').collect{|l| values = l.chomp.split(/\t/).collect{|v| v == "NA" ? nil : v.to_i };}
data = {}
codes.each_with_index{|code,i|
data[code.to_sym] = orders[i]
}
case
when codes.length < 65535
type = "SMALLINT UNSIGNED"
when codes.length < 16777215
type = "MEDIUMINT UNSIGNED"
else
type = "INT UNSIGNED"
end
DBcache.save(dataset + '_experiments', experiments)
DBcache.save(dataset, data, [type] * orders.first.length)
}
return unless File.exist?(File.join(Object::GEO.platform_path(platform),'cross_platform'))
codes = File.open(File.join(Object::GEO.platform_path(platform),'cross_platform')).collect{|l| l.chomp.downcase}
DBcache.save(platform + '_cross_platform', codes)
Progress.monitor("Saving #{ platform }")
datasets.sort.each{|dataset|
path = Object::GEO.dataset_path(dataset)
next unless File.exists?(path + '_cross_platform.experiments')
experiments = File.open(path + '_cross_platform.experiments').collect{|l| l.chomp}
orders = File.open(path + '_cross_platform.orders').collect{|l| values = l.chomp.split(/\t/).collect{|v| v == "NA" ? nil : v.to_i };}
data = {}
codes.each_with_index{|code,i|
data[code.to_sym] = orders[i]
}
case
when codes.length < 65535
type = "SMALLINT UNSIGNED"
when codes.length < 16777215
type = "MEDIUMIN UNSIGNED"
else
type = "INT UNSIGNED"
end
DBcache.save(dataset + '_cross_platform_experiments', experiments)
DBcache.save(dataset + '_cross_platform', data, [type] * orders.first.length)
}
end
|