Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/widdowquinn/pyani
Browse files Browse the repository at this point in the history
  • Loading branch information
widdowquinn committed Sep 21, 2016
2 parents 7c4ef1f + ce8a7d7 commit 98cc162
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions average_nucleotide_identity.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@
from pyani import run_multiprocessing as run_mp
from pyani import run_sge
from pyani.pyani_config import params_mpl, params_r, ALIGNDIR, FRAGSIZE
from pyani import __version__ as VERSION


# Process command-line arguments
Expand Down Expand Up @@ -580,19 +581,21 @@ def get_labels(filename):
Input files should be formatted as <key>\t<label>, one pair per line.
"""
labeldict = {}
with open(filename, 'rU') as fh:
count = 0
for line in fh.readlines():
count += 1
try:
key, label = line.strip().split('\t')
except ValueError:
logger.warning("Problem with class file: %s" % filename)
logger.warning("%d: %s" % (count, line.strip()))
logger.warning("(skipping line)")
continue
else:
labeldict[key] = label
if filename is not None:
logger.info("Reading labels from %s" % filename)
with open(filename, 'rU') as fh:
count = 0
for line in fh.readlines():
count += 1
try:
key, label = line.strip().split('\t')
except ValueError:
logger.warning("Problem with class file: %s" % filename)
logger.warning("%d: %s" % (count, line.strip()))
logger.warning("(skipping line)")
continue
else:
labeldict[key] = label
return labeldict


Expand Down Expand Up @@ -725,6 +728,7 @@ def subsample_input(infiles):
logger.addHandler(err_handler)

# Report arguments, if verbose
logger.info("pyani version: %s" % VERSION)
logger.info(args)
logger.info("command-line: %s" % ' '.join(sys.argv))

Expand Down

0 comments on commit 98cc162

Please sign in to comment.