SKILL.md
Version Compatibility
Reference examples tested with: BioPython 1.83+
Before using code patterns, verify installed versions match. If versions differ:
- Python:
pip show <package>thenhelp(module.function)to check signatures
If code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying.
Prime Editing Design
"Design a prime editing guide for my point mutation" → Generate pegRNA sequences (spacer, scaffold, RT template, PBS) for precise genomic modifications without double-strand breaks, optimizing PBS length and RT template for editing efficiency.
- Python: PrimeDesign algorithms with
Bio.Seqfor sequence handling
pegRNA Structure
pegRNA components:
1. Spacer (20nt) - guides Cas9 to target site
2. Scaffold - Cas9 binding sequence
3. RT template - encodes the desired edit
4. PBS (primer binding site) - anneals to nicked strand
Spacer (20nt) Scaffold RT template PBS
5'─[NNNNNNNNNNNNNNNNNNNN]─[scaffold]─[edit]─────[PBS]─3'
Design pegRNA for Point Mutation
from Bio.Seq import Seq
def design_pegrna_substitution(target_seq, edit_pos, new_base, pbs_length=13, rt_length=15):
'''Design pegRNA for a point mutation
Args:
target_seq: ~100bp sequence centered on edit site
edit_pos: Position of nucleotide to change (0-indexed in target_seq)
new_base: New nucleotide (A, C, G, or T)
pbs_length: Primer binding site length (13-17nt optimal)
Shorter = less stable, Longer = more secondary structure
rt_length: RT template length including edit (10-20nt for substitutions)
Returns:
dict with pegRNA components
'''
target_seq = target_seq.upper()
# Find nick site (3bp upstream of PAM, which is 3bp after edit for +strand)
# For substitution, nick should be close to edit site
nick_pos = edit_pos + 3 # Adjust based on PAM location
# Spacer: 20nt upstream of PAM
spacer_start = nick_pos - 17 # Nick is 3bp upstream of PAM
spacer = target_seq[spacer_start:spacer_start + 20]
# PBS: Reverse complement of sequence just upstream of nick
pbs_region = target_seq[nick_pos - pbs_length:nick_pos]
pbs = str(Seq(pbs_region).reverse_complement())
# RT template: Contains the edit
# Sequence from nick site, with edit incorporated
rt_region = list(target_seq[nick_pos:nick_pos + rt_length])
# Incorporate the edit
edit_offset = edit_pos - nick_pos
if 0 <= edit_offset < len(rt_region):
rt_region[edit_offset] = new_base
rt_template = str(Seq(''.join(rt_region)).reverse_complement())
return {
'spacer': spacer,
'pbs': pbs,
'rt_template': rt_template,
'pbs_length': pbs_length,
'rt_length': rt_length,
'edit_type': 'substitution'
}
