sh
micromamba run -n yapc_env yapc -h
micromamba run -n yapc_env yapc atac wt Share/ATAC/ATAC_rep1.bw Share/ATAC/ATAC_rep2.bwWe will investigate two datasets from the Koszul lab, generated in 2024 and published in Science.
yapc package to see how to annotate peaks with yapc.bw files.#::: {.callout-note icon=‘true’}
yapc has been installed in a separate micromamba environment, because it is incompatible with other tools we will use in the workshop. We will use it to annotate ATAC-seq peaks.
:::
sh
micromamba run -n yapc_env yapc -h
micromamba run -n yapc_env yapc atac wt Share/ATAC/ATAC_rep1.bw Share/ATAC/ATAC_rep2.bwIGV the peak sets generated with different p-value thresholds.*d2smooth.bw track. Can you understand how the peaks are identified?rtacklayer package to see how to import a bed file in R.Rsamtools package to see how to create a connection to disk-stored bam files.GenomicAlignments package documentation to see how to import fragments from a BamFile connection.bam column to recover is isize (insert size).R
library(GenomicAlignments)
library(purrr)
param <- ScanBamParam(
flag=scanBamFlag(
isPaired = TRUE,
isProperPair = TRUE,
isDuplicate = FALSE,
isSecondaryAlignment = FALSE
),
mapqFilter = 20,
what = c("isize")
)
atac_frags <- map(atac_bam, readGAlignmentPairs, param = param)
atac_fragsGRanges with the as function.peaks.:::. {.callout-answer .icon .callout-note collapse=true}
R
mnase_bam <- BamFile('Share/MNase/MNase_20_filtered_sorted.bam')
mnase_frags <- readGAlignmentPairs(mnase_bam, param = param)
mnase_frags <- as(mnase_frags, "GRanges")
df_mnase <- as_tibble(mnase_frags) |>
group_by(width) |>
tally()
df2 <- rbind(
df |> mutate(type = 'ATAC-seq'),
df_mnase |> mutate(type = 'MNase-seq')
) |>
group_by(type) |>
mutate(n = n / sum(n))
ggplot(df2, aes(x = width, y = n, color = type)) +
geom_line() +
xlim(c(0, 600)) +
theme_bw():::
R
peaks <- plyranges::add_nearest_distance(peaks, tss)
df <- as_tibble(peaks)
quantile(df$distance, probs = c(0.1, 0.25, 0.5, 0.75, 0.9))
p <- ggplot(df, aes(x = distance)) +
geom_density(fill = 'lightblue', alpha = 0.5) +
xlim(c(0, 1000)) +
theme_bw()