Error : Could not build fai index
1
0
Entering edit mode
4.7 years ago
manubiomed20 ▴ 10

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?

bwa samtools • 13k views
ADD COMMENT
0
Entering edit mode

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.fa would be useful for us.

Thanks.

fin swimmer

ADD REPLY
0
Entering edit mode

Is this the whole error message or just a part of it?

ADD REPLY
0
Entering edit mode

I used this command:

bwa index /home/ims.santos06/Ref_crhumano/GRCh38.chr.11.fa.gz


   [bwa_index] Pack FASTA... 2.33 sec
    [bwa_index] Construct BWT for the packed sequence...
    [BWTIncCreate] textLength=270173244, availableWord=31010396
    [BWTIncConstructFromPacked] 10 iterations done. 51153116 characters processed.
    [BWTIncConstructFromPacked] 20 iterations done. 94501340 characters processed.
    [BWTIncConstructFromPacked] 30 iterations done. 133025356 characters processed.
    [BWTIncConstructFromPacked] 40 iterations done. 167261564 characters processed.
    [BWTIncConstructFromPacked] 50 iterations done. 197686764 characters processed.
    [BWTIncConstructFromPacked] 60 iterations done. 224724716 characters processed.
    [BWTIncConstructFromPacked] 70 iterations done. 248752076 characters processed.
    [BWTIncConstructFromPacked] 80 iterations done. 270103628 characters processed.
    [bwt_gen] Finished constructing BWT in 81 iterations.
    [bwa_index] 81.98 seconds elapse.
    [bwa_index] Update BWT... 1.04 sec
    [bwa_index] Pack forward-only FASTA... 1.75 sec
    [bwa_index] Construct SA from BWT and Occ... 29.60 sec
    [main] Version: 0.7.17-r1188
    [main] CMD: bwa index /home/ims.santos06/Ref_crhumano/GRCh38.chr.11.fa.gz
    [main] Real time: 119.622 sec; CPU: 116.702 sec

and then I used the command:

samtools faidx /home/ims.santos06/Ref_crhumano/GRCh38.chr.11.fa.gz
[E::fai_build3_core] Cannot index files compressed with gzip, please use bgzip
[faidx] Could not build fai index /home/ims.santos06/Ref_crhumano/GRCh38.chr.11.fa.gz.fai
ADD REPLY
0
Entering edit mode

I got these files:

    GRCh38.chr.11.fa.gz.ann  GRCh38.chr.11.fa.gz.sa
    GRCh38.chr.11.fa.gz      GRCh38.chr.11.fa.gz.bwt  GRCh38.chr.20.fa.gz
    GRCh38.chr.11.fa.gz.amb  GRCh38.chr.11.fa.gz.pac
ADD REPLY
0
Entering edit mode

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.

ADD REPLY
0
Entering edit mode

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
ADD REPLY
0
Entering edit mode

and then I used this command and I got this contents 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 .fai index for the genome file you could directly do samtools faidx yourfile.fa. If it complains that the file needs to be zipped then use @finswimmer's answer below to bgzip.

ADD REPLY
0
Entering edit mode

the command is

samtools faidx /Volumes/DATASETS/LmjFwholegenome_20070731_V5.2.fasta
ADD REPLY
0
Entering edit mode

Looking at your original posting carefully it looks like the directory you are trying to work in is marked as read-only so bwa is not able to write the index files in that directory.

[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

So you should use an area/directory where you have write permissions. Use -p option to specify that location.

bwa index -a bwtsw -p some_dir_where_you_can_write/BasenameForIndex /Volumes/DATASETS/LmjFwholegenome_20070731_V5.2.fasta
ADD REPLY
0
Entering edit mode

Please use the formatting bar (especially the code option) to present your post better. You can use backticks for inline code (`text` becomes text), 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.
code_formatting

ADD REPLY
3
Entering edit mode
4.7 years ago

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
ADD COMMENT

Login before adding your answer.

Traffic: 2550 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6