Generating burrows-wheeler-transform and a suffix array of a DNA sequence with less memory

Also posted on biostars

After indexing

bwa index -a bwtsw reference.fa


I got files. like .bwt file and .sa file. The naive way of generating these file is:

1. Create all rotations of T
2. Sort the rotations lexicographically
3. Concatenate the last character of each rotation to form  BWT(T)

I used this naive way in my algorithm. The problem is it took too much memory.

My question is: is there an effective memory way to generate .bwt file and .sa file ?

Any help will be appreciated.

• I still do not fully understand the problem or what you need. .bwt and .sa are needed for bwa alignment and can be generated by your bwa index command. If you run out of memory, I think the solution is to buy more RAM. Or are you talking about the size of your HD? Please ask a new question, where you exactly explain your limitations and more about your algorithm and why (and how) it needs to .bwt and .sa files.