Question: Append two fasta sequences
0
gravatar for tarakaramji
14 months ago by
tarakaramji10
tarakaramji10 wrote:

I have two fasta files with different header and sequences and would like to append them one after the other in the same sequential order

Input: first file

>RNA1
AATGACGATGACGATGACAGAT
>RNA2
ATAGATGGGCAGTAGAGA

File2:

>mRNA1
ATGGAGATGAGAT
>mRNA2
AGATGGGGATGA

Ouput file should be

>RNA1:mRNA1
AATGACGATGACGATGACAGATATGGAGATGAGAT
>RNA2:mRNA2
ATAGATGGGCAGTAGAGAAGATGGGGATGA
biopython bioperl fasta • 449 views
ADD COMMENTlink modified 14 months ago by Pierre Lindenbaum107k • written 14 months ago by tarakaramji10

And what have you tried?

ADD REPLYlink written 14 months ago by WouterDeCoster28k
1

I have tried the EMBOSS tool pasteseq which appends only the first sequence but does not retrieve the identifiers

ADD REPLYlink written 14 months ago by tarakaramji10
3
gravatar for Pierre Lindenbaum
14 months ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum107k wrote:

assuming all fasta have two lines per record (name+seq)

paste f1.fasta f2.fasta | sed -e '/^>/s/\t>/:/' -e '/^[^>]/s/\t//'
ADD COMMENTlink written 14 months ago by Pierre Lindenbaum107k
3

Alternatively: paste -d '' file1 file2 | sed 's/>/:/2' or e.g. paste -d '' file1 <(tr ">" ":" <file2)

ADD REPLYlink modified 14 months ago • written 14 months ago by 5heikki7.2k

Thank you..Both works perfect!!

ADD REPLYlink written 14 months ago by tarakaramji10
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 645 users visited in the last hour