bb_get_fasta_range - ampinzonv/BB3 GitHub Wiki

Function: bb_get_fasta_range

Extract a specific subsequence range from a FASTA entry by ID and coordinates.


๐Ÿ” Description

This function retrieves a subsequence from a FASTA entry based on start and end positions. If the file contains only one sequence, the entry ID can be auto-detected.

๐Ÿ“ฅ Input

  • A FASTA file with sequence data.
  • STDIN is supported with --input -.

๐Ÿ“ค Output

  • A new FASTA record containing only the specified range.

๐Ÿงช Examples

Extract positions 10โ€“30 from seq1:

bb_get_fasta_range --input db.fasta --entry seq1 --start 10 --end 30

Auto-detect ID when only one sequence is present:

bb_get_fasta_range --input single_seq.fasta --start 5 --end 15

โš™๏ธ Usage

bb_get_fasta_range --input FILE [--entry ID] --start INT --end INT [--outfile FILE] [--quiet] [--force]

๐Ÿงต Options

Option Description
--input FILE FASTA file or - for STDIN (required)
--entry ID Entry ID (optional if input contains only one sequence)
--start INT Start position (1-based, inclusive) (required)
--end INT End position (1-based, inclusive) (required)
--outfile FILE Output file (default: STDOUT)
--quiet Suppress informational messages
--force Overwrite output file if it exists

๐Ÿ“Œ Notes

  • Coordinates are 1-based and inclusive.
  • If --entry is not provided, and the file has more than one sequence, the function will abort.