Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert DNAbin to DNAStringSet?

I am trying to get an alignment in ape from R with this code:

library(muscle)
#https://bioconductor.org/packages/release/bioc/html/muscle.html 

muscle(x, exec = "muscle", MoreArgs = "", quiet = TRUE)

but the console says:

 Error in muscle(x, exec = "muscle", MoreArgs = "",  : 
input must be an object of class XStringSet: DNAStringSet, RNAStringSet, or AAStringSet
like image 996
REHA42 Avatar asked Dec 15 '25 05:12

REHA42


1 Answers

You can convert any DNAbin to DNAStringSet by

library(magrittr)

yourDNAbin %>% as.character %>% lapply(.,paste0,collapse="") %>% unlist %>% DNAStringSet

if your DNAbin is: xxx DNA sequences in binary format stored in a list. If it is stored in a matrix as.list it first.

like image 173
user5878028 Avatar answered Dec 16 '25 22:12

user5878028



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!