Error : Could not build fai index
USED BWA VERSION 0.7 FOR INDEX.
soon after I used the command samtools faidex and got the following message:
Could not build fai index.
I noticed a fasta.sa file that in no other indexing before this one was generated and fa.fai was not generated.
How can I solve this problem?
• 17,060 views
•
link
1 answer
Much better these information.
samtools is complaining about the way your fasta file compressed. You have to use bgzip instead of gzip
$ bgzip -c input.fa > output.fa.gz
Or uncompress the wrong compressed file and recompress with the correct program
$ zcat GRCh38.chr.11.fa.gz | bgzip -c > output.fa.gz
• 0 views
•
link
Log in to answer this question.
Hello,
please take some more time to present your post better. Using the format bar and choose the right post tags are some of the easy action. This time I've done it for you.
Could you please post the exact command you were using? Also the output of
head your.fawould be useful for us.Thanks.
fin swimmer
Is this the whole error message or just a part of it?
I used this command:
and then I used the command:
I got these files:
Do not add an answer unless you're answering the top level post. Please delete this comment and add it as a reply at the appropriate location.
I used this command :
I got this :
and then I used this command :
I got this :
and then I used this commandandI got thiscontents don't make sense. Those are not commands you used but error messages.It looks like your genome indexes were built correctly. So what alignment commands did you use?Edit: See below.Please don't post new questions using
SUBMIT ANSWER.If you need to create a new
.faiindex for the genome file you could directly dosamtools faidx yourfile.fa. If it complains that the file needs to be zipped then use @finswimmer's answer below tobgzip.the command is
Looking at your original posting carefully it looks like the directory you are trying to work in is marked as
read-onlysobwais not able to write the index files in that directory.So you should use an area/directory where you have write permissions. Use
-poption to specify that location.Please use the formatting bar (especially the
codeoption) to present your post better. You can use backticks for inline code (`text` becomestext), or select a chunk of text and use the highlighted button to format it as a code block. I've done it for you this time.I used this command : bwa index -a bwtsw /Volumes/DATASETS/LmjFwholegenome_20070731_V5.2.fasta
I got this :
[bwa_index] Pack FASTA... [bns_fasta2bntseq] fail to open file '/Volumes/DATASETS/LmjFwholegenome_20070731_V5.2.fasta.pac' : Read-only file system (base) Air-de-mac:~ mac$ bwa index -p/Users/mac/NGS -a bwtsw /Volumes/DATASETS/LmjFwholegenome_20070731_V5.2.fasta [bwa_index] Pack FASTA... 0.74 sec [bwa_index] Construct BWT for the packed sequence... [BWTIncCreate] textLength=65710806, availableWord=16623368 [BWTIncConstructFromPacked] 10 iterations done. 27420310 characters processed. [BWTIncConstructFromPacked] 20 iterations done. 50654934 characters processed. [bwt_gen] Finished constructing BWT in 28 iterations. [bwa_index] 18.56 seconds elapse. [bwa_index] Update BWT... 0.31 sec [bwa_index] Pack forward-only FASTA... 0.17 sec [bwa_index] Construct SA from BWT and Occ... 6.97 sec [main] Version: 0.7.17-r1188 [main] CMD: bwa index -p/Users/mac/NGS -a bwtsw /Volumes/DATASETS/LmjFwholegenome_20070731_V5.2.fasta [main] Real time: 68.784 sec; CPU: 26.742 sec
and then I used this command :
[E::fai_build3_core] Failed to open the file /Volumes/DATASETS/LmjFwholegenome_20070731_V5.2.fasta [faidx] Could not build fai index /Volumes/DATASETS/LmjFwholegenome_20070731_V5.2.fasta.fai
I got this : [E::fai_build3_core] Failed to open the file /Volumes/DATASETS/LmjFwholegenome_20070731_V5.2.fasta [faidx] Could not build fai index /Volumes/DATASETS/LmjFwholegenome_20070731_V5.2.fasta.fai