diff --git a/src/toil_vg/vg_index.py b/src/toil_vg/vg_index.py index 9c396676..4589008f 100755 --- a/src/toil_vg/vg_index.py +++ b/src/toil_vg/vg_index.py @@ -859,6 +859,8 @@ def run_id_range(job, context, graph_id, graph_name, chrom): """ Compute a node id range for a graph (which should be an entire contig/chromosome with contiguous id space -- see vg ids) using vg stats + + Returns a tuple of 3 strings: chromosome name, first base number, last base number. """ work_dir = job.fileStore.getLocalTempDir() @@ -869,9 +871,9 @@ def run_id_range(job, context, graph_id, graph_name, chrom): #run vg stats #expect result of form node-id-range first:last command = ['vg', 'stats', '--node-id-range', os.path.basename(graph_filename)] - stats_out = context.runner.call(job, command, work_dir=work_dir, check_output = True).strip().split() - assert stats_out[0].decode('ascii') == 'node-id-range' - first, last = stats_out[1].split(b':') + stats_out = context.runner.call(job, command, work_dir=work_dir, check_output = True).decode('utf-8').strip().split() + assert stats_out[0] == 'node-id-range' + first, last = stats_out[1].split(':') return chrom, first, last @@ -883,9 +885,9 @@ def run_merge_id_ranges(job, context, id_ranges, index_name): # Where do we put the id ranges tsv? id_range_filename = os.path.join(work_dir, '{}_id_ranges.tsv'.format(index_name)) - with open(id_range_filename, 'wb') as f: + with open(id_range_filename, 'w') as f: for id_range in id_ranges: - f.write('{}\t{}\t{}\n'.format(*id_range).encode()) + f.write('{}\t{}\t{}\n'.format(*id_range)) # Checkpoint index to output store return context.write_output_file(job, id_range_filename)