This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Nucleotide statistics for fasta sequences

I have a FASTA file with 200 sequences, and I would like to know the average of nucleotides. How can I get it?

sequences

I edited the title to be consistent with the question.

2 answers

awk '/^>/ {N++;next;} {B+=length($0);} END {printf("%f\n",B/N);}' input.fasta

Thank you, Pierre Lindenbaum!

seqkit stats input.fasta

Look at avg.len field and link to seqkit: http://bioinf.shenwei.me/seqkit/download/

Log in to answer this question.