This is a test version of Biostars. For the public version, visit https://www.biostars.org.
how to sort protein and nucleotide sequences based on IDs

I have a protein alignment file in fasta format and nucleotide sequences of the original proteins. How can I sort my nucleotide sequences such that their IDs match that of the alignment file, Assuming my protein sequences looks like:

>Seq1
MYHLGQGDPEPDIN
>Seq2
MYGGQGDPEPYIN
>Seq3
MYHLHQGDPEPD
>Seq4
TYHLGQGDPEPDIN

Here are the corresponding nucleotides:

>Seq1
ACTTTTGATACAATTAACAGGACGAAAATAATAGAAAAGCTAAAGCATCTTAGAATCCCA
>Seq2
AATCCCAGACAAATTAAGACATATTCTAACAGTGAGTCTACAGAACACAGAACACTATAG
>Seq3
AGTTTTGCAATGGTAAATTATTTTGAAGAGTTTATAGGTCGTGTCTGGAACTGCAATTAT
>Seq4
TGGAATATTAGACGAATTCCATACACAGCACCTATTGTAATATTCATAGATTTCAAAAGC

Assuming my protein alignment looks like this:

>Seq4
MYHLG-QGDPEPDIN
>Seq2
MYGGQG-DPEPY-IN
>Seq1
MYHLHQ--GDPEP-D
>Seq3
--TYHLGQGDPEPDIN

How do I get my nucleotide sequences to now look like:

>Seq4
TGGAATATTAGACGAATTCCATACACAGCACCTATTGTAATATTCATAGATTTCAAAAGC
>Seq2
AATCCCAGACAAATTAAGACATATTCTAACAGTGAGTCTACAGAACACAGAACACTATAG
>Seq1
ACTTTTGATACAATTAACAGGACGAAAATAATAGAAAAGCTAAAGCATCTTAGAATCCCA
>Seq3
AGTTTTGCAATGGTAAATTATTTTGAAGAGTTTATAGGTCGTGTCTGGAACTGCAATTAT

Especially when I have many sequences thanks

fasta

Hello Kay!

I think you have already received an answer in the other thread you had started earlier today: how to change the sequence ID and order of sequences in a file to match an alignment output file We can reopen this question if you can demonstrate that it is substantially different.

For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.

If you disagree please tell us why in a reply below, we'll be happy to talk about it.

Cheers!

0 answers

No answers yet.

Log in to answer this question.