From b09fa767f7331dd2d8d6c007a35893b82f2e9e63 Mon Sep 17 00:00:00 2001 From: tkonopka Date: Mon, 15 Feb 2021 07:36:45 +0000 Subject: [PATCH] support for reference sequences with lowercase characters (a, c, g, t) --- src/bamsnap.egg-info/SOURCES.txt | 1 - src/bamsnap/conf.py | 12 ++++++++++++ src/bamsnap/drawreadset.py | 9 +++++---- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/bamsnap.egg-info/SOURCES.txt b/src/bamsnap.egg-info/SOURCES.txt index 0e2e9b7..bb3164a 100644 --- a/src/bamsnap.egg-info/SOURCES.txt +++ b/src/bamsnap.egg-info/SOURCES.txt @@ -1,6 +1,5 @@ MANIFEST.in README.md -setup.cfg setup.py src/bamsnap/__init__.py src/bamsnap/_logging.py diff --git a/src/bamsnap/conf.py b/src/bamsnap/conf.py index fa2e039..248a7e8 100644 --- a/src/bamsnap/conf.py +++ b/src/bamsnap/conf.py @@ -6,19 +6,31 @@ COLOR = {} COLOR['cov'] = ImageColor.getrgb("#AAAAAA") COLOR['A'] = ImageColor.getrgb("#00ff00") +COLOR['a'] = ImageColor.getrgb("#00ff00") COLOR['T'] = ImageColor.getrgb("#ff0000") +COLOR['t'] = ImageColor.getrgb("#ff0000") COLOR['G'] = ImageColor.getrgb("#d17105") +COLOR['g'] = ImageColor.getrgb("#d17105") COLOR['C'] = ImageColor.getrgb("#0000ff") +COLOR['c'] = ImageColor.getrgb("#0000ff") COLOR['N'] = ImageColor.getrgb("#AAAAAA") COLOR['wA'] = ImageColor.getrgb("#64E464") +COLOR['wa'] = ImageColor.getrgb("#64E464") COLOR['wG'] = ImageColor.getrgb("#CAB7A1") +COLOR['wg'] = ImageColor.getrgb("#CAB7A1") COLOR['wC'] = ImageColor.getrgb("#8C8CD9") +COLOR['wc'] = ImageColor.getrgb("#8C8CD9") COLOR['wT'] = ImageColor.getrgb("#DE7878") +COLOR['wt'] = ImageColor.getrgb("#DE7878") COLOR['wN'] = ImageColor.getrgb("#AAAAAA") COLOR['dA'] = ImageColor.getrgb("#078c07") +COLOR['da'] = ImageColor.getrgb("#078c07") COLOR['dT'] = ImageColor.getrgb("#9c0808") +COLOR['dt'] = ImageColor.getrgb("#9c0808") COLOR['dG'] = ImageColor.getrgb("#995508") +COLOR['dg'] = ImageColor.getrgb("#995508") COLOR['dC'] = ImageColor.getrgb("#060680") +COLOR['dc'] = ImageColor.getrgb("#060680") COLOR['dN'] = ImageColor.getrgb("#5c5959") COLOR['MAPQ_0'] = ImageColor.getrgb("#EFEFEF") COLOR['READ'] = ImageColor.getrgb("#c8c8c8") diff --git a/src/bamsnap/drawreadset.py b/src/bamsnap/drawreadset.py index 0161d08..a372cd0 100644 --- a/src/bamsnap/drawreadset.py +++ b/src/bamsnap/drawreadset.py @@ -28,10 +28,11 @@ def get_image(self, w, h, bgcolor="FFFFFF"): def get_vaf(self, base_composition, dp, posi, refseq): aflist = [] - for b1 in base_composition.keys(): - if refseq[posi] != b1: - aflist.append(base_composition[b1]/dp) - return max(aflist) + ref_base = str(refseq[posi]).upper() + for b1, v1 in base_composition.items(): + if ref_base != b1: + aflist.append(v1/dp) + return max(aflist, default=0.0) def draw_coverage(self, dr, w, h): try: