Skip to content

Commit

Permalink
adding check for Python version
Browse files Browse the repository at this point in the history
  • Loading branch information
fasnicar committed Jun 5, 2018
1 parent 371ae64 commit b68faf3
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 9 deletions.
10 changes: 8 additions & 2 deletions graphlan.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,16 @@
#------------------------------------------------------------------------------

__author__ = 'Nicola Segata ([email protected])'
__version__ = '1.1.2'
__date__ = '1 June 2018'
__version__ = '1.1.3'
__date__ = '5 June 2018'


import sys

if sys.version_info[0] > 2:
raise Exception("GraPhlAn requires Python 2, your current Python version is {}.{}.{}"
.format(sys.version_info[0], sys.version_info[1], sys.version_info[2]))

from sys import argv
from argparse import ArgumentParser
from src.graphlan_lib import CircTree as CTree
Expand Down
10 changes: 8 additions & 2 deletions graphlan_annotate.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,16 @@
#------------------------------------------------------------------------------

__author__ = 'Nicola Segata ([email protected])'
__version__ = '1.1.2'
__date__ = '1 June 2018'
__version__ = '1.1.3'
__date__ = '5 June 2018'


import sys

if sys.version_info[0] > 2:
raise Exception("GraPhlAn requires Python 2, your current Python version is {}.{}.{}"
.format(sys.version_info[0], sys.version_info[1], sys.version_info[2]))

from sys import argv
from argparse import ArgumentParser
from src.graphlan_lib import CircTree as CTree
Expand Down
16 changes: 11 additions & 5 deletions src/graphlan_lib.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
import sys

if sys.version_info[0] > 2:
raise Exception("GraPhlAn requires Python 2, your current Python version is {}.{}.{}"
.format(sys.version_info[0], sys.version_info[1], sys.version_info[2]))

from Bio import Phylo
from Bio.Phylo import PhyloXML
from Bio.Phylo import PhyloXMLIO
Expand Down Expand Up @@ -160,7 +166,7 @@ def legal( prop ):
try:
ilev = int(lev)
except:
print line
print(line)
asdasdasd

if prop not in gprops:
Expand Down Expand Up @@ -209,7 +215,7 @@ def legal( prop ):
try:
ilev = int(lev)
except:
print line
print(line)
asdasdasd

self._tmp_levs.add( ilev )
Expand Down Expand Up @@ -267,7 +273,7 @@ def _rec_annotate_( clade, rkeys_gen, path ):
try:
kkk,vvv = v.split(":")
except:
print v
print(v)
asdasdasd

if kkk == '*':
Expand Down Expand Up @@ -1055,7 +1061,7 @@ def draw(self, out_img, out_format=None, out_dpi=72, out_size=7.0, out_pad=0.5,
for p in ['ring_internal_separator_thickness','ring_external_separator_thickness']:
if p in v and float(v[p]) > 0.0:
if l not in self._ext_bottoms.keys():
print '[e] External ring #'+str(l), 'defined, but not used. Please check your annotations file'
print('[e] External ring #'+str(l), 'defined, but not used. Please check your annotations file')
continue

bot = offset + self._ext_bottoms[l]
Expand Down Expand Up @@ -1125,7 +1131,7 @@ def draw(self, out_img, out_format=None, out_dpi=72, out_size=7.0, out_pad=0.5,
height = round(self._tot_offset * len(labels) * charsize * self.class_legend_marker_size * 10.) / 10.
plt.figure(figsize=(width, height))
else:
print '[w] External legend not created, no annotated labels!'
print('[w] External legend not created, no annotated labels!')

if labels:
plt.figlegend(handles, labels, loc, labelspacing=0.1, frameon=False,
Expand Down

0 comments on commit b68faf3

Please sign in to comment.