SKILL.md
Version Compatibility
Reference examples tested with: BioPython 1.83+, primer3-py 2.0+
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.
HDR Template Design
"Design a donor template for my CRISPR knock-in" → Create homology-directed repair templates (ssODN, dsDNA, or plasmid) with optimized homology arm lengths and silent PAM mutations, using primer3 for flanking primer design.
- Python:
primer3.bindings.design_primers()(primer3-py) for primer/arm design,Bio.Seqfor template construction
Template Types
ssODN (single-stranded oligodeoxynucleotide):
- Length: 100-200nt total
- Homology arms: 30-60nt each side
- Best for: Small insertions (<50bp), point mutations
- Delivery: Electroporation with RNP
dsDNA (double-stranded DNA):
- Length: 500bp - 5kb total
- Homology arms: 200-800bp each side
- Best for: Larger insertions (tags, reporters)
- Delivery: Plasmid or PCR product
Plasmid donor:
- Homology arms: 500-2000bp
- Best for: Large insertions (>1kb), conditional alleles
- Delivery: Transfection
ssODN Design
from Bio.Seq import Seq
def design_ssodn(target_seq, cut_site, insert_seq='', arm_length=50):
'''Design single-stranded oligo donor for HDR
Args:
target_seq: Genomic sequence around cut site
cut_site: Position of Cas9 cut (3bp upstream of PAM)
insert_seq: Sequence to insert (empty for deletion/mutation)
arm_length: Length of each homology arm (30-60nt optimal)
ssODN considerations:
- Total length should be 100-200nt (synthesis limit)
- Asymmetric arms can improve HDR (PAM-distal shorter)
- Strand choice: complementary to non-target strand often better
'''
# Extract homology arms
left_arm = target_seq[cut_site - arm_length:cut_site]
right_arm = target_seq[cut_site:cut_site + arm_length]
# Assemble ssODN
ssodn = left_arm + insert_seq + right_arm
# Also provide reverse complement (may work better)
ssodn_rc = str(Seq(ssodn).reverse_complement())
return {
'sense': ssodn,
'antisense': ssodn_rc,
'length': len(ssodn),
'left_arm_length': len(left_arm),
'right_arm_length': len(right_arm),
'insert_length': len(insert_seq)
}
def design_ssodn_mutation(target_seq, mutation_pos, new_base, arm_length=50):
'''Design ssODN for a point mutation
For point mutations, center the mutation in the ssODN.
Also introduce silent PAM mutation to prevent re-cutting.
'''
# Build mutant sequence
mutant = list(target_seq)
mutant[mutation_pos] = new_base
mutant_seq = ''.join(mutant)
# Extract arms around mutation
left_start = mutation_pos - arm_length
right_end = mutation_pos + arm_length + 1
ssodn = mutant_seq[left_start:right_end]
return {
'sequence': ssodn,
'length': len(ssodn),
'mutation_position_in_ssodn': arm_length,
'original_base': target_seq[mutation_pos],
'new_base': new_base
}
