Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Tuo Zhang committed Feb 26, 2020
1 parent 1d0ca04 commit 6609289
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/select_candidate_variants.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def fix_splice_region(telements,thdic,cname):

# screen candidates and output
print "PMid\tnumTotal\tnumHits\tnumClvP\tnumTrunc\tnumOnco\tnumQC\tnumExAC\tnumClvB\tnumInbreed"
###print "#CHROM\tPOS\ttrunc\tnonTrunc\tcosonco\tcostsg\tuttsg"
# screen
numHits = numQC = numExAC = numClvP = numClvB = numTrunc = numInbreed = numOnco = 0
fout = open(outfile,'wb')
Expand All @@ -59,6 +60,13 @@ def fix_splice_region(telements,thdic,cname):
cosonco = elements[hdic["COSMIC_Onco"]]
costsg = elements[hdic["COSMIC_TSG"]]
uttsg = elements[hdic["UT_TSG"]]
# protein truncating?
trunc = False
nonTrunc = False
if "frameshift_variant" in effect or "stop_gained" in effect:
trunc = True
if "frameshift_variant" not in effect and "stop_gained" not in effect and "splice_acceptor_variant" not in effect and "splice_donor_variant" not in effect and "start_lost" not in effect and "stop_lost" not in effect:
nonTrunc = True
# filter
if category == "C.F" or category == "F":
mark = False
Expand All @@ -75,15 +83,18 @@ def fix_splice_region(telements,thdic,cname):
elif "InbreedingCoeff_Filter" in filt or "VQSRTrancheINDEL" in filt or "VQSRTrancheSNP" in filt:# keep AC_Adj0_Filter
mark = False
numInbreed += 1
elif ("frameshift_variant" in effect or "stop_gained" in effect) and (costsg == "yes" or uttsg == "yes"):# protein truncating on TSG
elif trunc and (costsg == "yes" or uttsg == "yes"):# protein truncating variants on TSG will be kept
mark = True
numTrunc += 1
elif cosonco == "yes":# non-protein truncating on onco gene
mark == True
elif not nonTrunc and cosonco == "yes":# protein truncating variants on onco gene should be discarded
mark = False
numOnco += 1
else:
mark = False
# output
if mark:
numHits += 1
###print elements[hdic["#CHROM"]], elements[hdic["POS"]],trunc,nonTrunc,cosonco,costsg,uttsg
###fout.write(sid+"\t"+"\t".join([elements[hdic[x]] for x in outcols])+"\n")
fout.write(sid+"\t"+"\t".join([fix_splice_region(elements,hdic,x) for x in outcols])+"\n")# fix Splice_Region annotation
fout.close()
Expand Down

0 comments on commit 6609289

Please sign in to comment.