Create journal database for FTW runs
164023
def instantiate_database(sqlite_file='ftwj.sqlite'):
    
    table_name = 'ftw'
    col1 = 'rule_id'
    col1_t = 'INTEGER'
    col2 = 'test_id'
    col2_t = 'STRING'
    col3 = 'time_start'
    col3_t = 'TEXT'
    col4 = 'time_end'
    col4_t = 'TEXT'
    col5 = 'response_blob'
    col5_t = 'TEXT'
    col6 = 'status_code'
    col6_t = 'INTEGER'
    col7 = 'stage'
    col7_t = 'INTEGER'
    conn = sqlite3.connect(sqlite_file)
    cur = conn.cursor()

    q = 'CREATE TABLE {tn}({col1} {col1_t},{col2} {col2_t},{col3} {col3_t},{col4} {col4_t},{col5} {col5_t},{col6} {col6_t},{col7} {col7_t})'.format(
        tn=table_name,
        col1=col1, col1_t=col1_t,
        col2=col2, col2_t=col2_t,
        col3=col3, col3_t=col3_t,
        col4=col4, col4_t=col4_t,
        col5=col5, col5_t=col5_t,
        col6=col6, col6_t=col6_t,
        col7=col7, col7_t=col7_t)
    cur.execute(q)
    conn.commit()
    conn.close()
407365
def _create(self, cache_file):
        """"""
        conn = sqlite3.connect(cache_file)
        cur = conn.cursor()
        cur.execute("PRAGMA foreign_keys = ON")
        cur.execute('''
            CREATE TABLE jobs(
                hash TEXT NOT NULL UNIQUE PRIMARY KEY, description TEXT NOT NULL,
                last_run REAL, next_run REAL, last_run_result INTEGER)''')

        cur.execute('''
            CREATE TABLE history(
                hash TEXT, description TEXT, time REAL, result INTEGER,
                FOREIGN KEY(hash) REFERENCES jobs(hash))''')

        conn.commit()
        conn.close()
1361716
def db_create(cls, impl, working_dir):
        

        global VIRTUALCHAIN_DB_SCRIPT
       
        log.debug("Setup chain state in {}".format(working_dir))

        path = config.get_snapshots_filename(impl, working_dir)
        if os.path.exists( path ):
            raise Exception("Database {} already exists")

        lines = [l + ";" for l in VIRTUALCHAIN_DB_SCRIPT.split(";")]
        con = sqlite3.connect(path, isolation_level=None, timeout=2**30)

        for line in lines:
            con.execute(line)

        con.row_factory = StateEngine.db_row_factory
        return con
77148
def _CreateDatabase(self):
    
    goodlogging.Log.Info("DB", "Initialising new database", verbosity=self.logVerbosity)

    with sqlite3.connect(self._dbPath) as db:
      # Configuration tables
      db.execute("CREATE TABLE Config ("
                  "Name TEXT UNIQUE NOT NULL, "
                  "Value TEXT)")

      db.execute("CREATE TABLE IgnoredDir ("
                  "DirName TEXT UNIQUE NOT NULL)")

      db.execute("CREATE TABLE SupportedFormat ("
                  "FileFormat TEXT UNIQUE NOT NULL)")

      # Look-up tables
      db.execute("CREATE TABLE TVLibrary ("
                  "ShowID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, "
                  "ShowName TEXT UNIQUE NOT NULL, "
                  "ShowDir TEXT UNIQUE)")

      db.execute("CREATE TABLE FileName ("
                  "FileName TEXT UNIQUE NOT NULL, "
                  "ShowID INTEGER, "
                  "FOREIGN KEY (ShowID) REFERENCES ShowName(ShowID))")

      db.execute("CREATE TABLE SeasonDir ("
                  "ShowID INTEGER, "
                  "Season INTEGER NOT NULL, "
                  "SeasonDir TEXT NOT NULL, "
                  "FOREIGN KEY (ShowID) REFERENCES ShowName(ShowID),"
                  "CONSTRAINT SeasonDirPK PRIMARY KEY (ShowID,Season))")

      db.commit()

    goodlogging.Log.Info("DB", "Database initialisation complete", verbosity=self.logVerbosity)
