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
|
# File 'lib/oddb/export/yaml.rb', line 153
def export(io)
raise "please specify which type of document you want to export" unless infotype
infos = []
names = {}
ODDB::Drugs::Sequence.all do |seq|
info = seq.send infotype
unless info.empty?
lnms = names[info.oid] ||= {}
info.canonical.each do |key, doc|
if (doc = info.send(key)) && (name = identify_name(seq, key))
lnms[key] = name
end
end
infos.push info
end
end
infos.uniq!
infos.each do |info|
info.canonical.each do |key, doc|
doc.title = names[info.oid][key]
end
io.puts info.to_yaml
end
nil
end
|