## ensembldb NAMESPACE
import(methods)

importFrom("stats", "setNames")
importFrom("utils",
           "read.table",
           "str",
           "download.file")
import("BiocGenerics")
importFrom("Biobase",
           "createPackage",
           "validMsg")
importMethodsFrom("ProtGenerics",
                  "proteins")
import("S4Vectors")
importFrom("DBI",
           "dbDriver")
import("RSQLite")
importMethodsFrom("AnnotationDbi",
                  "columns",
                  "dbconn",
                  "keys",
                  "keytypes",
                  "mapIds",
                  "select")
importFrom("GenomeInfoDb",
           "Seqinfo",
           "isCircular",
           "genome",
           "seqlengths",
           "seqnames",
           "seqlevels",
           "keepSeqlevels",
           "seqlevelsStyle",
           "seqlevelsStyle<-",
           "genomeStyles")
importFrom("rtracklayer",
           "import")

## Ranges and stuff
importFrom("IRanges",
           "IRanges",
           "IRangesList")
importMethodsFrom("IRanges",
                  "subsetByOverlaps")
import("GenomicRanges")
import("GenomicFeatures")

## AnnotationHub
## importFrom("AnnotationHub",
##            "AnnotationHub")
## importClassesFrom("AnnotationHub",
##                   "AnnotationHub")
## importMethodsFrom("AnnotationHub",
##                   "query",
##                   "mcols")
## Rsamtools
importClassesFrom("Rsamtools",
                  "FaFile",
                  "RsamtoolsFile")
importFrom("Rsamtools",
           "FaFile")
importMethodsFrom("Rsamtools",
                  "getSeq",
                  "indexFa")
importFrom("Rsamtools",
           "index")

## Stuff needed for protein annotations.
importClassesFrom("Biostrings",
                  "AAStringSet")
importFrom("Biostrings",
           "AAStringSet")

importFrom("curl",
           "curl")

## AnnotationFilter
importClassesFrom("AnnotationFilter",
                  "AnnotationFilter",
                  "CharacterFilter",
                  "IntegerFilter",
                  "ExonIdFilter",
                  "ExonRankFilter",
                  "ExonStartFilter",
                  "ExonEndFilter",
                  "GeneIdFilter",
                  "GenenameFilter",
                  "GeneBiotypeFilter",
                  "GeneStartFilter",
                  "GeneEndFilter",
                  "EntrezFilter",
                  "SymbolFilter",
                  "TxIdFilter",
                  "TxNameFilter",
                  "TxBiotypeFilter",
                  "TxStartFilter",
                  "TxEndFilter",
                  "ProteinIdFilter",
                  "UniprotFilter",
                  "SeqNameFilter",
                  "SeqStrandFilter",
                  "GRangesFilter",
                  "AnnotationFilterList"
                  )
importMethodsFrom("AnnotationFilter",
                  "field",
                  "value",
                  "condition",
                  "supportedFilters",
                  "convertFilter")
importFrom("AnnotationFilter",
           "AnnotationFilter",
           "ExonIdFilter",
           "ExonRankFilter",
           "ExonStartFilter",
           "ExonEndFilter",
           "GeneIdFilter",
           "GenenameFilter",
           "GeneBiotypeFilter",
           "GeneStartFilter",
           "GeneEndFilter",
           "EntrezFilter",
           "SymbolFilter",
           "TxIdFilter",
           "TxNameFilter",
           "TxBiotypeFilter",
           "TxStartFilter",
           "TxEndFilter",
           "ProteinIdFilter",
           "UniprotFilter",
           "SeqNameFilter",
           "SeqStrandFilter",
           "GRangesFilter",
           "AnnotationFilterList",
           "feature"
           )

## Functions
export("ensDbFromAH",
       "ensDbFromGff",
       "ensDbFromGRanges",
       "ensDbFromGtf",
       "fetchTablesFromEnsembl",
       "listEnsDbs",
       "makeEnsemblSQLiteFromTables",
       "makeEnsembldbPackage",
       "runEnsDbApp",
       "filter",
       "proteinToGenome",
       "proteinToTranscript",
       "genomeToTranscript",
       "transcriptToProtein",
       "genomeToProtein",
       "transcriptToGenome",
       "transcriptToCds",
       "cdsToTranscript"
       )
## Classes
exportClasses(
              "EnsDb",
              "ProtDomIdFilter",
              "ProteinDomainSourceFilter",
              "UniprotDbFilter",
              "UniprotMappingTypeFilter",
              "OnlyCodingTxFilter",
              "TxSupportLevelFilter",
	      "TxExternalNameFilter",
	      "TxIsCanonicalFilter"
              )
## Methods for EnsFilter
exportMethods(
    "seqnames",
    "seqlevels",
    "show",
    "convertFilter"
)
## Methods for class EnsDb:
exportMethods("cdsBy",
              "dbconn",
              "ensemblVersion",
              "exons",
              "exonsBy",
              "exonsByOverlaps",
              "fiveUTRsByTranscript",
              "genes",
              "getGeneRegionTrackForGviz",
              "getGenomeFaFile",
              "getGenomeTwoBitFile",
              "lengthOf",
              "listColumns",
              "listGenebiotypes",
              "listTxbiotypes",
              "listTables",
              "metadata",
              "organism",
              "promoters",
              "returnFilterColumns",
              "returnFilterColumns<-",
              "seqinfo",
              "threeUTRsByTranscript",
              "toSAF",
              "transcripts",
              "transcriptsBy",
              "transcriptsByOverlaps",
              "updateEnsDb",
              "useMySQL",
              "supportedFilters",
              "addFilter",
              "activeFilter",
              "dropFilter",
              "intronsByTranscript"
              )
## Protein data related stuff
exportMethods("hasProteinData",
              "proteins",
              "listUniprotDbs",
              "listUniprotMappingTypes")
export("listProteinColumns")
## Methods for AnnotationDbi
exportMethods("columns",
              "keytypes",
              "keys",
              "select",
              "mapIds")
## Methods for GenomeInfoDb and related stuff
exportMethods("seqlevelsStyle",
              "seqlevelsStyle<-",
              "supportedSeqlevelsStyles",
              "seqlevels")

## Constructor functions:
export(
    "EnsDb",
    "EntrezidFilter",
    "ExonidFilter",
    "ExonrankFilter",
    "GeneidFilter",
    "GenebiotypeFilter",
    "SeqnameFilter",
    "SeqstrandFilter",
    "SeqstartFilter",
    "SeqendFilter",
    "TxidFilter",
    "TxbiotypeFilter",
    "UniprotDbFilter",
    "UniprotMappingTypeFilter",
    "OnlyCodingTxFilter",
    "ProtDomIdFilter",
    "ProteinDomainIdFilter",
    "ProteinDomainSourceFilter",
    "TxSupportLevelFilter",
    "TxExternalNameFilter",
    "TxIsCanonicalFilter"
)
