data-raw/hemibrain/pnts/processPV4.R

#######
# PV4 #
#######
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

#LHPV4
x = c("518899665", "5813040727", "359524536", "667824200", "729859814",
      "5813048298", "636758191", "5813055963", "5813041163", "666450841",
      "790918176", "605740410", "760566169", "790918098", "790918133",
      "605727696", "729877292", "574696428", "821957319", "514060419",
      "480258202", "759888036", "728858272", "480931876", "698846779",
      "820581604", "761236545", "760566746", "634711906", "697801711",
      "698846552", "699515201", "666769954", "729518762", "5813064407",
      "541957126", "696095496", "698820341", "483004258", "578155687",
      "359223830", "821621397", "389917104", "821617263", "759888294",
      "760570054", "634717239", "760225398", "729530620", "942677658",
      "541952417", "760907730", "729867427", "608162891", "329258532",
      "5813020038", "821642912", "852993150", "634029702", "790918006",
      "730563850", "760569606", "730222949", "5901195066", "541956768",
      "5813012970", "790577606", "666481389", "729535748", "729954382",
      "760566454", "790917992", "790918021", "760566744", "760566735",
      "851314221", "637121560", "974732162", "5813070112", "605416852",
      "759888465", "388854495", "790922968", "542980274", "543002278",
      "452672881", "604731022", "574037479", "667486204", "482006328",
      "604022763", "572642334", "5813020004", "542639270", "514747179",
      "603340681", "516085453", "696791034", "450919762")
y = c("821272765", "913341138", "636465174", "912022802", "636434899",
      "573774122", "5813020002", "512312176", "512982243", "880987657",
      "604398262", "5901193788", "386838814", "633101926", "881329648",
      "480931899", "881329355", "5901195352", "880988155",
      "417554241", "880987844", "356153135", "417890128", "540998783",
      "694813676", "633438933", "757215581", "325814461", "756870190",
      "386833812", "5813108084", "850294342", "5813058028", "357146296",
      "5812980700", "573695941", "912022866", "513323340", "665439889",
      "543679473", "449289591", "943048975", "417204354", "944379777",
      "5813022150", "787908929", "694472338", "604735961", "484018923","356809554")
pv4 = c(x,y)

### 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:
# ### PDL08^pLH2 PDL16^pLH11 PDL23^pLH10
# PDL08 = neuprint_read_neurons("PDL08")
# PDL08 = PDL08[names(PDL08)%in%hemibrain.lhn.bodyids]
# PDL16 = neuprint_read_neurons("PDL16")
# PDL16 = PDL16[names(PDL16)%in%hemibrain.lhn.bodyids]
# PDL23 = neuprint_read_neurons("PDL23")
# PDL23 = PDL09[names(PDL23)%in%hemibrain.lhn.bodyids]
# pv4.hemi = union(PDL08,PDL16,PDL23)
#
# ### Re-define some of these CBFs
# sd = setdiff(pv4, names(pv4.hemi))
# ds = setdiff(names(pv4.hemi),pv4)
# pv4 = unique(pv4, names(pv4.hemi))

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

# ### Wrong CBF
# wrong1 = c("604398262")
# df[wrong1,"cbf.change"] = "PDL16^pLH11"

### Hemilineages:
df[x,"ItoLee_Hemilineage"] = "LHp1"
df[x,"Hartenstein_Hemilineage"] = "BLP4"
df[y,"ItoLee_Hemilineage"] = "SLPp&v1_posterior"
df[y,"Hartenstein_Hemilineage"] = "DPLp2_posterior"

##############################
# 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

############
### PV4x ###
############

#####
# d #
#####

d1 = c("452672881", "821642912")
# light = c("Cha-F-600269","130923c0","Cha-F-000507","140212c0",
#         "L2233#1", "L2233#2", "L2233#3", "L2233#4")
df[d1,"cell.type"] = "PV4d1"

d2 = c("5901195066", "608162891", "578155687") # light = c("Gad1-F-500171", "Gad1-F-500023")
df[d2,"cell.type"] = "PV4d2"

d3 = c("482006328", "514060419", "514747179") # Also in PV4y
df[d3,"cell.type"] = "PV4d3"

d4 = c("450919762", "696791034")
# light = c("L979#2", "L979#7", "Cha-F-600209",
#         "L979#1","L979#3","L979#6")
df[d4,"cell.type"] = "PV4d4"

d5 = c("389917104", "541957126") # light = c("Gad1-F-600125","130923c0")
df[d5,"cell.type"] = "PV4d5"

d6 = c("852993150", "359223830") # light = c("Cha-F-200398")
df[d6,"cell.type"] = "PV4d6"

d7 = c("821617263", "821621397", "329258532")
df[d7,"cell.type"] = "PV4d7"

d8 = "516085453"
df[d8,"cell.type"] = "PV4d8"

d9 = "483004258"
df[d9,"cell.type"] = "PV4d9"

d10 = c("5813020038", "698846779", "728858272")
df[d10,"cell.type"] = "PV4d10"

#####
# j #
#####

j1 = c("759888294", "760570054")
# z.a = c("Cha-F-600243", "Gad1-F-400124", "Cha-F-100221", "Cha-F-100456",
#         "Cha-F-800134", "Cha-F-300186")
df[j1,"cell.type"] = "PV4j1"

j2 = "667486204" #light = c("L1842#3", "Gad1-F-100178","L1842#1","L1842#2")
df[j2,"cell.type"] = "PV4j2"

j3 = c("5813040727") # light = c("L979#4","L979#5")
df[j3,"cell.type"] = "PV4j3"

j4 = c("604731022") # light = c("L784#1", "Gad1-F-700258", "fru-M-200253")
df[j4,"cell.type"] = "PV4j4"


#####
# i #
#####

i1 = c("759888465", "760569606", "699515201")
df[i1,"cell.type"] = "PV4i1"

i2 = "729535748"
df[i2,"cell.type"] = "PV4i2"

i3 = c("5813041163", "974732162", "480931876", "543002278")
df[i3,"cell.type"] = "PV4i3"

i4 = "359524536"
df[i4,"cell.type"] = "PV4i4"

i5 = c("541956768","634029702")
df[i5,"cell.type"] = "PV4i5"

#####
# u #
#####

k1 = c("790577606", "790918006", "851314221") # light = c("Cha-F-500298", "Gad1-F-700138", "Gad1-F-500038", "L1467#24")
df[k1,"cell.type"] = "PV4k1"

m1 = "518899665"
df[m1,"cell.type"] = "PV4m1"

#####
# a #
#####

a1 = c("790918133", "760225398", "760566169", "790918098")
# light = c("fru-F-400011", "fru-F-400180", "fru-F-400219", "fru-F-500177",
#         "fru-F-500479", "fru-M-500368", "Gad1-F-000381", "L1467#11",
#         "L1467#13", "L1467#16", "L1467#2", "L1467#20", "L1467#25", "L1467#26",
#         "L1467#27", "L1467#6", "L1467#8", "L1467#9", "L1473#11", "L1473#12",
#         "L1473#5", "L1473#7", "L1735#9", "L234#1", "L234#2", "L234#3",
#         "L542#3", "L542#4","L1475#8","L1735#9")
df[a1,"cell.type"] = "PV4a1"

a2 = c("790918176", "5813064407", "760566735")
# light = c("L234#1", "Cha-F-500234", "130619c0", "130625c0",
#         "fru-F-400011","L1385#21","L1467#10","L1473#6",
#         "L1467#22","L1473#10","L1473#3","L1473#4","L1749#8")
df[a2,"cell.type"] = "PV4a2"

a3 = c("790917992")
# light = c("L1354#1", "130411c2", "L1475#6", "Cha-F-100412",
#          "VGlut-F-600090", "L1475#9","L1475#1", "L1475#5", "130724c0", "130219c0",
#          "Gad1-F-000201", "L1354#2","L1475#2","L1475#3","L1475#4","L1475#7","L1477#1",
#          "L1735#11")
df[a3,"cell.type"] = "PV4a3"

a4 = c("729518762", "760566744", "760907730", "760566454", "760566746")
# light = c("L1467#18","130703c0", "L1735#4","L1473#8", "L1354#4",
#          "L1735#6", "L1467#19", "L1467#21", "L1735#2", "L1473#9", "L1467#5",
#          "L1475#1", "L542#1", "130408c0","Gad1-F-100345", "L1354#3", "L1354#4",
#          "L1467#7","L1475#10","L1475#11","L1475#13","L1477#3","L1749#1","L1749#11",
#          "L1749#2","L542#2","L954#1","L954#2","VGlut-F-600752","VGlut-F-700436")
df[a4,"cell.type"] = "PV4a4"

a5 = c("637121560", "5813070112", "605416852", "730563850", "730222949")
# light = c("Gad1-F-200395", "L1477#2", "L1735#7",
#         "L1735#10","L1475#12","130704c1","L1735#12","L1735#5",
#         "L1749#4", "L1749#5", "VGlut-F-500253")
df[a5,"cell.type"] = "PV4a5"

a6 = c("729867427", "729530620") # light = c("Cha-F-500303", "130911c2", "130912c0", "130913c0", "Gad1-F-100132")
df[a6,"cell.type"] = "PV4a6"

a7 = c("605727696", "5813048298", "698820341", "698846552", "759888036",
       "603340681", "634717239", "636758191",
       "697801711", "634711906", "666769954",
       "729530620", "761236545") # light = c("Cha-F-600207", "130205c2", "Gad1-F-500178")
df[a7,"cell.type"] = "PV4a7"

a8 = c("574696428", "605740410", "729877292") #light = c("VGlut-F-700430")
df[a8,"cell.type"] = "PV4a8"

a9 = c("729859814", "820581604","696095496", "821957319")
# light = c("5HT1A-F-300034", "130829c0", "130821c0",
#         "Cha-F-900046", "130826c0", "130829c1", "130911c0",
#         "5HT1A-F-300030", "Gad1-F-500281")
df[a9,"cell.type"] = "PV4a9"

a10 = c("541952417", "604022763", "572642334", "5813020004","480258202",
       "542639270", "542980274") # light = c("Gad1-F-700108","130627c0")
df[a10,"cell.type"] = "PV4a10"

a11 = c("5813055963", "666450841")
# light = c("L1842#6", "L1842#7", "VGlut-F-300393",
#           "Cha-F-600226","L1842#5","JJ142")
df[a11,"cell.type"] = "PV4a11"

a12 = c("574037479", "790922968") # light = c("L1842#4", "VGlut-F-400195", "VGlut-F-800068")
df[a12,"cell.type"] = "PV4a12"

#####
# h #
#####

h1 = c("5813012970", "666481389", "729954382")
df[h1,"cell.type"] = "PV4h1"

h2 = "388854495"
df[h2,"cell.type"] = "PV4h2"

h3 = "667824200"
df[h3,"cell.type"] = "PV4h3"

#####
# f #
#####

f1 = c("790918021", "942677658") #light = c("Cha-F-400318", "L1735#1", "L1467#15", "L1467#23", "130312c1", "L1735#8","L1467#17","L1735#3")
df[f1,"cell.type"] = "PV4f1"

############
### PV4y ###
############

#####
# c #
#####

c1 = c("5813022150", "756870190", "5813058028", "5813108084", "633438933",
       "694813676", "694472338", "787908929", "757215581", "540998783") # light = c("L2392#3","L2316#2","L2392#4","L2392#2", "Gad1-F-000274", "VGlut-F-500046","VGlut-F-500419")
df[c1,"cell.type"] = "PV4c1"

c2 = c("386838814", "633101926")
df[c2,"cell.type"] = "PV4c2"

c3 = c("325814461", "356153135")
df[c3,"cell.type"] = "PV4c3"

c4 = c("386833812", "417890128","417204354")
df[c4,"cell.type"] = "PV4c4"

#####
# b #
#####

b1 = c("604398262", "5901193788", "636434899")
# light = c("L1827#13", "VGlut-F-300574", "140117c2", "VGlut-F-500411",
#         "Gad1-F-300148","L1827#4","L1827#6","VGlut-F-500243","VGlut-F-600764",
#         "VGlut-F-700084","VGlut-F-700602")
df[b1,"cell.type"] = "PV4b1"

b2 = c("543679473", "881329355", "636465174")
# light = c("VGlut-F-500444", "Cha-F-100028", "VGlut-F-400084",
#         "L1827#7", "L1827#8", "L1828#2","131212c1",
#         "Gad1-F-100154","L1827#1","L1827#10","L1827#9")
# light = c("Gad1-F-200322", "140207c0",
#           "E0585-F-300056","L1827#11","L1827#12","L1827#2")
df[b2,"cell.type"] = "PV4b2"

b3 = c("665439889", "912022866", "513323340", "573695941")
df[b3,"cell.type"] = "PV4b3"

b4 = c("480931899", "5812980700", "512312176", "512982243", "912022802") ## Also in PV5Y....
df[b4,"cell.type"] = "PV4b4"

b5 = c("880988155")
df[b5,"cell.type"] = "PV4b5"

b6 = c("881329648")
df[b6,"cell.type"] = "PV4b6"

b7 = c("880987657")
df[b7,"cell.type"] = "PV4b7"

b8 = "5901195352"
df[b8,"cell.type"] = "PV4b8"

b9 = c("604735961", "484018923")
df[b9,"cell.type"] = "PV4b9"


#####
# g #
#####

g1 = c("573774122", "944379777", "880987844", "5813020002", "943048975",
      "913341138", "821272765") #light = c("VGlut-F-900028", "L1397#2", "L1397#1", "L1397#3")
df[g1,"cell.type"] = "PV4g1"

g2 = c("449289591", "417554241", "850294342")
df[g2,"cell.type"] = "PV4g2"

#####
# e #
#####

# e1 = c("1005102825", "573415212")
# df[e1,"cell.type"] = "PV4e1"

# e1 = "667184255" # light = c("Cha-F-100373","Cha-F-400138","Trh-F-000048","VGlut-F-200590")
# df[e1,"cell.type"] = "PV4e1"

e1 = "356809554"
df[e1,"cell.type"] = "PV4e1"

#####
# l #
#####

l1 = "357146296"
df[l1,"cell.type"] = "PV4l1"

########
# 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/PV4_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.