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

griffithlab / pVACtools / 10491680472

21 Aug 2024 02:20PM UTC coverage: 82.75% (-0.3%) from 83.028%
10491680472

push

github

susannasiebert
Merge remote-tracking branch 'origin/staging'

140 of 215 new or added lines in 17 files covered. (65.12%)

1 existing line in 1 file now uncovered.

6145 of 7426 relevant lines covered (82.75%)

4.13 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:
NEW
17
                prediction_algorithms = PredictionClass.prediction_methods()
×
NEW
18
                for algorithm in prediction_algorithms:
×
NEW
19
                    cls = globals()[algorithm]
×
NEW
20
                    alleles = cls().valid_allele_names()
×
NEW
21
                    for allele in alleles:
×
NEW
22
                        if cls.species_for_allele(allele) == self.species:
×
NEW
23
                            valid_algorithms.append(algorithm)
×
NEW
24
                            break
×
25
        else:
NEW
26
            PredictionClass.check_alleles_valid([self.allele])
×
NEW
27
            if (self.species != None and PredictionClass.species_for_allele(self.allele) != self.species):
×
NEW
28
                raise Exception("Given species does not match given allele.")
×
29
                return
NEW
30
            valid_algorithms = []
×
NEW
31
            prediction_algorithms = PredictionClass.prediction_methods()
×
NEW
32
            for algorithm in prediction_algorithms:
×
NEW
33
                cls = globals()[algorithm]
×
NEW
34
                alleles = cls().valid_allele_names()
×
NEW
35
                if (self.allele in alleles) \
×
36
                      and (PredictionClass.species_for_allele(self.allele) == self.species \
37
                           or self.species == None):
NEW
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