Concatenate two fasta file having same header name with different sequence
Hey everyone , i have two fasta files having same header with different sequence content. i have to merge both files. i want to write a script in perl or bioperl . file1:
sang123 ATGCGTA
file2:
sang123 ATTTGGCCC
FIXED STRING = 10 N between both the sequence
expected result
sang123 ATGCGTANNNNNNNNNNNNNNNNNNNATTGGCCC
Need help as i am trying to resolve a problem from past 1 week but couldn't found any solution. please help me .
• 1,323 views
•
link
2 answers
Assuming that 1) the files are sorted; 2) there are no pairless headers; 3) there are no linebreaks in sequences:
cat file1.fa
>sang123
ATGCGTA
>another
ABCD
cat file2.fa
>sang123
ATTTGGCCC
>another
EFGH
paste -d $'\t' <(paste -d $'\t' - - <file1.fa) <(paste -d $'\t' - - <file2.fa) | awk 'BEGIN{FS="\t";OFS="\n"}{print $1,$2"NNNNNNNNNN"$4}'
>sang123
ATGCGTANNNNNNNNNNATTTGGCCC
>another
ABCDNNNNNNNNNNEFGH
• 0 views
•
link
thank you. but i need a perl script for my query . if you can i really appreciate.
• 0 views
•
link
Log in to answer this question.