Entering edit mode
2.0 years ago
Sasha
▴
850
Hi,
I recently ran into an issue where my bed files were using the incorrect chromosome naming convention and I had to change them from '1' naming to convention 'chr1' naming. Here is the command I used:
awk '{if ($1 ~ /^[0-9]/) print "chr"$0; else if ($1 ~ /^X/) print "chr"$0; else if ($1 ~ /^Y/) print "chr"$0; else print $0}' peaks2.bed > peaks2_chr.bed
Cheers!
shorter ?
or
Beautiful. Any ideas on how to make it work with MT to chrM as well. I tried to get it to work with gsub but it did not work. :(
Great !!! Thankyou . Really saved alot of time for me .