useDynLib("crlmm", .registration=TRUE)
##---------------------------------------------------------------------------
## 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, isPackageLoaded)


importFrom(graphics, abline, axis, layout, legend, mtext, par, plot,
           polygon, rect, segments, text, points, boxplot, lines)
importFrom(lattice, xyplot, simpleKey, panel.grid, panel.xyplot, lrect, ltext,
	   lpoints, panel.number, lpolygon)

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, ffrowapply)
## 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)
importClassesFrom(oligoClasses, ff_matrix, ffdf)
## Important to export these classes
##exportClasses(ff_or_matrix, ff_matrix, ffdf)
##exportClasses(ff_or_matrix)
##---------------------------------------------------------------------------
## lattice imports
##---------------------------------------------------------------------------
##import(panel.number, panel.grid, panel.xyplot, lpoints, lsegments, lrect, ltext)

exportMethods(lines)
exportMethods(CA, CB)
export(crlmm,
       crlmmIllumina,
       crlmmIlluminaV2,
       genotype,
       readIDAT,
       readIdatFiles,
       snprma,
       snprma2,
       crlmm2,
       genotype2, genotypeLD,
       genotype.Illumina,
       crlmmCopynumber2, crlmmCopynumberLD, crlmmCopynumber)
export(genotypes, totalCopynumber, rawCopynumber, xyplot)
exportMethods(A, B, calculatePosteriorMean, corr, nuA, nuB, phiA, phiB, predictionRegion, posteriorProbability, tau2, Ns, medians, mads, xyplot)
export(ABpanel, constructInf, preprocessInf, genotypeInf)