Skip to content

NetMHCpan / NetMHCstabpan: add row-wise paired (peptide, allele) prediction (generalize #257 to command-line predictors) #259

Description

@iskandr

#257 gave BigMHC a row-wise predict_pairs(peptides, alleles) / predict_pairs_dataframe. The command-line pan-allele predictors (NetMHCpan, NetMHCstabpan, and their BaseCommandlinePredictor siblings) still only take a fixed allele set in the constructor and score peptide × allele — there is no way to score row-wise (peptide[i], allele[i]) pairs.

For paired data — each peptide carries its own allele (neoantigen / patient-genotype scoring) — every caller writes the same grouping loop:

scores = {}
for allele, rows in df.groupby("allele"):
    predictor = NetMHCpan(alleles=[allele])
    result = predictor.predict_peptides_dataframe(rows.peptide.unique())
    for _, r in result.iterrows():
        scores[(r.peptide, allele)] = r.score

Request

Add predict_pairs(peptides, alleles) and predict_pairs_dataframe(...) to the command-line predictors (ideally on BaseCommandlinePredictor, so every pan-allele tool gets it), matching BigMHC's signature from #257. It would group by allele internally, run the binary once per allele, and return one row per pair in input order. Alleles a tool cannot parse could be surfaced the way predict_peptides already handles UnsupportedAllele, rather than each caller reinventing skip-vs-fail.

This is the generalization noted in #254 — the same row-wise gap, for the command-line side.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions