healthyPlant / PhytoPipe

10 stars 1 forks source link

The computer memory is small for building kraken2 database #4

Open xhu556 opened 11 months ago

xhu556 commented 11 months ago

When I built the kraken2 database using the following command,

kraken2-build --download-taxonomy --threads 16 --db /path/to/my/database/kraken_db
kraken2-build --download-library nt --db /path/to/my/database/kraken_db
kraken2-build --build --threads 16 --db /path/to/my/database/kraken_db

I got the following errors,

Failed attempt to allocate 760296584044bytes; you may not have enough free memory to build this database. Perhaps increasing the k-mer length, or reducing memory usage from other programs could help you build this database? build_db: unable to allocate hash table memory xargs: cat: terminated by signal 13

How can I do?

xhu556 commented 11 months ago

Please check our Wiki, there are four methods that you can use to reduce memory usage for building a kraken2 database.
You can try to use the below option to reduce kraken2 hash table size

--max-db-size [NUM Maximum number of bytes] #for Kraken 2 hash table

For example,

kraken2-build --build --threads 32 --db /path/to/my/database/kraken_db --max-db-size 128000000000

The above command limits the kraken2 hash table size to 128Gb. Please check the file hash.k2d in the folder /path/to/my/database/kraken_db. It should be close to 128Gb.