#' Convert bedtools object to dataframe
#' @param obj A bedtools object that points to a file, and should have been generated by the bedtools command
#' @return A data.frame
#' @export
to_data_frame <- function(obj){
if(!is.bt_obj(obj)) stop('Can only convert an object to a data frame')
location <- unclass(obj)
df <- suppressMessages(suppressWarnings(fread(file = location, header = F, sep = '\t')))
if(nrow(df) != 0){ colnames(df) <- paste0('X', 1:ncol(df))}
return(df)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.