Dear author,This is your custom function, but I can't find the source code for the “partitions” function.Could you please provide me with some guidance? Thank you.
counts_shift<-function (counts, grouping, verbose = TRUE, typecast = identity)
{
assert_that(is.data.frame(grouping), "group" %in% colnames(grouping),
"name" %in% colnames(grouping))
groups <- split(grouping$name, grouping$group)
good <- map_int(groups, length) >= 2
groups <- groups[good]
parts <- partitions(length(groups), ncol(counts)/length(groups) *
nrow(counts))
if (verbose)
message("Calculating shifts in ", length(parts), " blocks")
result <- lapply(parts, function(part) {
counts_shift_inner(counts, groups[part], typecast = typecast)
})
result <- do.call(rbind, result)
colnames(result) <- colnames(counts)
result <- bless_weitrix(result, "x", "weights")
metadata(result)$weitrix$calibrate_trend_formula <- "~log(per_read_var)+well_knotted_spline(log(total_reads),3)"
metadata(result)$weitrix$calibrate_all_formula <- "~log(per_read_var)+well_knotted_spline(log(weight),3)"
result
}
Dear author,This is your custom function, but I can't find the source code for the “partitions” function.Could you please provide me with some guidance? Thank you.
counts_shift<-function (counts, grouping, verbose = TRUE, typecast = identity) { assert_that(is.data.frame(grouping), "group" %in% colnames(grouping), "name" %in% colnames(grouping)) groups <- split(grouping$name, grouping$group) good <- map_int(groups, length) >= 2 groups <- groups[good] parts <- partitions(length(groups), ncol(counts)/length(groups) * nrow(counts)) if (verbose) message("Calculating shifts in ", length(parts), " blocks") result <- lapply(parts, function(part) { counts_shift_inner(counts, groups[part], typecast = typecast) }) result <- do.call(rbind, result) colnames(result) <- colnames(counts) result <- bless_weitrix(result, "x", "weights") metadata(result)$weitrix$calibrate_trend_formula <- "~log(per_read_var)+well_knotted_spline(log(total_reads),3)" metadata(result)$weitrix$calibrate_all_formula <- "~log(per_read_var)+well_knotted_spline(log(weight),3)" result }