-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update methods-ext.R #27
Conversation
jiajic
commented
Sep 19, 2023
- fixes note in rmdcheck
- increment version
fixes note in rmdcheck
catch up to main
increment version
|
||
return(stereo) | ||
# data.table vars | ||
genes = y = sdimx = sdimy = cell_ID = count = NULL |
Check warning
Code scanning / lintr
local variable 'sdimx' assigned but may not be used Warning
|
||
return(stereo) | ||
# data.table vars | ||
genes = y = sdimx = sdimy = cell_ID = count = NULL |
Check warning
Code scanning / lintr
local variable 'sdimy' assigned but may not be used Warning
|
||
return(stereo) | ||
# data.table vars | ||
genes = y = sdimx = sdimy = cell_ID = count = NULL |
Check warning
Code scanning / lintr
local variable 'count' assigned but may not be used Warning
bin_size)) | ||
exprDT = data.table::as.data.table(geneExpData[['expression']]) | ||
exprDT$count = as.integer(exprDT$count) | ||
setorder(exprDT, x, y) # sort by x, y coords (ascending) |
Check warning
Code scanning / lintr
no visible binding for global variable 'x' Warning
# 2. create spatial locations | ||
if(isTRUE(verbose)) wrap_msg('2. create spatial_locations... \n') | ||
cell_locations = unique(exprDT[,c('x','y')], by = c('x', 'y')) | ||
cell_locations[, bin_ID := as.factor(seq_along(1:nrow(cell_locations)))] |
Check warning
Code scanning / lintr
no visible binding for global variable 'bin_ID' Warning
# 2. create spatial locations | ||
if(isTRUE(verbose)) wrap_msg('2. create spatial_locations... \n') | ||
cell_locations = unique(exprDT[,c('x','y')], by = c('x', 'y')) | ||
cell_locations[, bin_ID := as.factor(seq_along(1:nrow(cell_locations)))] |
Check warning
Code scanning / lintr
1:nrow(...) is likely to be wrong in the empty edge case. Use seq_len(nrow(...)) instead. Warning
if(isTRUE(verbose)) wrap_msg('2. create spatial_locations... \n') | ||
cell_locations = unique(exprDT[,c('x','y')], by = c('x', 'y')) | ||
cell_locations[, bin_ID := as.factor(seq_along(1:nrow(cell_locations)))] | ||
cell_locations[, cell_ID := paste0('cell_', bin_ID)] |
Check warning
Code scanning / lintr
no visible binding for global variable 'bin_ID' Warning
# 3. create expression matrix | ||
if(isTRUE(verbose)) wrap_msg('3. create expression matrix... \n') | ||
exprDT[, genes := as.character(rep(x = geneDT$gene, geneDT$count))] | ||
exprDT[, gene_idx := as.integer(factor(exprDT$genes, |
Check warning
Code scanning / lintr
no visible binding for global variable 'gene_idx' Warning
levels = unique(exprDT$genes)))] | ||
|
||
# merge on x,y and populate based on bin_ID values in cell_locations | ||
exprDT[cell_locations, cell_ID := i.bin_ID, on = .(x, y)] |
Check warning
Code scanning / lintr
no visible binding for global variable 'i.bin_ID' Warning
levels = unique(exprDT$genes)))] | ||
|
||
# merge on x,y and populate based on bin_ID values in cell_locations | ||
exprDT[cell_locations, cell_ID := i.bin_ID, on = .(x, y)] |
Check warning
Code scanning / lintr
no visible binding for global variable 'x' Warning