-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathobo_test.go
96 lines (76 loc) · 2.65 KB
/
obo_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/* See LICENSE file for copyright and license details. */
package obo
import (
"bufio"
"strings"
"testing"
)
func TestOboParsing(*testing.T) {
var obolist []*OboTermEntry
parentchildren := make(map[string][]*OboTermEntry)
obochan := make(chan *OboTermEntry)
s := `
format-version: 1.2
date: 17:11:2011 13:07
saved-by: lschriml
auto-generated-by: OBO-Edit 2.1-beta6
default-namespace: symptoms
[Typedef]
id: part_of
name: part_of
[Term]
id: SYMP:0000000
! We do not care about this comment
name: cellulitis
def: "Cellulitis is a musculoskeletal system symptom characterized as a diffuse and especially subcutaneous inflammation of connective tissue." [URL:http\://www2.merriam-webster.com/cgi-bin/mwmednlm?book=Medical&va=cellulitis]
is_a: SYMP:0000891 ! musculoskeletal system symptom
[Term]
id: SYMP:0000001
name: abdominal cramp
is_a: SYMP:0000461 ! abdominal symptom
[Term]
id: SYMP:0000002
name: abdominal distention
is_a: SYMP:0000461 ! abdominal symptom
[Term]
id: SYMP:0000003
name: acute enteritis in newborns
is_obsolete: true
[Term]
id: SYMP:0000004
name: arrested moulting
is_obsolete: true
[Term]
id: SYMP:0000005
name: ataxia
def: "Ataxia is a neurological and physiological symptom characterized by an inability to coordinate voluntary muscular movements that is symptomatic of some nervous disorders." [URL:http\://www2.merriam-webster.com/cgi-bin/mwmednlm?book=Medical&va=ataxia]
synonym: "uncoordination" EXACT []
is_a: SYMP:0000410 ! neurological and physiological symptom
[Term]
id: SYMP:0000006
name: backache
def: "Backache is a pain occurring in the lower back." [URL:http\://www2.merriam-webster.com/cgi-bin/mwmednlm?book=Medical&va=backache]
synonym: "back pain" EXACT []
is_a: SYMP:0000099 ! pain
[Term]
id: SYMP:0000007
name: bleeding
def: "A general symptom that is characterized as an act, instance, or result of being bled or the process by which something is bled: as a the escape of blood from vessels." [url:http\://www.merriam-webster.com/medlineplus/bleeding]
is_a: SYMP:0000567 ! general symptom
[Term]
id: SYMP:0000008
name: blindness
is_a: SYMP:0000320 ! vision symptom
[Term]
id: SYMP:0000009
name: blister
def: "Blister is a skin and integumentary tissue symptom characterized as a fluid-filled elevation of the epidermis." [url:http\://www2.merriam-webster.com/cgi-bin/mwmednlm?book=Medical&va=blister]`
stringreader1 := bufio.NewReader(strings.NewReader(s))
stringreader2 := bufio.NewReader(strings.NewReader(s))
obolist, parentchildren = ParseToSlice(*stringreader1, parentchildren, obolist)
obochan = ParseToChannel(*stringreader2, obochan)
for ent := range obochan {
obolist = append(obolist, ent)
}
Dump(obolist, parentchildren)
}