Chemical ligation of oligonucleotides in the presence and absence of a template