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

griffithlab / pVACtools / 25574809381

08 May 2026 07:18PM UTC coverage: 82.6%. First build
25574809381

Pull #1394

github

web-flow
Merge 8db918657 into 73b4fbbd1
Pull Request #1394: Various code cleanup

110 of 118 new or added lines in 7 files covered. (93.22%)

9518 of 11523 relevant lines covered (82.6%)

2.48 hits per line

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

94.44
/pvactools/tools/valid_algorithms.py
1
import sys
3✔
2
import argparse
3✔
3

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

6
def define_parser():
3✔
7
    parser = argparse.ArgumentParser(
3✔
8
        "pvactools valid_algorithms",
9
        description="Show a list of algorithms supported given the specified species and/or allele",
10
        formatter_class=argparse.ArgumentDefaultsHelpFormatter
11
    )
12
    parser.add_argument(
3✔
13
        "-a", "--allele",
14
        help="Show valid algorithms for the selected allele. "
15
             + "For a list of available alleles, use: `pvactools valid_alleles`.",
16
    )
17
    parser.add_argument(
3✔
18
        "-s", "--species",
19
        choices=sorted(set(list(PredictionClass.allele_to_species_map().values())), key=str.casefold),
20
        help="Show valid algorithms for the selected species only",
21
    )
22
    return parser
3✔
23

24
def main(args_input = sys.argv[1:]):
3✔
25
    parser = define_parser()
3✔
26
    args = parser.parse_args(args_input)
3✔
27

28
    if args.allele is None:
3✔
29
        valid_algorithms = []
3✔
30
        if args.species is None:
3✔
NEW
31
            valid_algorithms = PredictionClass.prediction_methods()
×
32
        else:
33
            prediction_algorithms = PredictionClass.prediction_methods()
3✔
34
            for algorithm in prediction_algorithms:
3✔
35
                cls = globals()[algorithm]
3✔
36
                alleles = cls().valid_allele_names()
3✔
37
                for allele in alleles:
3✔
38
                    if cls.species_for_allele(allele) == args.species:
3✔
39
                        valid_algorithms.append(algorithm)
3✔
40
                        break
3✔
41
    else:
42
        PredictionClass.check_alleles_valid([args.allele])
3✔
43
        if (args.species != None and PredictionClass.species_for_allele(args.allele) != args.species):
3✔
44
            raise Exception("Given species does not match given allele.")
3✔
NEW
45
            return
46
        valid_algorithms = []
3✔
47
        prediction_algorithms = PredictionClass.prediction_methods()
3✔
48
        for algorithm in prediction_algorithms:
3✔
49
            cls = globals()[algorithm]
3✔
50
            alleles = cls().valid_allele_names()
3✔
51
            if (args.allele in alleles) \
3✔
52
                  and (PredictionClass.species_for_allele(args.allele) == args.species \
53
                       or args.species == None):
54
                valid_algorithms.append(algorithm)
3✔
55
    print('\n'.join([a for a in valid_algorithms]))
3✔
56

57
if __name__ == "__main__":
3✔
NEW
58
    main()
×
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