def test_parse():
    p = GpadParser(config=assocparser.AssocParserConfig(
        group_metadata=yaml.load(open("tests/resources/mgi.dataset.yaml"),
                                 Loader=yaml.FullLoader)))
    test_gpad_file = "tests/resources/mgi.test.gpad"
    results = p.parse(open(test_gpad_file, "r"))
    print(p.report.to_markdown())
Esempio n. 2
0
def test_invalid_goid_in_gpad():
    # Note: this ontology is a subset of GO extracted using the GAF, not GPAD
    p = GpadParser()
    p.config.ontology = OntologyFactory().create(ONT)
    results = p.parse(open(POMBASE_GPAD, "r"), skipheader=True)

    # we expect errors since ONT is not tuned for the GPAD file
    # for m in p.report.messages:
    #     print("MESSAGE: {}".format(m))
    assert len(p.report.messages) > 500
    print(p.report.to_markdown())
Esempio n. 3
0
def test_parse():
    p = GpadParser()
    results = p.parse(open(POMBASE, "r"))
    for r in results:
        print(str(r))
Esempio n. 4
0
                        if sorted(r.upper() for r in source['evidence']['has_supporting_reference']) == \
                                sorted(r.upper() for r in target['evidence']['has_supporting_reference']):
                            match_score = 5
    return match_score


if __name__ == '__main__':
    f = open("compare.txt", "w")
    print("Starting comparison ")
    parser = argparse.ArgumentParser()
    parser.add_argument('-g1', '--gpad_file1', help="Filepath of GPAD file 1", required=True)
    parser.add_argument('-g2', '--gpad_file2', help="Filepath of GPAD file 2", required=True)
    args = parser.parse_args()

    gpad_parser = GpadParser()
    assocs1 = gpad_parser.parse(args.gpad_file1, skipheader=True)
    assocs2 = gpad_parser.parse(args.gpad_file2, skipheader=True)
    for a in assocs1:
        #gene_id_a = a["subject"]["id"]
        #ont_id_a = a["object"]["id"]
        #print("a" + gene_id_a + " "+ont_id_a)
        match = is_assoc_in_list(a, assocs2)
        if match.__eq__("exact match"):
            exact_matches = exact_matches + 1
        elif match.__eq__("close match"):
            close_matches = close_matches + 1
        elif match.__eq__("no match"):
            no_matches = no_matches + 1
        f.write(match + "\t" + a["source_line"])
        input_lines = input_lines + 1
    f.close()
Esempio n. 5
0
 def __init__(self, gpad_file, filter_rule: FilterRule):
     gpad_parser = GpadParser()
     assocs = gpad_parser.parse(gpad_file, skipheader=True)
     self.assocs = extract_properties_from_assocs(assocs)
     self.assoc_filter = AssocFilter(filter_rule)