-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
111 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env python | ||
|
||
# from bel.Config import config | ||
# import bel.edge.edges | ||
# import json | ||
|
||
|
||
# def test_get_start_dates(): | ||
|
||
# doc = bel.edge.edges.get_start_dates() | ||
# print(doc) | ||
# assert doc['_key'] == 'nanopubstore_start_dt' | ||
# assert 'start_dates' in doc | ||
|
||
|
||
# def test_update_start_dates(): | ||
|
||
# bel.edge.pipeline.put_start_dates('https://nanopubstore.demo.biodati.com', '2018-02-21T01:01:30.000Z') | ||
# doc = bel.edge.pipeline.get_start_dates() | ||
# print(f'Doc1: {json.dumps(doc, indent=4)}') | ||
# assert '2018-02-21T01:01:30.000Z' == [start_date for start_date in doc['start_dates'] if start_date['nanopubstore_url'] == 'https://nanopubstore.demo.biodati.com'][0]['start_dt'] | ||
|
||
# bel.edge.pipeline.put_start_dates('https://nanopubstore.test.biodati.com', '2018-01-21T01:01:30.000Z') | ||
# doc = bel.edge.pipeline.get_start_dates() | ||
# print(f'Doc2: {json.dumps(doc, indent=4)}') | ||
# assert '2018-01-21T01:01:30.000Z' == [start_date for start_date in doc['start_dates'] if start_date['nanopubstore_url'] == 'https://nanopubstore.test.biodati.com'][0]['start_dt'] | ||
|
||
# bel.edge.pipeline.put_start_dates('https://nanopubstore.demo.biodati.com', '2018-02-30T01:01:30.000Z') | ||
# doc = bel.edge.pipeline.get_start_dates() | ||
# print(f'Doc3: {json.dumps(doc, indent=4)}') | ||
# assert '2018-02-30T01:01:30.000Z' == [start_date for start_date in doc['start_dates'] if start_date['nanopubstore_url'] == 'https://nanopubstore.demo.biodati.com'][0]['start_dt'] | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import bel.lang.migrate_1_2 | ||
|
||
|
||
def test_migrate(): | ||
|
||
# No migration examples | ||
bel1 = 'sec(a(CHEBI:"3-hydroxybutyrate"))' | ||
bel2 = 'sec(a(CHEBI:"3-hydroxybutyrate"))' | ||
|
||
assert bel.lang.migrate_1_2.migrate(bel1) == bel2 | ||
|
||
# kin() -> activity() | ||
# bel1 = 'p(HGNC:BRAF,sub(V,599,E)) directlyIncreases kin(p(HGNC:BRAF))' | ||
# bel2 = 'p(HGNC:BRAF, var("p.599V>E")) directlyIncreases act(p(HGNC:BRAF), ma(kin))' | ||
|
||
bel1 = 'kin(p(HGNC:BRAF))' | ||
bel2 = 'act(p(HGNC:BRAF), ma(kin))' | ||
|
||
assert bel.lang.migrate_1_2.migrate(bel1) == bel2 | ||
|
||
# cat() -> act() | ||
bel1 = 'cat(p(RGD:Sod1))' | ||
bel2 = 'act(p(RGD:Sod1), ma(cat))' | ||
|
||
assert bel.lang.migrate_1_2.migrate(bel1) == bel2 | ||
|
||
# sub() -> var() | ||
|
||
# p(HGNC:CFTR, var(p.Gly576Ala)) # substitution using 3 or 1 letter amino acid code, *=stop codon | ||
# p(HGNC:CFTR, var(p.C65* )) # truncation at residue 65 | ||
# r(HGNC:CFTR), var(r.243a>u) # [a, g, c, u] | ||
# g(HGNC:CFTR), var(c.243A>T) # [A, G, C, T] (g.* prefix is for genomic sequence) | ||
|
||
bel1 = 'p(HGNC:PIK3CA, sub(E, 545, K))' | ||
bel2 = 'p(HGNC:PIK3CA, var("p.Glu545Lys"))' | ||
|
||
assert bel.lang.migrate_1_2.migrate(bel1) == bel2 | ||
|
||
# trunc() -> var() | ||
bel1 = 'p(HGNC:ABCA1, trunc(1851))' | ||
bel2 = 'p(HGNC:ABCA1, var("truncated at 1851"))' | ||
|
||
assert bel.lang.migrate_1_2.migrate(bel1) == bel2 | ||
|
||
# fus() | ||
bel1 = 'r(HGNC:BCR, fus(HGNC:JAK2, 1875, 2626), pmod(P))' | ||
bel2 = 'r(fus(HGNC:BCR, "r.1_1875", HGNC:JAK2, "r.2626_?"), pmod(Ph))' | ||
|
||
assert bel.lang.migrate_1_2.migrate(bel1) == bel2 | ||
|
||
bel1 = 'p(HGNC:BCR, fus(HGNC:JAK2))' | ||
bel2 = 'p(fus(HGNC:BCR, ?, HGNC:JAK2, ?))' | ||
|
||
assert bel.lang.migrate_1_2.migrate(bel1) == bel2 | ||
|
||
# pmod() - updating modtype | ||
bel1 = 'p(HGNC:MAPK1, pmod(P, Thr, 185))' | ||
bel2 = 'p(HGNC:MAPK1, pmod(Ph, Thr, 185))' | ||
|
||
assert bel.lang.migrate_1_2.migrate(bel1) == bel2 | ||
|
||
# tloc() | ||
bel1 = 'tloc(p(HGNC:EGFR), MESHCL:Cytoplasm, MESHCL:"Cell Nucleus")' | ||
bel2 = 'tloc(p(HGNC:EGFR), fromLoc(MESHCL:Cytoplasm), toLoc(MESHCL:"Cell Nucleus"))' | ||
|
||
assert bel.lang.migrate_1_2.migrate(bel1) == bel2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import bel.lang.partialparse | ||
|
||
|
||
def test_parse(): | ||
|
||
bel_version = '2.0.0' | ||
belstr = 'sec(a(CHEBI:"3-hydroxybutyrate"))' | ||
ast = bel.lang.partialparse.get_ast_obj(belstr, bel_version) | ||
|
||
print(ast.to_string()) | ||
|
||
assert False |