Question: Append two fasta sequences
0
gravatar for tarakaramji
22 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 • 629 views
ADD COMMENTlink modified 22 months ago by Pierre Lindenbaum116k • written 22 months ago by tarakaramji10

And what have you tried?

ADD REPLYlink written 22 months ago by WouterDeCoster36k
1

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

ADD REPLYlink written 22 months ago by tarakaramji10
3
gravatar for Pierre Lindenbaum
22 months ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum116k 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 22 months ago by Pierre Lindenbaum116k
3

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

ADD REPLYlink modified 22 months ago • written 22 months ago by 5heikki8.0k

Thank you..Both works perfect!!

ADD REPLYlink written 22 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: 664 users visited in the last hour