seqaln() without external muscle

Issue #637 new
Barry Grant created an issue

Lots of new users struggle with the muscle dependency for the seqaln() function. For these users in particular, how about adding something like this to the seqaln() function?

We could fall back to this if muscle is not available before the final fallback of the EBI web-services option.

# Within seqaln()

  # Use bioconductor MSA package for alignment!
  if (grepl("msa", tolower(exefile))) {

    # Write a temporty FASTA file to disc
    tf <- tempfile(pattern = "bio3d_aln",fileext = ".fasta")
    write.fasta(aln, file=tf)

    # Alignmnet and conversion for Bio3D
    res <- msa::msaMuscle(Biostrings::readAAStringSet(tf), order="input", ...)#type="protein", order="input"
    #res <- msa::msaMuscle(tf, type="protein",...)
    return( msa::msaConvert(res, type="bio3d::fasta") )
  }

This would require a dependency on the msa bioconductor package but CRAN has these so checking there should be ok...

Comments (4)

  1. Barry Grant reporter

    a quick test snippet function would look like this...

    seqaln_msa <- function(aln, exefile="msa", ...) {
    
      # Can use bioconductor MSA package for alignment!
      if (grepl("msa", tolower(exefile))) {
    
        # Write a temporty FASTA file to disc
        tf <- tempfile(pattern = "bio3d_aln",fileext = ".fasta")
        write.fasta(aln, file=tf)
    
        # Alignmnet and conversion for Bio3D
        res <- msa::msaMuscle(Biostrings::readAAStringSet(tf), order="input", ...)#type="protein", order="input"
        #res <- msa::msaMuscle(tf, type="protein",...)
        return( msa::msaConvert(res, type="bio3d::fasta") )
      }
    }
    

    With code like:

    library(bio3d)
    library(msa)
    
    URL <- "http://www.bioinf.jku.at/software/msa/HemoglobinExample.fasta"
    aln <- read.fasta(URL)
    
    seqaln_msa(aln)
    
  2. Xinqiu Yao

    This sounds very sensible. I suggest make the amendment and then upload a new patch to cran. Note that we have some bugfixes that haven't released yet and so probably the time to release a new patch version.

  3. Barry Grant reporter

    Great!

    We would need to add msa to the Imports list in our DESCRIPTION file (or maybe Suggests). Not sure about Biostrings.

  4. Log in to comment