Permalink
Browse files

Changed unit test TReNA to trena

  • Loading branch information...
matt
matt committed Jul 21, 2017
1 parent ebfd469 commit 22baef3a5ba74475e8343da6e86a8b7b3f97d268
@@ -1,4 +1,4 @@
library(TReNA)
library(trena)
library(RUnit)
#----------------------------------------------------------------------------------------------------
printf <- function(...) print(noquote(sprintf(...)))
@@ -30,7 +30,7 @@ test_ampAD.mef2c.154tfs.278samples.bayesSpike <- function()
printf("--- test_ampAD.mef2c.154tfs.278samples.bayesSpike")
set.seed(12415)
load(system.file(package="TReNA", "extdata/ampAD.154genes.mef2cTFs.278samples.RData"))
load(system.file(package="trena", "extdata/ampAD.154genes.mef2cTFs.278samples.RData"))
mtx.asinh <- asinh(mtx.sub)
target.gene <- "MEF2C"
@@ -56,7 +56,7 @@ test_nOrderings <- function()
printf("--- test_nOrderings")
set.seed(12415)
load(system.file(package="TReNA", "extdata/ampAD.154genes.mef2cTFs.278samples.RData"))
load(system.file(package="trena", "extdata/ampAD.154genes.mef2cTFs.278samples.RData"))
mtx.asinh <- asinh(mtx.sub)
target.gene <- "MEF2C"
@@ -1,4 +1,4 @@
library(TReNA)
library(trena)
library(RUnit)
#----------------------------------------------------------------------------------------------------
printf <- function(...) print(noquote(sprintf(...)))
@@ -1,4 +1,4 @@
library(TReNA)
library(trena)
library(RUnit)
#----------------------------------------------------------------------------------------------------
printf <- function(...) print(noquote(sprintf(...)))
@@ -34,7 +34,7 @@ test_ampAD.mef2c.154tfs.278samples.ensemble <- function()
set.seed(122113)
# Load matrix and transform via arcsinh
load(system.file(package="TReNA", "extdata/ampAD.154genes.mef2cTFs.278samples.RData"))
load(system.file(package="trena", "extdata/ampAD.154genes.mef2cTFs.278samples.RData"))
mtx.asinh <- asinh(mtx.sub)
#print(fivenum(mtx.asinh) # [1] 0.000000 1.327453 3.208193 4.460219 7.628290)
@@ -58,7 +58,7 @@ test_selectedSolversOnly <- function()
set.seed(122113)
# Load matrix and transform via arcsinh
load(system.file(package="TReNA", "extdata/ampAD.154genes.mef2cTFs.278samples.RData"))
load(system.file(package="trena", "extdata/ampAD.154genes.mef2cTFs.278samples.RData"))
mtx.asinh <- asinh(mtx.sub)
#print(fivenum(mtx.asinh) # [1] 0.000000 1.327453 3.208193 4.460219 7.628290)
@@ -1,4 +1,4 @@
library(TReNA)
library(trena)
library(RUnit)
#----------------------------------------------------------------------------------------------------
printf <- function(...) print(noquote(sprintf(...)))
@@ -16,7 +16,7 @@ test_FootprintFilter.geneCentered <- function()
{
printf("--- test_FootprintFilter.geneCentered")
db.address <- system.file(package="TReNA", "extdata")
db.address <- system.file(package="trena", "extdata")
genome.db.uri <- paste("sqlite:/", db.address, "genome.sub.db", sep = "/")
footprint.db.uri <- paste("sqlite:/", db.address, "project.sub.db", sep = "/")
target.gene <- "MEF2C"
@@ -53,7 +53,7 @@ test_FootprintFilter.byRegion <- function()
{
printf("--- test_FootprintFilter.byRegion")
db.address <- system.file(package="TReNA", "extdata")
db.address <- system.file(package="trena", "extdata")
genome.db.uri <- paste("sqlite:/", db.address, "genome.sub.db", sep = "/")
footprint.db.uri <- paste("sqlite:/", db.address, "project.sub.db", sep = "/")
#target.gene <- "MEF2C"
@@ -93,7 +93,7 @@ test_FootprintFilter.byTwoRegions <- function()
{
printf("--- test_FootprintFilter.byTwoRegions")
db.address <- system.file(package="TReNA", "extdata")
db.address <- system.file(package="trena", "extdata")
genome.db.uri <- paste("sqlite:/", db.address, "genome.sub.db", sep = "/")
footprint.db.uri <- paste("sqlite:/", db.address, "project.sub.db", sep = "/")
@@ -137,7 +137,7 @@ test_FootprintFilter.geneCenteredPlusRegion <- function()
{
printf("--- test_FootprintFilter.geneCenteredPlusRegion")
db.address <- system.file(package="TReNA", "extdata")
db.address <- system.file(package="trena", "extdata")
genome.db.uri <- paste("sqlite:/", db.address, "genome.sub.db", sep = "/")
footprint.db.uri <- paste("sqlite:/", db.address, "project.sub.db", sep = "/")
target.gene <- "MEF2C"
@@ -1,4 +1,4 @@
library(TReNA)
library(trena)
library(RUnit)
library(RPostgreSQL)
#----------------------------------------------------------------------------------------------------
@@ -22,16 +22,16 @@ runTests <- function()
test_.parseDatabaseUri <- function()
{
printf("--- test_.parseDatabaseUri")
db.address <- system.file(package="TReNA", "extdata")
db.address <- system.file(package="trena", "extdata")
genome.db.uri <- paste("sqlite:/",db.address,"genome.sub.db", sep = "/")
project.db.uri <- paste("sqlite:/",db.address,"project.sub.db", sep = "/")
x <- TReNA:::.parseDatabaseUri(genome.db.uri)
x <- trena:::.parseDatabaseUri(genome.db.uri)
checkEquals(x$brand, "sqlite")
checkEquals(x$host, db.address)
checkEquals(x$name, "genome.sub.db")
x <- TReNA:::.parseDatabaseUri(project.db.uri)
x <- trena:::.parseDatabaseUri(project.db.uri)
checkEquals(x$brand, "sqlite")
checkEquals(x$host, db.address)
checkEquals(x$name, "project.sub.db")
@@ -42,7 +42,7 @@ test_constructor <- function()
{
printf("--- test_constructor")
db.address <- system.file(package="TReNA", "extdata")
db.address <- system.file(package="trena", "extdata")
genome.db.uri <- paste("sqlite:/",db.address,"genome.sub.db", sep = "/")
project.db.uri <- paste("sqlite:/",db.address,"project.sub.db", sep = "/")
@@ -55,7 +55,7 @@ test_getGtfGeneBioTypes <- function()
{
printf("--- test_getGtfGeneBioTypes")
db.address <- system.file(package="TReNA", "extdata")
db.address <- system.file(package="trena", "extdata")
genome.db.uri <- paste("sqlite:/",db.address,"genome.sub.db", sep = "/")
project.db.uri <- paste("sqlite:/",db.address,"project.sub.db", sep = "/")
@@ -73,7 +73,7 @@ test_getGtfMoleculeTypes <- function()
{
printf("--- test_getGtfMoleculeTypes")
db.address <- system.file(package="TReNA", "extdata")
db.address <- system.file(package="trena", "extdata")
genome.db.uri <- paste("sqlite:/",db.address,"genome.sub.db", sep = "/")
project.db.uri <- paste("sqlite:/",db.address,"project.sub.db", sep = "/")
@@ -93,7 +93,7 @@ test_getChromLoc <- function()
{
printf("--- test_getChromLoc")
db.address <- system.file(package="TReNA", "extdata")
db.address <- system.file(package="trena", "extdata")
genome.db.uri <- paste("sqlite:/",db.address,"genome.sub.db", sep = "/")
project.db.uri <- paste("sqlite:/",db.address,"project.sub.db", sep = "/")
@@ -124,7 +124,7 @@ test_getGenePromoterRegion <- function()
{
printf("--- test_getGenePromoterRegion")
db.address <- system.file(package="TReNA", "extdata")
db.address <- system.file(package="trena", "extdata")
genome.db.uri <- paste("sqlite:/",db.address,"genome.sub.db", sep = "/")
project.db.uri <- paste("sqlite:/",db.address,"project.sub.db", sep = "/")
@@ -184,7 +184,7 @@ test_getFootprintsForGene <- function()
{
printf("--- test_getFootprintsForGene")
db.address <- system.file(package="TReNA", "extdata")
db.address <- system.file(package="trena", "extdata")
genome.db.uri <- paste("sqlite:/",db.address,"genome.sub.db", sep = "/")
project.db.uri <- paste("sqlite:/",db.address,"project.sub.db", sep = "/")
@@ -219,7 +219,7 @@ test_getFootprintsInRegion <- function()
{
printf("--- test_getFootprintsInRegion")
db.address <- system.file(package="TReNA", "extdata")
db.address <- system.file(package="trena", "extdata")
genome.db.uri <- paste("sqlite:/",db.address,"genome.sub.db", sep = "/")
project.db.uri <- paste("sqlite:/",db.address,"project.sub.db", sep = "/")
@@ -244,7 +244,7 @@ test_getFootprintsInRegionWithVariants <- function()
{
printf("--- test_getFootprintsInRegionWithVariants")
db.address <- system.file(package="TReNA", "extdata")
db.address <- system.file(package="trena", "extdata")
genome.db.uri <- paste("sqlite:/",db.address,"genome.sub.db", sep = "/")
project.db.uri <- paste("sqlite:/",db.address,"project.sub.db", sep = "/")
@@ -290,7 +290,7 @@ test_mapMotifsToTFsMergeIntoTable <- function()
{
printf("--- test_mapMotifsToTFsMergeIntoTable")
db.address <- system.file(package="TReNA", "extdata")
db.address <- system.file(package="trena", "extdata")
genome.db.uri <- paste("sqlite:/",db.address,"genome.sub.db", sep = "/")
project.db.uri <- paste("sqlite:/",db.address,"project.sub.db", sep = "/")
@@ -1,4 +1,4 @@
library(TReNA)
library(trena)
library(RUnit)
#----------------------------------------------------------------------------------------------------
printf <- function(...) print(noquote(sprintf(...)))
@@ -1,4 +1,4 @@
library(TReNA)
library(trena)
library(MotifDb)
library(RUnit)
#----------------------------------------------------------------------------------------------------
@@ -306,7 +306,7 @@ test_getRegulatoryRegions <- function()
tableNames <- getEncodeRegulatoryTableNames(hdf)
table <- "wgEncodeRegDnaseClustered"
checkTrue(table %in% tableNames)
x <- TReNA:::.parseChromLocString(candidateFilterSpec$regionsSpec)
x <- trena:::.parseChromLocString(candidateFilterSpec$regionsSpec)
tbl.regions <-getRegulatoryRegions(hdf, table, x$chrom, x$start, x$end)
@@ -466,7 +466,7 @@ test_.matchForwardAndReverse <- function()
tbl.regions <- data.frame(chrom=chrom, chromStart=start, chromEnd=end, stringsAsFactors=FALSE)
sequence <- getSequence(hdf, tbl.regions)
tbl <- TReNA:::.matchForwardAndReverse(sequence, mtx, motifName, min.match.percentage=90, quiet=TRUE)
tbl <- trena:::.matchForwardAndReverse(sequence, mtx, motifName, min.match.percentage=90, quiet=TRUE)
checkEquals(nrow(tbl), 1)
checkEquals(tbl$start, 57)
@@ -480,7 +480,7 @@ test_.matchForwardAndReverse <- function()
motifName <- "MA0478.1"
mtx <- query(MotifDb, motifName)[[1]];
tbl <- TReNA:::.matchForwardAndReverse(sequence, mtx, motifName, min.match.percentage=90, quiet=TRUE)
tbl <- trena:::.matchForwardAndReverse(sequence, mtx, motifName, min.match.percentage=90, quiet=TRUE)
# fimo finds:
# X.pattern.name sequence.name start stop strand score p.value q.value matched.sequence
# MA0478.1 ma0478 58 68 - 14.5455 1.21e-05 0.006 GCATGACTCAG
@@ -504,7 +504,7 @@ test_.matchForwardAndReverse <- function()
strand="-"))
# now relax the score threshold
tbl <- TReNA:::.matchForwardAndReverse(sequence, mtx, motifName, min.match.percentage=80, quiet=TRUE)
tbl <- trena:::.matchForwardAndReverse(sequence, mtx, motifName, min.match.percentage=80, quiet=TRUE)
tbl$score <- round(tbl$score, 2)
tbl$maxScore <- round(tbl$maxScore, 2)
tbl$relativeScore <- round(tbl$relativeScore, 2)
@@ -525,7 +525,7 @@ test_.findMofits <- function()
printf("--- test_.findMotifs")
x <- .findMotifs("ACTATTCCCCT", pfms, 90)
seqs <- test_getSequence()
motifs <- TReNA:::.getScoredMotifs(seqs, min.match.percentage=95)
motifs <- trena:::.getScoredMotifs(seqs, min.match.percentage=95)
checkEquals(unlist(lapply(motifs, nrow)), c(2, 4, 3))
} # test_.findMotifs
@@ -534,7 +534,7 @@ test_.getScoredMotifs <- function()
{
printf("--- test_.getScoredMotifs")
seqs <- test_getSequence()
motifs <- TReNA:::.getScoredMotifs(seqs, min.match.percentage=95)
motifs <- trena:::.getScoredMotifs(seqs, min.match.percentage=95)
checkEquals(unlist(lapply(motifs, nrow)), c(2, 4, 3))
} # test_.getScoredMotifs
@@ -562,7 +562,7 @@ test_vrk2Promoter.incrementally <- function()
seqs <-getSequence(df, tbl.regions)
checkEquals(with(tbl.regions, 1 + chromEnd - chromStart), nchar(seqs)) # 231 391
motifs <- TReNA:::.getScoredMotifs(seqs, min.match.percentage=95)
motifs <- trena:::.getScoredMotifs(seqs, min.match.percentage=95)
checkEquals(unlist(lapply(motifs, dim)), c(8,9,8,9)) # both
} # test_vrk2Promoter.incrementally
@@ -836,7 +836,7 @@ test_rs34423320 <- function()
printf("--- test_rs34423320")
# chr1 167830170 167830170 rs34423320-C-T
load(system.file(package="TReNA", "extdata/ampAD.154genes.mef2cTFs.278samples.RData"))
load(system.file(package="trena", "extdata/ampAD.154genes.mef2cTFs.278samples.RData"))
checkTrue(exists("mtx.sub"))
hdcf <- HumanDHSFilter("hg38", mtx.sub)
@@ -864,12 +864,12 @@ test_rs34423320 <- function()
seq.wt <- as.character(getSeq(reference.genome, "chr1", 167830170-10, 167830170+10))
seq.mut <- sprintf("%s%s%s", substr(seq.wt, 1, 10), "T", substr(seq.wt, 12, 21))
TReNA:::.findMotifs(seq.wt, hdcf@pfms["MA0081.1"], 90)
TReNA:::.findMotifs(seq.wt, hdcf@pfms["MA0056.1"], 90)
TReNA:::.findMotifs(seq.mut, hdcf@pfms["MA0081.1"], 90)
TReNA:::.findMotifs(seq.mut, hdcf@pfms["MA0056.1"], 90)
trena:::.findMotifs(seq.wt, hdcf@pfms["MA0081.1"], 90)
trena:::.findMotifs(seq.wt, hdcf@pfms["MA0056.1"], 90)
trena:::.findMotifs(seq.mut, hdcf@pfms["MA0081.1"], 90)
trena:::.findMotifs(seq.mut, hdcf@pfms["MA0056.1"], 90)
TReNA:::.getScoredMotifs(list(seq.wt, seq.mut), min.match.percentage=90, quiet=TRUE)
trena:::.getScoredMotifs(list(seq.wt, seq.mut), min.match.percentage=90, quiet=TRUE)
} # test_rs34423320
#----------------------------------------------------------------------------------------------------
@@ -1,4 +1,4 @@
library(TReNA)
library(trena)
library(RUnit)
#----------------------------------------------------------------------------------------------------
printf <- function(...) print(noquote(sprintf(...)))
@@ -32,7 +32,7 @@ test_ampAD.mef2c.154tfs.278samples.lassopv <- function()
printf("--- test_ampAD.mef2c.154tfs.278samples.lassopv")
# Load matrix and transform via arcsinh
load(system.file(package="TReNA", "extdata/ampAD.154genes.mef2cTFs.278samples.RData"))
load(system.file(package="trena", "extdata/ampAD.154genes.mef2cTFs.278samples.RData"))
mtx.asinh <- asinh(mtx.sub)
target.gene <- "MEF2C"
tfs <- setdiff(rownames(mtx.asinh), "MEF2C")
@@ -1,4 +1,4 @@
library(TReNA)
library(trena)
library(RUnit)
#----------------------------------------------------------------------------------------------------
printf <- function(...) print(noquote(sprintf(...)))
@@ -133,7 +133,7 @@ test_ampAD.mef2c.154tfs.278samples.lasso <- function()
printf("--- test_ampAD.mef2c.154tfs.278samples.lasso")
# Load matrix and transform via arcsinh
load(system.file(package="TReNA", "extdata/ampAD.154genes.mef2cTFs.278samples.RData"))
load(system.file(package="trena", "extdata/ampAD.154genes.mef2cTFs.278samples.RData"))
mtx.asinh <- asinh(mtx.sub)
target.gene <- "MEF2C"
tfs <- setdiff(rownames(mtx.asinh), "MEF2C")
@@ -160,7 +160,7 @@ test_alpha.lasso <- function()
printf("--- test_alpha.lasso")
# Load matrix and transform via arcsinh
load(system.file(package="TReNA", "extdata/ampAD.154genes.mef2cTFs.278samples.RData"))
load(system.file(package="trena", "extdata/ampAD.154genes.mef2cTFs.278samples.RData"))
mtx.asinh <- asinh(mtx.sub)
target.gene <- "MEF2C"
tfs <- setdiff(rownames(mtx.asinh), "MEF2C")
@@ -187,7 +187,7 @@ test_lambda.lasso <- function()
printf("--- test_lambda.lasso")
# Load matrix and transform via arcsinh
load(system.file(package="TReNA", "extdata/ampAD.154genes.mef2cTFs.278samples.RData"))
load(system.file(package="trena", "extdata/ampAD.154genes.mef2cTFs.278samples.RData"))
mtx.asinh <- asinh(mtx.sub)
target.gene <- "MEF2C"
tfs <- setdiff(rownames(mtx.asinh), "MEF2C")
@@ -214,7 +214,7 @@ test_keep.metrics.lasso <- function()
printf("--- test_keep.metrics.lasso")
# Load matrix and transform via arcsinh
load(system.file(package="TReNA", "extdata/ampAD.154genes.mef2cTFs.278samples.RData"))
load(system.file(package="trena", "extdata/ampAD.154genes.mef2cTFs.278samples.RData"))
mtx.asinh <- asinh(mtx.sub)
target.gene <- "MEF2C"
tfs <- setdiff(rownames(mtx.asinh), "MEF2C")
Oops, something went wrong.

0 comments on commit 22baef3

Please sign in to comment.