This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Extract Sequence Lengths From Formatdb Output?

Is it possible to get a list of sequence lengths from formatdb output? I figure one of the index files contains this information.

Else I'm stuck using BioPerl to calculate lengths per sequence...

Cheers, Dan.

fasta

2 answers

I don't know about blast but with the blast+ utility tools you can use blastdbcmd in the following way:

$ cat test.fa
>seq1
A
>seq2
TT
>seq3
CCC
>seq4
GGGG
$
$ makeblastdb -in test.fa -dbtype nucl -parse_seqids
$
$ blastdbcmd  -db test.fa -entry all -outfmt "%i %l"
lcl|seq1 1
lcl|seq2 2
lcl|seq3 3
lcl|seq4 4

with blast formatted fasta db you can try

fastacmd -d input.fa -s seqID -l 1000000000000000000000000000 | tr "\n" "\t" | awk ' BEGIN {OFS = FS = "\t"};{  print $1, length($2) }'

Log in to answer this question.