data-raw/hemibrain/pnts/processAV4.R

#######
# AV4 #
#######
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("705381843", "766781641", "764006565", "921969630",
      "1011616276", "1130605683", "1259528984", "357490931", "357823645",
      "388513464", "511966686", "512645188", "512981720", "515390688",
      "5812980863", "5813010525", "5813010845", "5813012083", "5813014585",
      "5813035183", "5813061530", "5813133775", "5901195038", "604031105",
      "605417133", "607096048", "607104768", "607787481", "638136190",
      "638476365", "640221192", "667474054", "669171261", "669852092",
      "669869547", "698180393", "699894933", "700210227", "700550360",
      "700878180", "700878295", "703305408",  "731244892",
      "731567967", "731918732", "731919293", "759586113", "762948368",
      "789580340", "793298641", "820581199", "823988254", "823999989",
      "851317951", "851684210", "856407289", "856408517", "881991445",
      "887433630", "918123297",  "948812702", "975432645",
      "979519562", "980198319", "883031393", "730882970", "794337453",
       "5813058137", "5813087621", "761580655","760541793",
      "822289778", "1039867920", "732280395", "728483069", "5813098080",
      "823668338", "637121971", "792610827", "882685590",
      "1042572999", "605791875", "606444098",  "762957069",
      "917086906", "826762561",   "579169802", "579169910", "360236724")
y = c("542293528", "573324939", "5813013443", "5813035168", "5813035204",
      "5901194395", "605723658", "634363193", "634712940", "635385969",
      "665735597", "666451615", "667141710", "668148078", "668485522",
      "696772937", "697456597", "697793250", "698829728", "699160906",
      "699161039", "727808408", "728483249", "821306235", "822622842",
      "851309562", "852678239", "852976677", "881986401", "886095820",
      "912663435", "913013165", "975072882", "788173517", "511949534",
      "543333530", "5813035150", "5813012448", "575729037", "760902933",
      "5901203780", "947453617", "916773484", "5901194039", "5813090944",
      "734667914", "849918343", "480931586", "669857319", "1166761119",
      "762262916", "911984113", "916773484", "761232088", "947103902",
      "916763916", "944729312", "947453617", "419548541", "731923098",
      "944055652", "946123380", "979857196", "761229983", "668148078",
      "666451615", "667141710")
z  = c("730537677", "764339342", "634712475", "5813010799", "731270909",
       "696095464", "5813012889", "700884019", "576773752", "5901193783",
       "761575136", "729211483", "545738451", "5901208658", "542639377",
       "947462997", "5813009261", "608465100", "857451691", "818888010",
       "635091875", "918468865",  "669857319", "5901197773",
       "762262916", "818888010")
w = c("1011616276", "515390688", "5813010845", "5813014585", "5813035183",
      "5813133775", "605417133", "607104768", "607787481", "638476365",
      "667474054", "669869547", "698180393", "699894933", "700210227",
      "700550360", "703305408", "731244892", "731567967", "731918732",
      "731919293", "759586113", "762948368", "789580340", "793298641",
      "820581199", "823988254", "851684210", "856407289", "856408517",
      "887433630", "918123297", "979519562", "980198319", "1042572999",
      "606444098", "826762561", "579169802", "579169910", "360236724","762263004"
)
av4 = c(x,y,z,w)

prob = c("730537677",
         "542639377",
         "761575136",
         "5813009261",
         "947462997",
         "5901193783",
         "857451691",
         "918468865",
         "576773752",
         "700884019",
         "5813012889",
         "5901208658")

### 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)
# z.match = unique(hemibrain_lhns[z,"FAFB.match"])
# z.match = z.match[!is.na(z.match)]
# z.match = read.neurons.catmaid.meta(z.match)
#
# ### Meta info
# mx = neuprint_get_meta(x)
# my = neuprint_get_meta(y)
# mz = neuprint_get_meta(z)
# table(mx$cellBodyFiber)
# table(my$cellBodyFiber)
# table(mz$cellBodyFiber)
#
# ### CBFs:
# ### ADL02^hLHT1 ADL03^hLHT3 ADL15^hLHT2 ADL21^hLHT4 ADL26^hLHT5
# ADL01 = neuprint_read_neurons("ADL01")
# ADL01 = ADL01[names(ADL01)%in%hemibrain.lhn.bodyids]
# ADL05 = neuprint_read_neurons("ADL05")
# ADL05 = ADL05[names(ADL05)%in%hemibrain.lhn.bodyids]
# av4.hemi = c(ADL01,ADL05)
#
# ### Re-define some of these CBFs
# sd = setdiff(av4, names(av4.hemi))
# ds = setdiff(names(av4.hemi),av4)
# av4 = unique(av4, names(av4.hemi))

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

### Wrong CBF
# wrong1 = c(z)
# df[wrong1,"cbf.change"] = "new_cbf_1"

### Hemilineages:
df[x,"ItoLee_Hemilineage"] = "LHl1_lateral"
df[x,"Hartenstein_Hemilineage"] = "BLD4_lateral"
df[y,"ItoLee_Hemilineage"] = "LHl4_lateral"
df[y,"Hartenstein_Hemilineage"] = "BLD1_lateral"
df[z,"ItoLee_Hemilineage"] = "LHl4_lateral"
df[z,"Hartenstein_Hemilineage"] = "BLD1_lateral"
df[w,"ItoLee_Hemilineage"] = "VLPl4_dorsal"
df[w,"Hartenstein_Hemilineage"] = "BLD3_dorsal"

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

#############
### AV4x ####
#############

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

c1 =  c("1011616276", "703305408", "856408517","826762561","979519562")
# light = c("L421#5", "L421#6", "L421#9", "L421#1", "fru-F-500093", "L421#3", "L421#14",
#              "131003c1", "131123c1", "140213c1", "fru-F-400486", "fru-M-300124","L421#11",
#              "L421#12", "L421#2","L421#7","856408517", "JJ73")
df[c1,"cell.type"] = "AV4c1"

c2 =  c("705381843", "766781641", "764006565", "921969630") # dead # light = c("fru-F-500553", "Gad1-F-100153", "fru-F-400494")
df[c2,"cell.type"] = "AV4c2"

# c4 = c("1014392280", "890925383", "5813009998", "1014051490", "949870573") # dead
# df[c4,"cell.type"] = "AV4c4"

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

i1 = c("5813133775", "698180393") # light = c("Cha-F-200329","JJ95")
df[i1,"cell.type"] = "AV4i1"

i2 = "759586113" # light = c("Gad1-F-200137","Gad1-F-200137")
df[i2,"cell.type"] = "AV4i2"

# i3 = "885132185" # light = c("Gad1-F-200137","Gad1-F-200137") # dead
# df[i3,"cell.type"] = "AV4i3"
#
# i4 = "1039267479" # light = c("Gad1-F-200137","Gad1-F-200137") # dead
# df[i4,"cell.type"] = "AV4i4"


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

f1 = c("1130605683", "1259528984")
df[f1,"cell.type"] = "AV4f1"

# e2 = c("1162711771", "1134703538") # dead
# df[e2,"cell.type"] = "AV4e2"

#####
# a #
#####
prob = c("730537677",
         "542639377",
         "761575136",
         "5813009261",
         "947462997",
         "5901193783",
         "857451691",
         "918468865",
         "576773752",
         "700884019",
         "5813012889",
         "5901208658")

a1 = c("5813098080", "823668338", "728483069", "822289778","5813058137", "760541793") # light = c("Gad1-F-600241", "L788#3", "Cha-F-300146", "Cha-F-200282","L788#1","L788#2","Trh-F-300041")
df[a1,"cell.type"] = "AV4a1"

a2 = c("637121971") # light = c("Cha-F-000524", "728483249", "Cha-F-200385", "Cha-F-600191", "JJ128")
df[a2,"cell.type"] = "AV4a2"

a4 = c("918123297", "669869547", "856407289",  "5813014585", "980198319","887433630", "731918732", "700550360",  "731567967", "851684210")
# light = c("Cha-F-000193", "L568#1", "L2098#2",
#              "L1046#3", "L240#12", "L1046#5", "L1046#12","Gad1-F-400436","JJ76",
#              "Cha-F-000481", "L1046#11", "L1046#4","L240#22","L568#3", "JJ40", "JJ72")
df[a4,"cell.type"] = "AV4a4"

a3 = c("975432645", "851317951", "820581199", "794337453", "881991445",
       "883031393", "823999989", "917086906", "5901195038") # light = c("L240#5", "L240#16")
df[a3,"cell.type"] = "AV4a3"

a7 =  c("667474054", "823988254", "761580655", "5813010845") #light = c("fru-F-500357", "Gad1-F-700104")
df[a7,"cell.type"] = "AV4a7"

a6 =  c("882685590", "792610827", "1039867920") # light = c("L1385#26")
df[a6,"cell.type"] = "AV4a6"

a5 =  c("604031105", "5813061530", "789580340") #light = c("Gad1-F-200163", "fru-M-300432", "VGlut-F-200021","VGlut-F-200382", "Gad1-F-800028", "L1046#8")
df[a5,"cell.type"] = "AV4a5"


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

e1 =  c("732280395", "640221192","730882970") # light = c("Cha-F-600124") ") # light = c("Cha-F-500116","L1385#1", "L1385#2", "L1385#4")
df[e1,"cell.type"] = "AV4e1"

e2 =  c("607104768", "731244892", "605417133", "638476365","887433630", "731918732", "700550360", "762263004", "762948368","731567967") # light = c("131011c0", "fru-F-600043","L1385#9","131007c1","131009c0")
df[e2,"cell.type"] = "AV4e2"

e3 = c("699894933", "793298641")
df[e3,"cell.type"] = "AV4e3"

e4 =  c("638136190", "669852092") # light = c("Cha-F-000515", "140618c0", "160201c1", "160211c1", "Gad1-F-100077","L1385#3")
df[e4,"cell.type"] = "AV4e4"

e5 =  c("607787481", "5813035183", "700210227")
df[e5,"cell.type"] = "AV4e5"

e6 =  c("515390688")
df[e6,"cell.type"] = "AV4e6"

e7 =  c("606444098", "731919293", "1042572999",
        "579169802", "579169910") #light = c("Gad1-F-100051","L568#7")
df[e7,"cell.type"] = "AV4e7"

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

d1 = c("700878295", "357823645", "669171261", "511966686", "5813012083")
df[d1,"cell.type"] = "AV4d1"

d2 =  c("605791875", "762957069","388513464") # light = c("Cha-F-400293")
df[d2,"cell.type"] = "AV4d2"

d3 = c("357490931", "948812702")
df[d3,"cell.type"] = "AV4d3"

d4 = c("5813010525", "607096048")
df[d4,"cell.type"] = "AV4d4"

d5 =  c("512981720", "700878180", "5812980863", "512645188")
df[d5,"cell.type"] = "AV4d5"

d6 = c("669857319", "5901197773", "818888010", "762262916") # light = c("L787#1")
df[d6,"cell.type"] = "AV4d6"


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

cent1 =  c("576773752","545738451", "608465100")
df[cent1,"cell.type"] = "CENT13_a"

cent2 =  c("5813012889", "700884019") # light = c("Cha-F-200378", "Gad1-F-200127", "L1385#8")
df[cent2,"cell.type"] = "CENT13_b"

cent3 =  "5901208658"
df[cent3,"cell.type"] = "CENT13_c"

cent4 = "764339342"
df[cent4,"cell.type"] = "CENT13_d"

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

l1 = c("360236724")
df[l1,"cell.type"] = "AV4l1"

#############
### AV3y ####
#############

# m1 = "5813019955" # dead
# df[m1,"cell.type"] = "AV4m1"

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

b1 =  c("634712475", "696095464", "729211483","5813010799", "731270909","822622842")
# light = c("fru-M-100096", "fru-M-800040", "fru-F-700136", "fru-F-600129",
#              "fru-F-500032", "fru-M-200048", "L1479#1", "131003c0", "fru-F-500181", "fru-F-500099",
#              "fru-F-200122", "fru-M-700052", "fru-M-700164", "fru-M-700174", "fru-M-700211",
#              "fru-F-500205", "140117c1", "Cha-F-700025", "fru-F-400039", "fru-F-500183",
#              "fru-F-600131", "fru-F-800071", "fru-M-500115", "JJ92")
df[b1,"cell.type"] = "AV4b1"

b2 = c("480931586", "849918343", "911984113", "635091875")
df[b2,"cell.type"] = "AV4b2"

b3 = c("669857319", "5901197773", "762262916", "818888010")
df[b3,"cell.type"] = "AV4b3"

b4 = c("5813012448", "851309562","575729037")
# light = c("L1385#22", "L1385#14", "L1385#26", "L1385#27", "L1385#23",
#              "L1385#7", "Gad1-F-200366", "L1385#11", "L1385#12", "L1385#14",
#              "L1385#16", "L1385#22", "L1385#23", "L1385#27","L1385#7","L787#3")
df[b4,"cell.type"] = "AV4b4"

b5 = c("857451691", "918468865")
df[b5,"cell.type"] = "AV4b5"

b6 = c("543333530", "511949534", "5813035150")
df[b6,"cell.type"] = "AV4b6"


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

h1 = c("5813090944", "734667914", "1166761119")
df[h1,"cell.type"] = "AV4h1"

j1 =  "5813087621"
df[j1,"cell.type"] = "AV4j1"

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

g1 =  c("731923098", "886095820", "946123380", "979857196") # light = c("L240#24", "L240#4", "L247#6", "L247#2", "L240#1", "L1385#25", "L247#3")
df[g1,"cell.type"] = "AV4g1"

g2 = c("944055652", "944729312", "916763916", "5901194039",
       "5901203780", "947453617", "916773484")
# light = c("Gad1-F-200155", "Cha-F-600191", "Trh-M-500176", "Gad1-F-000079","Gad1-F-700151",
#              "L247#4", "L240#21","L240#17", "L240#10", "L1046#7","L1046#7", "fru-F-500229",
#              "L1046#10","L1385#10","L240#13","L240#14","L240#15","L240#18","L240#19","L240#2",
#              "L240#20","L240#23","L240#3","L247#1","L247#5")
df[g2,"cell.type"] = "AV4g2"

g3 =  c("912663435", "881986401", "821306235") # light = c("131008c0")
df[g3,"cell.type"] = "AV4g3"

g4 = c("5901193783", "947462997","542639377", "761575136",  "5813009261") # light = c("131002c2")
df[g4,"cell.type"] = "AV4g4"

g5 =  c("696772937", "634712940", "730537677") #light = c("L1385#6")
df[g5,"cell.type"] = "AV4g5"

g6 = c("912663435", "881986401", "852678239", "5813035204")
df[g6,"cell.type"] = "AV4g6"

g7 =  c("542293528", "573324939", "635385969",  "5813035168", "975072882" )
df[g7,"cell.type"] = "AV4g7"

g8 = c("698829728","761229983", "668148078", "666451615", "667141710")
df[g8,"cell.type"] = "AV4g8"

g9 =  c("665735597", "697456597", "913013165")
df[g9,"cell.type"] = "AV4g9"

g11 = c("5901203780", "947453617", "916773484")
df[g11,"cell.type"] = "AV4g11"

g12 =  c("727808408", "728483249") #light = c("L240#11")
df[g12,"cell.type"] = "AV4g12"

g13 =  c("668485522", "852976677", "698829728")
df[g13,"cell.type"] = "AV4g13"

g14 =  "5813013443"
df[g14,"cell.type"] = "AV4g14"

g15 = c("761232088", "947103902") # light = c("L240#2", "L240#6")
df[g15,"cell.type"] = "AV4g15"

g16 = c("760902933", "788173517")
df[g16,"cell.type"] = "AV4g16"

g17 = "419548541"
df[g17,"cell.type"] = "AV4g17"

g18 =  "605723658"
df[g18,"cell.type"] = "AV4g18"

#####
# k #
#####

k1 =  c("634363193", "697793250", "699161039")
df[k1,"cell.type"] = "AV4k1"

k2 =  c("5901194395", "699160906")
df[k2,"cell.type"] = "AV4k2"

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

# Organise cell types
df = process_types(df = df, hemibrain_lhns = hemibrain_lhns)
df[av4,"pnt"] = "LHAV4"

# Summarise results
state_results(df)

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

# Process
if(process){
   # Make 2D Images
   take_pictures(df)

   # Update googlesheet
   write_lhns(df = df, column = c("class", "pnt", "cell.type", "ItoLee_Hemilineage", "Hartenstein_Hemilineage"))
}
jefferislab/lhns documentation built on Aug. 20, 2020, 10:10 p.m.