Skip to content

Commit

Permalink
Updated data
Browse files Browse the repository at this point in the history
* fixed bug in hemibrain_matching_rewrite, i.e. just update columns not whole sheet
  • Loading branch information
alexanderbates committed Dec 14, 2020
1 parent 37ed0d1 commit 3b49dcc
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 12 deletions.
41 changes: 30 additions & 11 deletions R/hemibrain_matching.R
Original file line number Diff line number Diff line change
Expand Up @@ -1575,7 +1575,8 @@ hemibrain_matching_rewrite <- function(ids = NULL,
meta = meta1
}
meta$cell.type = meta$type
meta = meta[,c("bodyid","ItoLee_Hemilineage","Hartenstein_Hemilineage","cellBodyFiber","cell.type","layer","ct.layer")]
chosen.cols = c("bodyid","ItoLee_Hemilineage","Hartenstein_Hemilineage","cellBodyFiber","cell.type","layer","ct.layer","flywire.xyz","flywire.id","top.nblast")
meta = meta[,intersect(colnames(meta),chosen.cols)]
meta$FAFB.match = gs$FAFB.match[match(meta$bodyid,gs$bodyid)]
meta$FAFB.match.quality = gs$FAFB.match.quality[match(meta$bodyid,gs$bodyid)]
meta$LM.match = gs$LM.match[match(meta$bodyid,gs$bodyid)]
Expand Down Expand Up @@ -1603,17 +1604,35 @@ hemibrain_matching_rewrite <- function(ids = NULL,
meta$nblast.flywire.top = fw.neurons[unlist(top),"flywire.xyz"]
}
}
batches = split(1:nrow(meta), ceiling(seq_along(1:nrow(meta))/500))
gsheet_manipulation(FUN = googlesheets4::write_sheet,
data = meta[0,],
ss = selected_file,
sheet = "hemibrain")
for(i in batches){
gsheet_manipulation(FUN = googlesheets4::sheet_append,
data = meta[min(i):max(i),],
ss = selected_file,
sheet = "hemibrain")
if(!identical(gs,meta)){
write.cols = unique(colnames(meta),chosen.cols)
for(wc in write.cols){
gs[[wc]] = meta[match(gs$bodyid,meta$bodyid),wc]
}
hemibrainr:::gsheet_update_cols(
write.cols = write.cols,
gs=gs,
selected_sheet = selected_file,
sheet = "hemibrain")
}
if(nrow(meta)>nrow(gs)){
newrows = subset(meta, !meta$bodyid%in%gs$bodyid)
hemibrainr:::gsheet_manipulation(FUN = googlesheets4::sheet_append,
data = newrows,
ss = selected_file,
sheet = "hemibrain")
}
# batches = split(1:nrow(meta), ceiling(seq_along(1:nrow(meta))/500))
# gsheet_manipulation(FUN = googlesheets4::write_sheet,
# data = meta[0,],
# ss = selected_file,
# sheet = "hemibrain")
# for(i in batches){
# gsheet_manipulation(FUN = googlesheets4::sheet_append,
# data = meta[min(i):max(i),],
# ss = selected_file,
# sheet = "hemibrain")
#}
}

#' @rdname hemibrain_add_made_matches
Expand Down
Binary file modified data/cent.info.rda
Binary file not shown.
Binary file modified data/dn.info.rda
Binary file not shown.
Binary file modified data/kc.info.rda
Binary file not shown.
Binary file modified data/lc.info.rda
Binary file not shown.
Binary file modified data/mbon.info.rda
Binary file not shown.
Binary file modified data/rn.info.rda
Binary file not shown.
Binary file modified data/ton.info.rda
Binary file not shown.
2 changes: 1 addition & 1 deletion man/info.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3b49dcc

Please sign in to comment.