import(graphics)
import(stats)
import(utils)
import(methods)
import(Biobase)
import(DBI)
import(RSQLite)
import(gdsfmt)
#import(ncdf4) # moved to Suggests
importFrom(GWASExactHW, HWExact)
importFrom(DNAcopy, getbdry, CNA, smooth.CNA, segment)
importFrom(survival, Surv, coxph) # used in assocCoxPH
importFrom(sandwich, vcovHC, vcovHC.default) # used in assocRegression
importFrom(lmtest, lrtest, lrtest.default) # used in assocRegression
importFrom(logistf, logistf) # used in assocRegression
importFrom(quantsmooth, paintCytobands, lengthChromosome) # used to plot ideograms
importFrom(data.table, fread, fwrite, rbindlist)

exportClasses(
    SnpAnnotationDataFrame,
    SnpAnnotationSQLite,
    ScanAnnotationDataFrame,
    ScanAnnotationSQLite,
    NcdfReader,
    NcdfGenotypeReader,
    NcdfIntensityReader,
    GdsReader,
    GdsGenotypeReader,
    GdsIntensityReader,
    MatrixGenotypeReader,
    GenotypeData,
    IntensityData,
    GenotypeIterator,
    GenotypeBlockIterator
)

export(
    ## Class constructor functions
    SnpAnnotationDataFrame,
    SnpAnnotationSQLite,
    ScanAnnotationDataFrame,
    ScanAnnotationSQLite,
    NcdfReader,
    NcdfGenotypeReader,
    NcdfIntensityReader,
    GdsReader,
    GdsGenotypeReader,
    GdsIntensityReader,
    MatrixGenotypeReader,
    GenotypeData,
    IntensityData,
    GenotypeIterator,
    GenotypeBlockIterator,

    ## Ordinary functions (i.e. not generic):
    alleleFrequency,
    anomSegmentBAF,
    anomFilterBAF,
    anomDetectBAF,
    anomDetectLOH,
    anomIdentifyLowQuality,
    anomSegStats,
    anomStatsPlot,
    apartSnpSelection,
    asSnpMatrix,
    assocCoxPH,
    assocRegression, 
    BAFfromClusterMeans,
    BAFfromGenotypes,
    batchChisqTest,
    batchFisherTest,
    checkGenotypeFile,
    checkImputedDosageFile,
    checkIntensityFile,
    checkNcdfGds,
    chromIntensityPlot,
    convertGdsNcdf,
    convertNcdfGds,
    createDataFile,
    createAffyIntensityFile,
    dupDosageCorAcrossDatasets,
    duplicateDiscordance,
    duplicateDiscordanceAcrossDatasets,
    duplicateDiscordanceProbability,
    exactHWE,
    findBAFvariance,
    gdsSubset,
    gdsSubsetCheck,
    genoClusterPlot,
    genoClusterPlotByBatch,
    genotypeToCharacter,
    hetByScanChrom,
    hetBySnpSex,
    ibdAreasDraw,
    ibdAssignRelatedness,
    ibdAssignRelatednessKing,
    ibdPlot,
    imputedDosageFile,
    intensityOutliersPlot,
    kingIBS0FSCI,
    manhattanPlot,
    meanIntensityByScanChrom,
    meanSdByChromWindow,
    medianSdOverAutosomes,
    mendelErr,
    mendelList,
    mendelListAsDataFrame,
    minorAlleleDetectionAccuracy,
    missingGenotypeByScanChrom,
    missingGenotypeBySnpSex,
    pedigreeCheck,
    pedigreeDeleteDuplicates,
    pedigreeMaxUnrelated,
    pedigreePairwiseRelatedness,
    pasteSorted,
    plinkCheck,
    plinkWrite,
    pseudoautoIntensityPlot,
    qqPlot,
    qualityScoreByScan,
    qualityScoreBySnp,
    sdByScanChromWindow,
    setMissingGenotypes,
    simulateGenotypeMatrix,
    simulateIntensityMatrix,
    snpCorrelationPlot,
    vcfCheck,
    vcfWrite,
    genoDataAsVCF,
    allequal,
    getobj,
    saveas,
    readWriteFirst
)


exportMethods(
    ## Methods associated with the generic functions defined in
    ## this package:
    getAlleleA,
    getAlleleB,
    getAnnotation,
    getAttribute,
    getBAlleleFreq,
    getChromosome,
    getDimension,
    getDimensionNames,
    getGenotype,
    getGenotypeSelection,
    getLogRRatio,
    getMetadata,
    getNodeDescription,
    getPosition,
    getQuality,
    getQuery,
    getScanAnnotation,
    getScanID,
    getScanVariable,
    getScanVariableNames,
    getSex,
    getSnpAnnotation,
    getSnpID,
    getSnpVariable,
    getSnpVariableNames,
    getVariable,
    getVariableNames,
    getX,
    getY,
    hasBAlleleFreq,
    hasCoordVariable,
    hasLogRRatio,
    hasQuality,
    hasScanAnnotation,
    hasScanVariable,
    hasSex,
    hasSnpAnnotation,
    hasSnpVariable,
    hasVariable,
    hasX,
    hasY,
    nsnp,
    nscan,
    writeAnnotation,
    writeMetadata,
    autosomeCode,
    XchromCode,
    YchromCode,
    XYchromCode,
    MchromCode,
    snpFilter,
    lastFilter, "lastFilter<-",
    iterateFilter,
    currentFilter,
    resetIterator,

    ## Methods associated with generic functions defined somewhere else:
    open, close, show
)