404487
function createDatabase() {
  var idx, a, b;
  
  db = new loki('sorting-bench.db');
   
  coll = db.addCollection('profile', { indices: ['a', 'b', 'c'] });
  
  for(idx=0;idx<INITIAL_DOCUMENT_COUNT;idx++) {
    coll.insert(genRandomObject());
  }
}
555622
public static void generateSDedit(List<TraceEvent> events, FileWriter fw) throws Exception
   {
      String connectionListener = events.get(0).getConnectionListener();
      long start = events.get(0).getTimestamp();
      long end = events.get(events.size() - 1).getTimestamp();

      boolean newCl = false;
      boolean hasTx = false;
      boolean newSync = false;
      boolean delist = false;
      Set<String> connections = new HashSet<String>();
      
      for (TraceEvent te : events)
      {
         if (te.getType() == TraceEvent.GET_CONNECTION_LISTENER_NEW ||
             te.getType() == TraceEvent.GET_INTERLEAVING_CONNECTION_LISTENER_NEW)
         {
            newCl = true;
         }
         else if (te.getType() == TraceEvent.ENLIST_CONNECTION_LISTENER ||
                  te.getType() == TraceEvent.ENLIST_CONNECTION_LISTENER_FAILED ||
                  te.getType() == TraceEvent.ENLIST_INTERLEAVING_CONNECTION_LISTENER ||
                  te.getType() == TraceEvent.ENLIST_INTERLEAVING_CONNECTION_LISTENER_FAILED)
         {
            hasTx = true;
         }
      }


      writeString(fw, "#![ConnectionListener: " + connectionListener + "]");
      writeEOL(fw);

      writeString(fw, "#!>>");
      writeEOL(fw);
      writeString(fw, "#!Start: " + start);
      writeEOL(fw);
      writeString(fw, "#!End  : " + end);
      writeEOL(fw);
      writeString(fw, "#!<<");
      writeEOL(fw);

      writeString(fw, "application:Application[a]");
      writeEOL(fw);

      writeString(fw, "cm:ConnectionManager[a]");
      writeEOL(fw);

      writeString(fw, "pool:Pool[a]");
      writeEOL(fw);

      writeString(fw, "mcp:MCP[a]");
      writeEOL(fw);

      if (!newCl)
      {
         writeString(fw, "cl:ConnectionListener[a]");
         writeEOL(fw);
      }
      else
      {
         writeString(fw, "/cl:ConnectionListener[a]");
         writeEOL(fw);
      }

      if (hasTx)
      {
         writeString(fw, "tx:Transaction[a]");
         writeEOL(fw);

         writeString(fw, "/sync:Synchronization[a,x]");
         writeEOL(fw);
      }

      writeEOL(fw);

      for (int i = 0; i < events.size(); i++)
      {
         TraceEvent te = events.get(i);
         switch (te.getType())
         {
            case TraceEvent.GET_CONNECTION_LISTENER:
               writeString(fw, "application:cm.allocateConnection()");
               writeEOL(fw);

               writeString(fw, "cm:pool.getConnection()");
               writeEOL(fw);

               writeString(fw, "pool:mcp." + TraceEvent.asText(te));
               writeEOL(fw);

               writeString(fw, "mcp:cl.get()");
               writeEOL(fw);

               break;
            case TraceEvent.GET_CONNECTION_LISTENER_NEW:
               writeString(fw, "application:cm.allocateConnection()");
               writeEOL(fw);

               writeString(fw, "cm:pool.getConnection()");
               writeEOL(fw);

               writeString(fw, "pool:mcp." + TraceEvent.asText(te));
               writeEOL(fw);

               writeString(fw, "mcp:cl.new()");
               writeEOL(fw);

               break;
            case TraceEvent.GET_INTERLEAVING_CONNECTION_LISTENER:
               writeString(fw, "application:cm.allocateConnection()");
               writeEOL(fw);

               writeString(fw, "cm:pool.getConnection()");
               writeEOL(fw);

               writeString(fw, "pool:mcp." + TraceEvent.asText(te));
               writeEOL(fw);

               writeString(fw, "mcp:cl.get()");
               writeEOL(fw);

               break;
            case TraceEvent.GET_INTERLEAVING_CONNECTION_LISTENER_NEW:
               writeString(fw, "application:cm.allocateConnection()");
               writeEOL(fw);

               writeString(fw, "cm:pool.getConnection()");
               writeEOL(fw);

               writeString(fw, "pool:mcp." + TraceEvent.asText(te));
               writeEOL(fw);

               writeString(fw, "mcp:cl.new()");
               writeEOL(fw);

               break;
            case TraceEvent.RETURN_CONNECTION_LISTENER:

               if (hasTx)
               {
                  if (delist)
                  {
                     writeString(fw, "[c afterCompletion]");
                     writeEOL(fw);

                     writeString(fw, "sync:mcp." + TraceEvent.asText(te));
                     writeEOL(fw);

                     writeString(fw, "[/c]");
                     writeEOL(fw);
                  }
                  else
                  {
                     writeString(fw, "cl:mcp." + TraceEvent.asText(te));
                     writeEOL(fw);
                  }
               }
               else
               {
                  writeString(fw, "cl:mcp." + TraceEvent.asText(te));
                  writeEOL(fw);
               }

               break;
            case TraceEvent.RETURN_CONNECTION_LISTENER_WITH_KILL:

               if (hasTx)
               {
                  if (delist)
                  {
                     writeString(fw, "[c afterCompletion]");
                     writeEOL(fw);

                     writeString(fw, "sync:>mcp." + TraceEvent.asText(te));
                     writeEOL(fw);

                     writeString(fw, "mcp:cl.doDestroy()");
                     writeEOL(fw);

                     writeString(fw, "[/c]");
                     writeEOL(fw);
                  }
                  else
                  {
                     writeString(fw, "cl:>mcp." + TraceEvent.asText(te));
                     writeEOL(fw);

                     writeString(fw, "mcp:cl.doDestroy()");
                     writeEOL(fw);
                  }
               }
               else
               {
                  writeString(fw, "cl:mcp." + TraceEvent.asText(te));
                  writeEOL(fw);

                  writeString(fw, "mcp:cl.doDestroy()");
                  writeEOL(fw);
               }

               break;
            case TraceEvent.RETURN_INTERLEAVING_CONNECTION_LISTENER:

               writeString(fw, "cl:mcp." + TraceEvent.asText(te));
               writeEOL(fw);

               break;
            case TraceEvent.RETURN_INTERLEAVING_CONNECTION_LISTENER_WITH_KILL:

               writeString(fw, "cl:mcp." + TraceEvent.asText(te));
               writeEOL(fw);

               writeString(fw, "mcp:cl.doDestroy()");
               writeEOL(fw);

               break;

            case TraceEvent.CLEAR_CONNECTION_LISTENER:

               break;

            case TraceEvent.ENLIST_CONNECTION_LISTENER:
            case TraceEvent.ENLIST_CONNECTION_LISTENER_FAILED:
               writeString(fw, "cl:tx." + TraceEvent.asText(te));
               writeEOL(fw);

               if (!newSync)
               {
                  writeString(fw, "cl:sync.new()");
                  writeEOL(fw);
                  newSync = true;
               }
               else
               {
                  writeString(fw, "cl:sync.register()");
                  writeEOL(fw);
               }

               writeString(fw, "sync:tx.registerInterposed()");
               writeEOL(fw);

               break;
            case TraceEvent.ENLIST_INTERLEAVING_CONNECTION_LISTENER:
            case TraceEvent.ENLIST_INTERLEAVING_CONNECTION_LISTENER_FAILED:
               writeString(fw, "cl:tx." + TraceEvent.asText(te));
               writeEOL(fw);

               break;
            case TraceEvent.DELIST_CONNECTION_LISTENER:
            case TraceEvent.DELIST_CONNECTION_LISTENER_FAILED:
               if (connections.size() == 0)
                  delist = true;
               
               writeString(fw, "[c beforeCompletion]");
               writeEOL(fw);

               writeString(fw, "cl:>sync.<free>");
               writeEOL(fw);

               writeString(fw, "sync:tx." + TraceEvent.asText(te));
               writeEOL(fw);

               writeString(fw, "[/c]");
               writeEOL(fw);

               if (!delist)
               {
                  writeString(fw, "[c afterCompletion]");
                  writeEOL(fw);

                  writeString(fw, "sync:>cl.<noReturn>");
                  writeEOL(fw);

                  writeString(fw, "[/c]");
                  writeEOL(fw);
               }

               break;
            case TraceEvent.DELIST_INTERLEAVING_CONNECTION_LISTENER:
            case TraceEvent.DELIST_INTERLEAVING_CONNECTION_LISTENER_FAILED:
               if (connections.size() == 0)
                  delist = true;
               
               writeString(fw, "cl:tx." + TraceEvent.asText(te));
               writeEOL(fw);

               break;
            case TraceEvent.DELIST_ROLLEDBACK_CONNECTION_LISTENER:
            case TraceEvent.DELIST_ROLLEDBACK_CONNECTION_LISTENER_FAILED:

               writeString(fw, "[c afterCompletion]");
               writeEOL(fw);

               writeString(fw, "cl:>sync.<rollback>");
               writeEOL(fw);

               writeString(fw, "sync:tx." + TraceEvent.asText(te));
               writeEOL(fw);

               writeString(fw, "[/c]");
               writeEOL(fw);

               break;
            case TraceEvent.GET_CONNECTION:
               connections.add(te.getPayload1());
               
               writeString(fw, "application:cl." + TraceEvent.asText(te));
               writeEOL(fw);

               break;
            case TraceEvent.RETURN_CONNECTION:
               connections.remove(te.getPayload1());

               if (TraceEventHelper.hasMoreApplicationEvents(events, i + 1))
               {
                  writeString(fw, "application:cl." + TraceEvent.asText(te));
               }
               else
               {
                  writeString(fw, "application:>cl." + TraceEvent.asText(te));
               }

               writeEOL(fw);

               break;
            case TraceEvent.CLEAR_CONNECTION:
               break;
            case TraceEvent.EXCEPTION:
               break;
            case TraceEvent.CREATE_CONNECTION_LISTENER_GET:
               break;
            case TraceEvent.CREATE_CONNECTION_LISTENER_PREFILL:
               break;
            case TraceEvent.CREATE_CONNECTION_LISTENER_INCREMENTER:
               break;
            case TraceEvent.DESTROY_CONNECTION_LISTENER_RETURN:
               break;
            case TraceEvent.DESTROY_CONNECTION_LISTENER_IDLE:
               break;
            case TraceEvent.DESTROY_CONNECTION_LISTENER_INVALID:
               break;
            case TraceEvent.DESTROY_CONNECTION_LISTENER_FLUSH:
               break;
            case TraceEvent.DESTROY_CONNECTION_LISTENER_ERROR:
               break;
            case TraceEvent.DESTROY_CONNECTION_LISTENER_PREFILL:
               break;
            case TraceEvent.DESTROY_CONNECTION_LISTENER_INCREMENTER:
               break;
            case TraceEvent.MANAGED_CONNECTION_POOL_CREATE:
               break;
            case TraceEvent.MANAGED_CONNECTION_POOL_DESTROY:
               break;
            case TraceEvent.PUSH_CCM_CONTEXT:
               break;
            case TraceEvent.POP_CCM_CONTEXT:
               break;
            case TraceEvent.REGISTER_CCM_CONNECTION:
               break;
            case TraceEvent.UNREGISTER_CCM_CONNECTION:
               break;
            case TraceEvent.CCM_USER_TRANSACTION:
               break;
            case TraceEvent.UNKNOWN_CCM_CONNECTION:
               break;
            case TraceEvent.CLOSE_CCM_CONNECTION:
               break;
            case TraceEvent.VERSION:
               break;
            default:
               System.err.println("SDeditGenerator: Unknown code: " + te);
         }
      }
   }
