Last active
February 2, 2017 04:35
-
-
Save zhihaozheng/1e2fe2529e215334c33066f20670d75a to your computer and use it in GitHub Desktop.
NBLAST Flycircuit PNs (glom=="VAsomething") against FAFB PNs of VAs glomeruli
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Use NBLAST against PNs of identified VA__ glomeruli in FAFB to see what VA is Flycircuit PNs with glom=="VAsomething"? | |
# general packages | |
library(magrittr) | |
library(dplyr) | |
library(doMC) | |
registerDoMC(4) | |
# neuro packages | |
library(catmaid) | |
library(flycircuit) | |
library(elmr) | |
library(nat.nblast) | |
library(nat) | |
# Load your FAFB credential. I name it fafb_conn here. | |
# download FAFB PNs annotated with "^glomerulus VA" | |
# turn out, there are 9: "VA1d", "VA1v", "VA2", "VA3", "VA4", "VA5", "VA6", "VA7l", "VA7m". | |
# transform to common template with flycircuit (FCWB) | |
fafb_vas=read.neurons.catmaid("annotation:^glomerulus VA", conn=fafb_conn) %>% | |
xform_brain(sample=FAFB13, reference=FCWB) | |
# load flycircuit 2 glom==VAsomething PNs | |
fc_vas=flycircuit::load_si_data('allpndps.rds') %>% | |
subset(glom=="VAsomething") %>% | |
mirror_brain(brain=FCWB, tranform='flip') | |
# a function to do nblast and order results according to mean scores | |
# also show identified glom from FAFB in the neuron name | |
nblast_against_fafb <- function(query, targets, conn) { | |
sc=nblast(query, targets, normalised=TRUE) | |
scr=nblast(targets, query, normalised=TRUE) | |
data.frame(score=sc, score_r=scr, muscore=(sc+scr)/2) %>% | |
.[order(.$muscore, decreasing = T), ] %>% | |
mutate(skids=as.numeric(row.names(.)), fafb_gloms=catmaid_get_neuronnames(skids, conn=conn)) | |
} | |
# run it for two VAsomething PNs in Flycircuit | |
VA_1st = nblast_against_fafb(fc_vas[[1]], dotprops(fafb_vas)) %T>% print | |
VA_2nd = nblast_against_fafb(fc_vas[[2]], dotprops(fafb_vas)) %T>% print | |
# top hit for both VAsomething PNs are all VA4 in FAFB! | |
# plot them, they look like VA4 as well. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment