R/googlesheets.R
create_tracing_samplesheet.Rd
Creates or updates a googlesheet in your drive for a neuron. Worksheets in the googlesheet containing randomised lists of synapses and CATMAID URLs to those synapses, as well as other meta information to inform tracing. Different worksheets contain separate lists for pre and post synapses, in the whole neuron and in labelled axonic or dendritic compartments. Randomised pre synapse lists for both presynaptic connector objects for the given neuron and presynaptic connections can be given.
create_tracing_samplesheet(neuron, sheet_title = "mystery_neuron", folder = "googlesheet", skid = neuron$skid, polypre = TRUE, axon.dendrite.split = FALSE, randomise = TRUE) update_single_samplesheet(sheet_title = "mystery_neuron", folder = "googlesheet", neuron = NULL, skid = neuron$skid, ws = "whole neuron input") update_tracing_samplesheets(sheet_title = "mystery_neuron", folder = "googlesheet", neuron = NULL, skid = neuron$skid, polypre = TRUE)
neuron | a neuron object. If neuron = NULL is given to the update function, data will be updated in the google sheet but any addition or removal of nodes/synapses to the CATMAID neuron will be ignored. If axon.dendrite.split = TRUE, neuron should be passed through catnat::flow.centrality first in order to identify its axon and dendrite |
---|---|
sheet_title | title of the googlesheet to be created or updated |
folder | location to save tracing sheets. Defaults to 'googlesheet' which creates a tracing sheet in your home folder on googledrive. It can take a while to write a googlesheet. Alternatively, CSVs can be created in a local folder. |
skid | CATMAID skeleton ID for the neuron |
polypre | if TRUE, then randomised worksheets for connections laid at the neuron's presynapses are generated |
axon.dendrite.split | if TRUE and the neuron is labelled in its neuron$d data frame in SWC fashion, then separate worksheets for randomised synapse lists in axon and dendrite are generated |
randomise | whether to randomise the synapse sampling list (recommended). If false, the sheet is organised by strongest known synaptic partners |
ws | the individual google worksheet or path to .csv file to update |
# NOT RUN { # Load the neurons for which we want to create sampling sheets wedpns.chosen = read.neurons.catmaid("annotation:^WED-PN Complete PDP$") # Assign their cell types to these neurons # This should be changed from being manual to depending on an external gogolesheet or the name in CATMAID at some point wedpns.chosen[,"cell.type"] = c("WED-PN3","WED-PN4","WED-PN1","WED-PN5","WED-PN6","WED-PN2") # Run the flow-centrality axon-dendrite split algorithm wedpns.chosen.flow = catnat::flow.centrality(wedpns.chosen, polypre= FALSE, mode = "centrifugal") # Create a new folder for seach of these cell types locally dir.create("Data/sampling") for(ct in wedpns.chosen.flow[,"cell.type"]){ message(ct) if(dir.exists(paste0("Data/sampling/",ct))){ message("Sampling sheets for this cell type ought already to be present!") }else{ dir.create(paste0("Data/sampling/",ct)) wedpn = subset(wedpns.chosen.flow,cell.type==ct)[[1]] catnat::create_tracing_samplesheet(neuron=wedpn,sheet_title = ct, folder = paste0("Data/sampling/",ct,"/"), polypre = TRUE, axon.dendrite.split = TRUE, randomise = TRUE) } } #Update the sampling sheets as connections have been sampled / the subject neuron has been further modified for(ct in wedpns.chosen.flow[,"cell.type"]){ message("Working on ",ct) wedpn = subset(wedpns.chosen.flow,cell.type==ct)[[1]] catnat::update_tracing_samplesheets(neuron=wedpn,sheet_title = ct, folder = paste0("Data/sampling/",ct,"/"), polypre = TRUE) } # }