how to replace fasta header
1
0
Entering edit mode
2.4 years ago
Nelo ▴ 20

Hi!

I have two files, ba.fasta and ba.header

ba.fasta                                                                               ba.header
>bas12                                                                                >seq1
MDNAVGYH..                                                                     MDNAVGYH..
>bas13                                                                                >seq2
MLSRTEQR..                                                                      MLSRTEQR..

So basically I wanted to replace the header of ba.fasta with that of ba.header while keeping the sequences

Any easy command for this please

Tnks in advance

linux header fasta • 1.3k views
ADD COMMENT
0
Entering edit mode
$ tail -n+1 *.fa
==> test1.fa <==
>bas12
MDNAVGYH
>bas13
MLSRTEQR
>seq
MLR

==> test2.fa <==
>seq1
MDNAVGYH
>seq2
MLSRTEQR

output:

$ seqkit --quiet replace -K  -p '(.*)' -r '{kv}' -k  <(paste <(seqkit seq -n test1.fa) <(seqkit seq -n test2.fa)| awk '$2!="" {print}') test1.fa
>seq1
MDNAVGYH
>seq2
MLSRTEQR
>seq
MLR
ADD REPLY
1
Entering edit mode
2.4 years ago
awk '/^>/{printf(">seq%d\n",++N);next;} {print;}'
ADD COMMENT
0
Entering edit mode

ba.fasta ba.header

Bol0453 >Bol.11 MKDIRGHTWQP... MKDIRGHTWQP... Bol0358 >Bol.75 MKSREVBTW.... MKSREVBTW....

What if situation is something like this. I want the header of file ba.header in the place of ba.fasta header.

ADD REPLY
1
Entering edit mode

linearize the fasta and use paste to merge the data.

ADD REPLY
0
Entering edit mode

First of all thank you for responding but I am not able to get you

ADD REPLY
0
Entering edit mode

Ok... I got it !!!

ADD REPLY

Login before adding your answer.

Traffic: 3861 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