Skip to content

Commit

Permalink
Fix matplotlib Backend. Fix small bugs in the integron drawing.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean committed Jun 22, 2015
1 parent d9ce48a commit 89f5fbd
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Integron_Finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
import psutil
import os
import argparse
from matplotlib import use as m_use
m_use("Agg")
import matplotlib.pyplot as plt

import distutils

class Integron:
Expand Down Expand Up @@ -415,7 +418,7 @@ def draw_integron(self, file=0):
"""
full = self.describe()
full["evalue"] = full["evalue"].astype("float")
h = [i + (0.5*i) if j.startswith("P") else i for i,j in zip(full.strand, full.element)]
h = [i + (0.5*i) if j == "Promoter" else i for i,j in zip(full.strand, full.type_elt)]
fig, ax = plt.subplots(1,1, figsize=(16,9))
alpha = [i if i<1 else 1 for i in (
(np.log10(full.evalue) - np.ones(len(full))*-1)/
Expand All @@ -424,12 +427,12 @@ def draw_integron(self, file=0):
# normalize alpha value with 0.2 as min value

colors = ["#749FCD" if i=="attC" else
"#DD654B" if i=="integrase" else
"#DD654B" if i=="intI" else
"#6BC865" if i[-2:]=="_1" else
"#D06CC0" if i[-2:]=="_2" else
"#C3B639" if i[-2:]=="_3" else
"#e8950e" if i != "protein" else
"#d3d3d3" for i in full.type_elt]
"#d3d3d3" for i in full.annotation]

colors_alpha = [j+[i] for j,i in zip([[ord(c)/255. for c in i[1:].decode("hex")] for i in colors],
alpha)]
Expand Down

0 comments on commit 89f5fbd

Please sign in to comment.