useDynLib("GENESIS")

import(grDevices)
import(graphics)
import(methods)
import(stats)
importFrom(utils, read.table)

import(Biobase)
import(gdsfmt)
import(Matrix)
import(data.table)
#import(foreach)

importFrom(BiocParallel,
           bpiterate,
           bpparam,
           bpnworkers)

importFrom(GWASTools,
           GdsGenotypeReader,
           GenotypeData,
           GenotypeBlockIterator)
importClassesFrom(GWASTools,
                  GdsGenotypeReader,
                  GenotypeData,
                  GenotypeIterator,
                  GenotypeBlockIterator,
                  ScanAnnotationDataFrame)
importMethodsFrom(GWASTools,
                  close,
                  getAlleleA,
                  getAlleleB,
                  getChromosome,
                  getGenotypeSelection,
                  getPosition,
                  getScanAnnotation,
                  getScanID,
                  getSnpID,
                  getSnpVariable,
                  getVariable,
                  getSex,
                  hasSex,
                  snpFilter,
                  XchromCode,
                  YchromCode)

import(SeqArray)
import(SeqVarTools)

importFrom(SNPRelate,
           snpgdsPCA,
           snpgdsPCASNPLoading,
           snpgdsPCASampLoading)

importFrom(BiocGenerics, start, end)
importFrom(GenomicRanges, GRanges)
importFrom(IRanges, IRanges, findOverlaps)
importFrom(S4Vectors, mcols, queryHits, subjectHits)

exportMethods(assocTestSingle,
              assocTestAggregate,
              effectAllele,
              fitNullModel,
              fitNullModelFastScore,
              kingToMatrix,
              makeSparseMatrix,
              pcair,
              pcrelate,
              pcrelateToMatrix)

export(admixMap,
       calcISAFBeta,
       calcScore,
       computeVSIF,
       computeVSIFNullModel,
       correctKin,
       correctK0,
       correctK2,
       isNullModelFastScore,
       isNullModelSmall,
       jointScoreTest,
       kin2gds,
       mat2gds,
       nullModelFastScore,
       nullModelInvNorm,
       nullModelSmall,
       pcairPartition,
       pcrelateSampBlock,
       samplesGdsOrder,
       varCompCI)

S3method(plot, pcair)
S3method(summary, pcair)
S3method(print, pcair)
S3method(print, summary.pcair)
