-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1_Discovery.Rmd
115 lines (85 loc) · 3.11 KB
/
1_Discovery.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
---
title: 1_Discovery
output: html_notebook
---
Basic installation procedure (not run)
```{r, eval=FALSE}
natmanager::install('natverse')
vfbconnectr::vc_install()
```
### How to find neurons across datasets
VirtualFlyBrain integrates images and connectomics profiles of neurons from many sources. It classifies and records their properties using a standard, queryable classification ([The Drosophila Anatomy Ontology](https://www.ebi.ac.uk/ols/ontologies/fbbt)). This standardises the names of neuron types across sources, so you don't need to worry about differences in nomenclature and supports queries for neurons by their classification.
```{r, message=FALSE}
# load packages
library(vfbconnectr)
library(natverse)
library(dplyr)
```
Set up connections to VFB APIs and VFB CATMAID server.
```{r}
# for latest version of ontology?
# vc = VfbConnect(neo_endpoint="http://pdb.p2.virtualflybrain.org")
vc = VfbConnect()
# Connect to the VFB CATMAID server hosting the FAFB data
catmaid::vfbcatmaid('fafb')
```
### Find neurons by type (classification) across datasets
We can use the `vc$get_instances` method in combination with the name of a neuron type on VFB to find individual neurons from multiple sources.
```{r}
DA3adPN = vc$get_instances("'adult antennal lobe projection neuron DA3 adPN'", summary=T)
DA3adPN %>%
vc_df()
```
### Find neurons by location
We can use the same method to search for neurons by location, using simple queries.
```{r}
# Find neurons by location. The following query works across multiple data sources and both sides of the brain.
# Results may be incomplete & may include minor overlap inferred from low synapse counts
neurons_in_DA3 = vc$get_instances("'neuron' that 'overlaps' some 'antennal lobe glomerulus DA3'", summary=T)
neurons_in_DA3_tab = vc_df(neurons_in_DA3)
neurons_in_DA3_tab
```
```{r}
# Find local interneurons (intrinsic neurons) of the AL, overlapping DA3:
local_in_DA3 = vc$get_instances("'local interneuron of adult antennal lobe' that 'overlaps' some 'antennal lobe glomerulus DA3'",
summary=T)
vc_df(local_in_DA3)
```
### Find neurons by dataset/paper
On CATMAID
```{r}
bates = catmaid_get_neuronnames('Paper: Bates and Schlegel et al 2020')
# easier to read as a data.frame
bates %>% as.data.frame()
```
```{r}
# Inspect what datasets are available on VFB
ds = vc$neo_query_wrapper$get_datasets(summary=T) %>%
vc_df() %>%
arrange(id)
ds
```
```{r}
sayin_tab = vc$get_instances_by_dataset('Sayin2019', summary=T) %>% vc_df()
sayin_tab
```
Find connections between neurons by type across datasets. NB:
1. results are limited by how detailed annotation currently is in the DB.
2. this is a rather slow query
```{r}
vc$get_connected_neurons_by_type(
upstream_type = 'GABAergic neuron',
downstream_type = 'adult descending neuron',
weight = 10
) %>%
arrange(desc(weight))
```
This is an interesting related query, but there seem to be speed issues.
```{r, eval=FALSE}
vc$get_connected_neurons_by_type(
upstream_type = 'antennal lobe projection neuron',
downstream_type = 'adult descending neuron',
weight = 10
) %>%
arrange(desc(weight))
```