You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: vignettes/deepMatchR.Rmd
+23-35Lines changed: 23 additions & 35 deletions
Original file line number
Diff line number
Diff line change
@@ -326,22 +326,21 @@ print(binding_results)
326
326
327
327
## Calculating Peptide Binding Load with `calculatePeptideBindingLoad()`
328
328
329
-
This function integrates the previous concepts to calculate a "Peptide Binding Load." It automates the complex workflow of identifying potential allo-antigens created by donor-recipient mismatches and predicting their binding affinity to the recipient's HLA alleles.
329
+
This function integrates the previous concepts to calculate a "Peptide Binding Load." It predicts transplant risk by calculating peptide-HLA binding affinities between recipient HLA molecules and donor-mismatched peptides.
330
330
331
331
The workflow is:
332
332
333
-
1. Identifies all mismatched amino acid positions between donor and recipient alleles (like `calculateMismatchLoad()`).
334
-
2. Generates all possible peptides (e.g., lengths 8-11 for Class I) that cover these mismatched positions.
335
-
3. Filters for peptides that are "donor-specific" (i.e., the mismatch created a new peptide sequence that is not found in the recipient's own proteome).
336
-
4. Predicts the binding of these donor-specific peptides against all of the recipient's HLA alleles using `predictMHCnuggets()`.
337
-
5. Summarizes the results, counting how many donor-specific peptides are predicted to bind to the recipient's MHCs.
333
+
1.**Input processing**: Converts recipient and donor inputs to standard format (allele names and peptides).
334
+
2.**Peptide derivation**: If donor is a genotype/alleles, derives mismatched peptides by comparing sequences and generating overlapping k-mers from mismatch regions.
335
+
3.**Binding prediction**: Uses the selected backend (PWM, NetMHCpan, or MHCflurry) to predict IC50 values for each peptide-allele combination.
336
+
4.**Risk calculation**: Aggregates binding predictions into a risk score based on strong (IC50 ≤ 500 nM) and weak (IC50 ≤ 5000 nM) binders.
338
337
339
338
### Get a simple summary
340
339
341
340
```{r}
342
341
summary_load <- calculatePeptideBindingLoad(
343
-
recipient_geno = rgeno,
344
-
donor_geno = dgeno,
342
+
recipient = rgeno,
343
+
donor = dgeno,
345
344
return = "summary"
346
345
)
347
346
@@ -350,52 +349,41 @@ print(summary_load)
350
349
351
350
### Get a per-allele breakdown
352
351
353
-
This shows which loci are contributing the most to the peptide binding load.
352
+
The `return = "summary"` option provides a per-HLA-allele breakdown showing which alleles are contributing the most to the peptide binding load.
354
353
355
354
```{r}
356
-
# Get a per-locus breakdown
357
-
per_locus_load <- calculatePeptideBindingLoad(
358
-
recipient_geno = rgeno,
359
-
donor_geno = dgeno,
360
-
return = "by_recipient_allele"
361
-
)
362
-
363
-
print(per_locus_load)
355
+
# The summary return already provides per-allele breakdown
356
+
print(summary_load)
364
357
```
365
358
366
359
### Get detailed results
367
360
368
-
This returns a list containing all the raw prediction data, including the specific peptides, their IC50 scores against each recipient allele, and the mismatch positions they came from.
361
+
This returns a data frame with per-peptide binding predictions, including the peptide sequences, HLA alleles, predicted IC50 values, binding levels, and contribution scores.
369
362
370
363
```{r}
371
364
# Get the full detailed output
372
365
detailed_load <- calculatePeptideBindingLoad(
373
-
recipient_geno = rgeno,
374
-
donor_geno = dgeno,
375
-
return = "detailed"
366
+
recipient = rgeno,
367
+
donor = dgeno,
368
+
return = "detail"
376
369
)
377
370
378
-
# The result is a list
379
-
names(detailed_load)
380
-
381
-
# You can inspect the raw predictions
382
-
head(detailed_load$all_predictions)
371
+
# The result is a data frame with per-peptide predictions
372
+
head(detailed_load)
383
373
```
384
374
385
-
### Visualizing petide binding results
375
+
### Getting a total risk score
386
376
387
-
After generating detailed peptide binding data, you can use visualizePeptideBinding to create plots. This function requires the output from `calculatePeptideBindingLoad()` when `return = "detailed"` is used.
377
+
You can also get a single aggregated risk score using `return = "total"`:
0 commit comments