1018944
def makeblastdb(self, fastapath):
        
        # remove the path and the file extension for easier future globbing
        db = fastapath.split('.')[0]
        nhr = '{}.nhr'.format(db)  # add nhr for searching
        if not os.path.isfile(str(nhr)):  # if check for already existing dbs
            # Create the databases
            threadlock = threading.Lock()
            command = 'makeblastdb -in {} -parse_seqids -max_file_sz 2GB -dbtype nucl -out {}'.format(fastapath, db)
            out, err = run_subprocess(command)
            threadlock.acquire()
            write_to_logfile(out, err, self.logfile)
            threadlock.release()
        dotter()
963308
def dump
      out = "\n"
      out += "Type            : #{@bs['desc_type']}\n"
      out += "Record ID       : #{@bs['id']}\n"
      out += "Version         : #{@bs['version']}\n"
      out += "System ID       : #{@bs['system_id'].strip}\n"
      out += "Volume ID       : #{@volName}\n"
      out += "Vol space size  : #{@bs["vol_space_size#{@suff}"]} (sectors)\n"
      out += "Vol set size    : #{@bs["vol_set_size#{@suff}"]}\n"
      out += "Vol sequence num: #{@bs["vol_seq_number#{@suff}"]}\n"
      out += "Logical blk size: #{@bs["log_block_size#{@suff}"]} (sector size)\n"
      out += "Path table size : #{@bs["path_table_size#{@suff}"]}\n"
      out += "Type 1 path tbl : #{@bs["type_1_path_table#{@suff}"]}\n"
      out += "Opt type 1 pth  : #{@bs["opt_type_1_path_table#{@suff}"]}\n"
      out += "Type M path tbl : #{@bs["type_m_path_table#{@suff}"]}\n"
      out += "Opt type M pth  : #{@bs["opt_type_m_path_table#{@suff}"]}\n"
      out += "Vol set ID      : #{@bs['vol_set_id'].strip}\n"
      out += "Publisher ID    : #{@bs['publisher_id'].strip}\n"
      out += "Preparer ID     : #{@bs['preparer_id'].strip}\n"
      out += "Application ID  : #{@bs['application_id'].strip}\n"
      out += "Copyright       : #{@bs['copyright_file_id'].strip}\n"
      out += "Abstract        : #{@bs['abstract_file_id'].strip}\n"
      out += "Biblographic    : #{@bs['biblographic_file_id'].strip}\n"
      out += "Creation date   : #{@bs['creation_date'].strip} (#{@cTime}, tz = #{Util.GetTimezone(@bs['creation_date'])})\n"
      out += "Mod date        : #{@bs['modification_date'].strip} (#{@mTime}, tz = #{Util.GetTimezone(@bs['modification_date'])})\n"
      out += "Expiration date : #{@bs['experation_date'].strip} (#{@expirationDate}, tz = #{Util.GetTimezone(@bs['experation_date'])})\n"
      out += "Effective date  : #{@bs['effective_date'].strip} (#{@effectiveDate}, tz = #{Util.GetTimezone(@bs['effective_date'])})\n"
      out += "File strct ver  : #{@bs['file_structure_version']}\n"
      out += "Application data: #{@bs['application_data'].strip}\n"
    end
