Home Software Services About Contact usearch manual
server mode
 
USEARCH supports a server mode designed for use in web servers and other environments where users submit queries that are used to search a large database. Server mode works as follows.

1. Database is loaded into memory.
2. USEARCH waits for a new query.
3. Search is performed. When completed, repeat step 2.

Server mode is specified using the -server option, which was introduced in version 6.0.178.

The -server option is supported only by the ublast command. Support for other commands could be added.

If -server is specified, the query name (argument to the -ublast option) is a directory name. This directory is polled for filenames ending with the .q extension. If a file named stop.q is found, USEARCH exits. Any other .q file is expected to be a query specifier (see below). If stop.q is found, USEARCH exits as soon as the current search is completed even if other .q files are present.

The -query_seqtype option must be set to nucleo or amino to specify the alphabet that will be used for query sets. All query files must use the same alphabet.

Query specifier files
A query specifier file name must end in .q, and can otherwise be freely chosen by the user. The file must be a text file with exactly one line containing exactly two fields separated by white space (one or more blanks or tabs), as follows.

  Field Description
  1 Query file name (FASTA).
  2 Output directory.

The output directory must already exist. Output files are written to this directory. For example:

Command line:
  
usearch -ublast query_dir -db nr.udb -blast6out results.b6 -query_seqtype nucleo

Create a query specifier file:
 
echo /serverfiles/queries/q123.fasta /serverfiles/results/out123 > query_dir/123.q

In this example, the output file will be named /serverfiles/results/out123/results.b6. Since output file names are the same for all queries, the output directory name should be unique to avoid conflicts.

When a query specifier file has been read by USEARCH, it is renamed from *.q to *.x before starting the search. When a search has completed, a file named done.q is written to the output directory. This allows detection of incomplete searches that must be restarted if e.g. the server computer crashes.