Thanks verymuch genomax2, i followed your command but no changes happened to my file (as below), could you please help figure out the problem?

Hi there,
I have a fasta file with the format like this:
@t0000001 2137624
TGGAATGTAAAGAAGTATGTAT
@t0000002 926007
TGTGCACGGCACACACCACGTCGACGTT
@t0000003 854045
TGAGGTAGTAGGTTGTATAGTT
@t0000004 544348
TGTGAACGGCAGACACCACGTCAGTGTT
@t0000007 286256
TGTGAACGGCAGACACCACGTCAGTGTTG
@t0000005 261735
TGTGCACGGCACACACCACGTCGACGTTT
@t0000006 174866
TGTGCACGGCACACACCACGTCGACGTTC
@t0000011 135896
GGAACACCGGGTGCAGTAGACAT
now I would like to change the title into
@t0000001_hd_2137624
@t0000002_hd_926007
@t0000003_hd_854045
...
to meet the demands of fasta file format in mirdeep2,
is there any command line or software could do this ? I searched the internet but comes no solutions.
Thank you very much. Sean
That format it is not fasta (it is like fastq but with the quality lines missing). If you wish it to keep in that format then you can try this:
sed 's/\ /\_hd\_/g' your_file > new_file
If you need to convert the file to fasta format at the same time then do this
sed -e 's/\ /\_hd\_/g' -e 's/^@t/>t/g' your_file > new_file
Thanks verymuch genomax2, i followed your command but no changes happened to my file (as below), could you please help figure out the problem?

it seems a tab separated headers, just replace single space to regular expression,
sed -e 's/\s/\_hd\_/g' -e 's/^@t/>t/g' your_file > new_file
Thanks verymuch genomax2, i followed your command but no changes happened to my file (as below), could you please help figure out the problem?

Log in to answer this question.