useDynLib("crlmm", .registration=TRUE)

## this is temporary
## exportPattern("^[^\\.]")

## Biobase
importClassesFrom(Biobase, AnnotatedDataFrame, AssayData, eSet, SnpSet,
		  NChannelSet, MIAME, Versioned, VersionedBiobase,
		  Versions)

importMethodsFrom(Biobase, annotation, "annotation<-",
                  annotatedDataFrameFrom, assayData, "assayData<-",
                  combine, dims, experimentData, "experimentData<-",
                  fData, featureData, "featureData<-", featureNames,
                  fvarMetadata, fvarLabels, pData, "pData<-", phenoData,
                  "phenoData<-", protocolData, "protocolData<-",
                  pubMedIds, rowMedians, sampleNames, snpCall,
                  snpCallProbability,
		  "snpCall<-", "snpCallProbability<-", storageMode,
                  "storageMode<-", updateObject, varLabels)

importFrom(Biobase, assayDataElement, assayDataElementNames,
           assayDataElementReplace, assayDataNew, classVersion,
           validMsg)

## oligoClasses
importClassesFrom(oligoClasses, SnpSuperSet, AlleleSet, CNSet)

importMethodsFrom(oligoClasses, allele, calls, "calls<-", confs,
		  "confs<-", cnConfidence, "cnConfidence<-", isSnp,
		  chromosome, position, A, B,
		  "A<-", "B<-", open, close, flags,
		  batchStatistics, "batchStatistics<-", updateObject)


importFrom(oligoClasses, chromosome2integer, celfileDate, list.celfiles,
           copyNumber, initializeBigMatrix, initializeBigVector)


importFrom(graphics, abline, axis, layout, legend, mtext, par, plot,
           polygon, rect, segments, text, points, boxplot, lines)

importFrom(grDevices, grey)

importFrom(affyio, read.celfile.header, read.celfile)

importFrom(preprocessCore, normalize.quantiles.use.target, normalize.quantiles)

importFrom(utils, data, packageDescription, setTxtProgressBar, txtProgressBar)

importFrom(stats, coef, cov, dnorm, kmeans, lm, mad, median, quantile, sd, update)

importFrom(genefilter, rowSds)

importFrom(mvtnorm, dmvnorm)

importFrom(ellipse, ellipse)

importFrom(ff, ffdf, physical.ff, physical.ffdf)

## It is important not to import these classes from oligoClasses
## Doing so causes the following errors:
## N.AA(container)[index, ] <- someMatrix
##Error in function (classes, fdef, mtable)  :
##  unable to find an inherited method for function "medianA.AA<-", for signature "CNSet", "ff_matrix"
##importClassesFrom(oligoClasses, ffdf, ff_matrix)

## Important to export these classes
exportClasses(ff_or_matrix, ff_matrix, ffdf)
exportMethods(lines)
exportMethods(CA, CB)
export(crlmm,
       crlmmIllumina,
       crlmmIlluminaV2,
       ellipseCenters,
       genotype,
       readIdatFiles,
       snprma,
       snprma2,
       crlmm2,
       genotype2, genotypeLD,
       crlmmCopynumber2, crlmmCopynumberLD, crlmmCopynumber)
export(constructIlluminaCNSet)
export(totalCopynumber)
export(cnrma, cnrma2)
exportMethods(A, B, nuA, nuB, phiA, phiB, corr, tau2, Ns, medians, mads)
export(genotypeSummary,
       shrinkSummary,
       estimateCnParameters,
       shrinkGenotypeSummaries, indexComplete, summarizeSnps, constructIlluminaAssayData, crlmmIlluminaV2, ACN, C1, C2, C3, fit.lm3)

exportMethods(N.AA, N.AB, N.BB, "N.AA<-", "N.AB<-", "N.BB<-", medianA.AA, "medianA.AA<-")

## export(fit.lm1, fit.lm2, fit.lm3, fit.lm4)

## For debugging
## exportPattern("^[^\\.]")