R/generate_permutation_RP.R

Defines functions GenPerm

# Given a rank matrix, this function permutes the gene labels once Subsequentlt this
# function computes the RP of permuted rank matrix Returns the resultant RP vector
# (length=number of genes)
GenPerm <- function(rankmatrix) {
  perm.rankmatrix <- apply(rankmatrix, 2, function(x) sample(x, length(x), FALSE))
  # perm.rp <- apply(perm.rankmatrix,1,function(rankrow)
  # prod(rankrow)^(1/ncol(perm.rankmatrix)))
  perm.rp <- (rowProds(perm.rankmatrix))^(1/ncol(perm.rankmatrix))
  return(perm.rp)
}

Try the GenRank package in your browser

Any scripts or data that you put into this service are public.

GenRank documentation built on April 28, 2020, 7:09 p.m.