useDynLib(ramwas, .registration = TRUE)
export(
    ramwasParameters,
    ramwasAnnotateLocations,
    isAbsolutePath,
    makefullpath,
    cachedRDSload,
    findBestNpvs,
    pvalue2qvalue,
    orthonormalizeCovariates,
    parameterDump,
    parameterPreprocess,
    parametersFromFile,
    ramwas0createArtificialData,
    ramwas1scanBams,
    pipelineProcessBam,
    ramwas2collectqc,
    ramwas3normalizedCoverage,
    ramwas4PCA,
    ramwas5MWAS,
    ramwas6annotateTopFindings,
    ramwas7ArunMWASes,
    ramwas7BrunElasticNet,
    ramwas7CplotByNCpGs,
    ramwas7riskScoreCV,
    processCommandLine,
    qcmean,
    qqPlotFast,
    qqPlotPrepare,
    manPlotPrepare,
    manPlotFast,
    plotPCvalues,
    plotPCvectors,
    plotROC,
    plotPrediction,
    plotCVcors,
    rowSumsSq,
    colSumsSq,
    testPhenotype,
    getCpGsetALL,
    getCpGsetCG,
    getLocations,
    getMWAS,
    getMWASandLocations,
    getMWASrange,
    getDataByLocation,
    subsetCoverageDirByLocation,
    madeBED,
    madeBEDrange,
    madeBEDgraph,
    madeBEDgraphRange,
    insilicoFASTQ,
    injectSNPsMAF,
    mat2cols,
    estimateFragmentSizeDistribution,
    plotFragmentSizeDistributionEstimate,
    ramwasSNPs
)

exportClasses("rwDataClass")

# export(
#     .log,
#     .showErrors,
#     pipelineCoverage1Sample,
#     .ramwas3coverageJob,
#     .ramwas3transposeFilterJob,
#     .ramwas3normalizeJob,
#     .set1MLKthread,
#     .matchCovmatCovar,
#     .getCovariates,
#     .file.remove,
#     postPCAprocessing,
#     .ramwas4PCAjob,
#     .testCovariates,
#     .ramwas5MWASjob,
#     groupSample
# )

importFrom(methods,
    setRefClass, new)
importFrom(grDevices,
    dev.off, pdf, png)
importFrom(graphics,
    abline, legend, lines, par, plot,
    points, title, axis, barplot, hist, layout)
importFrom(stats,
    complete.cases, pf, pt, qf, qt, optim, rnorm, pnorm,
    model.matrix, quantile, median, qlogis, rnbinom,
    plogis, qbeta, cor, lm, qchisq, runif, sd)
importFrom(utils,
    flush.console, head, tail, memory.limit,
    tail.matrix, read.table, write.table)
importFrom(grDevices, 
    palette)
importFrom(GenomicAlignments,
    cigarWidthAlongQuerySpace, cigarWidthAlongReferenceSpace)
importFrom(Rsamtools,
    scanBamFlag, ScanBamParam, BamFile,
    open.BamFile, scanBam, asBam)
importFrom(parallel,
    makeCluster, clusterEvalQ, clusterApplyLB, clusterCall,
    stopCluster, detectCores, clusterExport)
importFrom(KernSmooth, locpoly)
importFrom(digest, digest)
#importFrom(glmnet, cv.glmnet)
#importFrom(glmnet, predict)

importFrom(stats, predict)
import(glmnet)

importFrom(biomaRt, useMart, getBM)
importFrom(Biostrings, matchPattern)

importFrom(filematrix,
    fm.create, fm.load, fm.open,
    fm.create.from.matrix, closeAndDeleteFiles)
importClassesFrom(filematrix, filematrix)
importMethodsFrom(filematrix, close)
importMethodsFrom(filematrix, as.matrix)
importMethodsFrom(BiocGenerics, start)

#import(methods)

S3method(plot, qcHistScore)
S3method(plot, qcEditDist)
S3method(plot, qcLengthMatched)
S3method(plot, qcHistScoreBF)
S3method(plot, qcEditDistBF)
S3method(plot, qcLengthMatchedBF)
S3method(plot, qcIsoDist)
S3method(plot, qcCoverageByDensity)


S3method(qcmean, qcHistScore)
S3method(qcmean, qcEditDist)
S3method(qcmean, qcLengthMatched)
S3method(qcmean, qcHistScoreBF)
S3method(qcmean, qcEditDistBF)
S3method(qcmean, qcLengthMatchedBF)
S3method(qcmean, qcIsoDist)

S3method(qcmean, qcFrwrev)
S3method(qcmean, qcNonCpGreads)
S3method(qcmean, qcCoverageByDensity)
S3method(qcmean, qcChrX)
S3method(qcmean, qcChrY)
S3method(qcmean, NULL)
