R/activeNetScoreHTML.R

Defines functions activeNetScoreHTML

Documented in activeNetScoreHTML

## Function to search by modules (groups) of genes with similar profiles of
## expression
##
## Parameters: mod      -> object of class maigesActMod
##             dir      -> string giving the folder where to save the table
##             fileSave -> name of the file to be saved (without extension)
##
##
## Gustavo H. Esteves
## 27/05/07
##
##


activeNetScoreHTML <- function(mod=NULL, dir="./", fileSave="scores") {
    
    
    ## basic tests
    ## Making some basic initial tests...
    if(is.null(data))
        stop("You MUST specify an object generated by activeMod function.")
    
    ## Adjusting the dir parameter
    tmp <- strsplit(dir, NULL)
    if (tmp[[1]][length(tmp[[1]])] != "/")
        dir <- paste(dir, "/", sep="")
    
    
    ##geting the information needed
    scores <- t(mod@scores)
    pvalues <- t(mod@Pvalues)
    
    
    ## Saving HTML table
    target <- R2HTML::HTMLInitFile(outdir=dir, filename=fileSave)
    for (i in 1:ncol(scores)) {
        R2HTML::HTML(paste("<center><br><b> Tissue type", colnames(scores)[i],
        "</b></center>"), file=target)
        
        idxTmp <- sort(pvalues[, i], index.return=TRUE)$ix
        tmp <- cbind(scores[idxTmp, i], pvalues[idxTmp, i])
        rownames(tmp) <- rownames(scores)[idxTmp]
        colnames(tmp) <- c("Score", "P-value")
        R2HTML::HTML(tmp, digits=4, file=target)
    }
    R2HTML::HTMLEndFile()
    
}

Try the maigesPack package in your browser

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

maigesPack documentation built on Nov. 8, 2020, 6:23 p.m.