How to swap fasta entrys in a fasta file?
Hi, my files all have 2 fasta entries and they look like:
>ID.1
GTAACACGACATCCTGCAGGGTTAAAAAAGAAAAAATCAGTAAAAGTACTGGA
>ID.2
GGAATACCACATCCCGCAGGGTTAAAAAAGAAAAAATCAGTAACAGTACTGGA
My desired output looks like:
>ID.2
GGAATACCACATCCCGCAGGGTTAAAAAAGAAAAAATCAGTAACAGTACTGGA
>ID.1
GTAACACGACATCCTGCAGGGTTAAAAAAGAAAAAATCAGTAAAAGTACTGGA
I have looked into awk/sed and the only solutions involve cutting/pasting rows into a sperate file and then moving them back, is there an alternative way?
• 1,072 views
•
link
2 answers
Seqkit answer for posterity.
seqkit sort -r in.fasta > out.fasta
• 0 views
•
link
awk -F'\n' '{print $3, $4, $1, $2}' OFS='\n' RS= ORS='\n\n' $i
• 0 views
•
link
Log in to answer this question.