Skip to content

Commit adf9279

Browse files
authored
Merge pull request #144 from lazear/patch-2
Check to see if key is present *and* values are set
2 parents 15365bf + b1223cf commit adf9279

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

sdrf_pipelines/maxquant/maxquant.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -1225,7 +1225,7 @@ def maxquant_convert(
12251225
root.appendChild(secondPeptide)
12261226

12271227
matchBetweenRuns_node = doc.createElement("matchBetweenRuns")
1228-
if "enable_match_between_runs" in file2params:
1228+
if "enable_match_between_runs" in file2params and len(file2params["enable_match_between_runs"]) > 0:
12291229
first = list(file2params["enable_match_between_runs"].values())[0]
12301230
matchBetweenRuns = True
12311231
matchBetweenRuns_node.appendChild(doc.createTextNode(first))
@@ -1350,7 +1350,7 @@ def maxquant_convert(
13501350
root.appendChild(intensityPredictionsFile)
13511351

13521352
minPepLen = doc.createElement("minPepLen")
1353-
if "min_peptide_length" in file2params:
1353+
if "min_peptide_length" in file2params and len(file2params["min_peptide_length"]) > 0::
13541354
tparam = file2params["min_peptide_length"]
13551355
first = list(tparam.values())[0]
13561356
minPepLen.appendChild(doc.createTextNode(first))
@@ -1368,7 +1368,7 @@ def maxquant_convert(
13681368
root.appendChild(psmFdrCrosslink)
13691369

13701370
peptideFdr = doc.createElement("peptideFdr")
1371-
if "ident_fdr_peptide" in file2params:
1371+
if "ident_fdr_peptide" in file2params and len(file2params["ident_fdr_peptide"]) > 0::
13721372
tparam = file2params["ident_fdr_peptide"]
13731373
first = list(tparam.values())[0]
13741374
warning_message = "overwriting peptide FDR using the value in the sdrf file"
@@ -1382,7 +1382,7 @@ def maxquant_convert(
13821382
root.appendChild(peptideFdr)
13831383

13841384
proteinFdr = doc.createElement("proteinFdr")
1385-
if "ident_fdr_protein" in file2params:
1385+
if "ident_fdr_protein" in file2params and len(file2params["ident_fdr_protein"]) > 0::
13861386
tparam = file2params["ident_fdr_protein"]
13871387
first = list(tparam.values())[0]
13881388
warning_message = "overwriting protein FDR using the value in the sdrf file"
@@ -1396,7 +1396,7 @@ def maxquant_convert(
13961396
root.appendChild(proteinFdr)
13971397

13981398
siteFdr = doc.createElement("siteFdr")
1399-
if "ident_fdr_psm" in file2params:
1399+
if "ident_fdr_psm" in file2params and len(file2params["ident_fdr_psm"]) > 0::
14001400
tparam = file2params["ident_fdr_psm"]
14011401
first = list(tparam.values())[0]
14021402
warning_message = "overwriting PSM FDR using the value in the sdrf file"
@@ -1422,7 +1422,7 @@ def maxquant_convert(
14221422
root.appendChild(useNormRatiosForOccupancy)
14231423

14241424
minPeptides = doc.createElement("minPeptides")
1425-
if "min_num_peptides" in file2params:
1425+
if "min_num_peptides" in file2params and len(file2params["min_num_peptides"]) > 0::
14261426
tparam = file2params["min_num_peptides"]
14271427
first = list(tparam.values())[0]
14281428
minPeptides.appendChild(doc.createTextNode(first))
@@ -1504,7 +1504,7 @@ def maxquant_convert(
15041504
root.appendChild(compositionPrediction)
15051505

15061506
quantMode = doc.createElement("quantMode")
1507-
if "protein_inference" in file2params:
1507+
if "protein_inference" in file2params and len(file2params["protein_inference"]) > 0::
15081508
tparam = file2params["protein_inference"]
15091509
first = list(tparam.values())[0]
15101510
if first == "unique":

0 commit comments

Comments
 (0)