import(methods)
importFrom(utils, read.csv, read.table, write.csv, Sweave)
importFrom(grDevices, dev.off, pdf, png, rgb, rainbow)
importFrom(graphics, abline, axis, barplot, hist, legend, lines, mtext, par, plot, points,
    polygon, rect, strheight, strwidth, text)
importFrom(stats, as.dist, cutree, filter, hclust)
importFrom(tools, texi2dvi)
importFrom(xtable, xtable)
importFrom(R2HTML, HTML, HTML.title, HTMLEndFile, HTMLInitFile)
importFrom(TeachingDemos, spread.labs)

import(BiocGenerics)
import(S4Vectors)
import(IRanges)
import(XVector)
import(GenomicRanges)
import(SummarizedExperiment)

importClassesFrom(Biobase, AnnotatedDataFrame, AssayData, MIAME, Versions, Versioned, VersionedBiobase, eSet)
importMethodsFrom(Biobase, assayData, "assayData<-", combine, fData, featureData, "featureData<-",
    pData, phenoData, "phenoData<-", sampleNames, varMetadata)
importFrom(Biobase, assayDataElementNames, assayDataNew)
    
importFrom(biomaRt, getBM, getSequence, useMart)

importClassesFrom(Biostrings, DNAString, DNAStringSet, PhredQuality, QualityScaledDNAStringSet, 
    QualityScaledXStringSet, XStringQuality, XStringSet, BString, SolexaQuality)
importMethodsFrom(Biostrings, PDict, aligned, alphabetFrequency, complement, 
    deletion, endIndex, insertion, matchPDict, matchPattern, mismatchTable, 
    pairwiseAlignment, quality, reverseComplement, startIndex, translate, vmatchPattern)
importFrom(Biostrings, BStringSet, dinucleotideFrequency, DNAString, DNAStringSet, getSeq, 
    nucleotideSubstitutionMatrix, oligonucleotideFrequency, PhredQuality, QualityScaledDNAStringSet, 
    trinucleotideFrequency, writeXStringSet)

importClassesFrom(BSgenome, BSgenome)

importFrom(Rsamtools, scanBam)

importClassesFrom(ShortRead, AlignedRead)
importMethodsFrom(ShortRead, chromosome, id, name, position)
importFrom(ShortRead, AlignedDataFrame, AlignedRead, alignData, sread, alphabetByCycle)

importFrom(VariantAnnotation, VCF, VCFHeader)
importMethodsFrom(VariantAnnotation, writeVcf)

exportClasses(
    AVASet,
    MapperSet,
    AnnotatedVariants,
    Breakpoints,
    SFFRead,
    SFFContainer)


exportMethods(
    alignShortReads,
    readsOnTarget,
    coverageOnTarget,
    calculateTiTv,
    genomeSequencerMIDs,
    sequenceCaptureLinkers,
    demultiplexReads,
    removeLinker,

    filterChimericReads,
    detectBreakpoints,
    mergeBreakpoints,

    annotateVariants,
    annotatedVariants,
    htmlReport,

    ava2vcf,
    
    plotVariationFrequency,
    plotAmpliconCoverage,
    plotVariants,
    plotChimericReads,
            
    seqsC1, "seqsC1<-",
    seqsC2, "seqsC2<-",
    commonBpsC1, "commonBpsC1<-",
    commonBpsC2, "commonBpsC2<-",
    commonAlignC1, "commonAlignC1<-",
    commonAlignC2, "commonAlignC2<-",
    alignedReadsC1, "alignedReadsC1<-",
    alignedReadsC2, "alignedReadsC2<-",
             
    MapperSet,
    AVASet,
    fDataAmp,
    featureDataAmp, "featureDataAmp<-",
    assayDataAmp, "assayDataAmp<-",
    getAlignedReads,
    referenceSequences, "referenceSequences<-",
    getReadStatus,
    getVariantPercentages,
    setVariantFilter,
    
    name, "name<-",
    flowgramFormat, "flowgramFormat<-",
    flowChars, "flowChars<-",
    keySequence, "keySequence<-",
    clipQualityLeft, "clipQualityLeft<-",
    clipQualityRight, "clipQualityRight<-",
    clipAdapterLeft, "clipAdapterLeft<-",
    clipAdapterRight, "clipAdapterRight<-",
    flowgram, "flowgram<-",   
    flowgrams, "flowgrams<-",     
    flowIndexes, "flowIndexes<-",
    read, "read<-",
    quality, "quality<-",
    reads, "reads<-",
    addRead, getRead,
    sff2fastq,
    
    readLengthStats,
    readLengthHist,
    baseQualityStats,
    baseQualityHist,
    sequenceQualityHist,
    positionQualityBoxplot,
    baseFrequency,
    nucleotideCharts,
    gcContent,
    gcPerPosition,
    gcContentHist,
    complexity.dust,
    complexity.entropy,
    dinucleotideOddsRatio,
    flowgramBarplot,
    homopolymerHist
)

export(
    extendedCIGARToList,
    listToExtendedCIGAR,
    readSFF,
    writeSFF,
    qualityReportSFF
)

useDynLib(R453Plus1Toolbox)
