def test_no_optional_attrs():
    """Test loading DAG with no optional attributes."""
    obj = OptionalAttrs("go-basic.obo", None)
    obj.chk_no_optattrs()
    obj = OptionalAttrs("go-basic.obo", [])
    obj.chk_no_optattrs()
    obj = OptionalAttrs("go-basic.obo", set([]))
    obj.chk_no_optattrs()
Ejemplo n.º 2
0
def test_optional_attrs():
    """Test loading optional GO term field, 'synonym'."""
    # Summary for all fields in a GO DAG
    opt_attrs = ['relationship']
    obj = OptionalAttrs("go-basic.obo", opt_attrs)

    # RELATIONSHIP: Stored in a dict with values being sets of GO IDs
    for rel in [
            'part_of', 'regulates', 'negatively_regulates',
            'positively_regulates'
    ]:
        obj.chk_relationships_rev(rel, prt=None)
        print("PASSED: relationship: {REL}".format(REL=rel))

    obj.prt_summary()
    obj.chk_get_goterms_upper()
    obj.chk_get_goterms_lower()
def test_optional_attrs():
    """Test loading optional GO term field, 'synonym'."""
    # Summary for all fields in a GO DAG
    opt_attrs = ['relationship']
    obj = OptionalAttrs("go-basic.obo", opt_attrs)

    # RELATIONSHIP: Stored in a dict with values being sets of GO IDs
    for rel in ['part_of', 'regulates', 'negatively_regulates', 'positively_regulates']:
        obj.chk_relationships_rev(rel, prt=None)
        print("PASSED: relationship: {REL}".format(REL=rel))

    obj.prt_summary()
    obj.chk_get_goterms_upper()
    obj.chk_get_goterms_lower()
def test_no_optional_attrs():
    """Test loading DAG with no optional attributes."""
    obj = OptionalAttrs("go-basic.obo", None)
    obj.chk_no_optattrs()
Ejemplo n.º 5
0
def test_optional_attrs():
    """Test loading optional GO term field, 'synonym'."""
    prt = sys.stdout
    prt = None
    # Summary for all fields in a GO DAG
    opt_attrs = ['def', 'comment', 'subset', 'synonym', 'xref', 'relationship']
    obj = OptionalAttrs("go-basic.obo", opt_attrs)
    obj.prt_summary()

    # SCALAR: Check optional attributes whose information is stored in string
    for attr in ['defn', 'comment']:
        # Check that all GOTerms have a string; ACTUAL matches EXPECTED if present, else ""
        obj.chk_str(attr)
        print("PASSED COUNT TEST: {ATTR}".format(ATTR=attr))

    # SET: Check optional attributes whose information is stored in a set
    # Check that all GO IDs that should have relationships do have relationships.
    # For each GO ID, check that actual count of a set attr equals expected count
    obj.chk_set('subset')
    print("PASSED: subset")

    # RELATIONSHIP: Stored in a dict with values being sets of GO IDs
    obj.chk_relationships()
    print("PASSED: relationship")

    # SYNONYM: Synonyms are stored in a list of namedtuples
    obj.chk_synonyms(prt)
    print("PASSED: synonyms")

    # XREF: Stored in a set
    obj.chk_xref(prt)
    print("PASSED: xrefs")
def test_optional_attrs():
    """Test loading optional GO term field, 'synonym'."""
    args = set(sys.argv[1:])
    prt = sys.stdout if 'prt' in args else None
    exit_if_warning = 'die' in args
    # Summary for all fields in a GO DAG
    opt_attrs = ['def', 'comment', 'subset', 'synonym', 'xref', 'relationship']
    obj = OptionalAttrs("go-basic.obo", opt_attrs)
    obj.prt_summary()

    # SCALAR: Check optional attributes whose information is stored in string
    for attr in ['defn', 'comment']:
        # Check that all GOTerms have a string; ACTUAL matches EXPECTED if present, else ""
        obj.chk_str(attr)
        print("PASSED COUNT TEST: {ATTR}".format(ATTR=attr))

    # SET: Check optional attributes whose information is stored in a set
    # Check that all GO IDs that should have relationships do have relationships.
    # For each GO ID, check that actual count of a set attr equals expected count
    obj.chk_set('subset')
    print("PASSED: subset")

    # RELATIONSHIP: Stored in a dict with values being sets of GO IDs
    obj.chk_relationships()
    print("PASSED: relationship")

    # SYNONYM: Synonyms are stored in a list of namedtuples
    badnts = obj.chk_synonyms(prt)
    _prt_badnts(badnts, exit_if_warning)
    print("PASSED: synonyms")

    # XREF: Stored in a set
    obj.chk_xref(prt)
    print("PASSED: xrefs")