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

griffithlab / pVACtools / 14359242059

09 Apr 2025 02:05PM UTC coverage: 83.207% (-0.08%) from 83.282%
14359242059

Pull #1229

github

web-flow
Merge a88fe5c10 into 942c86ca7
Pull Request #1229: Add functionality to add gene of interest identification

76 of 79 new or added lines in 9 files covered. (96.2%)

4 existing lines in 4 files now uncovered.

7576 of 9105 relevant lines covered (83.21%)

4.15 hits per line

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

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

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

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

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

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