gsearch is the new name of the crate archaea. It stands for genomic search.
This package (currently in development) compute probminhash signature of bacteria and archaea (or virus and fungi) genomes and stores the id of bacteria and probminhash signature in a Hnsw structure for searching of new request genomes.
This package is developped by Jean-Pierre Both (https://github.com/jean-pierreBoth) for the software part and Jianshu Zhao (https://github.com/jianshu93) for the genomics part.
The sketching and database is done by the module tohnsw.
The sketching of reference genomes can take some time (one or 2 hours for ~65,000 bacterial genomes of NCBI for parameters giving a correct quality of sketching). Result is stored in 2 structures: - A Hnsw structure storing rank of data processed and corresponding sketches. - A Dictionary associating each rank to a fasta id and fasta filename.
The Hnsw structure is dumped in hnswdump.hnsw.graph and hnswdump.hnsw.data The Dictionary is dumped in a json file seqdict.json
For requests the module request is being used. It reloads the dumped files, hnsw and seqdict related takes a list of fasta files containing requests and for each fasta file dumps the asked number of nearest neighbours.
```bash
tohnsw -d dbdirnt -s 12000 -k 16 --ef 1600 -n 128 tohnsw -d dbdiraa -s 12000 -k 7 --ef 1600 -n 128 --aa
wget http://enve-omics.ce.gatech.edu/data/publicgsearch/GTDBr207hnswgraph.tar.gz tar xzvf ./GTDBr207hnswgraph.tar.gz cd ./GTDBr207hnswgraph/nucl
request -b ./ -d querydirnt -n 50
cd ./GTDBr207hnswgraph/prot request -b ./ -d querydir_aa -n 50 --aa
cd ./GTDBr207hnswgraph/universal request -b ./ -d querydiruniversalaa -n 50 --aa
cd ./GTDBr207hnsw_graph/nucl
tohnsw -d dbdirnt (new genomes directory) -s 12000 -k 16 --ef 1600 -n 128 --add
cd ./GTDBr207hnswgraph/ tohnsw -d dbdir_nt (new genomes directory in AA format predicted by prodigal/FragGeneScanRs) -s 12000 -k 16 --ef 1600 -n 128 --aa --add ```
gsearch.answers is the default output file in your current directory.
For each of your genome in the query_dir, there will be requested N nearest genomes found and sorted by distance (smallest to largest).
If one genome in the query does not exist in the output file, meaning at this level (nt or aa), there is no such nearest genomes in the database (or distant away from the best hit in the database), you may then go to amino acid level or universal gene level.
hnswrs relies on the crate simdeez to accelerate distance computation. On intel you can build hnswrs with the feature simdeez_f
annembed relies on openblas so you must choose between the features "annembedopenblas-static" , "annembedopenblas-system" or "annembed_intel-mkl". You may need to install gcc, gfortran and make. This can be done using the --features option as explained below, or by modifying the features section in Cargo.toml. In that case just fill in the default you want.
Pre-built binaries will be available on release page (https://github.com/jean-pierreBoth/gsearch/releases/tag/v0.0.12) for major platforms.
Otherwise it is possible to install/compile by yourself:
bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
bash
cargo install gsearch --features="annembed_intel-mkl"
or with a system installed openblas:
bash
cargo install gsearch --release --features="annembed_openblas-system"
- On MacOS, which requires dynamic library link (you have to install openblas first and then xz, the MacOS/Darwin binary provided also requires this):
(note that openblas install lib path is different on M1 MACs).
So you need to run:
bash
brew install openblas xz
echo 'export LDFLAGS="-L/usr/local/opt/openblas/lib"' >> ~/.bash_profile
echo 'export CPPFLAGS="-I/usr/local/opt/openblas/include"' >> ~/.bash_profile
echo 'export PKG_CONFIG_PATH="/usr/local/opt/openblas/lib/pkgconfig"' >> ~/.bash_profile
source ~/.bash_profile
cargo install gsearch --features="annembed_openblas-system"
bash
cargo install gsearch --features="annembed_openblas-system" --features="hnsw_rs/simdeez_f"
direct installation from github:
bash
cargo install gsearch --features="annembed_intel-mkl" --git https://github.com/jean-pierreBoth/gsearch
download and compilation: ```bash git clone https://github.com/jean-pierreBoth/gsearch cd gsearch
cargo build --release --features="annembed_openblas-static"
cargo build --release --features="annembed_openblas-system" ```
Html documentation can be generated by running (example for someone using the "annembed_openblas-system" feature):
bash
cargo doc --features="annembed_openblas-system" --no-deps --open
bash
cargo install --git https://gitlab.com/Jianshu_Zhao/fraggenescanrs
We provide pre-built genome/proteome database graph file for bacteria/archaea, virus and fungi. Proteome database are based on genes for each genome, predicted by FragGeneScanRs (https://gitlab.com/JianshuZhao/fraggenescanrs) for bacteria/archaea/virus and GeneMark-ES version 2 (http://exon.gatech.edu/GeneMark/licensedownload.cgi) for fungi.