Skip to content
Permalink
Browse files

removed all browser calls, including those w/in comments

  • Loading branch information...
paul-shannon committed Jun 5, 2019
1 parent b0ff4d2 commit 38ded8f573fb07e34f6f5e11cf2bd3e396a4f786
@@ -1,8 +1,8 @@
Package: trena
Type: Package
Title: Fit transcriptional regulatory networks using gene expression, priors, machine learning
Version: 1.7.4
Date: 2019-05-23
Version: 1.7.5
Date: 2019-06-05
Author: Seth Ament <seth.ament@systemsbiology.org>, Paul Shannon <pshannon@systemsbioloyg.org>, Matthew Richards <mrichard@systemsbiology.org>
Maintainer: Paul Shannon <paul.thurmond.shannon@gmail.com>
Imports:
@@ -195,7 +195,7 @@ setMethod("getSolverNames", "EnsembleSolver",
#'
#' @family solver methods
#'
#' @examples
#' @examples
#' \dontrun{
#' # Load included Alzheimer's data, create an Ensemble object with default solvers, and solve
#' load(system.file(package="trena", "extdata/ampAD.154genes.mef2cTFs.278samples.RData"))
@@ -214,7 +214,7 @@ setMethod("getSolverNames", "EnsembleSolver",
#' solverNames = c("lasso", "pearson", "ridge"))
#' tbl <- run(ensemble.solver)
#' }
#'
#'
#' @export

setMethod("run", "EnsembleSolver",
@@ -474,7 +474,6 @@ setMethod("run", "EnsembleSolver",
# # Else, just keep the old table and throw a warning
#
# if(class(tbl.augmented) == "try-error"){
# #browser()
# warning("The signal strength of ensemble of solvers is too weak to support
# composite scores ('pcaMax' and 'concordance' in the model output table. This is a classic
# "large n, small m" problem that could be rectified by providing more samples")
@@ -446,7 +446,6 @@ setMethod("getPfms", "MotifMatcher",
if(nrow(tbl.overlaps) == 0)
return(tbl.regions)

#browser()
regions.without.snps <- setdiff(1:nrow(tbl.regions), tbl.overlaps$region)
tbl.regions.out <- tbl.regions[regions.without.snps,]
tbl.regions.out$status <- rep("wt", nrow(tbl.regions.out))
@@ -173,7 +173,6 @@ setMethod('addStatsSimple', 'PCAMax',
if(length(col.rm) > 0)
mtx <- mtx[, -col.rm]
} # if excludeLasso
# browser()
scoreRow <- function(row){
zeros <- which(abs(row) < 1e-10)
if(length(zeros) > 0){
@@ -243,7 +243,6 @@ test.createModel <- function()
m2 <- createModel("AQP4", "chr18", start, end)
m2.mut <- createModel("AQP4", "chr18", start, end, variants="rs3875089")

browser()
if(length(m$model.fp) > 0){
head(m$model.dhs$edges)
# IncNodePurity gene.cor
@@ -519,7 +518,6 @@ identifyPerturbedMotifs <- function(chrom="chr18", start=26850565, end=26865469)
start=min(tbl.snp$loc) - 100,
end=max(tbl.snp$loc) + 5000,
stringsAsFactors=FALSE)
browser()
tbl.wt <- getSequence(mm, tbl.regions.noSeq)
tbl.mut <- getSequence(mm, tbl.regions.noSeq, tbl.snp$snp)
checkEquals(nchar(tbl.wt$seq), nchar(tbl.mut$seq))
@@ -580,7 +578,6 @@ identifyPerturbedMotifs <- function(chrom="chr18", start=26850565, end=26865469)
# G [ 147 398 21 0 4 0 2 1 206 138 ]
# T [ 314 51 18 32 1132 867 24 291 511 367 ]

browser()
tbl.snp

# target.gene chromosome loc snp shoulder genome
@@ -703,7 +700,6 @@ runBasic <- function(chrom="chr18", start=26865462, end=26865867, min.motif.scor
printf("addGraph")
addGraph(tv, g.lo)
loadStyle(tv, "style.js")
browser()
xyz <- 99

} # runBasic
@@ -903,8 +899,6 @@ quick <- function()
addGraph(tv, g.lo)
loadStyle(tv, "style.js")

browser();

chrom <- "chr18"
start <- tbl.snp$loc[2] - 10
end <- tbl.snp$loc[2] + 10
@@ -242,7 +242,6 @@ test.createModel <- function()
m2 <- createModel("AQP4", "chr18", start, end)
m2.mut <- createModel("AQP4", "chr18", start, end, variants="rs3875089")

browser()
if(length(m$model.fp) > 0){
head(m$model.dhs$edges)
# IncNodePurity gene.cor
@@ -579,7 +578,6 @@ identifyMotifs <- function(chrom="chr18", start=26865324, end=26866747)
# G [ 147 398 21 0 4 0 2 1 206 138 ]
# T [ 314 51 18 32 1132 867 24 291 511 367 ]

browser()
tbl.snp

# target.gene chromosome loc snp shoulder genome
@@ -702,7 +700,6 @@ runBasic <- function(chrom="chr18", start=26865462, end=26865867, min.motif.scor
printf("addGraph")
addGraph(tv, g.lo)
loadStyle(tv, "style.js")
browser()
xyz <- 99

} # runBasic
@@ -21,7 +21,7 @@ setGeneric("solve", signature="obj", function(obj, target.gen
#'
#' @rdname getSolverName
#' @aliases getSolverName
#'
#'
#' @param obj An object of class TReNA
#'
#' @return The name of the solver subclass object contained by the given TReNA object
@@ -31,7 +31,7 @@ setGeneric("solve", signature="obj", function(obj, target.gen
#' load(system.file(package="trena", "extdata/ampAD.154genes.mef2cTFs.278samples.RData"))
#' solver <- TReNA(mtx.sub, solver = "lasso")
#' mtx <- getSolverName(solver)
#'
#'
#' @export
setGeneric("getSolverName", signature="obj", function(obj) standardGeneric ("getSolverName"))

@@ -52,7 +52,7 @@ setGeneric("getSolverName", signature="obj", function(obj) standardGeneric ("g
#' load(system.file(package="trena", "extdata/ampAD.154genes.mef2cTFs.278samples.RData"))
#' solver <- TReNA(mtx.sub, solver = "lasso")
#' mtx <- getSolverObject(solver)
#'
#'
#' @export
setGeneric("getSolverObject", signature="obj", function(obj) standardGeneric ("getSolverObject"))
#----------------------------------------------------------------------------------------------------
@@ -88,7 +88,6 @@ setGeneric("getSolverObject", signature="obj", function(obj) standardGeneric ("g

TReNA <- function(mtx.assay=matrix(), solverName="lasso", quiet=TRUE)
{
browser()
recognized.solvers <- c("lasso", "randomForest", "bayesSpike", "pearson",
"spearman","sqrtlasso","lassopv","ridge", "naive", "ensemble")

@@ -160,7 +159,7 @@ setMethod("solve", "TReNA",
#' @describeIn TReNA Retrieve the name of the solver specified in a TReNA object
#'
#' @param obj An object of class TReNA
#'
#'
#' @examples
#'
#' # Create a LassoSolver object using the included Alzheimer's data and retrieve the solver name
@@ -189,6 +188,6 @@ setMethod("getSolverObject", "TReNA",

function(obj){
# Return the solver name stored in the object
return(obj@solver)
return(obj@solver)
})
#----------------------------------------------------------------------------------------------------
@@ -5,10 +5,10 @@ library(limma)

#----------------------------------------------------------------------------------------------------
assess_methodsAgainstDistributions <- function(mtx.sub, target.gene, tfs)
{
{
#fivenum(mtx.sub)# 0.000000 1.753137 12.346965 43.247467 1027.765854
# Transform with log2

# Transform with log2
mtx.tmp <- mtx.sub - min(mtx.sub) + 0.001
mtx.log2 <- log2(mtx.tmp)
#fivenum(mtx.log2) # [1] -9.9657843 0.8107618 3.6262014 5.4345771 10.005297
@@ -19,21 +19,21 @@ assess_methodsAgainstDistributions <- function(mtx.sub, target.gene, tfs)

# Transform via VOOM transformation
mtx.voom <- voom(mtx.sub)$E
#fivenum(mtx.voom)
#fivenum(mtx.voom)

printf("--- Testing LASSO")

trena <- TReNA(mtx.assay=mtx.sub, solver="lasso", quiet=FALSE)
lasso1 <- solve(trena, target.gene, tfs)
lasso1 <- data.frame(gene = rownames(lasso1),
lasso.as.is = lasso1$beta)


trena <- TReNA(mtx.assay=mtx.log2, solver="lasso", quiet=FALSE)
lasso2 <- solve(trena, target.gene, tfs)
lasso2 <- data.frame(lasso.log2 = lasso2$beta,
gene = rownames(lasso2))

trena <- TReNA(mtx.assay=mtx.asinh, solver="lasso", quiet=FALSE)
lasso3 <- solve(trena, target.gene, tfs)
lasso3 <- data.frame(lasso.asinh = lasso3$beta,
@@ -55,7 +55,7 @@ assess_methodsAgainstDistributions <- function(mtx.sub, target.gene, tfs)
lasso2.top10 <- lasso2$gene[order(abs(lasso2$lasso.log2), decreasing=TRUE)][1:10]
lasso3.top10 <- lasso3$gene[order(abs(lasso3$lasso.asinh), decreasing=TRUE)][1:10]
lasso4.top10 <- lasso4$gene[order(abs(lasso4$lasso.voom), decreasing = TRUE)][1:10]

printf("--- Testing Bayes Spike")

trena <- TReNA(mtx.assay=mtx.sub, solver="bayesSpike", quiet=FALSE)
@@ -82,7 +82,7 @@ assess_methodsAgainstDistributions <- function(mtx.sub, target.gene, tfs)
bs2$gene <- as.character(bs2$gene)
bs3$gene <- as.character(bs3$gene)
bs4$gene <- as.character(bs4$gene)

# Grab the top 10 genes from each
bs1.top10 <- bs1$gene[order(abs(bs1$bs.as.is), decreasing=TRUE)][1:10]
bs2.top10 <- bs2$gene[order(abs(bs2$bs.log2), decreasing=TRUE)][1:10]
@@ -119,7 +119,7 @@ assess_methodsAgainstDistributions <- function(mtx.sub, target.gene, tfs)
# Grab the top 10 genes from each
rf1.top10 <- rf1$gene[order(abs(rf1$rf.as.is), decreasing=TRUE)][1:10]
rf2.top10 <- rf2$gene[order(abs(rf2$rf.log2), decreasing=TRUE)][1:10]
rf3.top10 <- rf3$gene[order(abs(rf3$rf.asinh), decreasing=TRUE)][1:10]
rf3.top10 <- rf3$gene[order(abs(rf3$rf.asinh), decreasing=TRUE)][1:10]
rf4.top10 <- rf4$gene[order(abs(rf4$rf.voom), decreasing=TRUE)][1:10]

# Use Square Root LASSO
@@ -129,13 +129,13 @@ assess_methodsAgainstDistributions <- function(mtx.sub, target.gene, tfs)
sqrt.lasso1 <- solve(trena, target.gene, tfs)
sqrt.lasso1 <- data.frame(gene = rownames(sqrt.lasso1),
sqrt.lasso.as.is = sqrt.lasso1$beta)


trena <- TReNA(mtx.assay=mtx.log2, solver="sqrtlasso", quiet=FALSE)
sqrt.lasso2 <- solve(trena, target.gene, tfs)
sqrt.lasso2 <- data.frame(sqrt.lasso.log2 = sqrt.lasso2$beta,
gene = rownames(sqrt.lasso2))

trena <- TReNA(mtx.assay=mtx.asinh, solver="sqrtlasso", quiet=FALSE)
sqrt.lasso3 <- solve(trena, target.gene, tfs)
sqrt.lasso3 <- data.frame(sqrt.lasso.asinh = sqrt.lasso3$beta,
@@ -157,8 +157,8 @@ assess_methodsAgainstDistributions <- function(mtx.sub, target.gene, tfs)
sqrt.lasso2.top10 <- sqrt.lasso2$gene[order(abs(sqrt.lasso2$sqrt.lasso.log2), decreasing=TRUE)][1:10]
sqrt.lasso3.top10 <- sqrt.lasso3$gene[order(abs(sqrt.lasso3$sqrt.lasso.asinh), decreasing=TRUE)][1:10]
sqrt.lasso4.top10 <- sqrt.lasso4$gene[order(abs(sqrt.lasso4$sqrt.lasso.voom), decreasing = TRUE)][1:10]


# Take the union of all the genes
all.genes <- unique(c(lasso1.top10,
lasso2.top10,
@@ -224,7 +224,7 @@ assess_methodsAgainstDistributions <- function(mtx.sub, target.gene, tfs)
rf.result$edges$gene.cor[[which(rownames(rf.result$edges) == gene)]]
}

# Order the rows and return it
# Order the rows and return it
tbl.all <- tbl.all[order(abs(tbl.all$gene.cor), decreasing = TRUE),]
invisible(tbl.all)

@@ -236,7 +236,7 @@ assess_ampAD154AllSolversAndDistributions <- function(){
load(system.file(package="TReNA", "extdata/ampAD.154genes.mef2cTFs.278samples.RData"))
target.gene <- "MEF2C"
tfs <- setdiff(rownames(mtx.sub), "MEF2C")

tbl.all <- assess_methodsAgainstDistributions(mtx.sub,target.gene,tfs)


@@ -247,9 +247,8 @@ transform_ampADFromRaw <- function(){
library(edgeR)
file.path <- "./inst/extdata/MayoRNAseq_RNAseq_TCX_geneCounts2.tsv"
transposedCounts <- read.table(file.path, header = TRUE, check.names = FALSE, as.is = TRUE, sep = "\t", stringsAsFactors = TRUE)
browser()
rownames(transposedCounts) <- transposedCounts$ensembl_id

# Make it into a matrix of counts and drop the ENSEMBL IDs
mtx <- as.matrix(transposedCounts[, -1])

@@ -261,9 +260,9 @@ transform_ampADFromRaw <- function(){

# Compute counts per million (returns a matrix)
normalizedCpm <- cpm(normFactors)

# Organize as a data frame w/ENSEMBL IDs and data values
### Where are the IDs to map to ENSEMBL?
### Where are the IDs to map to ENSEMBL?
ids <- as.data.frame(row.names(normalizedCpm))
colnames(ids) <-c("ensembl_id")
row.names(normalizedCpm) <- NULL
@@ -272,6 +271,6 @@ transform_ampADFromRaw <- function(){

# Return the normalized data frame
invisible(newDF)

} #transform_ampADFromRaw
#----------------------------------------------------------------------------------------------------

0 comments on commit 38ded8f

Please sign in to comment.
You can’t perform that action at this time.