This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How can I split the names and a. acid sequences of certain organisms into columns in the fasta file I have?

My fasta file:

>H_sapiens_ [Homo sapiens]
MANGTADVR
>P_troglodytes_[Pan troglodytes]
MANGTADV
>C_elegans_  [Caenorhabditis elegans]
MSSDSKDQ

I'm trying to get a table like this by pulling codes that are only c.elegance and human.

H_sapiens_ [Homo sapiens].                             C_elegans_  [Caenorhabditis elegans]
    M                                                                                 M
    A                                                                                 S
    N                                                                                 S
programming r table

1 answer

Since you are not interested in main sequence, just grep line with the names:

grep "H_sapiens_" your.fasta > output1.txt 
grep "C_elegans_" your.fasta > output2.txt

Then merge two files:

cat output1.txt output2.txt > output_final.txt

Log in to answer this question.