diff --git a/docs/pvacbind/features.rst b/docs/pvacbind/features.rst index eba3341ce..56323155f 100644 --- a/docs/pvacbind/features.rst +++ b/docs/pvacbind/features.rst @@ -46,7 +46,11 @@ and immunogenicity algorithms. By using the IEDB RESTful web interface, pVACbind leverages their extensive support of different prediction algorithms. In addition to IEDB-supported prediction algorithms, we've also added support -for a variety of additional algorithms. +for a variety of additional algorithms. The following table lists all prediction algorithms supported +by pVACbind, whether the predictor is a MHC class I or class II algorithm, what type of scoring +the predictor returns (binding, presentation, or immunogenicity), whether the algorithm supports +percentile ranks natively, whether the predictor supports normalized percentile ranks (``--use-normalized-percentiles +flag), and whether the ``select`` algorithm shortcut includes this predictor. .. list-table:: :header-rows: 1 @@ -57,138 +61,161 @@ for a variety of additional algorithms. - Prediction Type - Supports Percentile Ranks? - Supports Normalized Percentile Ranks? + - Included On "select" Strategy? * - BigMHC_EL - - MHC Class I - Presentation - no - yes + - yes * - BigMHC_IM - - MHC Class I - Immunogenicity - no - yes + - yes * - DeepImmuno - - MHC Class I - Immunogenicity - no - yes - * - ImmuoScope_IM + - yes + * - ImmuScope_IM - - MHC Class II - Immunogenicity - no - no + - yes * - MHCflurry - - MHC Class I - Binding - yes - yes + - yes * - MHCflurryEL - - MHC Class I - Presentation, Processing - yes (Presentation only) - yes (Presentation and Processing) + - yes (Presentation and Processing) * - MHCnuggetsI - - MHC Class I - Binding - yes - yes + - no * - MHCnuggetsII - - MHC Class II - Binding - yes - no + - yes * - MixMHC2pred - - MHC Class II - Presentation - yes - no + - yes * - MixMHCpred - - MHC Class I - Binding - yes - yes + - yes * - NNalign - 2.3 - MHC Class II - Binding - yes - no + - no * - NetMHC - 4.0 - MHC Class I - Binding - yes - yes + - no * - NetMHCIIpan - 4.0 (not supported by standalone IEDB), 4.1 (default), 4.2., 4.3 - MHC Class II - Binding - yes - no + - yes * - NetMHCIIpanEL - 4.0 (not supported by standalone IEDB), 4.1 (default), 4.2., 4.3 - MHC Class II - Presentation - yes - no + - yes * - NetMHCcons - 1.1 - MHC Class I - Binding - yes - yes + - no * - NetMHCpan - 4.1 - MHC Class I - Binding - yes - yes + - yes * - NetMHCpanEL - 4.1 - MHC Class I - Presentation - yes - yes + - yes * - PRIME - - MHC Class I - Immunogenicity - yes - yes - * - Pickpocket + - yes + * - PickPocket - 1.1 - MHC Class I - Binding - yes - yes + - yes * - SMM - 1.0 - MHC Class I - Binding - yes - yes + - no * - SMMPMBEC - 1.0 - MHC Class I - Binding - yes - yes + - yes * - SMMalign - 1.1 - MHC Class II - Binding - yes - no + - yes **Calculation of normalized percentiles** diff --git a/docs/pvacfuse/features.rst b/docs/pvacfuse/features.rst index a8aef3dd7..d8c987040 100644 --- a/docs/pvacfuse/features.rst +++ b/docs/pvacfuse/features.rst @@ -46,7 +46,11 @@ and immunogenicity algorithms. By using the IEDB RESTful web interface, pVACfuse leverages their extensive support of different prediction algorithms. In addition to IEDB-supported prediction algorithms, we've also added support -for a variety of additional algorithms. +for a variety of additional algorithms. The following table lists all algorithms supported +by pVACfuse, whether the algorithm is a MHC class I or class II algorithm, what type of scoring +the algorithm returns (binding, presentation, or immunogenicity), whether it supports +percentile ranks natively, supports normalized percentile ranks (``--use-normalized-percentiles`` +flag), and whether the ``select`` algorithm shortcut includes this algorithm. .. list-table:: :header-rows: 1 @@ -57,138 +61,161 @@ for a variety of additional algorithms. - Prediction Type - Supports Percentile Ranks? - Supports Normalized Percentile Ranks? + - Included On "select" Strategy? * - BigMHC_EL - - MHC Class I - Presentation - no - yes + - yes * - BigMHC_IM - - MHC Class I - Immunogenicity - no - yes + - yes * - DeepImmuno - - MHC Class I - Immunogenicity - no - yes - * - ImmuoScope_IM + - yes + * - ImmuScope_IM - - MHC Class II - Immunogenicity - no - no + - yes * - MHCflurry - - MHC Class I - Binding - yes - yes + - yes * - MHCflurryEL - - MHC Class I - Presentation, Processing - yes (Presentation only) - yes (Presentation and Processing) + - yes (Presentation and Processing) * - MHCnuggetsI - - MHC Class I - Binding - yes - yes + - no * - MHCnuggetsII - - MHC Class II - Binding - yes - no + - yes * - MixMHC2pred - - MHC Class II - Presentation - yes - no + - yes * - MixMHCpred - - MHC Class I - Binding - yes - yes + - yes * - NNalign - 2.3 - MHC Class II - Binding - yes - no + - no * - NetMHC - 4.0 - MHC Class I - Binding - yes - yes + - no * - NetMHCIIpan - 4.0 (not supported by standalone IEDB), 4.1 (default), 4.2., 4.3 - MHC Class II - Binding - yes - no + - yes * - NetMHCIIpanEL - 4.0 (not supported by standalone IEDB), 4.1 (default), 4.2., 4.3 - MHC Class II - Presentation - yes - no + - yes * - NetMHCcons - 1.1 - MHC Class I - Binding - yes - yes + - no * - NetMHCpan - 4.1 - MHC Class I - Binding - yes - yes + - yes * - NetMHCpanEL - 4.1 - MHC Class I - Presentation - yes - yes + - yes * - PRIME - - MHC Class I - Immunogenicity - yes - yes - * - Pickpocket + - yes + * - PickPocket - 1.1 - MHC Class I - Binding - yes - yes + - yes * - SMM - 1.0 - MHC Class I - Binding - yes - yes + - no * - SMMPMBEC - 1.0 - MHC Class I - Binding - yes - yes + - yes * - SMMalign - 1.1 - MHC Class II - Binding - yes - no + - yes **Calculation of normalized percentiles** diff --git a/docs/pvacseq/features.rst b/docs/pvacseq/features.rst index 354bd3b1d..06e6e5f47 100644 --- a/docs/pvacseq/features.rst +++ b/docs/pvacseq/features.rst @@ -50,7 +50,11 @@ and immunogenicity algorithms. By using the IEDB RESTful web interface, pVACseq leverages their extensive support of different prediction algorithms. In addition to IEDB-supported prediction algorithms, we've also added support -for a variety of additional algorithms. +for a variety of additional algorithms. The following table lists all algorithms supported +by pVACseq, whether the algorithm is a MHC class I or class II algorithm, what type of scoring +the algorithm returns (binding, presentation, or immunogenicity), whether it supports +percentile ranks natively, supports normalized percentile ranks (``--use-normalized-percentiles`` +flag), and whether the ``select`` algorithm shortcut includes this algorithm. .. list-table:: :header-rows: 1 @@ -61,138 +65,161 @@ for a variety of additional algorithms. - Prediction Type - Supports Percentile Ranks? - Supports Normalized Percentile Ranks? + - Included On "select" Strategy? * - BigMHC_EL - - MHC Class I - Presentation - no - yes + - yes * - BigMHC_IM - - MHC Class I - Immunogenicity - no - yes + - yes * - DeepImmuno - - MHC Class I - Immunogenicity - no - yes - * - ImmuoScope_IM + - yes + * - ImmuScope_IM - - MHC Class II - Immunogenicity - no - no + - yes * - MHCflurry - - MHC Class I - Binding - yes - yes + - yes * - MHCflurryEL - - MHC Class I - Presentation, Processing - yes (Presentation only) - yes (Presentation and Processing) + - yes (Presentation and Processing) * - MHCnuggetsI - - MHC Class I - Binding - yes - yes + - no * - MHCnuggetsII - - MHC Class II - Binding - yes - no + - yes * - MixMHC2pred - - MHC Class II - Presentation - yes - no + - yes * - MixMHCpred - - MHC Class I - Binding - yes - yes + - yes * - NNalign - 2.3 - MHC Class II - Binding - yes - no + - no * - NetMHC - 4.0 - MHC Class I - Binding - yes - yes + - no * - NetMHCIIpan - 4.0 (not supported by standalone IEDB), 4.1 (default), 4.2., 4.3 - MHC Class II - Binding - yes - no + - yes * - NetMHCIIpanEL - 4.0 (not supported by standalone IEDB), 4.1 (default), 4.2., 4.3 - MHC Class II - Presentation - yes - no + - yes * - NetMHCcons - 1.1 - MHC Class I - Binding - yes - yes + - no * - NetMHCpan - 4.1 - MHC Class I - Binding - yes - yes + - yes * - NetMHCpanEL - 4.1 - MHC Class I - Presentation - yes - yes + - yes * - PRIME - - MHC Class I - Immunogenicity - yes - yes - * - Pickpocket + - yes + * - PickPocket - 1.1 - MHC Class I - Binding - yes - yes + - yes * - SMM - 1.0 - MHC Class I - Binding - yes - yes + - no * - SMMPMBEC - 1.0 - MHC Class I - Binding - yes - yes + - yes * - SMMalign - 1.1 - MHC Class II - Binding - yes - no + - yes **Calculation of normalized percentiles** diff --git a/docs/pvacsplice/features.rst b/docs/pvacsplice/features.rst index 03bac3e80..c721c24de 100644 --- a/docs/pvacsplice/features.rst +++ b/docs/pvacsplice/features.rst @@ -48,7 +48,11 @@ and immunogenicity algorithms. By using the IEDB RESTful web interface, pVACsplice leverages their extensive support of different prediction algorithms. In addition to IEDB-supported prediction algorithms, we've also added support -for a variety of additional algorithms. +for a variety of additional algorithms. The following table lists all algorithms supported +by pVACsplice, whether the algorithm is a MHC class I or class II algorithm, what type of scoring +the algorithm returns (binding, presentation, or immunogenicity), whether it supports +percentile ranks natively, supports normalized percentile ranks (``--use-normalized-percentiles`` +flag), and whether the ``select`` algorithm shortcut includes this algorithm. .. list-table:: :header-rows: 1 @@ -59,138 +63,161 @@ for a variety of additional algorithms. - Prediction Type - Supports Percentile Ranks? - Supports Normalized Percentile Ranks? + - Included On "select" Strategy? * - BigMHC_EL - - MHC Class I - Presentation - no - yes + - yes * - BigMHC_IM - - MHC Class I - Immunogenicity - no - yes + - yes * - DeepImmuno - - MHC Class I - Immunogenicity - no - yes - * - ImmuoScope_IM + - yes + * - ImmuScope_IM - - MHC Class II - Immunogenicity - no - no + - yes * - MHCflurry - - MHC Class I - Binding - yes - yes + - yes * - MHCflurryEL - - MHC Class I - Presentation, Processing - yes (Presentation only) - yes (Presentation and Processing) + - yes (Presentation and Processing) * - MHCnuggetsI - - MHC Class I - Binding - yes - yes + - no * - MHCnuggetsII - - MHC Class II - Binding - yes - no + - yes * - MixMHC2pred - - MHC Class II - Presentation - yes - no + - yes * - MixMHCpred - - MHC Class I - Binding - yes - yes + - yes * - NNalign - 2.3 - MHC Class II - Binding - yes - no + - no * - NetMHC - 4.0 - MHC Class I - Binding - yes - yes + - no * - NetMHCIIpan - 4.0 (not supported by standalone IEDB), 4.1 (default), 4.2., 4.3 - MHC Class II - Binding - yes - no + - yes * - NetMHCIIpanEL - 4.0 (not supported by standalone IEDB), 4.1 (default), 4.2., 4.3 - MHC Class II - Presentation - yes - no + - yes * - NetMHCcons - 1.1 - MHC Class I - Binding - yes - yes + - no * - NetMHCpan - 4.1 - MHC Class I - Binding - yes - yes + - yes * - NetMHCpanEL - 4.1 - MHC Class I - Presentation - yes - yes + - yes * - PRIME - - MHC Class I - Immunogenicity - yes - yes - * - Pickpocket + - yes + * - PickPocket - 1.1 - MHC Class I - Binding - yes - yes + - yes * - SMM - 1.0 - MHC Class I - Binding - yes - yes + - no * - SMMPMBEC - 1.0 - MHC Class I - Binding - yes - yes + - yes * - SMMalign - 1.1 - MHC Class II - Binding - yes - no + - yes **Calculation of normalized percentiles** diff --git a/pvactools/lib/prediction_class.py b/pvactools/lib/prediction_class.py index 95a6bff1a..70a007b15 100644 --- a/pvactools/lib/prediction_class.py +++ b/pvactools/lib/prediction_class.py @@ -190,9 +190,9 @@ def prediction_methods(cls): return sorted([prediction_class.__name__ for prediction_class in cls.prediction_classes()]) @classmethod - def prediction_methods_with_all(cls): + def prediction_methods_with_shortcuts(cls): methods = cls.prediction_methods() - methods.extend(['all', 'all_class_i', 'all_class_ii']) + methods.extend(['all', 'all_class_i', 'all_class_ii', 'select', 'select_class_i', 'select_class_ii']) return methods @classmethod @@ -355,6 +355,10 @@ class MHCI(PredictionClass, metaclass=ABCMeta): def needs_epitope_length(self): return True + @classmethod + def select_prediction_methods(cls): + return ["BigMHC_EL", "BigMHC_IM", "DeepImmuno", "MHCflurry", "MHCflurryEL", "MixMHCpred", "NetMHCpan", "NetMHCpanEL", "PRIME", "PickPocket", "SMMPMBEC"] + class DeepImmuno(MHCI): def valid_allele_names(self): base_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), '..')) @@ -890,6 +894,10 @@ class MHCII(PredictionClass, metaclass=ABCMeta): def needs_epitope_length(self): return False + @classmethod + def select_prediction_methods(cls): + return ["ImmuScope_IM", "MHCnuggetsII", "MixMHC2pred", "NetMHCIIpan", "NetMHCIIpanEL", "SMMalign"] + class MHCnuggetsII(MHCII, MHCnuggets): def valid_allele_names(self): return self.valid_allele_names_for_class('class_ii') diff --git a/pvactools/lib/prediction_class_utils.py b/pvactools/lib/prediction_class_utils.py index fc06ea757..04383b564 100644 --- a/pvactools/lib/prediction_class_utils.py +++ b/pvactools/lib/prediction_class_utils.py @@ -5,14 +5,25 @@ def split_algorithms(prediction_algorithms): if 'all' in prediction_algorithms: return (sorted(MHCI.prediction_methods()), sorted(MHCII.prediction_methods())) + class_i_prediction_algorithms = set() class_ii_prediction_algorithms = set() + if 'select' in prediction_algorithms: + class_i_prediction_algorithms.update(MHCI.select_prediction_methods()) + class_ii_prediction_algorithms.update(MHCII.select_prediction_methods()) if 'all_class_i' in prediction_algorithms: - class_i_prediction_algorithms = set(MHCI.prediction_methods()) - prediction_algorithms.remove('all_class_i') + class_i_prediction_algorithms.update(MHCI.prediction_methods()) + if 'select_class_i' in prediction_algorithms: + class_i_prediction_algorithms.update(MHCI.select_prediction_methods()) if 'all_class_ii' in prediction_algorithms: - class_ii_prediction_algorithms = set(MHCII.prediction_methods()) - prediction_algorithms.remove('all_class_ii') + class_ii_prediction_algorithms.update(MHCII.prediction_methods()) + if 'select_class_ii' in prediction_algorithms: + class_ii_prediction_algorithms.update(MHCII.select_prediction_methods()) + + for shortcut in ['select', 'select_class_i', 'select_class_ii', 'all_class_i', 'all_class_ii']: + if shortcut in prediction_algorithms: + prediction_algorithms.remove(shortcut) + for prediction_algorithm in prediction_algorithms: prediction_class = globals()[prediction_algorithm] prediction_class_object = prediction_class() diff --git a/pvactools/lib/run_argument_parser.py b/pvactools/lib/run_argument_parser.py index 759adde81..663eac258 100644 --- a/pvactools/lib/run_argument_parser.py +++ b/pvactools/lib/run_argument_parser.py @@ -33,7 +33,7 @@ def __init__(self, tool_name, input_file_help): ) parser.add_argument( "prediction_algorithms", - choices=PredictionClass.prediction_methods_with_all(), + choices=PredictionClass.prediction_methods_with_shortcuts(), nargs="+", help="The epitope prediction algorithms to use. Multiple prediction algorithms can be specified, separated by spaces.", ) diff --git a/tests/test_run_utils.py b/tests/test_run_utils.py index 7a239915f..39a73d2fa 100644 --- a/tests/test_run_utils.py +++ b/tests/test_run_utils.py @@ -21,6 +21,65 @@ def setUpClass(cls): def test_module_compiles(self): self.assertTrue(py_compile.compile(self.utils_path)) + def test_split_algorithms(self): + #individual shortcuts + self.assertEqual( + split_algorithms(["all"]), + (['BigMHC_EL', 'BigMHC_IM', 'DeepImmuno', 'MHCflurry', 'MHCflurryEL', 'MHCnuggetsI', 'MixMHCpred', 'NetMHC', 'NetMHCcons', 'NetMHCpan', 'NetMHCpanEL', 'PRIME', 'PickPocket', 'SMM', 'SMMPMBEC', 'TLBind', 'TLImm'], ['ImmuScope_IM', 'MHCnuggetsII', 'MixMHC2pred', 'NNalign', 'NetMHCIIpan', 'NetMHCIIpanEL', 'SMMalign']) + ) + self.assertEqual( + split_algorithms(["all_class_i"]), + (['BigMHC_EL', 'BigMHC_IM', 'DeepImmuno', 'MHCflurry', 'MHCflurryEL', 'MHCnuggetsI', 'MixMHCpred', 'NetMHC', 'NetMHCcons', 'NetMHCpan', 'NetMHCpanEL', 'PRIME', 'PickPocket', 'SMM', 'SMMPMBEC', 'TLBind', 'TLImm'], []) + ) + self.assertEqual( + split_algorithms(["all_class_ii"]), + ([], ['ImmuScope_IM', 'MHCnuggetsII', 'MixMHC2pred', 'NNalign', 'NetMHCIIpan', 'NetMHCIIpanEL', 'SMMalign']) + ) + self.assertEqual( + split_algorithms(["select"]), + (['BigMHC_EL', 'BigMHC_IM', 'DeepImmuno', 'MHCflurry', 'MHCflurryEL', 'MixMHCpred', 'NetMHCpan', 'NetMHCpanEL', 'PRIME', 'PickPocket', 'SMMPMBEC'], ['ImmuScope_IM', 'MHCnuggetsII', 'MixMHC2pred', 'NetMHCIIpan', 'NetMHCIIpanEL', 'SMMalign']) + ) + self.assertEqual( + split_algorithms(["select_class_i"]), + (['BigMHC_EL', 'BigMHC_IM', 'DeepImmuno', 'MHCflurry', 'MHCflurryEL', 'MixMHCpred', 'NetMHCpan', 'NetMHCpanEL', 'PRIME', 'PickPocket', 'SMMPMBEC'], []) + ) + self.assertEqual( + split_algorithms(["select_class_ii"]), + ([], ['ImmuScope_IM', 'MHCnuggetsII', 'MixMHC2pred', 'NetMHCIIpan', 'NetMHCIIpanEL', 'SMMalign']) + ) + + #Combining all and select gives you all + self.assertEqual( + split_algorithms(["all", "select"]), + split_algorithms(["all"]) + ) + self.assertEqual( + split_algorithms(["all_class_i", "select_class_i"]), + split_algorithms(["all_class_i"]) + ) + self.assertEqual( + split_algorithms(["all_class_ii", "select_class_ii"]), + split_algorithms(["all_class_ii"]) + ) + + #Combining shortcuts with individual algorithms gives you the superset + self.assertEqual( + split_algorithms(["all_class_i", "NNalign"]), + (['BigMHC_EL', 'BigMHC_IM', 'DeepImmuno', 'MHCflurry', 'MHCflurryEL', 'MHCnuggetsI', 'MixMHCpred', 'NetMHC', 'NetMHCcons', 'NetMHCpan', 'NetMHCpanEL', 'PRIME', 'PickPocket', 'SMM', 'SMMPMBEC', 'TLBind', 'TLImm'], ['NNalign']) + ) + self.assertEqual( + split_algorithms(["all_class_ii", "NetMHC"]), + (['NetMHC'], ['ImmuScope_IM', 'MHCnuggetsII', 'MixMHC2pred', 'NNalign', 'NetMHCIIpan', 'NetMHCIIpanEL', 'SMMalign']) + ) + self.assertEqual( + split_algorithms(["select_class_i", "NetMHC"]), + (['BigMHC_EL', 'BigMHC_IM', 'DeepImmuno', 'MHCflurry', 'MHCflurryEL', 'MixMHCpred', 'NetMHC', 'NetMHCpan', 'NetMHCpanEL', 'PRIME', 'PickPocket', 'SMMPMBEC'], []) + ) + self.assertEqual( + split_algorithms(["select_class_ii", "NNalign"]), + ([], ['ImmuScope_IM', 'MHCnuggetsII', 'MixMHC2pred', 'NNalign', 'NetMHCIIpan', 'NetMHCIIpanEL', 'SMMalign']) + ) + def test_combine_class_ii_alleles(self): self.assertEqual( sorted(combine_class_ii_alleles(["DQA1*06:02", "DQB1*06:43", "DQB1*06:44"])),