Skip to content

Commit 29ceb2e

Browse files
Merge pull request #15 from ncborcherding/main
Fixing issues with epletLoad and toSerology
2 parents de4e1e1 + 15e4188 commit 29ceb2e

6 files changed

Lines changed: 41 additions & 408 deletions

File tree

NAMESPACE

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ export(predictMHCnuggets)
2222
export(quantifyEpletMismatch)
2323
export(quantifyMismatch)
2424
export(serologyAUC)
25-
export(spiDeconvolute)
2625
export(toSerology)
2726
export(updateWmdaData)
2827
export(visualizePeptideBinding)
@@ -31,10 +30,7 @@ importFrom(basilisk,basiliskStart)
3130
importFrom(basilisk,basiliskStop)
3231
importFrom(data.table,`:=`)
3332
importFrom(data.table,as.data.table)
34-
importFrom(data.table,copy)
3533
importFrom(data.table,data.table)
36-
importFrom(data.table,dcast)
37-
importFrom(data.table,fcase)
3834
importFrom(data.table,fifelse)
3935
importFrom(data.table,rbindlist)
4036
importFrom(data.table,set)
@@ -85,13 +81,10 @@ importFrom(readxl,read_excel)
8581
importFrom(reticulate,import)
8682
importFrom(reticulate,py_run_string)
8783
importFrom(stats,as.formula)
88-
importFrom(stats,mad)
89-
importFrom(stats,median)
9084
importFrom(stats,reorder)
9185
importFrom(stats,setNames)
9286
importFrom(stats,xtabs)
9387
importFrom(utils,data)
9488
importFrom(utils,globalVariables)
9589
importFrom(utils,head)
96-
importFrom(utils,modifyList)
9790
importFrom(utils,read.csv)

R/calculateEpletLoad.R

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,22 +106,27 @@ calculateEpletLoad <- function(recipient_geno,
106106
)
107107
names(eplet_sets) <- all_alleles
108108

109-
# Helper: donor-specific eplet count for one pair
109+
# Helper: donor-specific eplet count for one pair (used for pairwise matrix)
110110
pair_count <- function(rec_a, don_a) {
111111
if (identical(rec_a, don_a)) return(0L)
112112
rec_set <- eplet_sets[[rec_a]]
113113
don_set <- eplet_sets[[don_a]]
114114
length(setdiff(don_set, rec_set))
115115
}
116-
117-
# Helper: total per locus
116+
117+
# Helper: total per locus - uses union of all recipient allele eplets vs union of all donor allele eplets
118118
locus_total <- function(L) {
119119
rL <- r_alleles[grep(paste0("^", L, "_"), names(r_alleles))]
120120
dL <- d_alleles[grep(paste0("^", L, "_"), names(d_alleles))]
121121
if (length(rL) == 0L || length(dL) == 0L) return(0L)
122-
total <- 0L
123-
for (ra in rL) for (da in dL) total <- total + pair_count(ra, da)
124-
total
122+
123+
# Union of all recipient eplets at this locus
124+
rec_union <- unique(unlist(eplet_sets[rL], use.names = FALSE))
125+
# Union of all donor eplets at this locus
126+
don_union <- unique(unlist(eplet_sets[dL], use.names = FALSE))
127+
128+
# Count donor-specific eplets (in donor but not in recipient)
129+
length(setdiff(don_union, rec_union))
125130
}
126131

127132
if (return == "total") {

R/spiDeconvolute.R

Lines changed: 0 additions & 265 deletions
This file was deleted.

0 commit comments

Comments
 (0)