75551
def create_tablefn_map(fns, pqdb, poolnames):
    """"""
    poolmap = {name: pid for (name, pid) in pqdb.get_all_poolnames()}
    pqdb.store_table_files([(poolmap[pool], os.path.basename(fn))
                            for fn, pool in zip(fns, poolnames)])
    return pqdb.get_tablefn_map()
1183596
def log(**data):
	
	# Get data from request body
	entry = {
		"module": data["params"]["module"],
		"event": data["params"]["event"],
		"timestamp": data["params"]["timestamp"],
		"arguments": data["params"]["arguments"]
	}
	# Call create metod for writing data to database
	history.create(entry)
265213
def create(self, force=False, exists_ok=False):
        
        if self.fname and self.fname.exists():
            if force:
                self.drop()
            elif exists_ok:
                return
            else:
                raise ValueError('db file already exists, use force=True to overwrite')
        with self.connection() as db:
            db.execute(
                """\
CREATE TABLE dataset (
    ID TEXT PRIMARY KEY NOT NULL,
    name TEXT,
    version TEXT,
    metadata_json TEXT
)""")
            db.execute("""\
CREATE TABLE datasetmeta (
    dataset_ID TEXT ,
    key TEXT,
    value TEXT,
    PRIMARY KEY (dataset_ID, key),
    FOREIGN KEY(dataset_ID) REFERENCES dataset(ID)
)""")
            db.execute("""\
CREATE TABLE SourceTable (
    dataset_ID TEXT ,
    ID TEXT ,
    bibtex_type TEXT,
    {0}
    extra TEXT,
    PRIMARY KEY (dataset_ID, ID),
    FOREIGN KEY(dataset_ID) REFERENCES dataset(ID)
)""".format('\n    '.join('`{0}` TEXT,'.format(f) for f in BIBTEX_FIELDS)))
185677
function syncDB(options) {
  var uri = options.uri || conf.db,
      entries = (options.drop ? scripts('drop') : []).concat(scripts('create')),
      progress = options.progress || noop,
      complete = options.complete || noop;

  connect(uri, function(err, client, done) {
    if(err) { throw err; }
    run(client, done);
  });

  function run(client, done) {
    var entry = entries.shift()
      , script
      , path;

    if(entry !== undefined) {
      script = entry[0];
      path = entry[1];

      progress(script, path);
      client.query(script, function (err) {
        if(err) {
          complete(err);
          done(err);
        } else {
          run(client, done);
        }
      });
    } else {
      complete();
      done();
    }
  }

}
51631
def create_db(self):
        
        if self.db_type != "json":
            raise RuntimeError("db_type only supports json now")

        if os.path.exists(self.json_db_path):
            return False

        if os.path.exists(self.factory_json_db_path):
            with self.db_mutex:
                shutil.copy2(
                    self.factory_json_db_path, self.json_db_path)
            return True

        _logger.debug(
            "*** NO such file: %s" % self.factory_json_db_path)
        raise RuntimeError("No *.json.factory file")
