R/clust2fasta.R

Defines functions clust2fasta

Documented in clust2fasta

#' @title Export sequences of TEs belonging to the same cluster
#' @description Export sequences of TEs belonging to the same cluster to separate fasta files.
#' Each cluster will be stored in an individual fasta file.
#' @param LTRpred.tbl \code{data.frame} generated by \code{\link{LTRpred}}.
#' @param seqs path to the fasta file storing the TE sequences.
#' @author Hajk-Georg Drost
#' @seealso \code{\link{LTRpred}}, \code{\link{cluster.members}}
#' @export

clust2fasta <- function(LTRpred.tbl, seqs){
     
     cl <- names(table(LTRpred.tbl$Clust_Cluster))
     cl <- cl[-which(cl == "unique")]
     
  for (i in seq_along(cl)) {
      
      pred2fasta(
          cluster.members(LTRpred.tbl, cl[i]),
          seqs,
          paste0(cl[i],".fa")
      )
  }
 }
HajkD/LTRpred documentation built on April 22, 2022, 4:35 p.m.