This function retrieves neuron matches (hemibrain_matches) from a master-matching google sheet. If then can update other google sheets, specified by the user to update neuron-match information. Just columns giving the match, match quality and cell_type are updated.

matches_update(
  matching_sheet = options()$hemibrainr_matching_gsheet,
  priority = c("FAFB", "hemibrain"),
  selected_sheets,
  id = c("root_id", "bodyid", "skid", "id"),
  match.field = c("hemibrain", "CATMAID", "flywire", "LM", "FAFB.hemisphere"),
  chosen.columns = c("cell_type", "flywire_xyz", "side", "ito_lee_hemilineage",
    "hartenstein_hemilineage")
)

Arguments

matching_sheet

the master matching sheet. Cannot be in selected_sheets. This sheet will be processed using hemibrain_matches to produce a data.frame describing hemibrain-FAFB and FAFB-hemibrain_matches.

priority

whether to use FAFB->hemibrain_matches (FAFB) or hemibrain->FAFB matches (hemibrain) in order to ascribe cell_type names to FAFB neurons. In both cases, cell_type names are attached to hemibrain bodyids, and propagated to their FAFB matches.

selected_sheets

character vector. the google sheet(s) to update. Each entry is a unique google sheet ID. You can find these in a sheet's URL. If NULL then defaults to option('hemibrainr_gsheets').

id

the ID specifying unique neuron identity for each row, for each tab of the google sheets specified with selected_sheets. When matches are added they are for the neuron specified in the id column of each worksheet.

match.field

which match to record. E.g. if id is "root_id" you may want to add the hemibrain_match from the master matching sheets. To do this set match.field to "hemibrain". Then, if there is a "hemibrain_match" and/or "hemibrain_match_quality" column, it will be updated. You may also want to know the hemispheric match within FAFB, in which case "FAFB.hemisphere" could be used.

chosen.columns

as well as writing column updates to the specified google sheets, this function returns a data.frame built from all given sheets and their individual tabs, that have been updated. This argument specifies which column you want returned. Filled with NAs if it does not exist.

Value

a data.frame with columns from the given google sheet(s), specified using the argument chosen.columns.

Details

For this function to work, the specified google sheet(s) must have either the column specified with the argument id, which gives the ID of a neuron from the FAFB (CATMAID or flywire) data set, or the hemibrain data set. Each tab of each specified google sheet is read in turn. The data set match (specified with the argument match.field). A match is recovered using hemibrain_matching(selected_file = matching_sheet, priority=priority). If the right columns exist in the google sheet, i.e. 'hemibrain_match' and 'hemibrain_match_quality' for a hemibrain_match, then this column in the google sheet is wiped and updated. If not, no update takes place.

See also

Examples

# \donttest{ if (FALSE) { # Update flywire_ids in the sheet: ## https://docs.google.com/spreadsheets/d/ ## 1spGSuhUX6Hhn-8HH0U_ArIWUuPpMBFNjIjeSSh_MFVY ## /edit#gid=603762040 lineage.gsheet.meta = matches_update(id = "root_id", match.field = "hemibrain", selected_sheets = "1spGSuhUX6Hhn-8HH0U_ArIWUuPpMBFNjIjeSSh_MFVY") }# }