Skip to content
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

Merged
merged 4 commits into from
Sep 19, 2023
Merged

update methods-ext.R #27

merged 4 commits into from
Sep 19, 2023

Conversation

jiajic
Copy link
Member

@jiajic jiajic commented Sep 19, 2023

  • fixes note in rmdcheck
  • increment version

@jiajic jiajic merged commit c01b303 into drieslab:dev Sep 19, 2023
1 check passed

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

local variable 'sdimx' assigned but may not be used

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

local variable 'sdimy' assigned but may not be used

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

local variable 'count' assigned but may not be used
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

no visible binding for global variable 'x'
# 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

no visible binding for global variable 'bin_ID'
# 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

1:nrow(...) is likely to be wrong in the empty edge case. Use seq_len(nrow(...)) instead.
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

no visible binding for global variable 'bin_ID'
# 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

no visible binding for global variable 'gene_idx'
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

no visible binding for global variable 'i.bin_ID'
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

no visible binding for global variable 'x'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant