def read_gaf(fin_gaf, prt=sys.stdout, **kws): """Read Gene Association File (GAF). Return data.""" # keyword arguments what is read from GAF. hdr_only = kws.get('hdr_only', None) # Read all data from GAF by default # Read GAF file gafobj = GafReader(fin_gaf, hdr_only, prt, **kws) return gafobj.read_gaf(**kws)
def test_gaf_illegal(prt=sys.stdout): """Test finding and reporting illegal GAF lines seen in the field.""" fin_gaf = os.path.join(REPO, 'data/gaf/goa_human_illegal.gaf') gafobj = GafReader(fin_gaf, hdr_only=False, prt=prt) id2gos = gafobj.read_gaf() # Read associations assert len(id2gos) == 15, "IDS FOUND: EXP({E}) ACT({A})".format( E=15, A=len(id2gos)) assert len(gafobj.datobj.ignored) == 1 assert len(gafobj.datobj.illegal_lines['ILLEGAL TAXON']) == 1