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.
Guide RNA Design
"Design guide RNAs for my CRISPR knockout experiment" → Scan a target gene sequence for PAM sites, extract candidate spacer sequences, and score them for on-target activity using Rule Set 2 or CRISPRscan algorithms.
- Python: custom PAM scanning with
Bio.Seq, CRISPRscan scoring models
Find PAM Sites
from Bio.Seq import Seq
import re
def find_pam_sites(sequence, pam='NGG', guide_length=20):
'''Find all PAM sites and extract guide sequences
PAM patterns:
- NGG: SpCas9 (most common)
- TTTN: Cas12a/Cpf1 (5' PAM)
- NNGRRT: SaCas9 (smaller, for AAV delivery)
'''
sequence = sequence.upper()
guides = []
# NGG PAM - guide is 20bp upstream of PAM
if pam == 'NGG':
for match in re.finditer(r'(?=(.GG))', sequence):
pos = match.start()
if pos >= guide_length:
guide = sequence[pos - guide_length:pos]
guides.append({
'sequence': guide,
'pam': sequence[pos:pos + 3],
'position': pos - guide_length,
'strand': '+'
})
# Also search reverse complement
rc_seq = str(Seq(sequence).reverse_complement())
for match in re.finditer(r'(?=(.GG))', rc_seq):
pos = match.start()
if pos >= guide_length:
guide = rc_seq[pos - guide_length:pos]
original_pos = len(sequence) - pos
guides.append({
'sequence': guide,
'pam': rc_seq[pos:pos + 3],
'position': original_pos,
'strand': '-'
})
return guides
