Skip to content

Commit

Permalink
Added support for XStringSet in msaplot
Browse files Browse the repository at this point in the history
  • Loading branch information
yasche committed Sep 13, 2024
1 parent 01b29ef commit a710718
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions R/msaplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@ msaplot <- function(p, fasta, offset=0, width=1, color=NULL, window=NULL, bg_lin
x <- fasta
} else if (is(fasta, "character")) {
x <- treeio::read.fasta(fasta)
} else if (is(fasta, "BStringSet")) {
if (requireNamespace("Biostrings", quietly = TRUE) == TRUE) {
temp_fasta <- tempfile("temp_fasta", fileext = ".fasta")
Biostrings::writeXStringSet(fasta, temp_fasta)

x <- treeio::read.fasta(temp_fasta)
} else {
stop("object is of class 'BStringSet' but library 'Biostrings' is not installed...\n-> please install 'Biostrings' from https://bioconductor.org/packages/Biostrings for handling objects of type 'BStringSet'.")
}
} else if (is(fasta, "DNAStringSet")) {
x <- ape::as.DNAbin(fasta)
} else if (is(fasta, "AAStringSet")) {
x <- ape::as.AAbin(fasta)
} else {
x <- NULL
}
Expand Down

0 comments on commit a710718

Please sign in to comment.