#' @title Format LTR prediction data to BED file format
#' @description This function formats the LTR prediction \code{\link{data.frame}}
#' generated by \code{\link{LTRharvest}}, \code{\link{LTRdigest}}, or \code{\link{LTRpred}}
#' to a \code{\link{data.frame}} in \code{BED} file format.
#' @param LTR.data the LTR prediction \code{\link{data.frame}}
#' generated by \code{\link{LTRharvest}}, \code{\link{LTRdigest}}, or \code{\link{LTRpred}}.
#' @param output filename of the output BED file.
#' @author Hajk-Georg Drost
#' @details
#' The BED file format is defined by: chromosome; start; end; name; columns.
#' @examples
#' gff.file <- system.file("TAIR10_chr_all_LTRdigestPrediction.gff",
#' package = "LTRpred")
#' tabout.file <- system.file("TAIR10_chr_all-ltrdigest_tabout.csv"
#' ,package = "LTRpred")
#' LTRfile <- read.prediction(gff.file,tabout.file, program = "LTRdigest")
#'
#' # generate BED file
#' pred2bed(LTRfile$ltr.retrotransposon)
#'
#' @references http://www.ensembl.org/info/website/upload/bed.html
#' @export
pred2bed <- function(LTR.data, output = "output"){
res <- dplyr::data_frame(chromosome = LTR.data$chromosome,
start = LTR.data$start,
end = LTR.data$end,
name = LTR.data$ID)
utils::write.table(res,output, sep = "\t", quote = FALSE, col.names = FALSE, row.names = FALSE)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.