# baseURI = d['baseURI'] # cursor.close() # Setting by hand again for now (!). Base URI not actually used in ind gen as full IRI taken from KB. vfb_ind = Brain("http://virtualflybrain.org/reports/", "http://purl.obolibrary.org/obo/fbbt/vfb/" + dataset + ".owl") # This sets entity generation to use baseURI from DB. # vfb_ind = Brain(baseURI, baseURI + dataset + ".owl") # This sets entity generation to use baseURI from DB. vfb_image = Brain() # Not specifying base as there seems to be a bug that overides full URL specified when adding individuals. Not ideal! addOboAnnotationProperties(vfb_ind) #addOboAnnotationProperties(vfb_image) addVFBAnnotationProperties(vfb_ind) #vfb_image.addObjectProperty('http://xmlns.com/foaf/0.1/depicts') #vfb_image.addClass('http://xmlns.com/foaf/0.1/image') ont_dict = {} ont_dict['fbbt'] = load_ont(FBBT) #ont_dict['fbbt'] = load_ont("http://purl.obolibrary.org/obo/fbbt/%s/fbbt-simple.owl" % fbbt_release_version) ont_dict['fb_feature'] = load_ont("../../owl/fb_features.owl") #ont_dict['fb_feature'] = load_ont("http://purl.obolibrary.org/obo/fbbt/vfb/fb_features.owl") ont_dict['vfb_ind'] = vfb_ind #ont_dict['vfb_image'] = vfb_image # Commenting for now as problems rolling some image files gen_ind_by_source(nc, ont_dict, dataset) #add_facts(cursor=conn.cursor(), ont=vfb_ind, source=dataset) # Before turning this on, need to make sure all inds declared first. vfb_ind.save("../../owl/" + dataset + ".owl") #vfb_image.save("../../owl/" + dataset + "_image.owl") vfb_ind.sleep() ont_dict['fbbt'].sleep() ont_dict['fb_feature'].sleep()
# baseURI = '' # for d in dc: # baseURI = d['baseURI'] # cursor.close() vfb_ind = Brain('http://www.virtualflybrain.org/owl/', 'http://www.virtualflybrain.org/owl/' + 'flycircuit_plus.owl') # Adding IRI manually for now. # Setup ontologies addOboAnnotationProperties(vfb_ind) addVFBAnnotationProperties(vfb_ind) ont_dict = {} ont_dict['vfb_ind']=vfb_ind ont_dict['fbbt'] = load_ont(FBBT) #ont_dict['fbbt'] = load_ont("http://purl.obolibrary.org/obo/fbbt/%s/fbbt-simple.owl" % fbbt_release_version) ont_dict['fb_feature'] = load_ont("../../owl/fb_features.owl") #ont_dict['fb_feature'] = load_ont("http://purl.obolibrary.org/obo/fbbt/vfb/fb_features.owl") # Now run all the functions gen_ind_by_source(nc, ont_dict, dataset) gen_ind_by_source(nc, ont_dict, "CostaJefferis_v3") # Add v3 clusters #add_manual_ann(conn.cursor(), vfb_ind) add_BN_dom_overlap(nc, vfb_ind, ont_dict['fbbt']) map_to_clusters(nc, vfb_ind) # Save output file and clean up vfb_ind.save("../../owl/flycircuit_plus.owl") #conn.close() vfb_ind.sleep() ont_dict['fbbt'].sleep() ont_dict['fb_feature'].sleep()
if fb['obstat']: warnings.warn(fb['fbid'] +" " + fb['uc_name'] + " is obsolete ! Not adding to fb_feature.owl.") else: if not fb_feature.knowsClass(fb['fbid']): # Only add class if not obsolete. fb_feature.addClass(fb['fbid']) tmp = re.sub("<up\>", "[",fb['uc_name']) uc_name = re.sub("<\/up>", "]", tmp) fb_feature.label(fb['fbid'], uc_name) if re.match('FBtp\d+', fb['fbid']): fb_feature.subClassOf(fb['fbid'], 'SO_0000796') elif re.match('FBti\d+', fb['fbid']): fb_feature.subClassOf(fb['fbid'], 'SO_0001218') elif re.match('FBgn\d+', fb['fbid']): fb_feature.subClassOf(fb['fbid'], 'SO_0000704') elif re.match('FBal\d+', fb['fbid']): fb_feature.subClassOf(fb['fbid'], 'SO_0001023') else: warnings.warn("Ignoring this, as doesn't look like an FB feature: %s." % fb['fbid']) continue time.sleep(0.1) # vfb_ms_conn.close() fb_cursor.close() fb_pg_conn.close() fb_feature.save("../../owl/fb_features.owl") # yuk fb_feature.sleep()