From 13ad23c4684a4d9c262058ddfbbfb845947248a8 Mon Sep 17 00:00:00 2001 From: Hongxin Date: Wed, 27 Apr 2022 11:33:37 -0400 Subject: [PATCH] Check whether level exists in the input file --- AnnotatorCore.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/AnnotatorCore.py b/AnnotatorCore.py index 9784747..97d6bb2 100644 --- a/AnnotatorCore.py +++ b/AnnotatorCore.py @@ -976,8 +976,8 @@ def processclinicaldata(annotatedmutfiles, clinicalfile, outfile): sampledrivers[sample].append(variant) for l in levels: - il = headers[l] - if il < len(row) and row[il] != '': + il = geIndexOfHeader(headers, [l]) + if 0 <= il < len(row) and row[il] != '': if l not in samplelevels[sample]: samplelevels[sample][l] = [] sampleleveltreatments[sample][l] = [] @@ -988,15 +988,15 @@ def processclinicaldata(annotatedmutfiles, clinicalfile, outfile): sampleactionablecount[sample][variant] = True for l in dxLevels: - il = headers[l] - if il < len(row) and row[il] != '': + il = geIndexOfHeader(headers, [l]) + if 0 <= il < len(row) and row[il] != '': if l not in samplelevels[sample]: samplelevels[sample][l] = [] samplelevels[sample][l].append(row[il] + "(" + variant + ")") for l in pxLevels: - il = headers[l] - if il < len(row) and row[il] != '': + il = geIndexOfHeader(headers, [l]) + if 0 <= il < len(row) and row[il] != '': if l not in samplelevels[sample]: samplelevels[sample][l] = [] samplelevels[sample][l].append(row[il] + "(" + variant + ")")