Skip to content

Commit

Permalink
Fix citation columns misalignment (#144)
Browse files Browse the repository at this point in the history
CNA/Fusion annotation files are not aligned appropriately caused by #134
  • Loading branch information
zhx828 committed Nov 29, 2021
1 parent 6c06049 commit 78ece67
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
20 changes: 14 additions & 6 deletions AnnotatorCore.py
Original file line number Diff line number Diff line change
Expand Up @@ -661,21 +661,25 @@ def processsv(svdata, outfile, previousoutfile, defaultCancerType, cancerTypeMap
outf.write("\t" + GENE_IN_ONCOKB_HEADER)
outf.write("\t" + VARIANT_IN_ONCOKB_HEADER)
outf.write("\tMUTATION_EFFECT")
outf.write("\tMUTATION_EFFECT_CITATIONS")
outf.write("\tONCOGENIC")
for l in levels:
outf.write('\t' + l)
outf.write("\tHIGHEST_LEVEL")
outf.write("\tCITATIONS")
outf.write("\tTX_CITATIONS")

for l in dxLevels:
outf.write('\t' + l)
outf.write("\tHIGHEST_DX_LEVEL")
outf.write("\tDX_CITATIONS")

for l in pxLevels:
outf.write('\t' + l)
outf.write("\tHIGHEST_PX_LEVEL\n")
outf.write("\tHIGHEST_PX_LEVEL")
outf.write("\tPX_CITATIONS")
outf.write("\n")

newcols = ncols + 8 + len(levels) + len(dxLevels) + len(pxLevels)
newcols = ncols + 11 + len(levels) + len(dxLevels) + len(pxLevels)

igene1 = geIndexOfHeader(headers, ['GENE1'])
igene2 = geIndexOfHeader(headers, ['GENE2'])
Expand Down Expand Up @@ -767,21 +771,25 @@ def processcnagisticdata(cnafile, outfile, previousoutfile, defaultCancerType, c
outf.write("\t"+GENE_IN_ONCOKB_HEADER)
outf.write("\t"+VARIANT_IN_ONCOKB_HEADER)
outf.write("\tMUTATION_EFFECT")
outf.write("\tMUTATION_EFFECT_CITATIONS")
outf.write("\tONCOGENIC")
for l in levels:
outf.write('\t' + l)
outf.write("\tHIGHEST_LEVEL")
outf.write("\tCITATIONS")
outf.write("\tTX_CITATIONS")

for l in dxLevels:
outf.write('\t' + l)
outf.write("\tHIGHEST_DX_LEVEL")
outf.write("\tDX_CITATIONS")

for l in pxLevels:
outf.write('\t' + l)
outf.write("\tHIGHEST_PX_LEVEL\n")
outf.write("\tHIGHEST_PX_LEVEL")
outf.write("\tPX_CITATIONS")
outf.write("\n")

ncols = 12 + len(levels) + len(dxLevels) + len(pxLevels)
ncols = 15 + len(levels) + len(dxLevels) + len(pxLevels)

i = 0
rows = []
Expand Down
5 changes: 2 additions & 3 deletions test_Annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,8 @@ def check_brca2_n3214i_without_cancertype(annotation):
assert annotation[MUTATION_EFFECT_INDEX] == 'Likely Loss-of-function'
assert annotation[ONCOGENIC_INDEX] == 'Likely Oncogenic'
assert annotation[HIGHEST_LEVEL_INDEX] == 'LEVEL_1'
assert annotation[LEVEL_1_INDEX] == 'Olaparib,Olaparib+Bevacizumab,Rucaparib,Niraparib'
assert annotation[LEVEL_2_INDEX] == 'Talazoparib,Olaparib'
assert annotation[LEVEL_3A_INDEX] == 'Rucaparib,Olaparib'
assert annotation[LEVEL_1_INDEX] == 'Olaparib,Rucaparib,Olaparib+Bevacizumab,Niraparib'
assert annotation[LEVEL_3A_INDEX] == 'Olaparib,Rucaparib,Talazoparib'

@pytest.mark.skipif(ONCOKB_API_TOKEN in (None, ''), reason="oncokb api token required")
def test_duplicated_treatments():
Expand Down

0 comments on commit 78ece67

Please sign in to comment.