def parse_with(f, p): p.config.ecomap = EcoMap() is_gaf = f == POMBASE ont = OntologyFactory().create(ONT) if is_gaf: # only do ontology checking on GAF parse; # this is because ontology is made from GAF p.config.ontology = ont else: p.config.ontology = None results = p.parse(open(f, "r"), skipheader=True) print(p.report.to_markdown()) r1 = results[0] # TODO: test datafile does not have ECOs yet!! assert ecomap.ecoclass_to_coderef(str( r1.evidence.type))[0] == 'ISO' or str( r1.evidence.type) == 'ECO:0000201' assert r1.evidence.with_support_from == [ association.ConjunctiveSet( [association.Curie.from_str('SGD:S000001583')]) ] assert r1.evidence.has_supporting_reference == [ association.Curie.from_str('GO_REF:0000024') ] if is_gaf: assert r1.subject.label == 'ypf1' assert association.ymd_str(r1.date, "") == '20150305' for r in results: #print(str(r)) sid = r.subject.id prov = r.provided_by assert prov == 'PomBase' or prov == 'UniProt' assert r.object.id.namespace == "GO" assert sid.namespace == 'PomBase' or (not is_gaf and sid.namespace == 'PR') if is_gaf: assert str(r.subject.taxon) == 'NCBITaxon:4896' # for m in p.report.messages: # print("MESSAGE: {}".format(m)) print("MESSAGES (sample): {}".format(p.report.messages[0:5])) # Messages that aren't about upgrading qualifiers in rule 59 should be 0 assert len([ msg for msg in p.report.messages if msg["rule"] != 59 and msg["rule"] != 27 ]) == 0
def test_date(): date_str = "20210105" date = association.Date(date_str[0:4], date_str[4:6], date_str[6:8], "") assert association.ymd_str(date, "-") == "2021-01-05"