simple_bioc 0.0.9 → 0.0.10
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.
- checksums.yaml +4 -4
- data/lib/simple_bioc/bioc_merger.rb +63 -17
- data/lib/simple_bioc/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38665d005a277e7bd83304fe0773618a2f242d54
|
4
|
+
data.tar.gz: 7101cfef679db82fbebc46d209b132a5a0952b6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b57ddecef7b4ed0654736a34dbf64af7a9096cb7a7b10bef11ed48bf4caa01540053177e9ae39c30bfe68c5eab81e8f755ee7030c5cfec2fe1cae4afed8f4da
|
7
|
+
data.tar.gz: e306a112cf15ccc092e93478226e35ce9f391fc456371791e4f0e74838efcfe05a7f26c0216ebd5e1a0fd93dbef1ee469c5479596189003e5bc1d12be56c4e0a
|
@@ -128,32 +128,78 @@ module BioCMerger
|
|
128
128
|
end
|
129
129
|
end
|
130
130
|
def copy_relation(doc, dest, relation, id_map)
|
131
|
-
new_r =
|
132
|
-
|
131
|
+
new_r = nil
|
132
|
+
need_add = true
|
133
|
+
dest.relations.each do |r|
|
134
|
+
if r.id == relation.id
|
135
|
+
new_r = r
|
136
|
+
need_add = false
|
137
|
+
break
|
138
|
+
end
|
139
|
+
end
|
140
|
+
if new_r.nil?
|
141
|
+
new_r = SimpleBioC::Relation.new(dest)
|
142
|
+
new_r.id = choose_id(doc, relation.id, id_map)
|
143
|
+
new_r.original = relation
|
144
|
+
end
|
145
|
+
|
133
146
|
relation.nodes.each do |n|
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
147
|
+
found = false
|
148
|
+
new_r.nodes.each do |old_n|
|
149
|
+
if n.refid == old_n.refid && n.role == old_n.role
|
150
|
+
found = true
|
151
|
+
break
|
152
|
+
end
|
153
|
+
end
|
154
|
+
unless found
|
155
|
+
node = SimpleBioC::Node.new(new_r)
|
156
|
+
node.refid = n.refid
|
157
|
+
node.role = n.role
|
158
|
+
new_r.nodes << node
|
159
|
+
end
|
138
160
|
end
|
139
161
|
copy_infons(new_r, relation)
|
140
|
-
|
141
|
-
|
162
|
+
if need_add
|
163
|
+
dest.relations << new_r
|
164
|
+
end
|
142
165
|
end
|
143
166
|
|
144
167
|
def copy_annotation(doc, dest, annotation, id_map)
|
145
|
-
new_a =
|
146
|
-
|
147
|
-
|
148
|
-
|
168
|
+
new_a = nil
|
169
|
+
need_add = true
|
170
|
+
dest.annotations.each do |a|
|
171
|
+
if a.id == annotation.id && a.text == annotation.text
|
172
|
+
new_a = a
|
173
|
+
need_add = false
|
174
|
+
break
|
175
|
+
end
|
176
|
+
end
|
177
|
+
if new_a.nil?
|
178
|
+
new_a = SimpleBioC::Annotation.new(dest)
|
179
|
+
new_a.id = choose_id(doc, annotation.id, id_map)
|
180
|
+
new_a.text = annotation.text
|
181
|
+
new_a.locations = []
|
182
|
+
end
|
183
|
+
|
149
184
|
annotation.locations.each do |l|
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
185
|
+
found = false
|
186
|
+
new_a.locations.each do |old_l|
|
187
|
+
if l.offset == old_l.offset && l.length == old_l.length
|
188
|
+
found = true
|
189
|
+
break
|
190
|
+
end
|
191
|
+
end
|
192
|
+
unless found
|
193
|
+
new_l = SimpleBioC::Location.new(new_a)
|
194
|
+
new_l.offset = l.offset
|
195
|
+
new_l.length = l.length
|
196
|
+
new_a.locations << new_l
|
197
|
+
end
|
154
198
|
end
|
155
199
|
copy_infons(new_a, annotation)
|
156
|
-
|
200
|
+
if need_add
|
201
|
+
dest.annotations << new_a
|
202
|
+
end
|
157
203
|
end
|
158
204
|
|
159
205
|
def choose_id(doc, id, id_map)
|
data/lib/simple_bioc/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_bioc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dongseop Kwon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|