gelpredict / app /POWER_TOOLS_GUIDE.md
awolter's picture
Upload folder using huggingface_hub
266eda8 verified
|
Raw History Blame Contribute Delete
17.3 kB
# GelPredict Power Tools Guide
## Overview
Two advanced features for high-throughput data entry and experimental design:
1. **๐Ÿ” Clone This Well** - Duplicate wells for replicates
2. **๐Ÿงฉ Plate Map Wizard** - Bulk-create entire plate layouts
## ๐Ÿ” Clone This Well
### Purpose
Create multiple copies of an existing well with the same metadata and reagents. Perfect for:
- Technical replicates
- Biological replicates across adjacent wells
- Time-course experiments with identical starting conditions
### Location
**๐Ÿ“Š View/Edit Data** โ†’ Select a well โ†’ Scroll to "๐Ÿ” Clone this well"
### How to Use
1. **Navigate to View/Edit Data**
2. **Select the well you want to clone**
3. **Configure clone parameters:**
- **How many clones?** (1-96)
- **Clone reagents** โœ“ (checkbox)
- **Operator override** (optional)
- **Batch override** (optional)
- **Plate ID** (where clones will live)
- **Start column** (clones go horizontally: Col 1, 2, 3...)
- **Row** (A-H)
- **Replicate start** (auto-increments for each clone)
4. **Click "โœจ Create clones"**
### Example Use Case
**Scenario:** You have a well at A1 with a specific collagen formulation. You want 3 technical replicates at A2, A3, A4.
```
Template well: A1 (batch B2025-043, 7 mg/mL collagen, pH 7.2)
Clones: 3
Clone reagents: โœ“
Row: A
Start column: 2
Replicate start: 1
```
**Result:**
- A2: replicate_id=1, new UUID, same reagents
- A3: replicate_id=2, new UUID, same reagents
- A4: replicate_id=3, new UUID, same reagents
### What Gets Copied
โœ… **Copied:**
- family, batch_id, donor_id
- Composition measurements (protein, pH, conductivity, UV, SDS)
- Test conditions (probe_type, target_pH, temp)
- Storage info (pre_storage_days, freeze cycles)
- Reagents (if checkbox selected)
- notes_pre
โŒ **Not Copied:**
- record_id (new UUID generated)
- Outcomes (gel_binary, gel_strength, time_to_halfmax)
- Kinetics (slope_OD, final_OD, lag_time)
- App predictions
- notes_post (filled after experiment)
### Benefits
- โฑ๏ธ **Time savings:** 30 seconds per replicate โ†’ bulk create in 5 seconds
- ๐ŸŽฏ **Accuracy:** No manual re-entry errors
- ๐Ÿงซ **Consistency:** Exact same reagent formulation
- ๐Ÿ“Š **Traceability:** All clones linked by batch_id
## ๐Ÿงฉ Plate Map Wizard
### Purpose
Bulk-create wells across entire plate layouts. Perfect for:
- Full 96-well plate setups
- Factorial designs (varying pH across rows, ionic strength across columns)
- High-throughput screening
- Batch processing
### Location
**๐Ÿงฉ Plate Map Wizard** (navigation menu)
### How to Use
#### Option A: With Template Well
1. **Navigate to Plate Map Wizard**
2. **Select a template well** (optional but recommended)
- Choose from dropdown
- Template provides base metadata
3. **Override fields** (optional):
- Family, Batch ID, Operator ID
- Plate ID
- pH, temperature, protein concentration
4. **Configure plate geometry:**
- **Plate type:** 96-well (8x12), 48-well (6x8), or 24-well (4x6)
- **Rows:** Select which rows to use (A-H)
- **Column range:** Start and end columns
- **Replicate start:** Auto-increments across wells
5. **Reagents:** Check "Copy reagents from template well" if desired
6. **Preview:** See planned wells (row ร— col ร— replicate_id)
7. **Click "๐Ÿš€ Create wells"**
#### Option B: From Scratch
1. **Template well:** Select "(none)"
2. **Fill in base metadata:**
- ECM Family, Batch ID, Operator ID
- Plate ID
- Target pH, temperature
- Pre-pH, protein, conductivity
3. **Configure geometry** (same as Option A)
4. **Create wells**
### Example Use Cases
#### Use Case 1: Full 96-well plate with pH gradient
```
Template: Existing well with collagen batch B2025-043
Plate: 96 (8x12)
Rows: A-H (all rows)
Columns: 1-12 (full plate)
Clone reagents: โœ“
Result: 96 wells created, all with same base formulation
You can then manually adjust pH for each row/column
```
#### Use Case 2: 2ร—6 mini-experiment (no template)
```
Template: (none)
Family: collagen_decECM
Batch ID: B2025-044
Operator ID: AW
Plate ID: Plate-001
pH: 7.2, Temp: 37ยฐC, Protein: 8.0 mg/mL
Plate: 96 (8x12)
Rows: A, B
Columns: 1-6
Replicate start: 1
Result: 12 wells created (A1-A6, B1-B6) with replicate_id 1-12
```
#### Use Case 3: Clone template across 2 rows
```
Template: Well XYZ (has 4 reagents defined)
Rows: C, D
Columns: 1-8
Clone reagents: โœ“
Result: 16 wells (C1-C8, D1-D8), all with same 4 reagents
```
### What Gets Created
Each well receives:
- **Unique UUID** (record_id)
- **Today's date**
- **Specified row/column position**
- **Auto-incremented replicate_id**
- **Base metadata** (from template or overrides)
- **Reagents** (if cloning enabled)
- **Empty outcomes** (ready for measurement)
### Preview Table
Before creation, you'll see:
```
| row | col | replicate_id |
|-----|-----|--------------|
| A | 1 | 1 |
| A | 2 | 2 |
| A | 3 | 3 |
| ...
```
### Performance
- **Transaction-safe:** Each well+reagents created atomically
- **Speed:** ~100 wells in < 5 seconds
- **Memory:** Handles up to 384 wells (four 96-well plates)
## ๐Ÿ’ก Pro Tips
### Clone This Well
**Tip 1: Horizontal replicates**
```
Template: A1
Clones: 5
Row: A
Start column: 2
โ†’ Creates A2, A3, A4, A5, A6
```
**Tip 2: Same position, different batch**
```
Template: A1 (batch B-001)
Clones: 1
Batch override: B-002
Row: A
Start column: 1
โ†’ Creates new well at A1 for batch B-002
```
**Tip 3: Quick replicates without reagents**
```
Clone reagents: โ˜ (unchecked)
โ†’ Copies metadata only
โ†’ Then go to Reagents Manager and add custom reagents per well
```
### Plate Map Wizard
**Tip 1: Full plate in one click**
```
Template: Your validated formulation
Rows: A-H (all 8)
Columns: 1-12 (all 12)
โ†’ 96 wells instantly
```
**Tip 2: Stripe pattern (rows = conditions)**
```
Rows: A (pH 6.8), B (pH 7.0), C (pH 7.2), D (pH 7.4)
Columns: 1-6 (replicates)
Clone reagents: โœ“
โ†’ Create 24 wells, then edit each row's pH
```
**Tip 3: Time course**
```
Rows: A
Columns: 1-12 (one per time point)
Clone reagents: โœ“
โ†’ Create 12 wells with identical starting conditions
โ†’ Sacrifice one well at each time point
โ†’ Log events for kinetic analysis
```
**Tip 4: No template, just blanks**
```
Template: (none)
Family, Batch, Operator filled in
โ†’ Creates wells with minimal metadata
โ†’ Complete characterization later as data becomes available
```
## ๐Ÿ”’ Safety Features
### Data Integrity
- โœ… **UUID collision prevention:** Each well gets unique UUID
- โœ… **Transaction safety:** Entire clone/bulk operation is atomic
- โœ… **Foreign key enforcement:** Reagents automatically linked to wells
- โœ… **Cascade delete:** Deleting a template doesn't affect clones
### Validation
- โœ… **Plate geometry enforced:** Can't select invalid rows/columns
- โœ… **Position preview:** See exactly what will be created
- โœ… **Error handling:** Failed clones don't corrupt database
- โœ… **Rollback on failure:** All-or-nothing creation
### Audit Trail
- โœ… **created_at timestamp:** Know when clones were made
- โœ… **operator_id tracked:** Know who created the clones
- โœ… **Distinct UUIDs:** Each clone is a separate, traceable record
## ๐Ÿ“Š Typical Workflows
### Workflow 1: Validation Plate
**Goal:** Test a new formulation across multiple pH values
1. Enter one well manually with full characterization (A1)
2. Navigate to Plate Map Wizard
3. Select that well as template
4. Create A1-A8, B1-B8 (16 wells)
5. Edit each well to adjust pH (7.0, 7.1, 7.2, ..., 7.7)
6. Run experiments
7. Log outcomes and events
### Workflow 2: Technical Replicates
**Goal:** Run triplicates of a validated recipe
1. Navigate to View/Edit Data
2. Select your validated well
3. Scroll to "Clone this well"
4. Set clones: 3, clone reagents: โœ“
5. Create clones
6. Run all 4 wells (original + 3 clones) simultaneously
### Workflow 3: Batch Comparison
**Goal:** Compare 3 different batches with identical conditions
1. Create template well for Batch A
2. Clone with batch override โ†’ Batch B, Batch C
3. All wells have same pH, temp, reagents
4. Only difference: batch_id
5. Measure outcomes to assess batch variability
### Workflow 4: Factorial Design
**Goal:** 3 pH levels ร— 4 ionic strengths = 12 conditions
1. Create template with base formulation
2. Plate Map Wizard: Rows A-C, Columns 1-4
3. Edit each well:
- Row A: pH 6.8
- Row B: pH 7.2
- Row C: pH 7.6
- Then adjust NaCl for columns (1=100mM, 2=120mM, 3=140mM, 4=160mM)
4. Run factorial experiment
## โš ๏ธ Common Pitfalls
### Pitfall 1: Forgot to override batch_id
**Problem:** Cloned 96 wells, all have same batch_id as template
**Fix:** Use "Batch override" field
**Prevention:** Always specify batch_id when cloning across batches
### Pitfall 2: Overlapping positions
**Problem:** Created wells at A1-A6, then A4-A8 (A4, A5, A6 duplicate)
**Impact:** Second batch fails with "Record ID already exists" (different UUIDs)
**Fix:** Check existing wells first, or use different rows
**Prevention:** Preview table shows all positions before creation
### Pitfall 3: Cloned outcomes
**Problem:** Template had gel_binary=1, clones also marked as success
**Reality:** Clones DON'T copy outcomes (by design)
**Why:** Outcomes must be measured, not cloned
### Pitfall 4: Too many clones
**Problem:** Tried to create 1000 wells at once
**Impact:** Long wait, potential timeout
**Fix:** Create in batches of 96
**Prevention:** Wizard warns if > 100 wells selected
## ๐ŸŽ“ Advanced Techniques
### Technique 1: Parameterized Sweep
Create a grid of conditions:
```python
# Template well with base recipe
Template: record_id ABC123
# Plate Map Wizard
Rows: A-H (8 pH values)
Columns: 1-6 (6 ionic strengths)
โ†’ 48 wells
# Then programmatically edit via SQL or CSV export/import:
pH_values = np.linspace(6.8, 7.6, 8)
ionic_values = np.linspace(100, 200, 6)
for row_idx, pH in enumerate(pH_values):
for col_idx, ionic in enumerate(ionic_values):
# Update well at (row, col) with (pH, ionic)
```
### Technique 2: Pre-populate from AI Recommendations
```
1. Get AI recipe recommendation (pH 7.3, NaCl 135 mM)
2. Create template well with those conditions
3. Clone 6 times (replicates)
4. Run experiments to validate AI prediction
```
### Technique 3: Batch Migration
Moving from old batch to new batch:
```
1. Filter View/Edit by old batch_id
2. Select one representative well
3. Clone with batch override = new_batch_id
4. Repeat for each formulation type
โ†’ Migrates protocols to new batch systematically
```
## ๐Ÿ“ˆ Performance Metrics
| Operation | Wells | Time | Database Operations |
|-----------|-------|------|---------------------|
| Clone 1 well | 1 | < 0.1s | 1 INSERT (well) + N INSERTs (reagents) |
| Clone 10 wells | 10 | < 1s | 10 wells + 40 reagents (if 4 reagents/well) |
| Plate Map (96 wells, no reagents) | 96 | ~3s | 96 INSERTs |
| Plate Map (96 wells, 4 reagents each) | 96 | ~5s | 96 + 384 INSERTs |
All operations are transaction-wrapped, so failures rollback completely.
## ๐Ÿ” Security & Data Integrity
### Clone Safety
- **Unique UUIDs:** Each clone gets a new UUID (no collisions)
- **Independent records:** Editing a clone doesn't affect the original
- **Outcome isolation:** Clones don't inherit experimental results
- **Audit trail:** created_at shows when clone was made
### Bulk Creation Safety
- **Atomic transactions:** All wells created or none
- **Foreign key enforcement:** Reagents can't orphan
- **Position validation:** Can't exceed plate dimensions
- **Duplicate detection:** SQLite UNIQUE constraint prevents duplicate positions if schema enforced
## ๐Ÿ› ๏ธ Troubleshooting
### Issue: "Record ID already exists"
**Cause:** UUID collision (extremely rare) or trying to clone to same position
**Solution:** Click "Create clones" again (generates new UUIDs)
### Issue: Clone created but reagents missing
**Cause:** "Clone reagents" was unchecked
**Solution:** Go to Reagents Manager and add manually, or delete clone and recreate with checkbox on
### Issue: Plate Map created wells with wrong metadata
**Cause:** Template well had incorrect values
**Solution:** Delete batch of wells, fix template, regenerate
**Prevention:** Preview table shows what will be created; verify before clicking "Create"
### Issue: Clones have same replicate_id
**Cause:** Replicate start was not set, defaults to template value
**Solution:** Set "Replicate start" to 1 (or appropriate value); clones auto-increment from there
### Issue: Bulk create failed halfway
**Cause:** CHECK constraint violation (e.g., pH > 14)
**Impact:** Transaction rolled back, no wells created
**Solution:** Fix invalid values in template/overrides, retry
**Evidence:** All-or-nothing atomicity protects database
## ๐Ÿ“š Integration with Other Features
### With Events Logger
After bulk-creating wells:
1. Navigate to Events Logger
2. Select first well
3. Log initial observation (t=0)
4. Repeat for remaining wells
5. Log time-series events as experiment progresses
### With Export
Bulk-created wells appear immediately in:
- View/Edit Data (filter by plate_id or batch_id)
- Export โ†’ Wells CSV
- Export โ†’ Excel workbook (Pivots by plate)
### With AI Predictions
Future enhancement:
1. Create template from AI recommendation
2. Plate Map Wizard โ†’ 96 wells
3. Run experiments
4. Compare actual vs predicted gel_binary
5. Retrain model with batch results
## ๐ŸŽฏ Best Practices
### Before Cloning
- โœ… Verify template well has correct metadata
- โœ… Check reagents are properly defined
- โœ… Decide if you need reagent cloning
- โœ… Plan plate layout (sketch on paper first)
### During Bulk Creation
- โœ… Start small (test with 6 wells before doing 96)
- โœ… Use descriptive plate_ids (e.g., "Plate-pH-Screen-001")
- โœ… Preview the table before creating
- โœ… Take note of replicate_id numbering
### After Creation
- โœ… Verify wells in View/Edit Data
- โœ… Spot-check reagents in Reagents Manager
- โœ… Edit any per-well variations (pH, etc.)
- โœ… Log initial events (t=0 observations)
## ๐Ÿ“Š Example Scenarios
### Scenario 1: Time Course (Gelation Kinetics)
**Setup:**
- Template: Well with 6 mg/mL collagen, pH 7.2
- Clone 12 wells (one per time point: 0, 5, 10, 15, 20, 30, 45, 60, 90, 120, 180, 240 min)
- Same row, columns 1-12
**Execution:**
1. Mix master batch
2. Aliquot to 12 wells at t=0
3. At each time point: measure OD, log event, tilt test
4. Final outcomes: plot time_to_halfmax vs predicted
### Scenario 2: Factorial Design (pH ร— Ionic)
**Setup:**
- 4 pH levels (7.0, 7.2, 7.4, 7.6)
- 6 NaCl levels (100, 120, 140, 160, 180, 200 mM)
- 24 total conditions
**Execution:**
1. Plate Map Wizard: Rows A-D, Columns 1-6
2. Edit each row: A=pH 7.0, B=7.2, C=7.4, D=7.6
3. Add reagents per column for NaCl gradient
4. Run plate, log outcomes
5. Analyze which (pH, ionic) combinations gel
### Scenario 3: Batch Validation
**Setup:**
- New batch needs testing at 3 standard conditions
- 3 replicates per condition
- 9 total wells
**Execution:**
1. Create 3 template wells (low pH, medium pH, high pH)
2. Clone each template 3 times
3. Run all 9 wells
4. Compare to historical batch performance
## ๐Ÿš€ Efficiency Gains
| Task | Manual Entry | With Power Tools | Time Saved |
|------|--------------|------------------|------------|
| 3 technical replicates | 3 ร— 2 min = 6 min | 10 sec | 5.8 min |
| 96-well plate | 96 ร— 2 min = 192 min | 30 sec | 191.5 min (3+ hours!) |
| 24-well factorial | 24 ร— 2 min = 48 min | 20 sec | 47.7 min |
**Average time savings:** **95-98%** for replicate/plate experiments
## ๐Ÿ”ฎ Future Enhancements
Planned features:
- [ ] Visual plate map (click wells to select)
- [ ] CSV import for plate layout (upload Excel with positions)
- [ ] Conditional creation (create only if position empty)
- [ ] Pattern-based naming (auto-generate record_ids like "PlateA_A01")
- [ ] Reagent gradients (auto-vary concentration across columns)
- [ ] Bulk edit (select multiple wells, change pH in batch)
## ๐Ÿ“ Documentation
Related docs:
- **QUICKSTART.md** - General GUI usage
- **README_APP_ARCHITECTURE.md** - System design
- **PREFLIGHT_CHECKLIST.md** - Validation and safety
- **DATA_PREP.md** - Measurement protocols
## ๐Ÿ†˜ Support
If you encounter issues:
1. **Check error message** - Usually explains what went wrong
2. **Verify template** - Make sure template well exists and has valid data
3. **Preview before creating** - Use the preview table to catch issues
4. **Test small first** - Try 2-3 wells before bulk-creating 96
5. **Check database** - Ensure gelpredict.db is not locked
## โœ… Success Checklist
Your power tools are working well when:
- [x] Clone creates exact duplicates (except outcomes)
- [x] Reagents copy correctly when checkbox selected
- [x] Plate Map preview matches your intent
- [x] Replicate IDs auto-increment properly
- [x] Bulk creation completes in < 10 seconds
- [x] All wells appear in View/Edit Data
- [x] No duplicate position errors (if properly designed)
---
**Version:** 2.0
**Last Updated:** October 11, 2025
**Status:** Production-ready
**Efficiency:** 95%+ time savings on plate-based experiments ๐Ÿš€