This skill enables AI agents to help you read biological sequence data from common file formats using Biopython. It covers FASTA, FASTQ, GenBank, and 40+ other formats, and the choice between streaming, in-memory, and on-disk-indexed access.
pip install biopython
Tell your AI agent what you want to do:
"Parse sequences.fasta and print each sequence ID and length"
"Read the GenBank file and extract all CDS product names"
"Load reads.fastq and calculate the average quality score for each read"
"I have a 10GB FASTA file and need to extract just one sequence by ID without loading the whole file"
"I query the same set of reference FASTA files every run; build a persistent index so lookups are instant next time"
parse, assert single with read, or random-access with to_dict/index/index_dbThe agent can read these common formats: - FASTA (.fasta, .fa, .fna, .faa) - FASTQ (.fastq, .fq) - GenBank (.gb, .gbk) - EMBL (.embl) - Swiss-Prot (.dat) - Alignment formats (PHYLIP, Clustal, Stockholm)
parse() holds one record at a time and scales to any file size; only load everything into memory when random access on a small file demands it.list() or to_dict() a huge file; it can exhaust RAM. Use index() for random access into one large file, or index_db() for files larger than memory, many files at once, or an index reused across runs.parse() generator is one-pass: it exhausts silently after the first loop and is not subscriptable. Re-call parse() for each pass.read() only when the file holds exactly one record; it raises loudly on zero or multiple records.to_dict/index/index_db raise ValueError: Duplicate key. Provide a key_function to derive unique keys.record.description is the whole header including the id; record.id is just its first whitespace token.