@@ -859,6 +859,8 @@ def run_id_range(job, context, graph_id, graph_name, chrom):
859859 """
860860 Compute a node id range for a graph (which should be an entire contig/chromosome with
861861 contiguous id space -- see vg ids) using vg stats
862+
863+ Returns a tuple of 3 strings: chromosome name, first base number, last base number.
862864 """
863865 work_dir = job .fileStore .getLocalTempDir ()
864866
@@ -869,9 +871,9 @@ def run_id_range(job, context, graph_id, graph_name, chrom):
869871 #run vg stats
870872 #expect result of form node-id-range <tab> first:last
871873 command = ['vg' , 'stats' , '--node-id-range' , os .path .basename (graph_filename )]
872- stats_out = context .runner .call (job , command , work_dir = work_dir , check_output = True ).strip ().split ()
873- assert stats_out [0 ]. decode ( 'ascii' ) == 'node-id-range'
874- first , last = stats_out [1 ].split (b ':' )
874+ stats_out = context .runner .call (job , command , work_dir = work_dir , check_output = True ).decode ( 'utf-8' ). strip ().split ()
875+ assert stats_out [0 ] == 'node-id-range'
876+ first , last = stats_out [1 ].split (':' )
875877
876878 return chrom , first , last
877879
@@ -883,9 +885,9 @@ def run_merge_id_ranges(job, context, id_ranges, index_name):
883885 # Where do we put the id ranges tsv?
884886 id_range_filename = os .path .join (work_dir , '{}_id_ranges.tsv' .format (index_name ))
885887
886- with open (id_range_filename , 'wb ' ) as f :
888+ with open (id_range_filename , 'w ' ) as f :
887889 for id_range in id_ranges :
888- f .write ('{}\t {}\t {}\n ' .format (* id_range ). encode () )
890+ f .write ('{}\t {}\t {}\n ' .format (* id_range ))
889891
890892 # Checkpoint index to output store
891893 return context .write_output_file (job , id_range_filename )
0 commit comments