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

griffithlab / pVACtools / 17985264923

24 Sep 2025 05:58PM UTC coverage: 86.06% (-0.1%) from 86.191%
17985264923

push

github

susannasiebert
Update to version 5.5.3

8001 of 9297 relevant lines covered (86.06%)

0.86 hits per line

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

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

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

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

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

41
    @classmethod
1✔
42
    def parser(cls, tool="pvacseq"):
1✔
43
        parser = argparse.ArgumentParser(
1✔
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(
1✔
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(
1✔
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
1✔
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