This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Fastafrombed Problem

hi,

I try this tools from BedTools but it doesnt work!

$ cat testgenome404.fa

>chr1
AAAAAAAACCCCCCCCCCCCCGCTACTGGGGGGGGGGGGGGGGGG

$ cat test.bed
chr1    5       10

$ ./fastaFromBed -fi testgenome404.fa -bed test.bed  -fo test.fa.out

**index file testgenome404.fa.fai not found, generating...

unable to find FASTA index entry for 'chr1'**

$ cat testgenome404.fa.fai
chr1    46      7       46      47

what is this file "testgenome404.fa.fai" what does means this number? chr1 46 7 46 47

why this message?

unable to find FASTA index entry for 'chr1'

Thanks in advance for any help Sara

bedtools bed fasta conversion

Is it possible that you have an extra space after 'chr1' in your fasta file?

no it is not possible i check it but there is still the same problem

Please try the verion in the latest release (2.13). If you were using a version from the dev. repository, this may fix your issue.

1 answer

The fai is an index for the sequences contained in a fasta file.This kind of index helps the programs to quickly retrieve a (sub)sequences for a given region.

It seems that your tool automatically generated it as it didn't exist.

Each line in this file contains:

  • the name of the sequence
  • the length of the sequence
  • the offset of the first base in the file
  • the number of bases in each fasta line
  • the number of bytes in each fasta line

so, if you want to get the base at index "beg" for the sequence defined in "val", the program will seek the following offset (code from samtool):

val.offset + beg / val.line_blen * val.line_len + beg % val.line_blen

Note: A faidx can be generated with samtools faidx

Log in to answer this question.