diff ensembl_variant_report.py @ 3:652d35c42bca draft

planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/ensembl_variant_report commit d3b7ff1c2f0a1eed7a65af7208e987a35627402c-dirty
author jjohnson
date Wed, 20 Mar 2019 15:27:02 -0400
parents f87fe6bc48f4
children
line wrap: on
line diff
--- a/ensembl_variant_report.py	Mon Mar 18 21:43:34 2019 -0400
+++ b/ensembl_variant_report.py	Wed Mar 20 15:27:02 2019 -0400
@@ -116,6 +116,7 @@
                 qual = float(qual)
                 dp = None
                 dpr = None
+                ao = None
                 af = None
                 for info_item in info.split(';'):
                     if info_item.find('=') < 0: continue
@@ -124,6 +125,8 @@
                         dp = int(val)
                     if key == 'DPR' or key == 'AD':
                         dpr = [int(x) for x in val.split(',')]
+                    if key == 'AO':
+                        ao = [int(x) for x in val.split(',')]
                     if key == 'AF':
                         af = [float(x) for x in val.split(',')]
                     if key in ['EFF','ANN']:
@@ -135,11 +138,14 @@
                                 (eff, effs) = effect.rstrip(')').split('(')
                                 (impact, functional_class, codon_change, aa_change, aa_len, gene_name, biotype, coding, transcript, exon, alt) = effs.split('|')[0:11]
                             i = alt_list.index(alt) if alt in alt_list else 0
-                            if af:
-                                freq = af[i]
+                            if ao:
+                                freq = float(ao[i])/float(dp) if dp else \
+                                    float(dpr[i])/float(sum(ao))
                             elif dpr:
                                 freq = float(dpr[i+1])/float(dp) if dp else \
                                     float(dpr[i+1])/float(sum(dpr))
+                            elif af:
+                                freq = af[i]
                             else: 
                                 freq = None
                             if freq: