data-raw/hemibrain/pnts/processPD5.R

#######
# PD5 #
#######
if(!exists("process")){
  source("data-raw/hemibrain/startupHemibrain.R")
  process = TRUE
}

# First read all LHNs in the related cell body fibres
### Use plot3d(), nlscan() and find.neuron() to choose IDs.

# Groups
x = c("514068564")
y = c("327933008", "387568523", "5813055800", "5812980326", "642409381",
       "639275368")
z = "478613576"
pd5 = c(x,y,z)

### Get FAFB assigned hemilineage information
# x.match = unique(hemibrain_lhns[x,"FAFB.match"])
# x.match = x.match[!is.na(x.match)]
# x.match = read.neurons.catmaid.meta(x.match)
# y.match = unique(hemibrain_lhns[y,"FAFB.match"])
# y.match = y.match[!is.na(y.match)]
# y.match = read.neurons.catmaid.meta(y.match)

### Meta info
# mx = neuprint_get_meta(x)
# my = neuprint_get_meta(y)
# table(mx$cellBodyFiber)
# table(my$cellBodyFiber)

### CBFs:
### PDM07^SIPT1 PDM10^pSIPB2 PDM11^pSIPB1 PDM29^pSIPB4
# PDM07 = neuprint_read_neurons("PDM07")
# PDM07 =  PDM07[names( PDM07)%in%hemibrain.lhn.bodyids]
# PDM10 = neuprint_read_neurons("PDM10")
# PDM10 = PDM10[names(PDM10)%in%hemibrain.lhn.bodyids]
# PDM11 = neuprint_read_neurons(" PDM11")
# PDM11 =  PDM11[names( PDM11)%in%hemibrain.lhn.bodyids]
# pd5.hemi = union(PDM07,PDM10, PDM11)

### Re-define some of these CBFs
# sd = setdiff(pd5, names(pd5.hemi))
# ds = setdiff(names(pd5.hemi),pd5)
# pd5 = unique(pd5, names(pd5.hemi))

### Set-up data.frame
df = subset(namelist, bodyid %in% pd5)
df$cbf.change = FALSE
df$class = "LHN"
df$cell.type = NA
rownames(df) = df$bodyid

### Hemilineages:
df[x,"ItoLee_Hemilineage"] = "SLPpm3"
df[x,"Hartenstein_Hemilineage"] = "DPLc3"
df[y,"ItoLee_Hemilineage"] = "VLPd&p1_anterior"
df[y,"Hartenstein_Hemilineage"] = "DPLl2"
df[z,"ItoLee_Hemilineage"] = "SLPad1"
df[z,"Hartenstein_Hemilineage"] = "DPLl3"

##############################
# Make and review cell types #
##############################
# hemibrain_type_plot(bodyids = a, meta = lh.meta, someneuronlist = db);plot3d(most.lhns.hemibrain[light],col="black")
### Plot your candidate type alongside the equivalent Ito groupings
# hemibrain_milti3d(a1, a2)
### Easily plot several of your candidate types at once

############
### PD5  ###
############

# a1 = c("296199149", "326888609", "484134987") # light = c("L1539#2", "fru-F-700240","Gad1-F-200241") # dead
# df[a1,"cell.type"] = "PD5a1"

a1 = "514068564"
df[a1,"cell.type"] = "PD5a1"

# c1 = "329566197" # light = c("Gad1-F-700184", "VGlut-F-100282", "VGlut-F-300438")
# df[c1,"cell.type"] = "PD5c1"

b1 = "327933008" # light = c("fru-M-000077", "fru-F-000098")
df[b1,"cell.type"] = "PD5b1"

c1 = "478613576"
df[c1,"cell.type"] = "PD5c1"

d1 = c("387568523", "5813055800")
df[d1,"cell.type"] = "PD5d1"

e1 = c("5812980326", "642409381")
df[e1,"cell.type"] = "PD5e1"

# f1 = "510680365" # dead
# df[f1,"cell.type"] = "PD5h1"

f1 = "639275368"
df[f1,"cell.type"] = "PD5f1"

# g1 = "517514588" # dead
# df[g1,"cell.type"] = "PD5g1"
#
# h1 = "299272434"
# df[h1,"cell.type"] = "PD5h1"

########
# save #
########

# Organise cell types
df = process_types(df = df, hemibrain_lhns = hemibrain_lhns)

# Summarise results
state_results(df)

# Write .csv
write.csv(df, file = "data-raw/hemibrain/pnts/csv/PD5_celltyping.csv", row.names = FALSE)

# Process
if(process){
  # Update googlesheet
  write_lhns(df = df, column = c("class", "pnt", "cell.type", "ItoLee_Hemilineage", "Hartenstein_Hemilineage"))

  # Make 2D Images
  take_pictures(df)
}
jefferislab/lhns documentation built on Aug. 20, 2020, 10:10 p.m.