Skip to content

Commit

Permalink
Incorporate feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasscheid committed Jun 28, 2022
1 parent 32e7782 commit 5d95289
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
14 changes: 7 additions & 7 deletions bin/epaa.py
Original file line number Diff line number Diff line change
Expand Up @@ -708,12 +708,12 @@ def create_affinity_values(allele, length, j, method, max_scores, allele_strings
return np.nan


def create_binder_values(pred_score, method, thresholds):
if not pd.isnull(pred_score):
def create_binder_values(pred_value, method, thresholds):
if not pd.isnull(pred_value):
if 'syf' in method:
return True if pred_score > thresholds[method] else False
return True if pred_value > thresholds[method] else False
else:
return True if pred_score <= thresholds[method.lower()] else False
return True if pred_value <= thresholds[method.lower()] else False
else:
return np.nan

Expand Down Expand Up @@ -962,7 +962,7 @@ def __main__():
parser.add_argument('-ml', "--min_length", help="Minimum peptide length")
parser.add_argument('-t', "--tools", help="Tools used for peptide predictions", required=True, type=str)
parser.add_argument('-tt', "--tool_thresholds", help="Customize thresholds of given tools using a json file", required=False, type=str)
parser.add_argument('-at', "--affinity_thresholds", help="Use affinity instead of rank for thresholding", required=False, action='store_true')
parser.add_argument('-at', "--use_affinity_thresholds", help="Use affinity instead of rank for thresholding", required=False, action='store_true')
parser.add_argument('-sv', "--versions", help="File containing parsed software version numbers.", required=True)
parser.add_argument('-a', "--alleles", help="<Required> MHC Alleles", required=True, type=str)
parser.add_argument('-r', "--reference", help="Reference, retrieved information will be based on this ensembl version", required=False, default='GRCh37', choices=['GRCh37', 'GRCh38'])
Expand Down Expand Up @@ -1034,9 +1034,9 @@ def __main__():
if version not in EpitopePredictorFactory.available_methods()[method]:
raise ValueError("The specified version " + version + " for " + method + " is not supported by epytope.")

thresholds = {"syfpeithi":60, "mhcflurry":500, "mhcnuggets-class-1":500, "mhcnuggets-class-2":500, "netmhc":500, "netmhcpan":500, "netmhcii":500, "netmhciipan":500}
thresholds = {"syfpeithi":50, "mhcflurry":500, "mhcnuggets-class-1":500, "mhcnuggets-class-2":500, "netmhc":500, "netmhcpan":500, "netmhcii":500, "netmhciipan":500}
# Define binders based on the rank metric for netmhc family tools
# NOTE these recommendet thresholds might change in the future with new versions of the tools
# NOTE these recommended thresholds might change in the future with new versions of the tools
if "netmhc" in ''.join(methods.keys()) and not args.affinity_thresholds:
thresholds.update({"netmhc":2, "netmhcpan":2, "netmhcii":10, "netmhciipan":5})

Expand Down
4 changes: 2 additions & 2 deletions modules/local/epytope_peptide_prediction.nf
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ process EPYTOPE_PEPTIDE_PREDICTION {
argument = "--tool_thresholds ${params.tool_thresholds} " + argument
}

if (params.affinity_thresholds) {
argument = "--affinity_thresholds " + argument
if (params.use_affinity_thresholds) {
argument = "--use_affinity_thresholds " + argument
}

def netmhc_paths_string = netmhc_paths.join(",")
Expand Down
2 changes: 1 addition & 1 deletion nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ params {
mhc_class = 1
tools = 'syfpeithi'
tool_thresholds = null
affinity_thresholds = false
use_affinity_thresholds = false

// Options: Filtering
filter_self = false
Expand Down
6 changes: 3 additions & 3 deletions nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,13 @@
"tool_thresholds": {
"type": "string",
"description": "Specifies tool-specific binder thresholds in a JSON file. This can be used to override the given default binder threshold values.",
"help_text": "Default thresholds to determine whether a peptide is considered as a binder are the following: `syfpeithi` > 60, `mhcflurry` <=500, `mhcnuggets-class-1` <= 500, `mhcnuggets-class-2` <= 500, `netmhc` <= 2, `netmhcpan` <= 2, `netmhcii` <= 5, `netmhciipan` <= 5. Note that the default threshold for NetMHC tools is based on the rank metric. The remaining predictors thresholds are based on affinities. Thresholds can be customized in a JSON file: `tool-name:value`"
"help_text": "Default thresholds to determine whether a peptide is considered as a binder are the following: `syfpeithi` > 50, `mhcflurry` <=500, `mhcnuggets-class-1` <= 500, `mhcnuggets-class-2` <= 500, `netmhc` <= 2, `netmhcpan` <= 2, `netmhcii` <= 5, `netmhciipan` <= 5. Note that the default threshold for NetMHC tools is based on the rank metric. The remaining predictors thresholds are based on affinities. Thresholds can be customized in a JSON file: `tool-name:value`"
},
"affinity_thresholds": {
"use_affinity_thresholds": {
"type": "boolean",
"default": false,
"description": "Specifies the affinity metric instead of the rank metric used for determining whether a peptide is considered as a binder.",
"help_text": "Default affinity thresholds to determine whether a peptide is considered as a binder are the following:: `syfpeithi` > 60, `mhcflurry` <=500, `mhcnuggets-class-1` <= 500, `mhcnuggets-class-2` <= 500, `netmhc` <= 500, `netmhcpan` <= 500, `netmhcii` <= 500, `netmhciipan` <= 500."
"help_text": "Switches the prediction metric of netMHC tools from rank to affinity. Default: `netmhc` <= 500, `netmhcpan` <= 500, `netmhcii` <= 500, `netmhciipan` <= 500."
},
"wild_type": {
"type": "boolean",
Expand Down

0 comments on commit 5d95289

Please sign in to comment.