Closed thomasleb0n closed 2 months ago
Update: I found a temporary fix. I'm not sure exactly how or why it works.
UNWIND ["AAAS","AMIGO2","ANKRD33","ATG101","CCDC65","CELA1","CSRNP2","DAZAP2","DDN","IGFBP6","KCNH3","KRT1","KRT18","KRT2","KRT4","KRT5","KRT6A","KRT6B","KRT7","KRT71","KRT72","KRT73","KRT75","KRT76","KRT77","KRT78","KRT79","KRT8","KRT80","KRT81","KRT82","KRT83","KRT84","KRT86","LETMD1","MAP3K12","SLC38A4","SPATS2","YAF2"] as text
MATCH (g:Gene) WHERE g.name = text
OPTIONAL MATCH (g)--(c:Compound)
WITH g,collect(c.name)[..5] as comp, text
OPTIONAL MATCH (g)--(b:BiologicalProcess)
WITH g, collect(b.name)[..3] as bio, comp, text
OPTIONAL MATCH (g)--(m:MolecularFunction)
RETURN text as Gene,comp as Compound,bio as BiologicalProcess,collect(m.name)[..3] as MolecularFunction
Cool thanks for the update. I don't have a ton of time right now to help with the Cypher, but looks like you're on the right track. I've found StackOverflow and the neo4j community forum to be helpful resources in the past for Cypher questions.
Hello,
I have a list of genes and I want to print their immediate connection to the following node labels: Compound, BiologicalProcess, and Molecular Function. I want precisely three nodes for each relation from every gene in the array.
The following command is working for two OPTIONAL MATCH conditions. I have ran the following query to get the Compound and BiologicalProcess relations in NEO4J browser:
But now I want to get all three relations with the following script:
When I run this, the following error occurs:
Anyone know a more efficient way of dealing with this problem? Or understand why the comp variable is suddenly not defined after a third optional match statement?
Thank you in advance!