In this demo, we will see how it is possible to use metagene to extract the genomic profiles from bam files.
We will work with the following bam files:
bam_files <- c(system.file("extdata/H3K4me1.bam", package = "ProfilesMetagene"), system.file("extdata/H3K27ac.bam", package = "ProfilesMetagene"))
We will use the following regions:
regions <- system.file("extdata/tidy_enhancers.txt", package = "ProfilesMetagene") regions <- read.table(regions, header = TRUE) regions <- makeGRangesFromDataFrame(regions, start.field = "chromStart", end.field = "chromEnd") width(regions) <- 1000
We also need to make sure the seqlevels
of the regions match the seqlevels
of the bam files:
seqlevels(regions, force = TRUE) <- seqlevels(Rsamtools::BamFile(bam_files[1]))
suppressMessages(library(metagene)) mg <- metagene$new(regions = regions, bam_files = bam_files, cores = 2)
profiles <- mg$coverages
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.