Skip to content

Commit

Permalink
modified code to work when using standalone iedb
Browse files Browse the repository at this point in the history
  • Loading branch information
ldhtnp committed Jan 23, 2025
1 parent 355d67f commit 3aeb360
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pvactools/lib/netmhc_pan_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


class NetMHCPanVersion:
valid_versions = ["4.3", "4.2", "4.1", "4.0"]
valid_versions = ["4.3", "4.2", "4.1", "4.0 (Not supported by standalone IEDB)"]

def __init__(self, list):
self.list = list
Expand Down
5 changes: 4 additions & 1 deletion pvactools/lib/output_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,10 @@ def get_scores(self, line, method):
elif method.lower() == 'netmhcpan_el':
return {'score': float(line['score'])}
elif 'netmhciipan_el' in method.lower():
return {'score': float(line['score'])}
try:
return {'score': float(line['score'])}
except:
return {'ic50': float(line['ic50'])}
else:
return {'ic50': float(line['ic50'])}

Expand Down
10 changes: 5 additions & 5 deletions pvactools/lib/prediction_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ def parse_iedb_allele_file(self):
#Ultimately we probably want this method to call out to IEDB but their command is currently broken
#curl --data "method=ann&species=human" http://tools-api.iedb.org/tools_api/mhci/
file_name = next(
(name for name in ["NetMHCIIpan", "netmhciipan_el"] if name in self.iedb_prediction_method),
(name for name in ["netmhciipan", "netmhciipan_el"] if name in self.iedb_prediction_method),
self.iedb_prediction_method
)
base_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), '..'))
Expand Down Expand Up @@ -685,14 +685,14 @@ class NetMHCIIVersion:
class NetMHCIIpan(IEDBMHCII):
@property
def iedb_prediction_method(self):
if NetMHCIIVersion.netmhcii_pan_version:
return 'NetMHCIIpan-' + NetMHCIIVersion.netmhcii_pan_version
return 'NetMHCIIpan'
if NetMHCIIVersion.netmhcii_pan_version in ['4.0', '4.2', '4.3']:
return 'netmhciipan_ba-' + NetMHCIIVersion.netmhcii_pan_version
return 'netmhciipan_ba'

class NetMHCIIpanEL(IEDBMHCII):
@property
def iedb_prediction_method(self):
if NetMHCIIVersion.netmhcii_pan_version:
if NetMHCIIVersion.netmhcii_pan_version in ['4.0', '4.2', '4.3']:
return 'netmhciipan_el-' + NetMHCIIVersion.netmhcii_pan_version
return 'netmhciipan_el'

Expand Down
5 changes: 4 additions & 1 deletion pvactools/tools/pvacseq/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,13 @@ def main(args_input = sys.argv[1:]):
input_file_type = 'vcf'
base_output_dir = os.path.abspath(args.output_dir)

if (args.netmhc_pan_version == '4.0' and args.iedb_install_directory is not None):
raise Exception("Standalone IEDB does not support version 4.0")

if (args.netmhc_pan_version and ("NetMHCIIpan" in args.prediction_algorithms or "NetMHCIIpanEL" in args.prediction_algorithms)):
NetMHCIIVersion.netmhcii_pan_version = args.netmhc_pan_version
elif (args.netmhc_pan_version and not ("NetMHCIIpan" in args.prediction_algorithms or "NetMHCIIpanEL" in args.prediction_algorithms or "all_class_ii" in args.prediction_algorithms)):
raise Exception("NetMHCIIpan and NetMHCIIpanEL version was specified but neither algorithm was selected.")
raise Exception("NetMHCIIpan and NetMHCIIpanEL version was specified but neither algorithm was selected")

(class_i_prediction_algorithms, class_ii_prediction_algorithms) = split_algorithms(args.prediction_algorithms)
alleles = combine_class_ii_alleles(args.allele)
Expand Down

0 comments on commit 3aeb360

Please sign in to comment.