Skip to content

Commit

Permalink
add methods is to the importFrom
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiiiyang committed Jun 22, 2019
1 parent 2bf5e16 commit a988e46
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 16 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
.Ruserdata
.DS_Store
*.Rproj
.o
.dll
doc
Meta
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Imports: R2jags, abind, cowplot, grid, forcats, stringr,
BSgenome.Hsapiens.UCSC.hg19, BiocGenerics, tidyr, grDevices, stats,
TxDb.Hsapiens.UCSC.hg19.knownGene, utils, methods, Rcpp
Suggests: knitr, rmarkdown, testthat, BiocStyle
Version: 0.99.3
Version: 0.99.4
Date: 2019-06-05
Authors@R: c(person("Zhi", "Yang", email = "zyang895@gmail.com",
role = c("aut", "cre")),
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ importFrom(forcats,fct_relevel)
importFrom(forcats,fct_reorder)
importFrom(grDevices,hcl)
importFrom(grid,unit.c)
importFrom(methods,is)
importFrom(methods,new)
importFrom(methods,slot)
importFrom(stats,aggregate)
Expand Down
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ Changes in version 0.99.2 (2019-06-05)
Changes in version 0.99.3 (2019-06-21)
+ Fix the issues commented by the Bioconductor reviewer

Changes in version 0.99.4 (2019-06-22)
+ Remove git tracking .o and .dll files
12 changes: 9 additions & 3 deletions R/hilda_diagnosis.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#'
#' @return a number for the Rhat statistic.
#'
#' @importFrom methods is
#'
#' @examples
#'
#' inputFile <- system.file("extdata/hildaLocal.rdata", package="HiLDA")
Expand All @@ -16,7 +18,7 @@
#

hildaRhat <- function(jagsOutput) {
if(class(jagsOutput) != "rjags") {
if(is(jagsOutput) != "rjags") {
stop("Not an output object from running the HiLDA tests.")
}
return(max(jagsOutput$BUGSoutput$summary[, "Rhat"]))
Expand All @@ -29,6 +31,8 @@ hildaRhat <- function(jagsOutput) {
#' @param jagsOutput the output jags file generated by the jags function from
#' the R2jags package.
#'
#' @importFrom methods is
#'
#' @examples
#'
#' inputFile <- system.file("extdata/hildaLocal.rdata", package="HiLDA")
Expand All @@ -42,7 +46,7 @@ hildaRhat <- function(jagsOutput) {
#

hildaLocalResult <- function(jagsOutput) {
if(class(jagsOutput) != "rjags") {
if(is(jagsOutput) != "rjags") {
stop("Not an output object from running the HiLDA tests.")
}
rownames <- rownames(jagsOutput$BUGSoutput$summary)
Expand All @@ -57,6 +61,8 @@ hildaLocalResult <- function(jagsOutput) {
#' @param pM1 the probability of sampling the null (default: 0.5)
#' @return a number for the Bayes factor
#'
#' @importFrom methods is
#'
#' @examples
#'
#' load(system.file("extdata/sample.rdata", package="HiLDA"))
Expand All @@ -68,7 +74,7 @@ hildaLocalResult <- function(jagsOutput) {
#

hildaGlobalResult <- function(jagsOutput, pM1=0.5) {
if(class(jagsOutput) != "rjags") {
if(is(jagsOutput) != "rjags") {
stop("Not an output object from running the HiLDA tests.")
}

Expand Down
13 changes: 8 additions & 5 deletions R/hilda_plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@
#' hildaPlotSignature(hildaLocal)
#'
#' @importFrom cowplot plot_grid
#' @importFrom methods is
#' @export

hildaPlotSignature <- function(hildaResult, sigOrder=NULL, colorList = NULL,
...) {
if(class(hildaResult) != "rjags") {
if(is(hildaResult) != "rjags") {
stop("Not an output object from running the HiLDA tests.")
}

Expand Down Expand Up @@ -110,6 +111,7 @@ hildaPlotSignature <- function(hildaResult, sigOrder=NULL, colorList = NULL,
#' @importFrom grid unit.c
#' @importFrom forcats fct_relevel fct_reorder
#' @importFrom stats aggregate
#' @importFrom methods is
#' @export


Expand All @@ -118,11 +120,11 @@ hildaBarplot <- function(inputG, hildaResult, sigOrder=NULL, refGroup,
charSize=3) {
numSig <- dim(hildaResult$BUGSoutput$mean$pStates1)[3]

if(class(inputG) != "MutationFeatureData") {
if(is(inputG)[1] != "MutationFeatureData") {
stop("Not an output object from reading in the data using HiLDA.")
}

if(class(hildaResult) != "rjags") {
if(is(hildaResult) != "rjags") {
stop("Not an output object from running the HiLDA tests.")
}

Expand Down Expand Up @@ -205,6 +207,7 @@ hildaBarplot <- function(inputG, hildaResult, sigOrder=NULL, refGroup,
#' @importFrom cowplot plot_grid
#' @importFrom grid unit.c
#' @import ggplot2
#' @importFrom methods is
#'
#' @export

Expand All @@ -216,11 +219,11 @@ hildaDiffPlot <- function(inputG, hildaResult, sigOrder=NULL, charSize=3) {
sigOrder <- seq_len(numSig)
}

if(class(inputG) != "MutationFeatureData") {
if(is(inputG)[1] != "MutationFeatureData") {
stop("Not an output object from reading in the data using HiLDA.")
}

if(class(hildaResult) != "rjags") {
if(is(hildaResult) != "rjags") {
stop("Not an output object from running the HiLDA tests.")
}

Expand Down
5 changes: 5 additions & 0 deletions R/hilda_test.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#' @importFrom R2jags jags
#' @importFrom abind abind
#' @importFrom stats reshape
#' @importFrom methods is
#' @export

hildaTest <- function(inputG, numSig, refGroup, useInits=NULL, sigOrder=NULL,
Expand All @@ -44,6 +45,10 @@ hildaTest <- function(inputG, numSig, refGroup, useInits=NULL, sigOrder=NULL,
stop(paste("There are more reference samples than the total samples"))
}

if(is(inputG)[1] != "MutationFeatureData") {
stop("Not an output object from reading in the data using HiLDA.")
}

# reshape the counts of input data
countWide <- as.data.frame(t(inputG@countData))
colnames(countWide) <- c("type", "sample", "count")
Expand Down
4 changes: 2 additions & 2 deletions R/pm_getSignature.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
#' @useDynLib HiLDA
#' @importFrom Rcpp sourceCpp
#' @importFrom stats rgamma
#' @importFrom methods slot
#' @importFrom methods slot is
#' @export
pmgetSignature <- function(mutationFeatureData, K, numInit = 10, tol = 1e-4,
maxIter = 10000) {

if (class(mutationFeatureData) != "MutationFeatureData") {
if (is(mutationFeatureData)[1] != "MutationFeatureData") {
stop("This inputfile is not an MutationFeatureData object.")
}

Expand Down
13 changes: 8 additions & 5 deletions R/pm_plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#'
#' @importFrom cowplot plot_grid
#' @importFrom grDevices hcl
#' @importFrom methods is
#' @export

pmPlotSignature <- function(inputParam, sigOrder=NULL, colorList=NULL, ...) {
Expand All @@ -24,7 +25,7 @@ pmPlotSignature <- function(inputParam, sigOrder=NULL, colorList=NULL, ...) {
sigOrder <- seq_len(numSig)
}

if (class(inputParam) != "EstimatedParameters") {
if (is(inputParam)[1] != "EstimatedParameters") {
stop("The inputParam object is not an EstimatedParameters object")
}

Expand Down Expand Up @@ -78,6 +79,7 @@ pmPlotSignature <- function(inputParam, sigOrder=NULL, colorList=NULL, ...) {
#' @importFrom tidyr gather_
#' @importFrom grid unit.c
#' @importFrom forcats fct_relevel fct_reorder
#' @importFrom methods is
#' @export

pmBarplot <- function(inputG, inputParam, sigOrder=NULL, refGroup=NULL,
Expand All @@ -89,11 +91,11 @@ pmBarplot <- function(inputG, inputParam, sigOrder=NULL, refGroup=NULL,
sigOrder <- seq_len(numSig)
}

if (class(inputParam) != "EstimatedParameters") {
if (is(inputParam)[1] != "EstimatedParameters") {
stop("The inputParam object is not an EstimatedParameters object")
}

if(class(inputG) != "MutationFeatureData") {
if(is(inputG)[1] != "MutationFeatureData") {
stop("Not an output object from reading in the data using HiLDA.")
}

Expand Down Expand Up @@ -191,6 +193,7 @@ pmBarplot <- function(inputG, inputParam, sigOrder=NULL, refGroup=NULL,
#' @importFrom tidyr gather_
#' @importFrom grid unit.c
#' @importFrom forcats fct_relevel fct_reorder
#' @importFrom methods is
#' @export

pmMultiBarplot <- function(inputG, inputParam, sigOrder=NULL, groupIndices,
Expand All @@ -201,11 +204,11 @@ pmMultiBarplot <- function(inputG, inputParam, sigOrder=NULL, groupIndices,
sigOrder <- seq_len(numSig)
}

if(class(inputG) != "MutationFeatureData") {
if(is(inputG)[1] != "MutationFeatureData") {
stop("Not an output object from reading in the data using HiLDA.")
}

if (class(inputParam) != "EstimatedParameters") {
if (is(inputParam)[1] != "EstimatedParameters") {
stop("The inputParam object is not an EstimatedParameters object")
}

Expand Down
Binary file modified src-i386/HiLDA.dll
Binary file not shown.
Binary file modified src-x64/HiLDA.dll
Binary file not shown.

0 comments on commit a988e46

Please sign in to comment.