更改 header 带序号的 fasta 文件
Change header of fasta file with sequential numbers
如何使用 awk/sed/grep 更改文件中更多 fasta 序列的 header,例如:
>chromosome1|2199-2200
----------------------
>chromosome1|3546-3548
----------------------
>chromosome1|6489-6548
----------------------
对此:
>chromosome1-1|2199-2200
------------------------
>chromosome1-2|3546-3548
------------------------
>chromosome1-3|6489-6548
------------------------
目前我只能在名称的开头或结尾添加一个序号,例如:
awk '/^>/{gsub(/^>/,">Seq"i++" ");}1'
>Seq1chromosome1|2199-2200
$ awk '/>/{sub(/\|/,"-"++i"|")}1' file
>chromosome1-1|2199-2200
----------------------
>chromosome1-2|3546-3548
----------------------
>chromosome1-3|6489-6548
----------------------
如何使用 awk/sed/grep 更改文件中更多 fasta 序列的 header,例如:
>chromosome1|2199-2200
----------------------
>chromosome1|3546-3548
----------------------
>chromosome1|6489-6548
----------------------
对此:
>chromosome1-1|2199-2200
------------------------
>chromosome1-2|3546-3548
------------------------
>chromosome1-3|6489-6548
------------------------
目前我只能在名称的开头或结尾添加一个序号,例如:
awk '/^>/{gsub(/^>/,">Seq"i++" ");}1'
>Seq1chromosome1|2199-2200
$ awk '/>/{sub(/\|/,"-"++i"|")}1' file
>chromosome1-1|2199-2200
----------------------
>chromosome1-2|3546-3548
----------------------
>chromosome1-3|6489-6548
----------------------