This skill enables AI agents to help you create and manipulate biological sequence objects in Biopython. It covers the core Seq, MutableSeq, and SeqRecord classes that form the foundation of sequence analysis.
pip install biopythonTell your AI agent what you want to do:
- "Create a Seq object from this DNA string"
- "I need a mutable sequence I can modify in place"
- "Build a SeqRecord with ID and description for writing to FASTA"
- "Copy this SeqRecord and change its ID"
"Create a Seq object from 'ATGCGATCGATCG' and show its length"
"I need to replace position 5 with a G in this sequence"
"Create a SeqRecord with ID 'gene1' and description 'Example gene' that I can write to a file"
"Build a SeqRecord with organism annotation set to 'E. coli'"
"Create SeqRecords from this list of sequences with sequential IDs"
- Import the appropriate classes (Seq, MutableSeq, SeqRecord)
- Create the sequence object with the correct type
- Set any required attributes (id, description, annotations)
- Perform the requested operations
- Return or display the result
- Seq: Most common. Use for reading, analyzing, and transforming sequences.
- MutableSeq: When you need to modify individual bases/residues in place.
- SeqRecord: When you need metadata (ID, description) or plan to write to files.
- If you're writing to a file, you need SeqRecord (not just Seq)
- For GenBank format output, set
record.annotations['molecule_type'] - When copying SeqRecords, use
deepcopy()to avoid reference issues - Seq objects are immutable - use MutableSeq for in-place changes