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 

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.


1 Answer 1


No, there is no way to decompress .bwt or .sa files, because they are not compressed. After indexing you'll get these files, which some programs (bwa) use. They should be in the same folder as your reference fasta file. What are you trying to do with these files? To get proper help here, please explain why you need these files, and show how you made the files.

  • $\begingroup$ thanks for your reply. I need to use BWT and SA in my algorithm that why I need to decompress them because in the first step to produce BWT and SA: we have to form all rotations. All these rotations took too much memory that why I prefer to produce BWT and SA by using BWA. Do you a way to use BWT and SA while they are compressed ? $\endgroup$
    – Mariam
    Commented Feb 10, 2018 at 7:45
  • $\begingroup$ Or what is the best way to produce BWT ? better than the naive version of the BWT that forms all rotations. $\endgroup$
    – Mariam
    Commented Feb 10, 2018 at 8:10
  • $\begingroup$ 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. $\endgroup$
    – benn
    Commented Feb 10, 2018 at 10:08
  • $\begingroup$ ok here is my question in another way: how BWA generate .bwt file and .sa file in with less memory usage ? Do they save all rotations temporary ? $\endgroup$
    – Mariam
    Commented Feb 10, 2018 at 10:33
  • $\begingroup$ This is indeed a whole other question. $\endgroup$
    – benn
    Commented Feb 10, 2018 at 10:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.