Skip to content

Commit f887668

Browse files
committed
Update vignette
1 parent 222453f commit f887668

1 file changed

Lines changed: 23 additions & 35 deletions

File tree

vignettes/deepMatchR.Rmd

Lines changed: 23 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -326,22 +326,21 @@ print(binding_results)
326326

327327
## Calculating Peptide Binding Load with `calculatePeptideBindingLoad()`
328328

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.
330330

331331
The workflow is:
332332

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.
338337

339338
### Get a simple summary
340339

341340
```{r}
342341
summary_load <- calculatePeptideBindingLoad(
343-
recipient_geno = rgeno,
344-
donor_geno = dgeno,
342+
recipient = rgeno,
343+
donor = dgeno,
345344
return = "summary"
346345
)
347346
@@ -350,52 +349,41 @@ print(summary_load)
350349

351350
### Get a per-allele breakdown
352351

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.
354353

355354
```{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)
364357
```
365358

366359
### Get detailed results
367360

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.
369362

370363
```{r}
371364
# Get the full detailed output
372365
detailed_load <- calculatePeptideBindingLoad(
373-
recipient_geno = rgeno,
374-
donor_geno = dgeno,
375-
return = "detailed"
366+
recipient = rgeno,
367+
donor = dgeno,
368+
return = "detail"
376369
)
377370
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)
383373
```
384374

385-
### Visualizing petide binding results
375+
### Getting a total risk score
386376

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"`:
388378

389379
```{r}
390-
visualizePeptideBinding(
391-
detailed_load,
392-
plot_type = "heatmap"
380+
total_risk <- calculatePeptideBindingLoad(
381+
recipient = rgeno,
382+
donor = dgeno,
383+
return = "total"
393384
)
394385
395-
visualizePeptideBinding(
396-
detailed_load,
397-
plot_type = "scatter"
398-
)
386+
print(total_risk)
399387
```
400388

401389

0 commit comments

Comments
 (0)