def build_blast_db_data
      # Create necessary directories and return.
      if @empty
        make_directories
        return
      end

      if @dir.blank?
        raise "DIR must be set to continue. Execute `rake -D` for more information."
      end

      unless VALID_TYPES.include?(@type)
        raise "Unknown type: #{@type}. " <<
          "Please provide one: both, nucl or prot."
      end

      check_dependencies

      make_directories

      begin
        @dir.split(':').each do |d|
          unless File.directory?(d)
            raise "Directory not found: #{d}"
          end

          @data = Dir.glob("#{d}/*.{tgz,tar.gz,tbz,tar.bz2}")

          if @data.blank?
            raise "Data not found. Please check your directory and try " <<
            "again.\nDirectory Entered: #{d}"
          end

          @data.each do |s|
            if s =~ GZIP
              files = `tar -tzf #{s}`
              flag  = "z"
            elsif s =~ BZIP
              files = `tar -tjf #{s}`
              flag  = "j"
            end
            files = files.split(/\n/)
            files.each do |f|
              if f.include?(@prot_file)
                file_name = create_file_name(f, @blastdb_dir)
                extract_files(s, f, flag, File.join(@blastdb_dir, file_name, "peptides.fa"))
              elsif f.include?(@nucl_file)
                file_name = create_file_name(f, @blastdb_dir)
                extract_files(s, f, flag, File.join(@blastdb_dir, file_name, "contigs.fa"))
              elsif f.include?("gff")
                file_name = create_file_name(f, @gff_dir)
                extract_files(s, f, flag, File.join(@gff_dir, file_name, "annots.gff"))
              end
            end
          end
        end
        build_blast_db(@blastdb_dir)
      rescue Exception => e
        # Remove empty directories.
        `rm -rf #{@blastdb_dir}/*` if File.directory?(@blastdb_dir)
        `rm -rf #{@gff_dir}/*` if File.directory?(@gff_dir)
        raise e
      end
      readme
    end
def build_blast_db_data
      # Create necessary directories and return.
      if @empty
        make_directories
        return
      end

      if @dir.blank?
        raise "DIR must be set to continue. Execute `rake -D` for more information."
      end

      unless VALID_TYPES.include?(@type)
        raise "Unknown type: #{@type}. " <<
          "Please provide one: both, nucl or prot."
      end

      check_dependencies

      make_directories

      begin
        @dir.split(':').each do |d|
          unless File.directory?(d)
            raise "Directory not found: #{d}"
          end

          @data = Dir.glob("#{d}/*.{tgz,tar.gz,tbz,tar.bz2}")

          if @data.blank?
            raise "Data not found. Please check your directory and try " <<
            "again.\nDirectory Entered: #{d}"
          end

          @data.each do |s|
            if s =~ GZIP
              files = `tar -tzf #{s}`
              flag  = "z"
            elsif s =~ BZIP
              files = `tar -tjf #{s}`
              flag  = "j"
            end
            files = files.split(/\n/)
            files.each do |f|
              if f.include?(@prot_file)
                file_name = create_file_name(f, @blastdb_dir)
                extract_files(s, f, flag, File.join(@blastdb_dir, file_name, "peptides.fa"))
              elsif f.include?(@nucl_file)
                file_name = create_file_name(f, @blastdb_dir)
                extract_files(s, f, flag, File.join(@blastdb_dir, file_name, "contigs.fa"))
              elsif f.include?("gff")
                file_name = create_file_name(f, @gff_dir)
                extract_files(s, f, flag, File.join(@gff_dir, file_name, "annots.gff"))
              end
            end
          end
        end
        build_blast_db(@blastdb_dir)
      rescue Exception => e
        # Remove empty directories.
        `rm -rf #{@blastdb_dir}/*` if File.directory?(@blastdb_dir)
        `rm -rf #{@gff_dir}/*` if File.directory?(@gff_dir)
        raise e
      end
      readme
    end
Parse Blast database data.