##
## Importing
##

import(methods)
importFrom(BiocGenerics, "anyDuplicated", "cbind", "colnames",
           "combine", "density", "intersect", "lapply", "ncol",
           "nrow", "order", "paste", "pmax", "pmin", "rbind",
           "Reduce", "rep.int", "rownames", "sapply", "setdiff",
           "strand", "strand<-", "union", "unique", "updateObject")
importFrom(stats, "approxfun", "fisher.test", "ppoints",
           "predict", "preplot", "qchisq",
           "qnorm", "qqplot", "qunif", "cov2cor",
           "plogis")
importFrom(graphics, "abline", "axis", "layout", "legend", "lines",
           "mtext", "par", "plot", "points", "polygon", "rect", "rug", "text")
import(parallel)
importFrom(locfit, "locfit", "lp")
importFrom(DelayedMatrixStats, "rowSds", "rowVars", "colMeans2", "colSums2",
           "rowSums2", "rowMeans2")
import(IRanges)
import(GenomicRanges)
import(SummarizedExperiment)
importFrom(scales, "alpha")
importClassesFrom(Biobase, "AnnotatedDataFrame")
importMethodsFrom(Biobase, "annotatedDataFrameFrom",
                  "pData", "pData<-",
                  "sampleNames", "sampleNames<-")
importFrom(Biobase, "validMsg")
importMethodsFrom(GenomeInfoDb, "seqlengths", "seqlengths<-", "seqinfo", "seqinfo<-",
                  "seqnames", "seqnames<-", "seqlevels", "seqlevels<-")
import(S4Vectors)
importFrom(gtools, "combinations")
importFrom(data.table, "fread", "setnames")
importFrom(R.utils, "isGzipped", "gunzip")
import(limma)
importFrom(permute, "shuffleSet", "how")
importClassesFrom(DelayedArray, "DelayedArray", "DelayedMatrix")
importFrom(DelayedArray, "DelayedArray", "plogis", "pmin2", "pmax2", "rowMaxs",
           "rowMins", "close", "write_block_to_sink", "RegularArrayGrid",
           "type")
importClassesFrom(HDF5Array, "HDF5Array")

##
## Exporting
##


exportClasses("hasGRanges",
              "BSseq",
              "BSseqTstat",
              "BSseqStat",
              "matrixOrNULL")

exportMethods("[", "show",
              "seqnames", "seqnames<-",
              "seqlevels", "seqlevels<-",
              "seqlengths", "seqlengths<-",
              "start", "start<-",
              "end", "end<-",
              "width", "width<-",
              "strand", "strand<-",
              "granges",
              "dim", "nrow", "ncol",
              "sampleNames", "sampleNames<-",
              "pData", "pData<-",
              "findOverlaps", "subsetByOverlaps",
              "combine", "updateObject")

export("BSseq", "getMeth", "getCoverage", "getBSseq", "getStats",
       "collapseBSseq", "orderBSseq", "hasBeenSmoothed", "chrSelectBSseq",
       "BSmooth", "BSmooth.tstat", "dmrFinder", "fisherTests",
       "combineList", "strandCollapse",
       "plotRegion", "plotManyRegions",
       "read.umtab", "read.umtab2", "read.bsmooth", "read.bismark",
       "poissonGoodnessOfFit", "binomialGoodnessOfFit",
       "data.frame2GRanges", "BSseqTstat",
       "BSseqStat")

S3method("print", "chisqGoodnessOfFit")
S3method("plot", "chisqGoodnessOfFit")
S3method("print", "summary.BSseqTstat")
S3method("summary", "BSseqTstat")
S3method("plot", "BSseqTstat")

## Fixes, to be removed

exportMethods("assays", "assayNames")