Skip to main content

Fasta_summary

A small, dependency-free Python command-line tool that summarizes a FASTA file: it counts the number of sequences and prints their mean length.

Installation

From PyPI (once published):

pip install fasta-summary-songwei

From source:

git clone https://github.com/songwei/fasta-summary.git
cd fasta-summary
python -m pip install -e .

Requires Python 3.9 or newer.

Usage

Run the command against a FASTA file:

fasta-summary example.fasta

Typical output (TSV, two lines):

sequences	3
mean_length	8.33

You can also invoke it as a module:

python -m fasta_summary example.fasta

Help:

fasta-summary --help
usage: fasta-summary [-h] input

Summarize a FASTA file: count sequences and compute mean length.

positional arguments:
  input       Path to the input FASTA file

options:
  -h, --help  show this help message and exit

Input / Output

  • Input: a FASTA file. Headers start with >. Sequences may span multiple lines. Blank lines are ignored.
  • Output: two TSV lines written to stdout:
    • sequences<TAB><count>
    • mean_length<TAB><mean> (mean is formatted with 2 decimal places)

Special cases

  • Empty file (or file containing only blank lines): prints sequences\t0 and mean_length\t0.00 and exits with code 0.
  • Missing file: prints a friendly error to stderr and exits with code 1.
  • Sequence data before any header: prints a clear error to stderr and exits with code 2.

Known Limitations

  • Reads the whole file into memory; not optimized for very large FASTA files.
  • Length is counted in raw characters; letters are not validated against any biological alphabet (IUPAC, etc.).
  • Header metadata (anything after the first whitespace) is ignored.
  • Only standard >-prefixed FASTA headers are recognized; alternate formats such as FASTQ or multi-record line-wrapping conventions are not supported.
  • Input is read as UTF-8 text; binary FASTA files are not supported.

Metadata

Release files for fasta-summary-songwei 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fasta-summary-songwei 0.1.0
File Size Uploaded
fasta_summary_songwei-0.1.0.tar.gz 5.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fasta-summary-songwei 0.1.0
File Interpreter ABI Platform
fasta_summary_songwei-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 12.1 kB

Release files / fasta_summary_songwei-0.1.0.tar.gz

Download URL fasta_summary_songwei-0.1.0.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
076f3202d23abc2955974eba3583c4bab61ef71275e5e6239cc4e1897752ace0
BLAKE2b-256 checksum
How to use checksums
df560847717323c34a298f598cf6f73b7f9bd37d242eb02d2272af5b191e8aed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.12

Release files / fasta_summary_songwei-0.1.0-py3-none-any.whl

Download URL fasta_summary_songwei-0.1.0-py3-none-any.whl
Size 6.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e14e1a5d45ea532571be76614e24b21679a48a28492e60c2503db7e2d8536170
BLAKE2b-256 checksum
How to use checksums
252ecc585a0d70884faebfdb74706d3b2beb14b8dcf30036f2d0b4cdeea971a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.12

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page