Nanowire transformation and annealing by Joule heating