Ejemplo n.º 1
0
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')
Ejemplo n.º 2
0
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)
Ejemplo n.º 3
0
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)
Ejemplo n.º 4
0
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')
Ejemplo n.º 5
0
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)
Ejemplo n.º 6
0
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)
Ejemplo n.º 7
0
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))
Ejemplo n.º 8
0
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))
Ejemplo n.º 9
0
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')
Ejemplo n.º 10
0
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')
Ejemplo n.º 11
0
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)))
Ejemplo n.º 12
0
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
Ejemplo n.º 13
0
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)))
Ejemplo n.º 14
0
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))
Ejemplo n.º 15
0
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))
Ejemplo n.º 16
0
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)))
Ejemplo n.º 17
0
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)))