MonashBioinformaticsPlatform / polyApipe

polyApipe
GNU Lesser General Public License v2.1
13 stars 6 forks source link

Error in partitions(length(groups), ncol(counts)/length(groups) * nrow(counts)) : 没有"partitions"这个函数 #9

Closed shimi-ly closed 3 months ago

shimi-ly commented 3 months ago

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 }

pfh commented 3 months ago

Please see my weitrix package, specifically R/util.R.

https://github.com/pfh/weitrix