本文介绍了按顺序重命名fasta标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我有多个fasta文件,每个文件带有8个标头,始终以相同的顺序(就种类而言).例如,就像

I have multiple fasta files and each file with 8 headers always in the same order (in term of species). For example it is like

 grep -o -E "^>\w+" batch1.seq

 jgi
 jgi
 augustus_masked
 augustus_masked
 augustus_masked
 jgi
 augustus_masked
 augustus_masked

 grep -o -E "^>\w+" batch2.seq

给予

jgi
jgi
maker
maker
maker
jgi
maker
maker

无论标题如何,我都希望将文件夹中文件的所有fasta标题(数量为8)重命名为

Irrespective of their headers, I want to rename all fasta headers (8 in number) for the files in the folder to

Ara
Soy
Gly
Tom
Whe
Cor
Nat
Blu

推荐答案

awk进行救援!

awk 'NR==FNR{names[NR]=$0; next}
        /^>/{$1=">"names[++c]}1' names fasta > fasta.new

使用脚本时,将新标题列表保留在文件names中.

keep your new header list in the file names when using the script.

这篇关于按顺序重命名fasta标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-07 12:56