Skip to content

Instantly share code, notes, and snippets.

@amergin
Created December 11, 2012 21:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amergin/4262270 to your computer and use it in GitHub Desktop.
Save amergin/4262270 to your computer and use it in GitHub Desktop.
Cypher branching example
START a = node(137059)
MATCH a-[rel]->b
WITH a,b,rel
ORDER BY rel.pvalue DESC LIMIT 5
MATCH b-[rel2]->c
WITH a,b,c,rel,rel2
ORDER BY rel2.pvalue DESC LIMIT 5
RETURN a.label?, rel.pvalue, b.label?, b.source, rel2.pvalue, c.label?, c.source;
neo4j-sh (0)$ START a = node(137059) MATCH a-[rel]->b WITH a,b,rel ORDER BY rel.pvalue DESC LIMIT 5 MATCH b-[rel2]->c WITH a,b,c,rel,rel2 ORDER BY rel2.pvalue DESC LIMIT 5 RETURN a.label?, rel.pvalue, b.label?, b.source, rel2.pvalue, c.label?, c.source;
==> +-----------------------------------------------------------------------------------------------------+
==> | a.label? | rel.pvalue | b.label? | b.source | rel2.pvalue | c.label? | c.source |
==> +-----------------------------------------------------------------------------------------------------+
==> | "histology" | 19.36 | "CDH1" | "GEXP" | 19.36 | "histology" | "CLIN" |
==> | "histology" | 19.36 | "CDH1" | "GEXP" | 15.12 | "I(C3,C8|mRNAseq_CNMF_8)" | "SAMP" |
==> | "histology" | 7.153 | "CDH1" | "GNAB" | 15.115 | "CDH1" | "GNAB" |
==> | "histology" | 8.506 | "CDH1" | "GNAB" | 13.774 | "CDH1" | "GNAB" |
==> | "histology" | 7.858 | "CTNNB1" | "RPPA" | 12.417 | "I(BASAL,REAC2|RPPA_k6)" | "SAMP" |
==> +-----------------------------------------------------------------------------------------------------+
==> 5 rows
==> 1 ms
----------------------------------------------------------------
START a = node(137059)
MATCH a-[rel]->b
WHERE b.source! = 'GEXP'
WITH a,b,rel
ORDER BY rel.pvalue DESC LIMIT 5
MATCH b-[rel2]->c
WHERE c.source! = 'SAMP'
WITH a,b,c,rel,rel2
ORDER BY rel2.pvalue DESC LIMIT 5
RETURN a.label?, rel.pvalue, b.label?, b.source, rel2.pvalue, c.label?, c.source;
neo4j-sh (0)$ START a = node(137059) MATCH a-[rel]->b WHERE b.source! = 'GEXP' WITH a,b,rel ORDER BY rel.pvalue DESC LIMIT 5 MATCH b-[rel2]->c WHERE c.source! = 'SAMP' WITH a,b,c,rel,rel2 ORDER BY rel2.pvalue DESC LIMIT 5 RETURN a.label?, rel.pvalue, b.label?, b.source, rel2.pvalue, c.label?, c.source;
==> +-----------------------------------------------------------------------------------------------------+
==> | a.label? | rel.pvalue | b.label? | b.source | rel2.pvalue | c.label? | c.source |
==> +-----------------------------------------------------------------------------------------------------+
==> | "histology" | 2.375 | "ZBTB16" | "GEXP" | 18.034 | "I(C1,C2|mRNA_CC_3)" | "SAMP" |
==> | "histology" | 19.36 | "CDH1" | "GEXP" | 15.12 | "I(C3,C8|mRNAseq_CNMF_8)" | "SAMP" |
==> | "histology" | 2.375 | "ZBTB16" | "GEXP" | 12.322 | "I(C1,C5|mRNA_CNMF_8)" | "SAMP" |
==> | "histology" | 2.375 | "ZBTB16" | "GEXP" | 9.766 | "I(C1,C4|mRNAseq_CNMF_8)" | "SAMP" |
==> | "histology" | 2.375 | "ZBTB16" | "GEXP" | 8.806 | "I(C1,C5|mRNAseq_CC_5)" | "SAMP" |
==> +-----------------------------------------------------------------------------------------------------+
==> 5 rows
==> 1 ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment