Here is how the data files contained in this package were produced:

1) Choose a <DOWNLOAD_DIR> dir e.g.
     ~/BSgenome_srcdata/BSgenome.Dmelanogaster.UCSC.dm2/
   and create 2 subdirs in it: <DOWNLOAD_DIR>/seqs/ and <DOWNLOAD_DIR>/masks/

2) Download the sequence files to the <DOWNLOAD_DIR>/seqs/ dir:

     ftp://hgdownload.cse.ucsc.edu/goldenPath/dm2/bigZips/
       chromFa.zip (40M)
       upstream1000.fa.gz (4.1M)
       upstream2000.fa.gz (7.7M)
       upstream5000.fa.gz (18MB)

   and extract them:

     cd <DOWNLOAD_DIR>/seqs/
     for file in *.gz ; do gunzip $file ; done
     for file in *.tar ; do tar xvf $file ; done

3) Download the masks files to the <DOWNLOAD_DIR>/masks/ dir:

     cd <DOWNLOAD_DIR>/masks/

     ftp://hgdownload.cse.ucsc.edu/goldenPath/dm2/database/
       ftp> prompt
       ftp> mget chr*_gap.txt.gz

     wget http://hgdownload.cse.ucsc.edu/goldenPath/dm2/bigZips/chromOut.zip
     wget http://hgdownload.cse.ucsc.edu/goldenPath/dm2/bigZips/chromTrf.zip

   then extract them:

     for file in chr*_gap.txt.gz; do gunzip $file ; done
     unzip chromOut.zip
     unzip chromTrf.zip

   and move the *.bed files one level up:

     mv trfMaskChrom/*.bed . -i

4) Install the BSgenome.Dmelanogaster.UCSC.dm2 package (contains no data yet):

     R CMD INSTALL BSgenome.Dmelanogaster.UCSC.dm2

5) R commands:

     library(BSgenome.Dmelanogaster.UCSC.dm2)
     download_dir <- "<DOWNLOAD_DIR>"
     extdata_dir <- "<EXTDATA_DIR>"
     data_dir <- "<DATA_DIR>"
     system.time({
       srcdir <- file.path(download_dir, "seqs")
       forgeSeqFiles(srcdir, extdata_dir, seqnames(Dmelanogaster),
                     prefix="", suffix=".fa")
       forgeSeqFiles(srcdir, extdata_dir, mseqnames(Dmelanogaster),
                     prefix="", suffix=".fa", single.seq=FALSE)
       srcdir <- file.path(download_dir, "masks")
       forgeMaskFiles(srcdir, data_dir, seqnames(Dmelanogaster), extdata_dir,
                      3, "gap", prefix="", suffix="_gap.txt")
     })

