comparison id_converter.py @ 21:6e65e1c78705 draft default tip

"planemo upload commit 540dd383c0617193db43bf11457011888751b022-dirty"
author proteore
date Thu, 23 Jan 2020 08:43:51 -0500
parents 9d758344d36e
children
comparison
equal deleted inserted replaced
20:77a2cd4162b7 21:6e65e1c78705
171 else : 171 else :
172 ids_dictionary[id][ids_dictionary_index[other_id_type]] |= set(line[other_id_type].replace("NA","").replace(" ","").split(";")) 172 ids_dictionary[id][ids_dictionary_index[other_id_type]] |= set(line[other_id_type].replace("NA","").replace(" ","").split(";"))
173 if len(ids_dictionary[id][ids_dictionary_index[other_id_type]]) > 1 and '' in ids_dictionary[id][ids_dictionary_index[other_id_type]] : 173 if len(ids_dictionary[id][ids_dictionary_index[other_id_type]]) > 1 and '' in ids_dictionary[id][ids_dictionary_index[other_id_type]] :
174 ids_dictionary[id][ids_dictionary_index[other_id_type]].remove('') 174 ids_dictionary[id][ids_dictionary_index[other_id_type]].remove('')
175 175
176 #print ("dictionary created")
177
178 #Get file and/or ids from input 176 #Get file and/or ids from input
179 if args.input_type == "list" : 177 if args.input_type == "list" :
180 ids = get_input_ids_from_string(args.input) 178 ids = get_input_ids_from_string(args.input)
181 elif args.input_type == "file" : 179 elif args.input_type == "file" :
182 input_file, ids = get_input_ids_from_file(args.input,args.column_number,header) 180 input_file, ids = get_input_ids_from_file(args.input,args.column_number,header)
183 181
184 #print ("starting mapping")
185
186 #Mapping ids 182 #Mapping ids
187 result_dict = map_to_dictionary(ids,ids_dictionary,args.id_type,target_ids) 183 result_dict = map_to_dictionary(ids,ids_dictionary,args.id_type,target_ids)
188 184
189 #print ("mapping done")
190
191 #print ("creating output file")
192 #creating output file 185 #creating output file
193 with open(args.output,"w") as output : 186 with open(args.output,"w") as output :
194 writer = csv.writer(output,delimiter="\t") 187 writer = csv.writer(output,delimiter="\t")
195 #writer.writerows(output_file) 188 #writer.writerows(output_file)
196 189