This is a test version of Biostars. For the public version, visit https://www.biostars.org.
FASTA File Concatenation

Hello, I am a beginner in bioinformatics and I am currently doing gene mapping of viral RNA sequences. And I have the following question:

How can I concatenate several FASTA files without losing the ID of each one?

These files are located in different folders.

I hope you can help me, thank you very much.

bash fasta

what do you mean with concatenate ? concatenate the files or the entries ?

I want to concatenate the input FASTA files.

How can I concatenate several FASTA files without losing the ID of each one?

If you are referring to not losing the fasta header inside each file then that would not happen when you cat the files together. But you will end up with a single fasta file after this operation.

1 answer

find  dir1 dir2 dir3 -type f \( -name "*.fa" -o -name "*.fasta" \) -exec cat '{}' ';'

It might be a little safer to do.

find  dir1 dir2 dir3 -type f \( -name "*.fa" -o -name "*.fasta" \) -not -name 'concat.fasta' -exec cat '{}' > 'concat.fasta' '+'

Thank you very much it helped me a lot.

Log in to answer this question.