def test_gpa_iterator(self): """Test GOA GPA file iterator.""" recs = [] with open("UniProt/goa_yeast.gpa.59.gpa") as handle: for rec in GOA.gpa_iterator(handle): recs.append(rec) self.assertEqual(len(recs), 300) self.assertEqual(sorted(recs[0].keys()), sorted(GOA.GPA11FIELDS)) # Check values of first record self.assertEqual(recs[0]["DB"], "UniProtKB") self.assertEqual(recs[0]["DB_Object_ID"], "A0A023PXA5") self.assertEqual(recs[0]["Qualifier"], ["enables"]) self.assertEqual(recs[0]["GO_ID"], "GO:0003674") self.assertEqual(recs[0]["DB:Reference"], ["GO_REF:0000015"]) self.assertEqual(recs[0]["ECO_Evidence_code"], "ECO:0000307") self.assertEqual(recs[0]["With"], [""]) self.assertEqual(recs[0]["Interacting_taxon_ID"], "") self.assertEqual(recs[0]["Date"], "20030730") self.assertEqual(recs[0]["Assigned_by"], "SGD") self.assertEqual(recs[0]["Annotation Extension"], [""]) self.assertEqual(recs[0]["Annotation_Properties"], "go_evidence=ND")
def test_gpa_iterator(self): """Test GOA GPA file iterator.""" recs = [] with open('UniProt/goa_yeast.gpa.59.gpa', 'r') as handle: for rec in GOA.gpa_iterator(handle): recs.append(rec) self.assertEqual(len(recs), 300) self.assertEqual(sorted(recs[0].keys()), sorted(GOA.GPA11FIELDS)) # Check values of first record self.assertEqual(recs[0]['DB'], 'UniProtKB') self.assertEqual(recs[0]['DB_Object_ID'], 'A0A023PXA5') self.assertEqual(recs[0]['Qualifier'], ['enables']) self.assertEqual(recs[0]['GO_ID'], 'GO:0003674') self.assertEqual(recs[0]['DB:Reference'], ['GO_REF:0000015']) self.assertEqual(recs[0]['ECO_Evidence_code'], 'ECO:0000307') self.assertEqual(recs[0]['With'], ['']) self.assertEqual(recs[0]['Interacting_taxon_ID'], '') self.assertEqual(recs[0]['Date'], '20030730') self.assertEqual(recs[0]['Assigned_by'], 'SGD') self.assertEqual(recs[0]['Annotation Extension'], ['']) self.assertEqual(recs[0]['Annotation_Properties'], 'go_evidence=ND')