1046881
def write_table_file(self, job_table_file=None, file_table_file=None):
        """"""
        if self._table is None:
            raise RuntimeError("No table to write")
        if self._table_ids is None:
            raise RuntimeError("No ID table to write")
        if job_table_file is not None:
            self._table_file = job_table_file
        if self._table_file is None:
            raise RuntimeError("No output file specified for table")
        write_tables_to_fits(self._table_file, [self._table, self._table_ids], clobber=True,
                             namelist=['JOB_ARCHIVE', 'FILE_IDS'])
        self._file_archive.write_table_file(file_table_file)
1305485
def mash(self, databasepath):
        
        logging.info('Downloading pre-computed RefSeq MASH sketches')
        # Create the folder in which the database is to be stored
        databasepath = self.create_database_folder(databasepath=databasepath,
                                                   database='mash')
        output_file = os.path.join(databasepath, 'assembly_summary_refseq.txt')
        # Download the assembly summary RefSeq document
        if not os.path.isfile(output_file):
            self.database_download(output_file=output_file,
                                   database_path=databasepath,
                                   target_url='ftp://ftp.ncbi.nih.gov/genomes/ASSEMBLY_REPORTS/'
                                              'assembly_summary_refseq.txt'
                                   )
        # Set the call to create the database
        output_file = os.path.join(databasepath, 'RefSeqSketchesDefaults.msh')
        # Download the database
        if not os.path.isfile(output_file):
            self.database_download(output_file=output_file,
                                   database_path=databasepath,
                                   target_url='https://gembox.cbcb.umd.edu/mash/refseq.genomes.k21s1000.msh',
                                   complete=True)
