def test_parse_site_text(): rp = ReachProcessor(None) text = ['threonine 185', 'thr 185', 'thr-185', 'threonine residue 185', 'T185'] for t in text: residue, site = rp._parse_site_text(t) assert(residue == 'Threonine') assert(site == '185')
def test_parse_site_residue_only(): rp = ReachProcessor(None) text = ['serine residue', 'serine', 'a serine site'] for t in text: residue, site = rp._parse_site_text(t) assert(residue == 'Serine') assert(site is None)
def test_parse_site_residue_only(): rp = ReachProcessor(None) text = ['serine residue', 'serine', 'a serine site'] for t in text: residue, site = rp._parse_site_text(t) assert (residue == 'Serine') assert (site is None)
def test_parse_site_text(): rp = ReachProcessor(None) text = [ 'threonine 185', 'thr 185', 'thr-185', 'threonine residue 185', 'T185' ] for t in text: residue, site = rp._parse_site_text(t) assert (residue == 'Threonine') assert (site == '185')
def test_parse_site_residue_only(): text = ['serine residue', 'serine', 'a serine site', 's', 'ser'] assert unicode_strs(text) for t in text: residue, site = ReachProcessor._parse_site_text(t) assert unicode_strs((residue, site)) assert (residue == 'S') assert (site is None)
def test_parse_site_residue_only(): text = ['serine residue', 'serine', 'a serine site', 's', 'ser'] assert unicode_strs(text) for t in text: residue, site = ReachProcessor._parse_site_text(t) assert unicode_strs((residue, site)) assert(residue == 'S') assert(site is None)
def test_parse_site_text(): text = ['threonine 185', 'thr 185', 'thr-185', 'threonine residue 185', 'T185'] assert unicode_strs(text) for t in text: residue, site = ReachProcessor._parse_site_text(t) assert(residue == 'T') assert(site == '185') assert unicode_strs((residue, site))
def test_parse_site_text(): text = [ 'threonine 185', 'thr 185', 'thr-185', 'threonine residue 185', 'T185' ] assert unicode_strs(text) for t in text: residue, site = ReachProcessor._parse_site_text(t) assert (residue == 'T') assert (site == '185') assert unicode_strs((residue, site))
def test_valid_name(): assert(ReachProcessor._get_valid_name('') == '') assert(ReachProcessor._get_valid_name('a') == 'a') assert(ReachProcessor._get_valid_name('Name123') == 'Name123') assert(ReachProcessor._get_valid_name('<>#~!,./][;-') == '____________') assert(ReachProcessor._get_valid_name('PI3 Kinase') == 'PI3_Kinase') assert(ReachProcessor._get_valid_name('14-3-3') == 'p14_3_3')
def test_valid_name(): assert (ReachProcessor._get_valid_name('') == '') assert (ReachProcessor._get_valid_name('a') == 'a') assert (ReachProcessor._get_valid_name('Name123') == 'Name123') assert (ReachProcessor._get_valid_name('<>#~!,./][;-') == '____________') assert (ReachProcessor._get_valid_name('PI3 Kinase') == 'PI3_Kinase') assert (ReachProcessor._get_valid_name('14-3-3') == 'p14_3_3')
def test_parse_site_text_other_aa(): t = 'A431' residue, site = ReachProcessor._parse_site_text(t) assert(residue == 'A') assert(site == '431') assert(unicode_strs((residue, site)))
def process_json_str(json_str, citation=None): """Return a ReachProcessor by processing the given REACH json string. The output from the REACH parser is in this json format. For more information on the format, see: https://github.com/clulab/reach Parameters ---------- json_str : str The json string to be processed. citation : Optional[str] A PubMed ID passed to be used in the evidence for the extracted INDRA Statements. Default: None Returns ------- rp : ReachProcessor A ReachProcessor containing the extracted INDRA Statements in rp.statements. """ assert isinstance(json_str, basestring) json_str = json_str.replace('frame-id', 'frame_id') json_str = json_str.replace('argument-label', 'argument_label') json_str = json_str.replace('object-meta', 'object_meta') json_str = json_str.replace('doc-id', 'doc_id') json_str = json_str.replace('is-hypothesis', 'is_hypothesis') json_str = json_str.replace('is-negated', 'is_negated') json_str = json_str.replace('is-direct', 'is_direct') json_str = json_str.replace('found-by', 'found_by') try: json_dict = json.loads(json_str) except ValueError: logger.error('Could not decode JSON string.') return None rp = ReachProcessor(json_dict, citation) rp.get_modifications() rp.get_complexes() rp.get_activation() rp.get_translocation() rp.get_regulate_amounts() return rp
def test_parse_site_text_number_first(): t = '293T' residue, site = ReachProcessor._parse_site_text(t) assert(residue == 'T') assert(site == '293') assert(unicode_strs((residue, site)))
def test_parse_site_text_number(): t = '135' residue, site = ReachProcessor._parse_site_text(t) assert(residue is None) assert(site == '135') assert(unicode_strs(site))
def test_parse_site_text_number(): t = '135' residue, site = ReachProcessor._parse_site_text(t) assert (residue is None) assert (site == '135') assert (unicode_strs(site))
def test_parse_site_text_number_first(): t = '293T' residue, site = ReachProcessor._parse_site_text(t) assert (residue == 'T') assert (site == '293') assert (unicode_strs((residue, site)))
def test_parse_site_text_other_aa(): t = 'A431' residue, site = ReachProcessor._parse_site_text(t) assert (residue == 'A') assert (site == '431') assert (unicode_strs((residue, site)))