This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Fasta file is not converting properly to Indexed Fasta File

I am trying to set up an assembly in Jbrowse2. For that, I need an indexed Fasta file. I am using the following command line to convert my Fasta file to an indexed Fasta file.

samtools faidx /home/maliha/Downloads/jbrowse2/sequence.fasta

However, I got an indexed Fasta file containing just one line. I have attached the picture of that line to this post. Please do help me to figure out the problem.

enter image description here

jbrowse2 samtools fasta

2 answers

How many contigs do you have in your fasta file?

Samtools faidx doesn't convert a fasta file into an indexed fasta, it produced an index file to be used alongside your fasta file. For a one contig fasta file, your index looks as expected.

Seconding this, you can also read a bit more about this here. You can check which contigs are in your file by looking for lines starting with ">". In your example above we'd expect to find just one line, starting with "> U00096.3"

You can do that on the command line using grep, e.g. grep "^>" fasta.file More details on grep here

U00096 appears to be E. coli so one entry in the index file is ok. @Maliha: well behaved tools give an error message if something goes wrong - I suppose you didn't get any from samtools faidx?

just for "extra jbrowse 2 context" after running the samtools faidx command you can then run

jbrowse add-assembly yourfile.fasta --out output_directory --load copy

this will create a config.json in a folder named "output_directory" and also copy the yourfile.fasta and yourfile.fasta.fai to the output_directory folder

Log in to answer this question.