R/flywire_matching.R
, R/hemibrain_matching.R
hemibrain_matching.Rd
Match up neurons between the hemibrain, FAFB and light level data and save the
result using a
Google
Sheet on the hemibrain Google Team Drive operated by the flyconnectome
group at the University of Cambridge. Your aim is to match the light blue neuron to the best red neuron!
You must have access to the Team Drive
in order to use this function. This function makes use of the Google
Filestream application or rclone, which should be installed on your machine. Further,
note that neurons are read from the FAFB CATMAID project when repository=="CATMAID"
, and you must have
login details for this project recorded in your .Renviron for these
functions to work. You are given neurons assigned to your initials on the matching google sheet (the User
column)
though you can look at other's assigned matches using superUser=TRUE
. Your selection is further narrowed
by omitting neurons whose matches have already been made, when using the default overwrite="TRUE"
. However, you
can change this to overwrite matches, and to review made matches.
LR_matching( ids = NULL, threshold = 0, mirror.nblast = NULL, selected_file = options()$hemibrainr_matching_gsheet, batch_size = 50, db = flywire_neurons(), query = flywire_neurons(mirror = TRUE), overwrite = c("FALSE", "bad", "TRUE", "review"), column = NULL, entry = NULL, User = NULL, superUser = FALSE, flywire.good = FALSE, verbose = FALSE ) hemibrain_matching( ids = NULL, hemibrain.nblast = NULL, threshold = 0, selected_file = options()$hemibrainr_matching_gsheet, batch_size = 50, db = NULL, repository = c("flywire", "CATMAID", "lm"), query = hemibrain_neurons(brain = "FAFB14"), overwrite = c("FALSE", "bad", "TRUE", "review"), column = NULL, entry = NULL, User = NULL, superUser = FALSE, verbose = FALSE ) lm_matching( ids = NULL, hemibrain.nblast = NULL, selected_file = options()$hemibrainr_matching_gsheet, batch_size = 50, db = hemibrain_neurons(), query = NULL, overwrite = c("FALSE", "bad", "TRUE", "review"), column = NULL, entry = NULL, User = NULL, superUser = FALSE ) fafb_matching( ids = NULL, repository = c("flywire", "CATMAID"), hemibrain.nblast = NULL, threshold = 0, selected_file = options()$hemibrainr_matching_gsheet, batch_size = 20, db = hemibrain_neurons(brain = "FAFB14"), query = NULL, overwrite = c("FALSE", "bad", "TRUE", "review"), column = NULL, entry = NULL, User = NULL, superUser = FALSE, flywire.good = FALSE )
ids | body IDs for hemibrain neurons present in the
Google
Sheet, for which the user will attempt to make a match if one has not
been made already. Else, LM neuron IDs in the tab 'lm' when using |
---|---|
threshold | the minimum normalised NBLAST score between query and target neurons, for the potential match to be show. If set to |
mirror.nblast | a flywire (rows) - flywire-mirrored (columns) normalised NBLAST matrix. By default this is read from the hemibrain Team Drive. |
selected_file | the Google Sheet database to read and write from. For now, defaults to this Google Sheet. |
batch_size | the number of FAFB top matches to read from CATMAID in one go. |
db | Either a neuronlist or the name of a character vector naming a
neuronlist. Defaults to the value of |
query | a neuronlist of neurons for matching. Should correspond to the given NBLAST matrix.
Defaults to reading a transformed |
overwrite | Whether or not to overwrite matches already made.
The neurons you could possibly be looking at are selected through
the arguments: |
column | defaults to |
entry | defaults to |
User | the initials of the matching 'Users', i.e. you, which should also be recorded on the master matching google sheet. However, you can enter a new user
for the matches you make in R. If set to |
superUser | if |
flywire.good | logical, whether or not to only take 'well traced' flywire neurons, as annotated by the Drosophila Connectomics Group. This relies on the status column retrieved
by |
verbose | logical. If |
hemibrain.nblast | a FAFB (rows) - hemibrain (columns) normalised NBLAST matrix. By default this is read from the flyconnectome Team Drive. |
repository | whether to match up FAFB skeletons from
CATMAID (using |
Currently, the Google Sheet is set up with limited number of users, each of whom have been assigned a number of neurons to match up. In order to add yourself as a user, simply open this Google Sheet in your browser and add your initials to neurons of your choosing on the rightmost column 'Users'. Once a match is recorded, the user selects a quality for that match. There can be no match (none), a poor match (poor) an okay match (okay) or an exact match (good). As a rule of thumb, a poor match could be a neuron from a very similar same cell type or a highly untraced neuron that may be the correct cell_type. An okay match should be a neuron that looks to be from the same morphological cell type but there may be some discrepancies in its arbour. A good match is a neuron that corresponds well between FAFB and the hemibrain data.
# \donttest{ if (FALSE) { # install package to bridge neurons between FAFB14 and hemibrain space if (!requireNamespace("remotes")) install.packages("remotes") remotes::install_github('natverse/nat.jrcbrains') nat.jrcbrains::download_saalfeldlab_registrations() # Load precomputed NBLAST from the flyconnectome Team Drive load(file.path("/Volumes/GoogleDrive/Shared drives/flyconnectome/", "fafbpipeline/fib.fafb.crossnblast.twigs5.mean.compress.rda")) # Sometimes the filenames are changed by drive # load(file.path("/Volumes/GoogleDrive/Shared drives/flyconnectome", # "fafbpipeline/fib.fafb.crossnblast.twigs5.mean.compress (1).rda")) # Match! hemibrain_matching(hemibrain.nblast = fib.fafb.crossnblast.twigs5.mean.compress) # And example of matching neurons in a flywire tracing sheet sheet = flywire_tracing_sheet("SLPal2_dorsal", regex = TRUE) fafb_matching(ids = unique(sheet$root_id), repository="flywire", overwrite = "bad", User = "AJ", superUser = TRUE) # Look at all poorly made matches fafb_matching(repository="flywire", column = "hemibrain_match_quality", entry = "poor", overwrite = "TRUE", User = "AJ", superUser = TRUE) }# }