Alphabetizing fasta sequence
3
1
Entering edit mode
7.5 years ago
stacy734 ▴ 40

Hi everyone,

Can someone suggest a method to sort a fasta file by alphabetical order of the sequence (not the defline)?

Any advice will be appreciated.

fasta • 3.4k views
ADD COMMENT
1
Entering edit mode

Do you have a multi-line or single line fasta?

ADD REPLY
1
Entering edit mode

Thank you all!

Stacy

ADD REPLY
1
Entering edit mode

it it answer your question, please choose a green mark on the left to close this thead.

ADD REPLY
3
Entering edit mode
7.5 years ago

Using the BBMap package:

shuffle.sh in=file.fasta out=sorted.fasta sequence
ADD COMMENT
2
Entering edit mode
7.5 years ago

linearize and sort...

awk '/^>/ {printf("%s%s\t",(N>0?"\n":""),$0);N++;next;} {printf("%s",$0);} END {printf("\n");}'  roxan.fasta |LC_ALL=C sort -t $'\t' -k2,2 | tr "\t" "\n"
ADD COMMENT
2
Entering edit mode
7.5 years ago
seqkit sort --quiet -s -i <fasta file>

i is ignore case s is sort by sequence

ADD COMMENT

Login before adding your answer.

Traffic: 1877 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6