Entering edit mode
2.3 years ago
Dan
▴
180
I want to add "chr" to the chromosome names of the head line of fasta file:
>1 dna:chromosome chromosome:GRCm38:1:1:195471971:1 REF
to
>chr1 dna:chromosome chromosome:GRCm38:chr1:1:195471971:1 REF
I tried
cat Mus_musculus.GRCm38.dna.primary_assembly.fa | sed -e 's/^>\([0-9XY]\)/>chr\1/' -e 's/.*GRCm38:\([0-9XY]\):.*/chr\1/'
which can only change the first position, how should I change the second position?
Thanks