This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #' @param p,q two orthonormal matrices of size `N x M` (i.e., `t(p) %*% p == diag(nrow=N)`) | |
| #' that each represent an `M` dimensional subspace in the `N` dimensional gene space. | |
| #' | |
| #' @return the tangent vector to go from point `p` to `q` on the Grassmann manifold | |
| #' represented as an `N x M` dimensional matrix. | |
| grassmann_log <- function(p, q){ | |
| n <- nrow(p) | |
| k <- ncol(p) | |
| z <- t(q) %*% p | |
| At <- t(q) - z %*% t(p) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Search for supplementary figures and properly resolve links to them | |
| -- Important. You need to flag the refstepcounter commands in LATEX. | |
| -- Please include the following in your preamble | |
| -- % Help with pandoc conversion | |
| -- \newcommand{\arabic}[1]{__||supfiganchor:display||__} | |
| -- \newcommand{\refstepcounter}[1]{__||supfiganchor:increment||__} | |
| -- Bail if we are converting to LaTeX. | |
| if FORMAT:match('latex') then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Based on https://github.com/openjournals/inara/blob/f47cfd4e87d5d1afda9db353966b5102f9c941f2/data/filters/resolve-references.lua | |
| -- Bail if we are converting to LaTeX. | |
| if FORMAT:match('latex') then | |
| return {} | |
| end | |
| local nequations = 0 | |
| local equation_labels = {} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #' Combine two SummarizedExperiments / SingleCellExperiments with partially overlapping | |
| #' genes into one | |
| #' | |
| #' Note: This ignores all but the first assay | |
| #' Can handle column sparse and standard matrices | |
| cbind_se <- function(se1, se2, assay_fill = 0, colData_fill = NA, rowData_fill = NA, post_fix = c("_1", "_2")){ | |
| stopifnot(length(post_fix) == 2) | |
| # Merge assays based on rowNames | |
| if( (is.null(rownames(se1)) || is.null(rownames(se2))) && nrow(se1) != nrow(se2)){ | |
| stop("To cbind SummarizedExperiments either rownames are needed or the ", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| df <- data.frame(Circulatory=c(32,26,19,16,14,13,11,11), | |
| Mental=c(11,11,18,24,23,24,26,23), | |
| Musculoskeletal=c(17,18,13,16,12,18,20,26), | |
| Cancer=c(10,15,15,14,16,16,14,14)) | |
| rownames(df) <- seq(1975,2010,by=5) | |
| df | |
| library(ggplot2) |