https://github.com/baranzinilab/pspg_245b
https://github.com/baranzinilab/pspg_245b
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/baranzinilab/pspg_245b
- Owner: BaranziniLab
- Created: 2019-02-26T16:05:39.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2021-03-03T14:56:14.000Z (about 5 years ago)
- Last Synced: 2025-01-10T15:14:42.298Z (over 1 year ago)
- Language: Jupyter Notebook
- Size: 1.91 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[Instance](https://neo4j.het.io/browser/)
### Graph Stats
##### Find number of each node type in graph
>MATCH (node)
>RETURN
> head(labels(node)) AS label,
> count(*) AS count
>ORDER BY count DESC
##### Find number of each edge type in graph
>MATCH ()-[rel]->()
>RETURN
> type(rel) AS rel_type,
> count(*) AS count
>ORDER BY count DESC
##### Get examples of each edge/node type
>MATCH ()-[rel]->()
>WITH type(rel) AS rel_type, collect(rel) AS rels
>WITH rels[toInteger(rand() * size(rels))] AS rel
>RETURN startNode(rel), rel, endNode(rel)
### Multiple Sclerosis (MS) examples
##### Find Disease node for MS
>MATCH (d: Disease) WHERE d.name =~ '(?i).\*Multiple Sclerosis.\*'
>RETURN d
##### Find Compounds that treat MS
>MATCH (d: Disease) WHERE d.name =~ '(?i).\*Multiple Sclerosis.\*'
>MATCH compound_for_ms = ((c: Compound)-[:TREATS_CtD]-(d))
>RETURN compound_for_ms
##### Find Genes that bind Compounds that trat MS
>MATCH (d: Disease) WHERE d.name =~ '(?i).\*Multiple Sclerosis.\*'
>MATCH compound_for_ms = ((c: Compound)-[:TREATS_CtD]-(d))
>MATCH ms_genes_with_compound= ((c)-[:BINDS_CbG]-(g:Gene)-[]-(d))
>RETURN ms_genes_with_compound
##### Find Molecular Functions (GeneOntology) for the Genes that bind Compounds that trat MS
>MATCH (d: Disease) WHERE d.name =~ '(?i).\*Multiple Sclerosis.\*'
>MATCH compound_for_ms = ((c: Compound)-[:TREATS_CtD]-(d))
>MATCH ms_genes_with_compound= ((c)-[:BINDS_CbG]-(g:Gene)-[]-(d))
>MATCH mf = ((g)-[:PARTICIPATES_GpMF]-(:MolecularFunction))
>RETURN ms_genes_with_compound, mf
### Myelin examples
##### Find all GeneOntology nodes involving Myelin
>MATCH (cc: CellularComponent) WHERE cc.name =~ '(?i).\*Myelin.\*'
>MATCH (m: MolecularFunction) WHERE m.name =~ '(?i).\*Myelin.\*'
>MATCH (b: BiologicalProcess) WHERE b.name =~ '(?i).\*Myelin.\*'
>RETURN cc, m, b
##### Find Compounds that Bind that Participate in GeneOntology nodes involving Myelin
>MATCH (cc: CellularComponent) WHERE cc.name =~ '(?i).\*Myelin.\*'
>MATCH (m: MolecularFunction) WHERE m.name =~ '(?i).\*Myelin.\*'
>MATCH (b: BiologicalProcess) WHERE b.name =~ '(?i).\*Myelin.\*'
>MATCH compounds_for_myelin_genes = ((c: Compound)-[:BINDS_CbG]-(:Gene)-[:PARTICIPATES_GpCC]-(cc)), ((c)-[]-(:Gene)-[:PARTICIPATES_GpMF]-(m)), ((c)-[]-(:Gene)-[:PARTICIPATES_GpBP]-(b))
>RETURN compounds_for_myelin_genes
##### Find Diseases Treated by Compounds that Bind Genes that Participate in GeneOntology nodes involving Myelin
>MATCH (cc: CellularComponent) WHERE cc.name =~ '(?i).\*Myelin.\*'
>MATCH (m: MolecularFunction) WHERE m.name =~ '(?i).\*Myelin.\*'
>MATCH (b: BiologicalProcess) WHERE b.name =~ '(?i).\*Myelin.\*'
>MATCH compounds_for_myelin_genes = ((c: Compound)-[:BINDS_CbG]-(:Gene)-[:PARTICIPATES_GpCC]-(cc)), ((c)-[]-(:Gene)-[:PARTICIPATES_GpMF]-(m)), ((c)-[]-(:Gene)-[:PARTICIPATES_GpBP]-(b))
>MATCH disease_compounds_treat = ((c)-[:TREATS_CtD]-(:Disease))
>RETURN compounds_for_myelin_genes, cc, m, b, disease_compounds_treat
### DWPC example
##### Find DWPC for meta path DaGiGpBP between MS and GeneOntology BiologicalProcess nodes[1](https://think-lab.github.io/d/220/)
>MATCH path = (n0:Disease)-[e1:ASSOCIATES_DaG]-(n1)-[:INTERACTS_GiG]-(n2)-[:PARTICIPATES_GpBP]-(n3:BiologicalProcess)
>WHERE n0.name = 'multiple sclerosis'
> AND 'GWAS Catalog' in e1.sources
> AND exists((n0)-[:LOCALIZES_DlA]-()-[:UPREGULATES_AuG]-(n2))
>WITH
>[
> size((n0)-[:ASSOCIATES_DaG]-()),
> size(()-[:ASSOCIATES_DaG]-(n1)),
> size((n1)-[:INTERACTS_GiG]-()),
> size(()-[:INTERACTS_GiG]-(n2)),
> size((n2)-[:PARTICIPATES_GpBP]-()),
> size(()-[:PARTICIPATES_GpBP]-(n3))
>] AS degrees, path, n3 as target
>WITH
> target.identifier AS go_id,
> target.name AS go_name,
> count(path) AS PC,
> sum(reduce(pdp = 1.0, d in degrees| pdp * d ^ -0.7)) AS DWPC,
> size((target)-[:PARTICIPATES_GpBP]-()) AS n_genes
> WHERE 5 <= n_genes <= 100 AND PC >= 2
>RETURN
> go_id, go_name, PC, DWPC, n_genes
>ORDER BY DWPC DESC
>LIMIT 5
[MS example workshop](https://nbviewer.jupyter.org/github/baranzini-lab/PSPG_245B/blob/master/ms_example_notebook2.ipynb)
[Epilepsy example workshop](https://nbviewer.jupyter.org/github/baranzini-lab/PSPG_245B/blob/master/epilepsy_example_notebook.ipynb)
##### Other examples
>DISEASE = 'DOID:6364'
>DISEASE_NAME = "migraine"
>DISEASE = 'DOID:0050742'
>DISEASE_NAME = "nicotine_dependence"
##### For breast cancer please use:
>DISEASE = 'DOID:1612'
>DISEASE_NAME = "breast_cancer"