[Seqinr-forum] fasta sorting?

Jean Lobry jean.lobry at univ-lyon1.fr
Fri Feb 10 17:37:24 CET 2023


Here is an example:

library(seqinr)
# Toy example
writeLines(">C\nCCCC\n>B\nTTTT\n>A\nAAAA\n", "threeProt.fasta")

# Import fasta file
myseqs <- read.fasta("threeProt.fasta")

# Put them in protein name alphabetic order
myseqs <- myseqs[order(getName(myseqs))]

# Write the result in a FASTA file
write.fasta(getSequence(myseqs), names(myseqs), "threeProtOrdered.fasta")

Best,
JLO


Le 07/02/2023 à 18:00, Melody Young a écrit :
> Hi there!
> 
> Thank you for this package. I was wondering if there was any way to sort 
> a fasta file using the name of each protein.
> 
> Thanks.
> 
> Best regards,
> 
> Melody Young
> GS2
> 
> 
> _______________________________________________
> Seqinr-forum mailing list
> Seqinr-forum at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/seqinr-forum



More information about the Seqinr-forum mailing list