e2bdb - Examine and interact with a EMAN2DB directory


Usage in command lines: --cleanup --force --delete --all --long --short --filt --filtexclude --match --exclude --dump --check --nocache --makevstack="bdb:/Home/user/project#output" --appendvstack="bdb:output" --verbose --list="abc.txt" --restore="bdb:vstack"



Clean up the database cache so files can safely be moved or accessed on another computer via NFS, e.g.

  • --clean
Database cache will be removed, and it is safe to access databases from another machine or delete existing databases.

Do not use the database cache for this operation - Cache was permanently disabled as of August 2013.

Force an action that would normally fail due to failed checks.

Delete (or at least empty) the named database(s) e.g.

  • bdb:filename --delete
List per-particle info
Give details for each database
Return each database name in 'bdb:database' format for use

Only include dictionary names containing the specified string e.g.

  • . --makevstack=bdb:vstack --filt=abc
A virtual stack will be generated, which contains all bdb files that have "abc" in the file name.

Exclude dictionary names containing the specified string e.g.

  • . --makevstack=bdb:vstack --filtexclude=abc
A virtual stack will be generated, which contains all bdb files that don't have "abc" in the file name.

Only include dictionaries matching the provided Python regular expression e.g.

  • . --makevstack=bdb:vstack --match=abc
A virtual stack will be generated, which the bdb file that is named "abc" .
The name of a database containing a list of exclusion keys

List contents of an entire database, e.g.

  • -D refine_01#register
Check for self-consistency and errors in the structure of specified databases
Verbose level [0-9], higner number means higher level of verboseness

Make a 'virtual' image stack from one or more other stacks, e.g:

  • bdb:db1 bdb:db2 --makevstack=bdb:db3

will combine images in db1 and db2 into db3. Please note that any change in metadata of db1 or db2, there won't be changes in db3. However, if there are changes in the image data, it will appear at db3. In order to include all stack with a common root in the name (for example, db1, db2, db3) into one virtual stack called data, use:

  • . --makevstack=bdb:data --filt=db

Appends to/creates a 'virtual' BDB stack with its own metadata e.g.

  • bdb:db1 bdb:db2 --appendvstack=bdb:db3
db1 and db2 virtual stack will be appended to db3, if it exists. If not, a new db3 will be created.

Inputs an ASCII file with selected image to creates a new virtual BDB stack from an existed virtual stack, e.g.

  • bdb:#db1 bdb:#db2 --makevstack=bdb:.#db3 --list=abc.txt
here abc.txt is a file which contains the selected images' ID in each bdb file, a virtual stack db3 will be generated which contains the selected image of db1 and db2. If change makevstack to appendvstack virtual, virtual stack of db1 and db2 will be appended to db3. This option allows you to select some specific images which you would like to manipulate to generate a virtual stack.

Write changes in the derived virtual stack back to the original stack, e.g.

  • --restore=bdb:vstack
vstack is a derived image stack, --restore will allow it to write the change back to the parent image stack. This option is very useful when an operation (such as alignment) is performed on a subset of data (extracted as a virtual fact) and then the results are to be merged with the parent stack.


IN EMAN2, the usage of Berkeley DB file format has been increased since it is very convenient to manipulate the metadata separately from the image data, and it is faster that other formats, such as HDF. As it has this special structure, its files are stored in a folder named EMAN2DB, which cannot manually copy or remove files in it.

Note: It is important to emphasize that one cannot manually rename or edit the files in the EMAN2DB directory. Doing so can corrupt the entire database such that programs will no longer be able to access it properly. You can safely move the directory as a whole to a different location, but otherwise it should not be modified. The e2bdb program is using to interact with the EMAN2DB directory.

Virtual stack is a stack of metadata associated with the image data. When generate a virtual stack, unlike doing this same task with bdb:.#db1 bdb:.#db3; bdb:.#db2 bdb:.#db3, it will only generate the metadata stack. When generate a virtual stack, in the metadata, image location will be recored as data_path, original image ID will be recored as data_n, and the original stack will be recored as data_source.

By using the --list option, we are able to generate a virtual stack which contains metadata information of selected images. The virtual stack can be manipulate just as the original bdb files. Changes in virtual stack won't appear on the original stack. One can use the --restore option to write the change back to the original stack. It is very convenient to do so, and this functionality is expected to be very useful if one would like to use virtual stack for iteration.

Author / Maintainer

Steve Ludtke, Ran Lin


category 1


Please also refer to Eman2DataStorage. (

e2bdb (last edited 2013-08-26 16:47:42 by penczek)