bb_get_fasta_header - ampinzonv/BB3 GitHub Wiki
bb_get_fasta_header
Function: Extract FASTA headers from a file or from standard input (STDIN).
๐ Description
This function retrieves only the header lines (those starting with >
) from a FASTA file. It can read from a file or from a pipeline (using -
as input), making it ideal for use in command-line workflows.
๐ฅ Input
- A FASTA file containing biological sequences.
- Can also read from STDIN using
--input -
.
๐ค Output
- A list of headers (each line starting with
>
). - Output is sent to STDOUT by default, or to a file using
--outfile
.
๐งช Examples
Extract headers from a file:
bb_get_fasta_header --input sequences.fasta
Extract headers from a stream:
cat sequences.fasta | bb_get_fasta_header --input -
Save headers to a file:
bb_get_fasta_header --input sequences.fasta --outfile headers.txt
โ๏ธ Usage
bb_get_fasta_header --input FILE [--outfile FILE] [--quiet] [--force]
๐งต Options
Option | Description |
---|---|
--input FILE |
Input FASTA file, or - to read from STDIN (required) |
--outfile FILE |
Path to output file (optional, default: STDOUT) |
--quiet |
Suppress informational log messages |
--force |
Overwrite output file if it exists |
๐ Notes
- If running on macOS,
grep
behaves the same as on Linux, so no special handling is required. - This function is useful when preparing lists of entries for filtering or extracting specific sequences.