This skill enables AI agents to help you process many sequence files at once (count, merge, split, convert, summarize) without exhausting RAM, choosing between Biopython streaming, on-disk indexing, and faster readers (pysam, pyfastx) based on data size.
pip install biopython
pip install pysam pyfastx # optional, faster readers for huge FASTQ
Tell your AI agent what you want to do:
"Count reads in every .fastq file under reads/ without loading them into memory"
"Combine all .fasta files in samples/ into one file, tagging each record with its source filename"
"Split large.fasta into files of 500 sequences each"
"Build a persistent index across all FASTA files in data/ so I can look up records by id later"
"Convert all .gb files in genbank/ to FASTA in fasta/"
"Generate a summary CSV with sequence counts and min/max/avg lengths for all FASTA files"
"Iterate over a 50-million-read FASTQ as fast as possible to tally read lengths"
list(SeqIO.parse(...)) a large file; iterate the generator or use sum(1 for _ in ...) to countSeqIO.parse is one-pass and exhausts silently; re-create it per pass or use index_db for repeated lookupsSeqIO.index_db() (not to_dict()) for random access across many or huge files; the SQLite index persists across sessionsValueError: Duplicate key in index_db/to_dict; prefix ids by filename to keep them uniqueSeqIO is slow over tens of millions of reads because it builds a full record each; switch to pysam.FastxFile (linear) or pyfastx (indexed)bgzip before indexingmultiprocessing.Pool for CPU-bound per-file work, ThreadPoolExecutor for I/O-bound workrglob() for recursive directory search and pathlib.Path for cross-platform paths