Read length distribution from FASTA file I have a ~10GB FASTA file generated from an Oxford Nanopore Technologies' MinION run. How can I quickly and efficiently calculate the distribution of read lengths?

A naive approach would be to read the FASTA file in Biopython, check the length of each sequence, store the lengths in a numpy array and plot the results using matplotlib, but this seems like reinventing the wheel.
If you want something quick and dirty you could rapidly index the FASTA with samtools faidx and then put the lengths column through R (other languages are available) on the command line.

samtools faidx $fasta
cut -f2 $fasta.fai | Rscript -e 'data &lt;- as.numeric (readLines ("stdin")); summary(data); hist(data)'


This outputs a statistical summary, and creates a PDF in the current directory called Rplots.pdf, containing a histogram.