Replace header of fasta file according to another file
0
0
Entering edit mode
14 months ago
Nelo ▴ 20

Hi

I have a file T.fasta as:

>AAAA
GVNCLPQWERTYI
>BBBB
HJKSDRTYPALVNM
>CCCC
TRHJPKFLMVNCTEGH

and another file.txt with two columns: One column with header of the T.fasta file and a second column with the new name like:

CCCC     C_pr3
BBBB     B_pr2
AAAA     A_pr1

Now I want to replace the header of T.fa with the second column of the second file if first column of second file match with the header of T.fa.

The deisred output should look like this:

>A_pr1
GVNCLPQWERTYI
>B_pr2
HJKSDRTYPALVNM
>C_pr3
TRHJPKFLMVNCTEGH

**My both file are not sorted accordingly.

fasta • 562 views
ADD COMMENT

Login before adding your answer.

Traffic: 1375 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6