• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

griffithlab / pVACtools / 18312623902

07 Oct 2025 12:27PM UTC coverage: 82.708% (-0.8%) from 83.548%
18312623902

Pull #1307

github

web-flow
Merge 8e70e466f into 9aa720e9d
Pull Request #1307: Add support for MixMHCpred and PRIME prediction algorithms

181 of 294 new or added lines in 2 files covered. (61.56%)

26 existing lines in 7 files now uncovered.

9011 of 10895 relevant lines covered (82.71%)

2.48 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/pvactools/lib/valid_algorithms.py
1
import sys
3✔
2
import argparse
3✔
3

4
from pvactools.lib.prediction_class import *
3✔
5

6
class ValidAlgorithms:
3✔
7
    def __init__(self, allele, species):
3✔
8
        self.allele = allele
3✔
9
        self.species = species
3✔
10

11
    def print_valid_algorithms(self):
3✔
12
        if self.allele is None:
3✔
13
            valid_algorithms = []
3✔
14
            if self.species is None:
3✔
15
                valid_algorithms = PredictionClass.prediction_methods()
3✔
16
            else:
17
                prediction_algorithms = PredictionClass.prediction_methods()
3✔
18
                for algorithm in prediction_algorithms:
3✔
19
                    cls = globals()[algorithm]
3✔
20
                    alleles = cls().valid_allele_names()
3✔
21
                    for allele in alleles:
3✔
22
                        if cls.species_for_allele(allele) == self.species:
3✔
23
                            valid_algorithms.append(algorithm)
3✔
24
                            break
3✔
25
        else:
26
            PredictionClass.check_alleles_valid([self.allele])
3✔
27
            if (self.species != None and PredictionClass.species_for_allele(self.allele) != self.species):
3✔
28
                raise Exception("Given species does not match given allele.")
3✔
UNCOV
29
                return
30
            valid_algorithms = []
3✔
31
            prediction_algorithms = PredictionClass.prediction_methods()
3✔
32
            for algorithm in prediction_algorithms:
3✔
33
                cls = globals()[algorithm]
3✔
34
                alleles = cls().valid_allele_names()
3✔
35
                if (self.allele in alleles) \
3✔
36
                      and (PredictionClass.species_for_allele(self.allele) == self.species \
37
                           or self.species == None):
38
                    valid_algorithms.append(algorithm)
3✔
39
        print('\n'.join([a for a in valid_algorithms]))
3✔
40

41
    @classmethod
3✔
42
    def parser(cls, tool="pvacseq"):
3✔
43
        parser = argparse.ArgumentParser(
3✔
44
            "%s valid_algorithms" % tool,
45
            description="Show a list of algorithms supported given the specified species and/or allele",
46
            formatter_class=argparse.ArgumentDefaultsHelpFormatter
47
        )
48
        parser.add_argument(
3✔
49
            "-a", "--allele",
50
            help="Show valid algorithms for the selected allele. "
51
                 + "For a list of available alleles, use: `{} valid_alleles`.".format(tool),
52
        )
53
        parser.add_argument(
3✔
54
            "-s", "--species",
55
            choices=sorted(set(list(PredictionClass.allele_to_species_map().values())), key=str.casefold),
56
            help="Show valid algorithms for the selected species only",
57
        )
58
        return parser
3✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc