import(methods)
importFrom(utils, read.table, available.packages, contrib.url,
                  installed.packages, str)
importFrom(stats, setNames)
importFrom(matrixStats, rowAlls)

import(BiocGenerics)
import(S4Vectors)
import(IRanges)
import(GenomeInfoDb)
import(GenomicRanges)
import(XVector)
import(Biostrings)
importFrom(BiocIO, export)
importMethodsFrom(BiocIO, import, export)
importClassesFrom(rtracklayer, TwoBitFile)
importFrom(rtracklayer, TwoBitFile)
import(Rsamtools)


### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
### Export S4 classes
###

exportClasses(
    OnDiskLongTable_old,
    GRanges_OR_NULL, OnDiskLongTable,
    SNPlocs, ODLT_SNPlocs, OldFashionSNPlocs,
    InjectSNPsHandler,
    XtraSNPlocs,
    BSgenome, MaskedBSgenome,
    BSgenomeViews
)


### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
### Export S3 methods
###

S3method(as.data.frame, BSgenomeViews)

### We also export them thru the export() directive so that (a) they can be
### called directly, (b) tab-completion on the name of the generic shows them,
### and (c) methods() doesn't asterisk them.
export(
    as.data.frame.BSgenomeViews
)


### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
### Export S4 methods for generics not defined in BSgenome
###

exportMethods(
    ## Methods for generics defined in the base package:
    length, names,
    dim, dimnames,
    as.character, as.list, as.data.frame,
    "[[", "$", unlist,
    nchar,

    ## Methods for generics defined in the methods package:
    coerce, show,

    ## Methods for generics defined in the BiocGenerics package:
    start, end, width, strand, organism,

    ## Methods for generics defined in the S4Vectors package:
    elementNROWS,

    ## Methods for generics defined in the IRanges package:
    ranges, Views, subject, score,

    ## Methods for generics defined in the GenomeInfoDb package:
    seqinfo, "seqinfo<-", seqnames, "seqnames<-",
    commonName, provider, providerVersion, releaseDate,

    ## Methods for generics defined in the GenomicRanges package:
    granges,

    ## Methods for generics defined in the Biostrings package:
    getSeq, extractAt,
    seqtype, alphabetFrequency, hasOnlyBaseLetters,
    uniqueLetters, letterFrequency,
    oligonucleotideFrequency, nucleotideFrequencyAt,
    consensusMatrix, consensusString,
    matchPWM, countPWM, vmatchPattern, vcountPattern,

    ## Methods for generics defined in the rtracklayer package:
    export
)


### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
### Export non-generic functions
###

export(
    ## OnDiskLongTable_old-class.R:
    saveAsOnDiskLongTable_old, saveRowidsForOnDiskLongTable_old,
    OnDiskLongTable_old,
    getBatchesFromOnDiskLongTable_old,
    getRowsByIndexFromOnDiskLongTable_old,

    ## OnDiskLongTable-class.R:
    OnDiskLongTable, writeOnDiskLongTable, writeOnDiskLongTableRowids,
    getBatchesFromOnDiskLongTable,
    getBatchesBySeqnameFromOnDiskLongTable,
    getBatchesByOverlapsFromOnDiskLongTable,
    getRowsFromOnDiskLongTable,
    getRowsByIdFromOnDiskLongTable,

    ## ODLT_SNPlocs-class.R:
    inferRefAndAltAlleles,

    ## OldFashionSNPlocs-class.R:
    newSNPlocs,

    ## XtraSNPlocs-class.R:
    newXtraSNPlocs,

    ## BSgenome-class.R:
    BSgenome, MaskedBSgenome,

    ## available.genomes.R:
    installed.genomes, available.genomes, getBSgenome,

    ## injectSNPs.R:
    installed.SNPs, available.SNPs,

    ## bsapply.R:
    bsapply,

    ## BSgenomeViews-class.R:
    BSgenomeViews,

    ## export-methods.R:
    writeBSgenomeToFasta,
    writeBSgenomeToTwobit,

    ## AdvancedBSgenomeForge.R:
    forgeSeqlengthsRdsFile,
    forgeSeqlengthsRdaFile,
    forgeSeqFiles,
    forgeMasksFiles,
    forgeBSgenomeDataPkg,
    forgeMaskedBSgenomeDataPkg
)


### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
### Export S4 generics defined in BSgenome + export corresponding methods
###

export(
    ## OnDiskLongTable_old-class.R:
    breakpoints, blocksizes,

    ## OnDiskLongTable-class.R:
    batchsizes, spatialIndex,

    ## SNPlocs-class.R:
    releaseName, referenceGenome, compatibleGenomes,
    snpcount, snplocs,
    snpsBySeqname, snpsByOverlaps, snpsById,

    ## InjectSNPsHandler-class.R:
    SNPlocs_pkgname,

    ## BSgenome-class.R:
    sourceUrl,
    mseqnames,
    masknames,

    ## injectSNPs.R:
    injectSNPs
)

### Exactly the same list as above.
exportMethods(
    breakpoints, blocksizes,
    batchsizes, spatialIndex,
    releaseName, referenceGenome, compatibleGenomes,
    snpcount, snplocs,
    snpsBySeqname, snpsByOverlaps, snpsById,
    SNPlocs_pkgname,
    sourceUrl,
    mseqnames,
    masknames,
    injectSNPs
)