698963
def makeblastdb(self):
        """"""
        while True:  # while daemon
            fastapath = self.dqueue.get()  # grabs fastapath from dqueue
            # remove the path and the file extension for easier future globbing
            db = os.path.splitext(fastapath)[0]
            nhr = '{}.nhr'.format(db)  # add nhr for searching
            # fnull = open(os.devnull, 'w')  # define /dev/null
            if not os.path.isfile(str(nhr)):  # if check for already existing dbs
                # Create the databases
                # TODO use MakeBLASTdb class
                threadlock = threading.Lock()
                command = 'makeblastdb -in {} -parse_seqids -max_file_sz 2GB -dbtype nucl -out {}'.format(fastapath, db)
                # subprocess.call(shlex.split('makeblastdb -in {} -parse_seqids -max_file_sz 2GB -dbtype nucl -out {}'
                #                            .format(fastapath, db)), stdout=fnull, stderr=fnull)
                out, err = run_subprocess(command)
                threadlock.acquire()
                write_to_logfile(command, command, self.logfile, None, None, None, None)
                write_to_logfile(out, err, self.logfile, None, None, None, None)
                threadlock.release()
            self.dqueue.task_done()
1134860
private static <S extends Sequence<S>> BlastDB build(List<S> sequences, boolean buildIdIndex,
                                                         Path path, boolean tmp) {
        if (sequences.isEmpty())
            throw new IllegalArgumentException("No records.");

        if (path == null)
            path = getTmpDBPath();

        Alphabet<S> alphabet = sequences.get(0).getAlphabet();

        try {
            String name = RandomUtil.getThreadLocalRandomData().nextHexString(40);
            String fullName = path.resolve(name).toString();
            List<String> cmd = new ArrayList<>();
            cmd.addAll(Arrays.asList(Blast.CMD_MAKEBLASTDB, "-dbtype", Blast.toBlastAlphabet(alphabet),
                    "-out", fullName, "-title", name));
            cmd.addAll(Arrays.asList("-parse_seqids", "-hash_index"));
            Process proc = Blast.getProcessBuilder(cmd).start();
            FastaWriter<S> writer = new FastaWriter<>(proc.getOutputStream(), FastaWriter.DEFAULT_MAX_LENGTH);
            for (int i = 0; i < sequences.size(); i++)
                writer.write(getIdFasta(i), sequences.get(i));
            writer.close();
            String err = IOUtils.toString(proc.getErrorStream(), Charset.forName("US-ASCII"));
            if (proc.waitFor() != 0)
                throw new RuntimeException("Something goes wrong: " + err);
            return BlastDB.get(fullName, tmp);
        } catch (RuntimeException e) {
            throw e;
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }