Hi everyone,
I have a problem with apoc.do.case but I do not understand where this come from.
I use apoc.do.case inside an apoc.trigger in this way:
CALL apoc.trigger.add('Trigger','UNWIND $createdNodes AS node
CALL apoc.do.case(
[
node:Mutation, reactkg.criticalEffect(node.name),
node:Sequence and reactkg.unassignedSequence(node.accession), reactkg.sequenceAlerts(5,6, node.accession),
],
"RETURN *", {node:node}) YIELD value
RETURN value', {phase:'afterAsync'});
What I would like this trigger to do is that when new nodes are added from a csv, the trigger checks both the label of the new node and some conditions with a custom procedure. If both conditions are verified then another procedure is called which creates other nodes with label 'Alert'.
However an error comes up only when a node with label Sequence is loaded from the csv:
Failed to invoke procedure `apoc.do.case`: Caused by: org.neo4j.exceptions.SyntaxException: Query cannot conclude with WITH (must be a RETURN clause, an update clause, a unit subquery call, or a procedure call with no YIELD) (line 1, column 2 (offset: 1)) " WITH $ `node` as `node`"
The creation of the node Sequence is done by this query:
MATCH (v:Variant {pangoLineage: '"+csvLine[8]+"'})
MATCH mutations = (m:Mutation) where m.name in "+csvLine[5]+"
MATCH (l:Lab {name: '"+csvLine[7]+"'})
MATCH (p:Patient {cf: '"+csvLine[6]+"'})
MERGE (l)<-[:SEQUENCED_AT]-(s:Sequence {accession: '"+csvLine[2]+"', collectionDate: '"+csvLine[3]+"', isolate: '"+csvLine[4]+"', mutations: "+csvLine[5]+", host: '"+csvLine[6]+"'})-[:BELONGS_TO]->(v)
MERGE (p)<-[:AFFECTED]-(s)
FOREACH (n IN nodes(mutations) | MERGE (s)<-[:FOUND_IN]-(m))
Can someone please explain why this might happen?
Thanks in advance,
Alessia