comparison split_file_to_collection.py @ 3:2ddc36385d7a draft

"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/split_file_to_collection commit 8d069684e155d2f5b6fae06d14d98ce41321da53"
author bgruening
date Tue, 10 Sep 2019 12:31:15 -0400
parents d150ac3d853d
children 0850f2dfba13
comparison
equal deleted inserted replaced
2:d150ac3d853d 3:2ddc36385d7a
138 new_file_base = os.path.splitext(os.path.basename(in_file)) 138 new_file_base = os.path.splitext(os.path.basename(in_file))
139 else: 139 else:
140 new_file_base = [custom_new_file_name, custom_new_file_ext] 140 new_file_base = [custom_new_file_name, custom_new_file_ext]
141 141
142 newfiles = [ 142 newfiles = [
143 open(out_dir + "/" + new_file_base[0] + "_" + str(count) + new_file_base[1], "w") 143 open(os.path.join(out_dir, "%s_%06d%s" % (new_file_base[0], count, new_file_base[1])) , "w")
144 for count in range(0, numnew) 144 for count in range(0, numnew)
145 ] 145 ]
146 146
147 # bunch o' counters 147 # bunch o' counters
148 # index to list of new files 148 # index to list of new files
157 fresh_files = {i for i in range(0, numnew)} 157 fresh_files = {i for i in range(0, numnew)}
158 158
159 # keep track in loop of number of records in each file 159 # keep track in loop of number of records in each file
160 # only used in batch 160 # only used in batch
161 records_in_file = 0 161 records_in_file = 0
162 162
163 # open file 163 # open file
164 with open(in_file, "r") as file: 164 with open(in_file, "r") as file:
165 record = "" 165 record = ""
166 for line in file: 166 for line in file:
167 n_read += 1 167 n_read += 1