query_single_entity()
query = query_single_entity(
paths = c("Cell - SPECIFICALLY_EXPRESS - Gene"), # select from output of `get_relation_paths()`
target_entity_class = "Cell",
target_entity_name = "BEST4+ epithelial",
states = list(Disease = c("UC")),
config,
threshold
)
cat(query)
## MATCH (e1: Cell)-[r1: SPECIFICALLY_EXPRESS]-(e2: Gene)
## WHERE e1.id='BEST4+ epithelial'
## AND ((r1.expression >= 0.000000) OR (r1.expression is NULL))
## AND ((r1.FDR <= 0.200000) OR (r1.FDR is NULL))
## AND ((r1.logFC >= 1.000000) OR (r1.logFC is NULL))
## AND ((r1.method IN ['wilcoxon']) OR (r1.method is NULL))
## AND ((r1.rank <= 3.000000) OR (r1.rank is NULL))
## AND ((r1.study IN ['IBDMDB']) OR (r1.study is NULL))
## AND ((r1.Disease IN ['UC']) OR (r1.Disease is NULL))
## RETURN e1, e2, r1
An argument diff
enables to filter entities
differentially abundant in specific conditions
# this option selects entities which is more abundant in UC than control by logFC > 0
diff = list(type="above", logFC=0, Disease="UC")
query = query_single_entity(
paths = c("Cell - CORRELATE_WITH - Cell"), # select from output of `get_relation_paths()`
target_entity_class = "Cell",
target_entity_name = "BEST4+ epithelial",
states = list(Disease = c("UC")),
config,
threshold,
diff = diff
)
cat(query)
## MATCH (e1: Cell)-[r1: CORRELATE_WITH]-(e2: Cell)
## MATCH (e2)-[diff2:DIFFERENTIAL_ABUNDANCE]-()
## WHERE e1.id='BEST4+ epithelial'
## AND ((r1.method IN ['Pearson', 'Spearman']) OR (r1.method is NULL))
## AND ((r1.study IN ['IBDMDB']) OR (r1.study is NULL))
## AND ((r1.value >= 0.250000) OR (r1.value is NULL))
## AND ((r1.Disease IN ['UC']) OR (r1.Disease is NULL))
## AND diff2.logfc >= 0
## AND diff2.Disease='UC'
## RETURN e1, e2, r1
result = neo2R::cypher(con, query, result="graph")
result$nodes[[1]]
## $id
## [1] "93"
##
## $elementId
## [1] "4:e7c7ced8-5961-47bd-a9b2-cb6254fbc4c0:93"
##
## $labels
## $labels[[1]]
## [1] "Cell"
##
##
## $properties
## $properties$CellType
## [1] "BEST4+ epithelial"
##
## $properties$id
## [1] "BEST4+ epithelial"
##
## $properties$CellTypeGroup
## [1] "Epithelial"
result$relationships[[1]]
## $id
## [1] "63131"
##
## $elementId
## [1] "5:e7c7ced8-5961-47bd-a9b2-cb6254fbc4c0:63131"
##
## $type
## [1] "CORRELATE_WITH"
##
## $startNode
## [1] "93"
##
## $startNodeElementId
## [1] "4:e7c7ced8-5961-47bd-a9b2-cb6254fbc4c0:93"
##
## $endNode
## [1] "110"
##
## $endNodeElementId
## [1] "4:e7c7ced8-5961-47bd-a9b2-cb6254fbc4c0:110"
##
## $properties
## $properties$directed
## [1] "False"
##
## $properties$study
## [1] "IBDMDB"
##
## $properties$method
## [1] "Pearson"
##
## $properties$Disease
## [1] "UC"
##
## $properties$value
## [1] 0.598486
query_multi_entity()
cells = get_entity_properties(con, "Cell", "id") %>% na.omit()
cells = cells[1:10]
query = query_multi_entity(
paths = c("Cell - CORRELATE_WITH - Cell"), # select from output of `get_relation_paths()`
target_entities = list(Cell = cells),
states = list(Disease = c("UC")),
config,
threshold
)
cat(query)
## MATCH (e1: Cell)-[r1: CORRELATE_WITH]-(e2: Cell)
## WHERE e1.id IN ['Naive B', 'Stromal 2', 'LYVE1+ macrophage', 'APOE+ macrophage', 'Memory B', 'Inflammatory fibroblast', 'IgA plasma', 'Non-classical monocyte', 'CD4+ tissue-Tcm', 'Cycling EC']
## AND e2.id IN ['Naive B', 'Stromal 2', 'LYVE1+ macrophage', 'APOE+ macrophage', 'Memory B', 'Inflammatory fibroblast', 'IgA plasma', 'Non-classical monocyte', 'CD4+ tissue-Tcm', 'Cycling EC']
## AND ((r1.method IN ['Pearson', 'Spearman']) OR (r1.method is NULL))
## AND ((r1.study IN ['IBDMDB']) OR (r1.study is NULL))
## AND ((r1.value >= 0.250000) OR (r1.value is NULL))
## AND ((r1.Disease IN ['UC']) OR (r1.Disease is NULL))
## RETURN e1, e2, r1
An argument diff
enables to filter entities
differentially abundant in specific conditions
# this option selects entities which is more abundant in UC than control by logFC > 0
diff = list(type="above", logFC=0, Disease="UC")
#
cells = get_entity_properties(con, "Cell", "id") %>% na.omit()
query = query_multi_entity(
paths = c("Cell - CORRELATE_WITH - Cell"), # select from output of `get_relation_paths()`
target_entities = list(Cell = cells),
states = list(Disease = c("UC")),
config,
threshold,
diff = diff
)
cat(query)
## MATCH (e1: Cell)-[r1: CORRELATE_WITH]-(e2: Cell)
## MATCH (e1)-[diff1:DIFFERENTIAL_ABUNDANCE]-()
## MATCH (e2)-[diff2:DIFFERENTIAL_ABUNDANCE]-()
## WHERE e1.id IN ['Naive B', 'Stromal 2', 'LYVE1+ macrophage', 'APOE+ macrophage', 'Memory B', 'Inflammatory fibroblast', 'IgA plasma', 'Non-classical monocyte', 'CD4+ tissue-Tcm', 'Cycling EC', 'BEST4+ epithelial', 'CD4+ Trm', 'Adult glia', 'Stromal 1', 'IgA+IgG+ plasma', 'GC B', 'Cycling TA', 'CD4+ blood-Tcm', 'pDC', 'Adult venous EC (C7+)', 'CD4+ Treg', 'Reticular fibroblast', 'CD8+ Tn', 'Mast', 'Cycling GC B', 'NCR+ ILC3', 'Myofibroblast 2', 'DUOX2+ epithelial', 'Adult arterial capillary', 'IgA-IgG- plasma', 'Immature pericyte', 'CD8+ activated T', 'Cycling macrophage', 'CD4+ Tfh', 'Adult arterial EC', 'Cycling plasma', 'Paneth', 'CD4+ activated T', 'CD16+ NK', 'Adult colonocyte', 'CD56+ SELL_low NK', 'Enteroendocrine', 'Goblet', 'cDC2', 'LEC', 'Pediatric colonocyte', 'Enterocyte', 'CD8+ IEL', 'Adult venous EC (SELE+)', 'CD56+ SELL_high NK', 'SMC 1', 'Fetal venous capillary', 'CD4+ Th17', 'Mature pericyte', 'cDC1', 'CD8+ Trm', 'CD4+ Tn', 'CD8+ Teff', 'IgG plasma', 'CD8+ Tc17', 'CD8+ Tem', 'Transitional stromal', 'Classical monocyte', 'CD8+ Tcm', 'CD4+ Temra', 'Tuft', 'CD8+ MAIT', 'AREG+ macrophage', 'LAMP3+ DC', 'Inflammatory monocyte', 'TA']
## AND e2.id IN ['Naive B', 'Stromal 2', 'LYVE1+ macrophage', 'APOE+ macrophage', 'Memory B', 'Inflammatory fibroblast', 'IgA plasma', 'Non-classical monocyte', 'CD4+ tissue-Tcm', 'Cycling EC', 'BEST4+ epithelial', 'CD4+ Trm', 'Adult glia', 'Stromal 1', 'IgA+IgG+ plasma', 'GC B', 'Cycling TA', 'CD4+ blood-Tcm', 'pDC', 'Adult venous EC (C7+)', 'CD4+ Treg', 'Reticular fibroblast', 'CD8+ Tn', 'Mast', 'Cycling GC B', 'NCR+ ILC3', 'Myofibroblast 2', 'DUOX2+ epithelial', 'Adult arterial capillary', 'IgA-IgG- plasma', 'Immature pericyte', 'CD8+ activated T', 'Cycling macrophage', 'CD4+ Tfh', 'Adult arterial EC', 'Cycling plasma', 'Paneth', 'CD4+ activated T', 'CD16+ NK', 'Adult colonocyte', 'CD56+ SELL_low NK', 'Enteroendocrine', 'Goblet', 'cDC2', 'LEC', 'Pediatric colonocyte', 'Enterocyte', 'CD8+ IEL', 'Adult venous EC (SELE+)', 'CD56+ SELL_high NK', 'SMC 1', 'Fetal venous capillary', 'CD4+ Th17', 'Mature pericyte', 'cDC1', 'CD8+ Trm', 'CD4+ Tn', 'CD8+ Teff', 'IgG plasma', 'CD8+ Tc17', 'CD8+ Tem', 'Transitional stromal', 'Classical monocyte', 'CD8+ Tcm', 'CD4+ Temra', 'Tuft', 'CD8+ MAIT', 'AREG+ macrophage', 'LAMP3+ DC', 'Inflammatory monocyte', 'TA']
## AND ((r1.method IN ['Pearson', 'Spearman']) OR (r1.method is NULL))
## AND ((r1.study IN ['IBDMDB']) OR (r1.study is NULL))
## AND ((r1.value >= 0.250000) OR (r1.value is NULL))
## AND ((r1.Disease IN ['UC']) OR (r1.Disease is NULL))
## AND diff1.logfc >= 0
## AND diff1.Disease='UC'
## AND diff2.logfc >= 0
## AND diff2.Disease='UC'
## RETURN e1, e2, r1
result = neo2R::cypher(con, query, result="graph")
result$nodes[[1]]
## $id
## [1] "115"
##
## $elementId
## [1] "4:e7c7ced8-5961-47bd-a9b2-cb6254fbc4c0:115"
##
## $labels
## $labels[[1]]
## [1] "Cell"
##
##
## $properties
## $properties$CellType
## [1] "Cycling macrophage"
##
## $properties$id
## [1] "Cycling macrophage"
##
## $properties$CellTypeGroup
## [1] "Myeloid"
query_search_by_path()
relation_path_df = config$relation_path_dfs$`Cell - SPECIFICALLY_EXPRESS - Gene - RECEPTOR - Metabolite - PRODUCE - Microbe`
relation_path_df %>% kbl(row.names=F) %>% kable_classic_2()
from
|
to
|
relation_type
|
directed
|
Cell
|
Gene
|
SPECIFICALLY_EXPRESS
|
FALSE
|
Gene
|
Metabolite
|
RECEPTOR
|
TRUE
|
Metabolite
|
Microbe
|
PRODUCE
|
TRUE
|
query = query_search_by_path(
relation_path_df,
target_entity = "BEST4+ epithelial",
states = list(Disease = c("UC")),
config,
threshold
)
cat(query)
## MATCH (e1: Cell)-[r1: SPECIFICALLY_EXPRESS]-(e2: Gene)
## MATCH (e2: Gene)-[r2: RECEPTOR]-(e3: Metabolite)
## MATCH (e3: Metabolite)-[r3: PRODUCE]-(e4: Microbe)
## WHERE e1.id='BEST4+ epithelial'
## AND ((r1.expression >= 0.000000) OR (r1.expression is NULL))
## AND ((r1.FDR <= 0.200000) OR (r1.FDR is NULL))
## AND ((r1.logFC >= 1.000000) OR (r1.logFC is NULL))
## AND ((r1.method IN ['wilcoxon']) OR (r1.method is NULL))
## AND ((r1.rank <= 3.000000) OR (r1.rank is NULL))
## AND ((r1.study IN ['IBDMDB']) OR (r1.study is NULL))
## AND ((r3.n >= 1.000000) OR (r3.n is NULL))
## AND ((r3.source IN ['gutMGene', 'NJC19', 'AGORA2']) OR (r3.source is NULL))
## AND ((r3.total >= 1.000000) OR (r3.total is NULL))
## AND ((r3.value >= 0.250000) OR (r3.value is NULL))
## AND ((r2.source IN ['HMDB', 'GPCRdb', 'Human1']) OR (r2.source is NULL))
## AND ((r1.Disease IN ['UC']) OR (r1.Disease is NULL))
## AND ((r2.Disease IN ['UC']) OR (r2.Disease is NULL))
## AND ((r3.Disease IN ['UC']) OR (r3.Disease is NULL))
## RETURN e1, e2, e3, e4, r1, r2, r3
#
query = query_search_by_path(
relation_path_df,
target_entity = "BEST4+ epithelial",
states = list(Disease = c("UC")),
config,
threshold,
diff=list(logFC=0, type="below", Disease="UC")
)
cat(query)
## MATCH (e1: Cell)-[r1: SPECIFICALLY_EXPRESS]-(e2: Gene)
## MATCH (e2: Gene)-[r2: RECEPTOR]-(e3: Metabolite)
## MATCH (e3: Metabolite)-[r3: PRODUCE]-(e4: Microbe)
## MATCH (e3)-[diff3:DIFFERENTIAL_ABUNDANCE]-()
## MATCH (e4)-[diff4:DIFFERENTIAL_ABUNDANCE]-()
## WHERE e1.id='BEST4+ epithelial'
## AND ((r1.expression >= 0.000000) OR (r1.expression is NULL))
## AND ((r1.FDR <= 0.200000) OR (r1.FDR is NULL))
## AND ((r1.logFC >= 1.000000) OR (r1.logFC is NULL))
## AND ((r1.method IN ['wilcoxon']) OR (r1.method is NULL))
## AND ((r1.rank <= 3.000000) OR (r1.rank is NULL))
## AND ((r1.study IN ['IBDMDB']) OR (r1.study is NULL))
## AND ((r3.n >= 1.000000) OR (r3.n is NULL))
## AND ((r3.source IN ['gutMGene', 'NJC19', 'AGORA2']) OR (r3.source is NULL))
## AND ((r3.total >= 1.000000) OR (r3.total is NULL))
## AND ((r3.value >= 0.250000) OR (r3.value is NULL))
## AND ((r2.source IN ['HMDB', 'GPCRdb', 'Human1']) OR (r2.source is NULL))
## AND ((r1.Disease IN ['UC']) OR (r1.Disease is NULL))
## AND ((r2.Disease IN ['UC']) OR (r2.Disease is NULL))
## AND ((r3.Disease IN ['UC']) OR (r3.Disease is NULL))
## AND diff3.logfc <= 0
## AND diff3.Disease='UC'
## AND diff4.logfc <= 0
## AND diff4.Disease='UC'
## RETURN e1, e2, e3, e4, r1, r2, r3
result = neo2R::cypher(con, query, result="graph")
result$nodes[[1]]
## $id
## [1] "950"
##
## $elementId
## [1] "4:e7c7ced8-5961-47bd-a9b2-cb6254fbc4c0:950"
##
## $labels
## $labels[[1]]
## [1] "Microbe"
##
##
## $properties
## $properties$phylum_name
## [1] "Bacillota"
##
## $properties$class_taxid
## [1] "186801"
##
## $properties$species_name
## [1] "Christensenella minuta"
##
## $properties$genus_name
## [1] "Christensenella"
##
## $properties$family_taxid
## [1] "186802"
##
## $properties$order_name
## [1] "Christensenellaceae"
##
## $properties$species_taxid
## [1] "626937"
##
## $properties$order_taxid
## [1] "990719"
##
## $properties$taxid
## [1] "626937"
##
## $properties$rank
## [1] "species"
##
## $properties$phylum_taxid
## [1] "1239"
##
## $properties$id
## [1] "Christensenella minuta"
##
## $properties$family_name
## [1] "Eubacteriales"
##
## $properties$genus_taxid
## [1] "990721"
##
## $properties$class_name
## [1] "Clostridia"
result$relationships[[1]]
## $id
## [1] "79276"
##
## $elementId
## [1] "5:e7c7ced8-5961-47bd-a9b2-cb6254fbc4c0:79276"
##
## $type
## [1] "SPECIFICALLY_EXPRESS"
##
## $startNode
## [1] "93"
##
## $startNodeElementId
## [1] "4:e7c7ced8-5961-47bd-a9b2-cb6254fbc4c0:93"
##
## $endNode
## [1] "3328"
##
## $endNodeElementId
## [1] "4:e7c7ced8-5961-47bd-a9b2-cb6254fbc4c0:3328"
##
## $properties
## $properties$directed
## [1] "False"
##
## $properties$study
## [1] "IBDMDB"
##
## $properties$expression
## [1] 3.05688
##
## $properties$logFC
## [1] 6.028984
##
## $properties$method
## [1] "wilcoxon"
##
## $properties$Disease
## [1] "UC"
##
## $properties$FDR
## [1] 4.510815e-44
##
## $properties$rank
## [1] 3