
useDynLib(girafe, girafeCoverage=girafe_coverage)

import("methods")

importFrom("graphics", "abline", "axTicks", "barplot", "hist", "legend", "par", "points", "plot", "text")

importFrom("grDevices", "rainbow")

importFrom("grid", "arrow", "convertWidth", "dataViewport", "gpar",
          "grid.layout", "grid.lines", "grid.polygon", "grid.rect",
          "grid.segments", "grid.text", "grid.yaxis", "popViewport",
          "pushViewport", "stringWidth", "unit", "viewport")

importFrom("utils", "write.table")

importFrom("stats", "median", "p.adjust", "p.adjust.methods", "pnbinom", "rnbinom")

import("BiocGenerics")
import("S4Vectors")

importMethodsFrom("Biobase", "annotation")
importFrom("Biobase", "addVigs2WinMenu", "listLen")

importFrom("Biostrings", "consensusString","pairwiseAlignment","pattern","quality", "nucleotideSubstitutionMatrix")
importClassesFrom("Biostrings", "DNAString","DNAStringSet")
importMethodsFrom("Biostrings", "nchar", "detail")

importClassesFrom("IRanges", "IntegerRanges", "IRanges", "CompressedIRangesList", "IntegerRangesList", "SimpleRleList")
importMethodsFrom("IRanges", "score", "score<-", "[", "coverage", "sort")
importFrom("IRanges", "IRanges", "RleList")

importClassesFrom("ShortRead", "AlignedRead")
importMethodsFrom("ShortRead", "chromosome", "position", "id")
importFrom("ShortRead", "sread")

importFrom("intervals", "plot")
importClassesFrom("intervals", "Intervals_virtual",
                     "Intervals_virtual_or_numeric", "Intervals_full")
importMethodsFrom("intervals", "clusters", "interval_included", "interval_overlap", "which_nearest", "reduce")

importClassesFrom("genomeIntervals", "Genome_intervals",
                  "Genome_intervals_stranded")
importMethodsFrom("genomeIntervals", "strand", "strand<-",
                  "seqnames", "seqnames<-")
importFrom("genomeIntervals", "getGffAttribute")

export("AlignedGenomeIntervals", "plotAligned", "trimAdapter",
       "perWindow", "fracOverlap", "intPhred", "coverageOneStrand",
       "addNBSignificance", "plotNegBinomFit", "medianByPosition",
       "agiFromBam", "getFeatureCounts", "countReadsAnnotated",
       "chrlengths", "clusters", "coerce", 
       "plot", "sample", "subset", "summary") # generics

exportClasses("AlignedGenomeIntervals")

exportMethods("plot", "[", "interval_overlap", "interval_included",
              "chrlengths", "chrlengths<-", "chromosome",
              "coerce", "coverage", "clusters", "detail",
              "export", "extend", "hist", "nchar",
              "matches", "matches<-", "id", "id<-",
              "organism", "organism<-", "reads", "reads<-", "reduce", 
              "sample", "score", "score<-", "seqnames", "show",
              "sort", "strand", "strand<-", "subset", "summary",
              "width", "which_nearest")

S3method("c", "AlignedGenomeIntervals")
