Skip to content

Instantly share code, notes, and snippets.

@dosumis
Created March 25, 2020 17:58
Show Gist options
  • Save dosumis/9e2551acd3daa2f2343c6ee169ee71a7 to your computer and use it in GitHub Desktop.
Save dosumis/9e2551acd3daa2f2343c6ee169ee71a7 to your computer and use it in GitHub Desktop.
Scripts for generating FB->VFB linkouts
from vfb_connect.neo.neo4j_tools import Neo4jConnect, dict_cursor
nc = Neo4jConnect('http://kb.virtualflybrain.org', 'neo4j', 'neo4j')
query = """MATCH (f:Feature)<-[]-(ep:Class)-[dbx:hasDbXref]->(s:Site)
WHERE (s.short_form = 'FlyLight') OR (s.short_form = 'FlyLightSplit')
WITH f, ep MATCH (ep)<-[:INSTANCEOF]-(i:Individual)
<-[]-(channel:Individual)-[irw:in_register_with]->(t:Individual)
WITH distinct f.short_form AS `#FlyBase ID`,
collect(i.short_form)[0] AS DBURL, ep.label AS epl, t.label as template
RETURN `#FlyBase ID`, DBURL, 'VFB' AS DBNAME,
epl + ' in ' + replace(
replace(template, ' template - Court2018_c', ''),
'JFRC2_template_c',
'adult brain') + ' on Virtual Fly Brain' AS DBID ORDER BY `#FlyBase ID`"""
q = nc.commit_list([query])
dc = dict_cursor(q)
df = pd.DataFrame.from_records(dc)
df.to_csv('VFB_linkout.txt', sep = "\t")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment