I have seven fasta files, one per gene, with more than 400 fasta entries per file, like this: Input:
Gene1.fasta
>1721_1 gene name
ATG
>10_14 gene name
GTT
Gene2.fasta
>1721_1 gene name
TGA
>10_14 gene name
GAT
Output:
>1721_1
ATGTGA
>10_14
GTTGAT
What I want to do is create one fasta (continuously) file containing seven genes per sample. As you can see, the sample name is not the same before the _ in the fasta headers.
Is there any way to do this with awk or other command-line tools? Thank you very much.
cat Gene*.fasta > all_genes.fasta
? $\endgroup$samtools faidx
to pull the sample's gene out of each file, and then removing the header. It will ignore anything after whitespace so gene name after space should not be problem. You could iterate across sample names in a bash loop. Of course, it requires that every sample have every gene. $\endgroup$