def setUp(self): self.t0 = c.Entity('number', 'GO:testing') self.t1 = c.Entity('amount', 'GO:testing') self.t2 = c.Entity('size', 'GO:testing') self.t3 = c.Entity('count', 'GO:testing') self.c0 = c.Cluster(self.t0, {self.t0, self.t1}) self.c1 = c.Cluster(self.t2, {self.t2, self.t3})
def test_simplity(self): self.t0 = c.Entity('vitamin C', 'GO:000') self.t1 = c.Entity('ascorbic acid', 'GO:000') self.t2 = c.Entity('ascorbate', 'GO:000') self.c0 = c.Cluster(self.t0, {self.t0, self.t1, self.t2}) self.t3 = c.Entity('vitamin C', 'GO:111') self.t4 = c.Entity('L-ascorbic acid', 'GO:111') self.t5 = c.Entity('L-ascorbate', 'GO:111') self.c1 = c.Cluster(self.t3, {self.t3, self.t4, self.t5}) self.t6 = c.Entity('vitamin B12', 'GO:222') self.t7 = c.Entity('cobalamin', 'GO:222') self.c2 = c.Cluster(self.t6, {self.t6, self.t7}) cb = self.cb cb.add(self.c0) cb.add(self.c1) cb.add(self.c2) result = cb.simplify(0.2) self.assertNotEqual(cb.preferred_term(self.t1), cb.preferred_term(self.t3)) self.assertNotEqual(cb.preferred_term(self.t1), cb.preferred_term(self.t6)) self.assertEqual(result.preferred_term(self.t1), result.preferred_term(self.t3)) self.assertNotEqual(result.preferred_term(self.t1), result.preferred_term(self.t6))
def setUp(self): self.t0 = c.Entity('vitamin C', 'GO:000') self.t1 = c.Entity('ascorbic acid', 'GO:000') self.t2 = c.Entity('ascorbate', 'GO:000') self.c0 = c.Cluster(self.t0, {self.t0, self.t1, self.t2}) self.t3 = c.Entity('vitamin C', 'GO:111') self.t4 = c.Entity('L-ascorbic acid', 'GO:111') self.t5 = c.Entity('L-ascorbate', 'GO:111') self.c1 = c.Cluster(self.t3, {self.t3, self.t4, self.t5}) self.t6 = c.Entity('vitamin B12', 'GO:222') self.t7 = c.Entity('cobalamin', 'GO:222') self.c2 = c.Cluster(self.t6, {self.t6, self.t7})
def test_evidence_split(self): regex_in = gopattern.PatternManager.from_definition( PATTERN_PATH).regex_in() goid = 'GO:testing' label = 'upregulation of gene slicing via miRNA' trunk = self.main_trunk t1 = c.Pattern('positregulate', 'annotator') e1 = c.Evidence(t1, 'upregulation', 0, len('upregulation')) t2 = c.Entity('gene slicing', 'GO:testing') e2 = c.Evidence(t2, 'gene slicing', self.label.index('gene slicing'), len(trunk.text)) t3 = c.Constraint('miRNA', 'GO:testing') e3 = c.Evidence(t3, 'miRNA', self.label.index('miRNA'), len(self.label)) result = c.evidence_split(goid, label, regex_in) wanted = [e1, e2, e3] self.assertEqual(result, wanted)
def setUp(self): self.t0 = c.Entity('number', 'GO:testing') self.t1 = c.Entity('amount', 'GO:testing') self.c0 = c.Cluster(self.t0, {self.t0, self.t1}) self.t2 = c.Entity('size', 'GO:testing') self.t3 = c.Entity('count', 'GO:testing') self.c1 = c.Cluster(self.t2, {self.t2, self.t3}) self.t4 = c.Entity('teacher', 'GO:testing') self.t5 = c.Entity('tutor', 'GO:testing') self.c2 = c.Cluster(self.t4, {self.t4, self.t5}) self.cb = c.ClusterBook()