This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Replace fasta Header witha a matching text

My fasta header looks like this

>name1
ATGCATGCAT

My output must look like this

>alfaAB

--kv file looks like this

name1        alfaAB

What command can be used to achieve this??

Thank You

awk seqkit grep

Please use the formatting bar (especially the code option) to present your post better. I've done it for you this time.
code_formatting

What is --kv? Is that a seqkit option? If you are using seqkit then please post the command you are using by editing the original post.

I want to know what command can be used to achieve the purpose.

It can be seqkit or anything else

1 answer

$ more test.fa
>name1
ATGCATGCAT
>name2
AGCTAGC

$ more names
name1   alfaAB
name2   alfaCD

$ seqkit replace -p "(.+)" -r '{kv}' -k names test.fa
[INFO] read key-value file: names
[INFO] 2 pairs of key-value loaded
>alfaAB
ATGCATGCAT
>alfaCD
AGCTAGC

This worked

Thanks a ton

Log in to answer this question.