Skip to content

Commit

Permalink
Merge pull request #890 from drieslab/revert-889-db
Browse files Browse the repository at this point in the history
Revert "Catch up to suite"
  • Loading branch information
Ed2uiz authored Feb 2, 2024
2 parents 3978416 + 9224808 commit 37df6f6
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 409 deletions.
5 changes: 0 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,3 @@ testdata
merfish_preoptic/

*.DS_Store
:temp:
*.wal

*.RDS
*.db
15 changes: 5 additions & 10 deletions R/auxiliary_giotto.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
}))
}


#' @title Normalize expression matrix for library size
#' @param mymatrix matrix object
#' @param scalefactor scalefactor
Expand All @@ -32,16 +31,15 @@
This will likely result in normalization problems.
filter (filterGiotto) or impute (imputeGiotto) spatial units.'))
}

norm_expr = t_flex(t_flex(mymatrix)/ libsizes)*scalefactor

norm_expr = t_flex(t_flex(mymatrix)/ libsizes)*scalefactor
return(norm_expr)
}

#' @title Log normalize expression matrix
#' @keywords internal
.log_norm_giotto = function(mymatrix, base, offset) {

if(methods::is(mymatrix, 'DelayedArray')) {
mymatrix = log(mymatrix + offset)/log(base)
# } else if(methods::is(mymatrix, 'DelayedMatrix')) {
Expand All @@ -50,9 +48,6 @@
mymatrix@x = log(mymatrix@x + offset)/log(base) # replace with sparseMatrixStats
} else if(methods::is(mymatrix, 'Matrix')) {
mymatrix@x = log(mymatrix@x + offset)/log(base)
} else if(methods::is(mymatrix, 'dbMatrix')) {
mymatrix[] = dplyr::mutate(mymatrix[], x = x + offset) # workaround for lack of @x slot
mymatrix = log(mymatrix)/log(base)
} else {
mymatrix = log(as.matrix(mymatrix) + offset)/log(base)
}
Expand Down Expand Up @@ -518,13 +513,13 @@ filterGiotto = function(gobject,
# 2. then remove cells that do not have sufficient detected genes

## filter features
filter_index_feats = GiottoClass::rowSums_flex(expr_values >= expression_threshold) >= feat_det_in_min_cells
filter_index_feats = rowSums_flex(expr_values >= expression_threshold) >= feat_det_in_min_cells
selected_feat_ids = names(filter_index_feats[filter_index_feats == TRUE])



## filter cells
filter_index_cells = GiottoClass::colSums_flex(expr_values[filter_index_feats, ] >= expression_threshold) >= min_det_feats_per_cell
filter_index_cells = colSums_flex(expr_values[filter_index_feats, ] >= expression_threshold) >= min_det_feats_per_cell
selected_cell_ids = names(filter_index_cells[filter_index_cells == TRUE])


Expand Down Expand Up @@ -652,7 +647,7 @@ filterGiotto = function(gobject,
## 1. library size normalize
if(library_size_norm == TRUE) {
norm_expr = .lib_norm_giotto(mymatrix = raw_expr[],
scalefactor = scalefactor)
scalefactor = scalefactor)
} else {
norm_expr = raw_expr[]
}
Expand Down
3 changes: 0 additions & 3 deletions tests/testthat/.gitignore

This file was deleted.

43 changes: 0 additions & 43 deletions tests/testthat/test-dbMatrix_filterGiotto.R

This file was deleted.

62 changes: 0 additions & 62 deletions tests/testthat/test-dbMatrix_libNorm.R

This file was deleted.

62 changes: 0 additions & 62 deletions tests/testthat/test-dbMatrix_logNorm.R

This file was deleted.

62 changes: 0 additions & 62 deletions tests/testthat/test-dbMatrix_scale.R

This file was deleted.

Loading

0 comments on commit 37df6f6

Please sign in to comment.