Skip to content

Commit

Permalink
switching to data.table for debarcoding
Browse files Browse the repository at this point in the history
  • Loading branch information
pfgherardini committed Dec 22, 2021
1 parent f243b02 commit 8e98c65
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions R/debarcode_cytof.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,33 @@ get_barcode_channels_names <- function(m, bc.key) {
}


sort_rows <- function(m) {
x <- data.table::as.data.table(m)
x$row.id <- 1:nrow(x)

x <- dcast(melt(setDT(x), id.var='row.id')[order(-value),
.SD, row.id][, N:=1:.N , .(row.id)],
row.id~N, value.var=c("value"))
x$row.id <- NULL
return(as.matrix(x))






#aa <- melt(data.table::setDT(x), id.var='row.id')
#bb <- aa[order(-value), .SD, row.id]

#cc <- bb[, N:=1:.N , .(row.id)]
#dd <- dcast(cc, row.id~N, value.var = c("value"))





}


#' This assumes that all barcodes are identified by the same number of channels
#' @param m Transformed data matrix
Expand Down

0 comments on commit 8e98c65

Please sign in to comment.