Last updated: 2024-03-06

Checks: 7 0

Knit directory: ATAC_learning/

This reproducible R Markdown analysis was created with workflowr (version 1.7.1). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.


Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.

Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.

The command set.seed(20231016) was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.

Great job! Recording the operating system, R version, and package versions is critical for reproducibility.

Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.

Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.

Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.

The results in this page were generated with repository version 2ffc80a. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.

Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:


Ignored files:
    Ignored:    .Rhistory
    Ignored:    .Rproj.user/
    Ignored:    analysis/figure/
    Ignored:    data/Ind1_75DA24h_dedup_peaks.csv
    Ignored:    data/Ind1_TSS_peaks.RDS
    Ignored:    data/Ind1_firstfragment_files.txt
    Ignored:    data/Ind1_fragment_files.txt
    Ignored:    data/Ind1_peaks_list.RDS
    Ignored:    data/Ind1_summary.txt
    Ignored:    data/Ind2_TSS_peaks.RDS
    Ignored:    data/Ind2_fragment_files.txt
    Ignored:    data/Ind2_peaks_list.RDS
    Ignored:    data/Ind2_summary.txt
    Ignored:    data/Ind3_TSS_peaks.RDS
    Ignored:    data/Ind3_fragment_files.txt
    Ignored:    data/Ind3_peaks_list.RDS
    Ignored:    data/Ind3_summary.txt
    Ignored:    data/Ind4_79B24h_dedup_peaks.csv
    Ignored:    data/Ind4_TSS_peaks.RDS
    Ignored:    data/Ind4_V24h_fraglength.txt
    Ignored:    data/Ind4_fragment_files.txt
    Ignored:    data/Ind4_fragment_filesN.txt
    Ignored:    data/Ind4_peaks_list.RDS
    Ignored:    data/Ind4_summary.txt
    Ignored:    data/Ind5_TSS_peaks.RDS
    Ignored:    data/Ind5_fragment_files.txt
    Ignored:    data/Ind5_fragment_filesN.txt
    Ignored:    data/Ind5_peaks_list.RDS
    Ignored:    data/Ind5_summary.txt
    Ignored:    data/Ind6_TSS_peaks.RDS
    Ignored:    data/Ind6_fragment_files.txt
    Ignored:    data/Ind6_peaks_list.RDS
    Ignored:    data/Ind6_summary.txt
    Ignored:    data/aln_run1_results.txt
    Ignored:    data/anno_ind1_DA24h.RDS
    Ignored:    data/anno_ind4_V24h.RDS
    Ignored:    data/first_Peaksummarycounts.csv
    Ignored:    data/ind1_DA24hpeaks.RDS
    Ignored:    data/ind4_V24hpeaks.RDS
    Ignored:    data/initial_complete_stats_run1.txt
    Ignored:    data/multiqc_fastqc_run1.txt
    Ignored:    data/multiqc_fastqc_run2.txt
    Ignored:    data/multiqc_genestat_run1.txt
    Ignored:    data/multiqc_genestat_run2.txt
    Ignored:    data/peakAnnoList_1.RDS
    Ignored:    data/peakAnnoList_2.RDS
    Ignored:    data/peakAnnoList_3.RDS
    Ignored:    data/peakAnnoList_4.RDS
    Ignored:    data/peakAnnoList_5.RDS
    Ignored:    data/peakAnnoList_6.RDS
    Ignored:    data/trimmed_seq_length.csv

Untracked files:
    Untracked:  code/just_for_Fun.R
    Untracked:  splited/

Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.


These are the previous versions of the repository in which changes were made to the R Markdown (analysis/Peak_calling.Rmd) and HTML (docs/Peak_calling.html) files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view the files as they were in that past version.

File Version Author Date Message
Rmd 2ffc80a reneeisnowhere 2024-03-06 updates to peak calling
html 8999d6a reneeisnowhere 2024-03-04 Build site.
Rmd 4b83ab1 reneeisnowhere 2024-03-04 adding in read progression
html 9a1e500 reneeisnowhere 2024-03-04 Build site.
Rmd d61bef5 reneeisnowhere 2024-03-04 updating Peak info
html 8ff3334 reneeisnowhere 2024-03-04 Build site.
Rmd 05933d7 reneeisnowhere 2024-03-04 updates to Ind4 and Ind5 fragment lengths, beginning Peak analysis
html 3538b64 reneeisnowhere 2024-03-01 Build site.
Rmd 3a404bd reneeisnowhere 2024-03-01 adding basic graphs of reads and reordering others
html 0cced72 reneeisnowhere 2024-02-29 Build site.
Rmd 6e496d2 reneeisnowhere 2024-02-29 adding fragment files from all samples
html 4bfdef9 reneeisnowhere 2024-02-27 Build site.
Rmd 0a26679 reneeisnowhere 2024-02-27 adding in the the reads data
html 3d2aa7b reneeisnowhere 2024-02-27 Build site.
Rmd 1a8126f reneeisnowhere 2024-02-27 adding the peak-calling files

library(tidyverse)
# library(ggsignif)
# library(cowplot)
# library(ggpubr)
# library(scales)
# library(sjmisc)
library(kableExtra)
# library(broom)
# library(biomaRt)
library(RColorBrewer)
# library(gprofiler2)
# library(qvalue)
library(ChIPseeker)
library("TxDb.Hsapiens.UCSC.hg38.knownGene")
library("org.Hs.eg.db")
library(ATACseqQC)
drug_pal_fact <- c("#8B006D","#DF707E","#F1B72B", "#3386DD","#707031","#41B333")
txdb <- TxDb.Hsapiens.UCSC.hg38.knownGene

loadFile_peakCall <- function(){
 file <- choose.files()
 file <- readPeakFile(file, header = FALSE)
 return(file)
}

prepGRangeObj <- function(seek_object){
 seek_object$Peaks = seek_object$V4
 seek_object$level = seek_object$V5
 seek_object$V4 = seek_object$V5 = NULL
 return(seek_object)
}
TSS = getBioRegion(TxDb=txdb, upstream=3000, downstream=3000, by = "gene", 
                   type = "start_site")

# ind4_V24hpeaks <- readRDS("data/ind4_V24hpeaks.RDS")
# ind1_DA24hpeaks <- readRDS("data/ind1_DA24hpeaks.RDS")
# anno_ind4_V24h <- readRDS("data/anno_ind4_V24h.RDS")
# anno_ind1_DA24h <- readRDS("data/anno_ind1_DA24h.RDS")


Ind1_summary  <- read.csv("data/Ind1_summary.txt", row.names = 1) %>% 
  rename(X1="sample",X2="reads",X3="mapped")
Ind2_summary  <- read.csv("data/Ind2_summary.txt", row.names = 1)%>% 
  rename(X1="sample",X2="reads",X3="mapped")
Ind3_summary  <- read.csv("data/Ind3_summary.txt", row.names = 1)%>% 
  rename(X1="sample",X2="reads",X3="mapped")
Ind4_summary  <- read.csv("data/Ind4_summary.txt", row.names = 1)%>% 
  rename(X1="sample",X2="reads",X3="mapped")
Ind5_summary  <- read.csv("data/Ind5_summary.txt", row.names = 1)%>% 
  rename(X1="sample",X2="reads",X3="mapped")
Ind6_summary  <- read.csv("data/Ind6_summary.txt", row.names = 1)%>% 
  rename(X1="sample",X2="reads",X3="mapped")

This specific page so far contains the QC analysis after calling peaks using MACS2.

Primary scripts used for ATAC data preprocesing will be linked here in the future:

  •  Currently the steps were are as follows:

    • Basic Fastqc followed by adapter trimming and Fastqc analysis on the leftover fragments.

    • Trimmed reads were aligned to the hg38 human genome.

    • Mitochondrial reads (chrM) were removed

    • samtools was used to removed non-paired, discordantly paired, and multi-mapped reads from the .bam.

    • Markduplicates function from Picard was used to mark optical and PCR duplicates, with samtools used to remove these reads using the flag -F 1024.

    • MACS2 was used to call peaks, with QC of the peak files below.

Initial read summary is found at this LINK

Individual 1 fragment files:

Ind1_frag_files <- read.csv("data/Ind1_fragment_files.txt", row.names = 1)
Ind1_firstfrag_files <- read.csv("data/Ind1_firstfragment_files.txt", row.names = 1)
Ind1_frag_files %>% 
  mutate(trt=factor(trt, levels=c("DX","E","DA","M","T","V"), labels = c("DOX","EPI","DNR","MTX","TRZ","VEH"))) %>% 
  dplyr::filter(time =="3h") %>%
  ggplot(., aes(y=counts, x=frag_size, group=trt))+
  # geom_line(aes(col=trt, alpha = 0.5, linewidth=1 ))+
  geom_line(aes(col=trt))+
  ggtitle("Individual 1\n3 hour fragment sizes")+
  theme_classic()+
   facet_wrap(~trt)+
  scale_color_manual(values=drug_pal_fact)+
  coord_cartesian(ylim=c(0,300000))

Version Author Date
8ff3334 reneeisnowhere 2024-03-04
3538b64 reneeisnowhere 2024-03-01
0cced72 reneeisnowhere 2024-02-29
Ind1_firstfrag_files %>% 
  mutate(trt=factor(trt, levels=c("DX","E","DA","M","T","V"), labels = c("DOX","EPI","DNR","MTX","TRZ","VEH"))) %>% 
  dplyr::filter(time =="3h") %>%
  ggplot(., aes(y=(counts), x=(frag_size), group=trt))+
  # geom_line(aes(col=trt, alpha = 0.5, linewidth=1 ))+
  geom_line(aes(col=trt))+
  ggtitle("Individual 1\n3 hour fragment sizes")+
  theme_classic()+
   facet_wrap(~trt)+
  scale_color_manual(values=drug_pal_fact)+
  coord_cartesian(xlim=c(0,1000))

Version Author Date
8ff3334 reneeisnowhere 2024-03-04
3538b64 reneeisnowhere 2024-03-01
0cced72 reneeisnowhere 2024-02-29
# 

Ind1_frag_files %>% 
  mutate(trt=factor(trt, levels=c("DX","E","DA","M","T","V"), labels = c("DOX","EPI","DNR","MTX","TRZ","VEH"))) %>% 
  dplyr::filter(time =="24h") %>%
  ggplot(., aes(y=(counts), x=frag_size, group=trt))+
  geom_line(aes(col=trt))+
  ggtitle("Individual 1\n24 hour fragment sizes")+
  theme_classic()+
  facet_wrap(~trt)+
  scale_color_manual(values=drug_pal_fact)#+

  # coord_cartesian(ylim=c(0,300000))



Ind1_firstfrag_files %>% 
  mutate(trt=factor(trt, levels=c("DX","E","DA","M","T","V"), labels = c("DOX","EPI","DNR","MTX","TRZ","VEH"))) %>% 
  dplyr::filter(time =="24h") %>%
  ggplot(., aes(y=(counts), x=(frag_size), group=trt))+
  # geom_line(aes(col=trt, alpha = 0.5, linewidth=1 ))+
  geom_line(aes(col=trt))+
  ggtitle("Individual 1\n3 hour fragment sizes")+
  theme_classic()+
   facet_wrap(~trt)+
  scale_color_manual(values=drug_pal_fact)+
  coord_cartesian(xlim=c(0,1000))

# 

Individual 2 fragment files:

Ind2_frag_files <- read.csv("data/Ind2_fragment_files.txt", row.names = 1)
Ind2_frag_files %>% 
  mutate(trt=factor(trt, levels=c("DX","E","DA","M","T","V"), labels = c("DOX","EPI","DNR","MTX","TRZ","VEH"))) %>% 
  dplyr::filter(time =="3h") %>%
  ggplot(., aes(y=counts, x=frag_size, group=trt))+
  # geom_line(aes(col=trt, alpha = 0.5, linewidth=1 ))+
  geom_line(aes(col=trt))+
  ggtitle("Individual 2\n3 hour fragment sizes")+
  theme_classic()+
   facet_wrap(~trt)+
  scale_color_manual(values=drug_pal_fact)

Version Author Date
3538b64 reneeisnowhere 2024-03-01
0cced72 reneeisnowhere 2024-02-29
Ind2_frag_files %>% 
  mutate(trt=factor(trt, levels=c("DX","E","DA","M","T","V"), labels = c("DOX","EPI","DNR","MTX","TRZ","VEH"))) %>% 
  dplyr::filter(time =="24h") %>%
  ggplot(., aes(y=counts, x=frag_size, group=trt))+
  geom_line(aes(col=trt))+
  ggtitle("Individual 2\n24 hour fragment sizes")+
  theme_classic()+
  facet_wrap(~trt)+
  scale_color_manual(values=drug_pal_fact)

Version Author Date
3538b64 reneeisnowhere 2024-03-01
0cced72 reneeisnowhere 2024-02-29

Individual 3 fragment files:

Ind3_frag_files <- read.csv("data/Ind3_fragment_files.txt", row.names = 1)
Ind3_frag_files %>% 
  mutate(trt=factor(trt, levels=c("DX","E","DA","M","T","V"), labels = c("DOX","EPI","DNR","MTX","TRZ","VEH"))) %>% 
  dplyr::filter(time =="3h") %>%
  ggplot(., aes(y=counts, x=frag_size, group=trt))+
  # geom_line(aes(col=trt, alpha = 0.5, linewidth=1 ))+
  geom_line(aes(col=trt))+
  ggtitle("Individual 3\n3 hour fragment sizes")+
  theme_classic()+
   facet_wrap(~trt)+
  scale_color_manual(values=drug_pal_fact)

Version Author Date
3538b64 reneeisnowhere 2024-03-01
0cced72 reneeisnowhere 2024-02-29
Ind3_frag_files %>% 
  mutate(trt=factor(trt, levels=c("DX","E","DA","M","T","V"), labels = c("DOX","EPI","DNR","MTX","TRZ","VEH"))) %>% 
  dplyr::filter(time =="24h") %>%
  ggplot(., aes(y=counts, x=frag_size, group=trt))+
  geom_line(aes(col=trt))+
  ggtitle("Individual 3\n24 hour fragment sizes")+
  theme_classic()+
  facet_wrap(~trt)+
  scale_color_manual(values=drug_pal_fact)

Version Author Date
3538b64 reneeisnowhere 2024-03-01
0cced72 reneeisnowhere 2024-02-29

Individual 4 fragment files:

Ind4_frag_files <- read.csv("data/Ind4_fragment_files.txt", row.names = 1)
Ind4_frag_files %>% 
  mutate(trt=factor(trt, levels=c("DX","E","DA","M","T","V"), labels = c("DOX","EPI","DNR","MTX","TRZ","VEH"))) %>% 
  dplyr::filter(time =="3h") %>%
  ggplot(., aes(y=counts, x=frag_size, group=trt))+
  geom_line(aes(col=trt ))+
  ggtitle("Individual 4\n3 hour fragment sizes")+
  theme_classic()+
   facet_wrap(~trt)+
  scale_color_manual(values=drug_pal_fact)

Version Author Date
3538b64 reneeisnowhere 2024-03-01
0cced72 reneeisnowhere 2024-02-29
3d2aa7b reneeisnowhere 2024-02-27
Ind4_frag_files %>% 
  mutate(trt=factor(trt, levels=c("DX","E","DA","M","T","V"), labels = c("DOX","EPI","DNR","MTX","TRZ","VEH"))) %>% 
  dplyr::filter(time =="24h") %>%
  ggplot(., aes(y=counts, x=frag_size, group=trt))+
  geom_line(aes(col=trt ))+
  ggtitle("Individual 4\n24 hour fragment sizes")+
  theme_classic()+
   facet_wrap(~trt)+
  scale_color_manual(values=drug_pal_fact)

Version Author Date
3538b64 reneeisnowhere 2024-03-01
0cced72 reneeisnowhere 2024-02-29
3d2aa7b reneeisnowhere 2024-02-27

Individual 5 fragment files:

Ind5_frag_files <- read.csv("data/Ind5_fragment_files.txt", row.names = 1)
Ind5_frag_files %>% 
  mutate(trt=factor(trt, levels=c("DX","E","DA","M","T","V"), labels = c("DOX","EPI","DNR","MTX","TRZ","VEH"))) %>% 
  dplyr::filter(time =="3h") %>%
  ggplot(., aes(y=counts, x=frag_size, group=trt))+
  # geom_line(aes(col=trt, alpha = 0.5, linewidth=1 ))+
  geom_line(aes(col=trt))+
  ggtitle("Individual 5\n3 hour fragment sizes")+
  theme_classic()+
   facet_wrap(~trt)+
  scale_color_manual(values=drug_pal_fact)

Version Author Date
8ff3334 reneeisnowhere 2024-03-04
3538b64 reneeisnowhere 2024-03-01
0cced72 reneeisnowhere 2024-02-29
Ind5_frag_files %>% 
  mutate(trt=factor(trt, levels=c("DX","E","DA","M","T","V"), labels = c("DOX","EPI","DNR","MTX","TRZ","VEH"))) %>% 
  dplyr::filter(time =="24h") %>%
  ggplot(., aes(y=counts, x=frag_size, group=trt))+
  geom_line(aes(col=trt))+
  ggtitle("Individual 5\n24 hour fragment sizes")+
  theme_classic()+
  facet_wrap(~trt)+
  scale_color_manual(values=drug_pal_fact)

Version Author Date
8ff3334 reneeisnowhere 2024-03-04
3538b64 reneeisnowhere 2024-03-01
0cced72 reneeisnowhere 2024-02-29

Individual 6 fragment files:

Ind6_frag_files <- read.csv("data/Ind6_fragment_files.txt", row.names = 1)
Ind6_frag_files %>% 
  dplyr::filter(time =="3h") %>%
  mutate(trt=factor(trt, levels=c("DX","E","DA","M","T","V"), labels = c("DOX","EPI","DNR","MTX","TRZ","VEH"))) %>% 
  ggplot(., aes(y=counts, x=frag_size, group=trt))+
  # geom_line(aes(col=trt, alpha = 0.5, linewidth=1 ))+
  geom_line(aes(col=trt))+
  ggtitle("Individual 6\n3 hour fragment sizes")+
  theme_classic()+
   facet_wrap(~trt)+
  scale_color_manual(values=drug_pal_fact)

Version Author Date
3538b64 reneeisnowhere 2024-03-01
0cced72 reneeisnowhere 2024-02-29
Ind6_frag_files %>% 
  dplyr::filter(time =="24h") %>%
  mutate(trt=factor(trt, levels=c("DX","E","DA","M","T","V"), labels = c("DOX","EPI","DNR","MTX","TRZ","VEH"))) %>% 
  ggplot(., aes(y=counts, x=frag_size, group=trt))+
  geom_line(aes(col=trt))+
  ggtitle("Individual 6\n24 hour fragment sizes")+
  theme_classic()+
  facet_wrap(~trt)+
  scale_color_manual(values=drug_pal_fact)

Version Author Date
3538b64 reneeisnowhere 2024-03-01
0cced72 reneeisnowhere 2024-02-29

Peak data

##collecting summary files

# Ind1_peaksummary <- read_table("~/ATAC_downloads/Ind1/trimmed/macs_output/Ind1_peaksummary.txt",
#     col_names = FALSE) %>%
#   rename(X1 ="counts", X2= "sample")
# Ind2_peaksummary <- read_table("~/ATAC_downloads/Ind2/trimmed/macs_output/Ind2_peaksummary.txt",
#     col_names = FALSE)%>%
#   rename(X1 ="counts", X2= "sample")
# Ind3_peaksummary <- read_table("~/ATAC_downloads/Ind3/trimmed/macs_output/Ind3_peaksummary.txt",
#     col_names = FALSE)%>%
#   rename(X1 ="counts", X2= "sample")
# Ind4_peaksummary <- read_table("~/ATAC_downloads/Ind4/trimmed/macs_output/Ind4_peaksummary.txt",
#     col_names = FALSE)%>%
#   rename(X1 ="counts", X2= "sample")
# Ind5_peaksummary <- read_table("~/ATAC_downloads/Ind5/trimmed/macs_output/Ind5_peaksummary.txt",
#     col_names = FALSE)%>%
#   rename(X1 ="counts", X2= "sample")
# Ind6_peaksummary <- read_table("~/ATAC_downloads/Ind6/trimmed/macs_output/Ind6_peaksummary.txt",
#     col_names = FALSE)%>%
#   rename(X1 ="counts", X2= "sample")
# Peaksummary <- rbind(Ind1_peaksummary,Ind2_peaksummary,Ind3_peaksummary,Ind4_peaksummary,Ind5_peaksummary,Ind6_peaksummary)
# # 
# write.csv(Peaksummary, "data/first_Peaksummarycounts.csv")
Peaksummary <- read.csv("data/first_Peaksummarycounts.csv",row.names=1)
Peaksummary %>% 
  dplyr::filter(sample != "total") %>% 
   separate(sample, into=c(NA,"indv","sample",NA,NA,NA)) %>% 
  mutate(trt=gsub("[[:digit:]]", "",sample)) %>% 
  # mutate(trt=substr(trt,-1,2))
  mutate(time = if_else(grepl("24h$", sample) ==TRUE, "24_hours","3_hours")) %>% 
  mutate(trt = case_match(trt,"DAh"~"DNR","DXh"~"DOX","Eh"~"EPI", "Mh" ~ "MTX", "Th" ~ "TRZ", "Vh" ~"VEH",.default = trt)) %>% 
  mutate(indv = factor(indv, levels = c("Ind1", "Ind2", "Ind3", "Ind4", "Ind5", "Ind6"))) %>%
  mutate(time = factor(time, levels = c("3_hours", "24_hours"), labels= c("3 hours","24 hours"))) %>% 
  mutate(trt = factor(trt, levels =  c("DOX","EPI", "DNR", "MTX", "TRZ", "VEH")))%>% 
  ggplot(., aes(x =trt, y=counts,group=trt))+
  geom_boxplot(aes(fill= trt))+
  geom_point(aes(col=indv, size =3))+
  facet_wrap(~time)+
   scale_fill_manual(values=drug_pal_fact)+
  scale_color_brewer(palette = "Dark2")+
  ggtitle("Peak counts by treatment")+
  theme_bw()

Version Author Date
9a1e500 reneeisnowhere 2024-03-04
4bfdef9 reneeisnowhere 2024-02-27

Ind1 Peaks

# plotAnnoBar(anno_ind4_V24h, main = "Genomic Feature Distribution")+ ggtitle("Ind4 VEH 24 hour")
# plotAnnoBar(anno_ind1_DA24h, main = "Genomic Feature Distribution")+ ggtitle("Ind1 DNR 24 hour")

# ind4_V24hpeaks_gr <- prepGRangeObj(ind4_V24hpeaks)
# ind1_DA24hpeaks_gr <- prepGRangeObj((ind1_DA24hpeaks))
# Epi_list <- GRangesList(ind1_DA24hpeaks_gr, ind4_V24hpeaks_gr)
# # ##plotting the TSS average window (making an overlap of each using Epi_list as list holder)
# Epi_list_tagMatrix = lapply(Epi_list, getTagMatrix, windows = TSS)
# plotAvgProf(Epi_list_tagMatrix, xlim=c(-3000, 3000), ylab = "Count Frequency")
#plotPeakProf(Epi_list_tagMatrix, facet = "none", conf = 0.95)

## What I did here:  I called all my narrowpeak files
# peakfiles1 <- choose.files()

##these were practice for getting file names and shortening for the for loop below
# testname <- basename(peakfiles1[1])
# str_split_i(testname, "_",3)

##This loop first established a list then (because I already knew the list had 12 files)
## I then imported each of these onto that list.  Once I had the list, I stored it as
## an R object, 
# Ind1_peaks <- list()
# for (file in 1:12){
#     testname <- basename(peakfiles1[file])
#   banana_peel <- str_split_i(testname, "_",3)
#  Ind1_peaks[[banana_peel]] <- readPeakFile(peakfiles1[file])
# }
# saveRDS(Ind1_peaks, "data/Ind1_peaks_list.RDS")
# I then called annotatePeak on that list object, and stored that as a R object for later retrieval.)
# peakAnnoList_1 <- lapply(Ind1_peaks, annotatePeak, tssRegion =c(-2000,2000), TxDb= txdb)
# saveRDS(peakAnnoList_1, "data/peakAnnoList_1.RDS")

peakAnnoList_1 <- readRDS("data/peakAnnoList_1.RDS")
plotAnnoBar(peakAnnoList_1, main = "Genomic Feature Distribution")

Version Author Date
9a1e500 reneeisnowhere 2024-03-04
# saveRDS(Epi_list_tagMatrix, "data/Ind1_TSS_peaks.RDS")

Ind1_TSS_peaks_plot <- readRDS("data/Ind1_TSS_peaks.RDS")

# Epi_list_tagMatrix = lapply(Ind1_peaks, getTagMatrix, windows = TSS)

plotAvgProf(Ind1_TSS_peaks_plot[c(1,3,5,7,9,11)], xlim=c(-3000, 3000), ylab = "Count Frequency")+ ggtitle("3 hour Individual 1" )
>> plotting figure...            2024-03-06 2:55:44 PM 

Version Author Date
9a1e500 reneeisnowhere 2024-03-04
plotAvgProf(Ind1_TSS_peaks_plot[c(2,4,6,8,10,12)], xlim=c(-3000, 3000),ylab = "Count Frequency")+ ggtitle("24 hour Individual 1" )
>> plotting figure...            2024-03-06 2:55:45 PM 

Version Author Date
9a1e500 reneeisnowhere 2024-03-04

Ind2 Peaks

## What I did here:  I called all my narrowpeak files

# peakfiles2 <- choose.files()

##This loop first established a list then (because I already knew the list had 12 files)
## I then imported each of these onto that list.  Once I had the list, I stored it as
## an R object, 
# Ind2_peaks <- list()
# for (file in 1:12){
#     testname <- basename(peakfiles2[file])
#   banana_peel <- str_split_i(testname, "_",3)
#  Ind2_peaks[[banana_peel]] <- readPeakFile(peakfiles2[file])
# }
# saveRDS(Ind2_peaks, "data/Ind2_peaks_list.RDS")
# I then called annotatePeak on that list object, and stored that as a R object for later retrieval.)

Ind2_peaks <- readRDS("data/Ind2_peaks_list.RDS")
# peakAnnoList_2 <- lapply(Ind2_peaks, annotatePeak, tssRegion =c(-2000,2000), TxDb= txdb)
# saveRDS(peakAnnoList_2, "data/peakAnnoList_2.RDS")

peakAnnoList_2 <- readRDS("data/peakAnnoList_2.RDS")
plotAnnoBar(peakAnnoList_2, main = "Genomic Feature Distribution, Individual 2")

Version Author Date
9a1e500 reneeisnowhere 2024-03-04
# Epi_list_tagMatrix = lapply(Ind2_peaks, getTagMatrix, windows = TSS)
# saveRDS(Epi_list_tagMatrix, "data/Ind2_TSS_peaks.RDS")

Ind2_TSS_peaks_plot <- readRDS("data/Ind2_TSS_peaks.RDS")



plotAvgProf(Ind2_TSS_peaks_plot[c(1,3,5,7,9,11)], xlim=c(-3000, 3000), ylab = "Count Frequency")+ ggtitle("3 hour Individual 2" )
>> plotting figure...            2024-03-06 2:56:04 PM 

Version Author Date
9a1e500 reneeisnowhere 2024-03-04
plotAvgProf(Ind2_TSS_peaks_plot[c(2,4,6,8,10,12)], xlim=c(-3000, 3000),ylab = "Count Frequency")+ ggtitle("24 hour Individual 2" )
>> plotting figure...            2024-03-06 2:56:05 PM 

Version Author Date
9a1e500 reneeisnowhere 2024-03-04

Ind3 Peaks

## What I did here:  I called all my narrowpeak files

# peakfiles3 <- choose.files()

##This loop first established a list then (because I already knew the list had 12 files)
## I then imported each of these onto that list.  Once I had the list, I stored it as
## an R object, 
# Ind3_peaks <- list()
# for (file in 1:12){
#     testname <- basename(peakfiles3[file])
#   banana_peel <- str_split_i(testname, "_",3)
#  Ind3_peaks[[banana_peel]] <- readPeakFile(peakfiles3[file])
# }
# saveRDS(Ind3_peaks, "data/Ind3_peaks_list.RDS")
# I then called annotatePeak on that list object, and stored that as a R object for later retrieval.)

Ind3_peaks <- readRDS("data/Ind3_peaks_list.RDS")
# peakAnnoList_3 <- lapply(Ind3_peaks, annotatePeak, tssRegion =c(-2000,2000), TxDb= txdb)
# saveRDS(peakAnnoList_3, "data/peakAnnoList_3.RDS")

peakAnnoList_3 <- readRDS("data/peakAnnoList_3.RDS")
plotAnnoBar(peakAnnoList_3, main = "Genomic Feature Distribution, Individual 3")

Version Author Date
9a1e500 reneeisnowhere 2024-03-04
# Epi_list_tagMatrix = lapply(Ind3_peaks, getTagMatrix, windows = TSS)
# saveRDS(Epi_list_tagMatrix, "data/Ind3_TSS_peaks.RDS")

Ind3_TSS_peaks_plot <- readRDS("data/Ind3_TSS_peaks.RDS")



plotAvgProf(Ind3_TSS_peaks_plot[c(1,3,5,7,9,11)], xlim=c(-3000, 3000), ylab = "Count Frequency")+ ggtitle("3 hour Individual 3" )
>> plotting figure...            2024-03-06 2:56:25 PM 

Version Author Date
9a1e500 reneeisnowhere 2024-03-04
plotAvgProf(Ind3_TSS_peaks_plot[c(2,4,6,8,10,12)], xlim=c(-3000, 3000),ylab = "Count Frequency")+ ggtitle("24 hour Individual 3" )
>> plotting figure...            2024-03-06 2:56:26 PM 

Version Author Date
9a1e500 reneeisnowhere 2024-03-04

Ind4 Peaks

## What I did here:  I called all my narrowpeak files

# peakfiles4 <- choose.files()
# 
# ##This loop first established a list then (because I already knew the list had 12 files)
# ## I then imported each of these onto that list.  Once I had the list, I stored it as
# ## an R object, 
# Ind4_peaks <- list()
# for (file in 1:12){
#     testname <- basename(peakfiles4[file])
#   banana_peel <- str_split_i(testname, "_",3)
#  Ind4_peaks[[banana_peel]] <- readPeakFile(peakfiles4[file])
# }
# saveRDS(Ind4_peaks, "data/Ind4_peaks_list.RDS")
# I then called annotatePeak on that list object, and stored that as a R object for later retrieval.)

Ind4_peaks <- readRDS("data/Ind4_peaks_list.RDS")
# peakAnnoList_4 <- lapply(Ind4_peaks, annotatePeak, tssRegion =c(-2000,2000), TxDb= txdb)
# saveRDS(peakAnnoList_4, "data/peakAnnoList_4.RDS")

peakAnnoList_4 <- readRDS("data/peakAnnoList_4.RDS")
plotAnnoBar(peakAnnoList_4, main = "Genomic Feature Distribution, Individual 4")

Version Author Date
9a1e500 reneeisnowhere 2024-03-04
# Epi_list_tagMatrix = lapply(Ind4_peaks, getTagMatrix, windows = TSS)
# saveRDS(Epi_list_tagMatrix, "data/Ind4_TSS_peaks.RDS")

Ind4_TSS_peaks_plot <- readRDS("data/Ind4_TSS_peaks.RDS")



plotAvgProf(Ind4_TSS_peaks_plot[c(1,3,5,7,9,11)], xlim=c(-3000, 3000), ylab = "Count Frequency")+ ggtitle("3 hour Individual 4" )
>> plotting figure...            2024-03-06 2:56:42 PM 

Version Author Date
9a1e500 reneeisnowhere 2024-03-04
plotAvgProf(Ind4_TSS_peaks_plot[c(2,4,6,8,10,12)], xlim=c(-3000, 3000),ylab = "Count Frequency")+ ggtitle("24 hour Individual 4" )
>> plotting figure...            2024-03-06 2:56:43 PM 

Version Author Date
9a1e500 reneeisnowhere 2024-03-04

Ind5 Peaks

## What I did here:  I called all my narrowpeak files

# peakfiles4 <- choose.files()
# # 
# # ##This loop first established a list then (because I already knew the list had 12 files)
# # ## I then imported each of these onto that list.  Once I had the list, I stored it as
# ## an R object,
# Ind4_peaks <- list()
# for (file in 1:12){
#     testname <- basename(peakfiles4[file])
#   banana_peel <- str_split_i(testname, "_",3)
#  Ind4_peaks[[banana_peel]] <- readPeakFile(peakfiles4[file])
# }
# saveRDS(Ind4_peaks, "data/Ind4_peaks_list.RDS")
# I then called annotatePeak on that list object, and stored that as a R object for later retrieval.)

Ind5_peaks <- readRDS("data/Ind5_peaks_list.RDS")
# peakAnnoList_5 <- lapply(Ind5_peaks, annotatePeak, tssRegion =c(-2000,2000), TxDb= txdb)
# saveRDS(peakAnnoList_5, "data/peakAnnoList_5.RDS")

peakAnnoList_5 <- readRDS("data/peakAnnoList_5.RDS")
plotAnnoBar(peakAnnoList_5, main = "Genomic Feature Distribution, Individual 4")

# Epi_list_tagMatrix = lapply(Ind5_peaks, getTagMatrix, windows = TSS)
# saveRDS(Epi_list_tagMatrix, "data/Ind5_TSS_peaks.RDS")

Ind5_TSS_peaks_plot <- readRDS("data/Ind5_TSS_peaks.RDS")



plotAvgProf(Ind5_TSS_peaks_plot[c(1,3,5,7,9,11)], xlim=c(-3000, 3000), ylab = "Count Frequency")+ ggtitle("3 hour Individual 5" )
>> plotting figure...            2024-03-06 2:56:59 PM 

plotAvgProf(Ind5_TSS_peaks_plot[c(2,4,6,8,10,12)], xlim=c(-3000, 3000),ylab = "Count Frequency")+ ggtitle("24 hour Individual 5" )
>> plotting figure...            2024-03-06 2:57:00 PM 

Ind6 Peaks

## What I did here:  I called all my narrowpeak files

# peakfiles6 <- choose.files()
# 
# ##This loop first established a list then (because I already knew the list had 12 files)
# ## I then imported each of these onto that list.  Once I had the list, I stored it as
# ## an R object, 
# Ind6_peaks <- list()
# for (file in 1:12){
#     testname <- basename(peakfiles6[file])
#   banana_peel <- str_split_i(testname, "_",3)
#  Ind6_peaks[[banana_peel]] <- readPeakFile(peakfiles6[file])
# }
# saveRDS(Ind6_peaks, "data/Ind6_peaks_list.RDS")
# I then called annotatePeak on that list object, and stored that as a R object for later retrieval.)

Ind6_peaks <- readRDS("data/Ind6_peaks_list.RDS")
# peakAnnoList_6 <- lapply(Ind6_peaks, annotatePeak, tssRegion =c(-2000,2000), TxDb= txdb)
# saveRDS(peakAnnoList_6, "data/peakAnnoList_6.RDS")

peakAnnoList_6 <- readRDS("data/peakAnnoList_6.RDS")
plotAnnoBar(peakAnnoList_6, main = "Genomic Feature Distribution, Individual 6")+ggtitle ("Genomic Feature Distribution, Individual 6")

##Epi_list_tagMatrix title was just because I was too lazy to change the name
# Epi_list_tagMatrix = lapply(Ind6_peaks, getTagMatrix, windows = TSS)
# saveRDS(Epi_list_tagMatrix, "data/Ind6_TSS_peaks.RDS")

Ind6_TSS_peaks_plot <- readRDS("data/Ind6_TSS_peaks.RDS")



plotAvgProf(Ind6_TSS_peaks_plot[c(1,3,5,7,9,11)], xlim=c(-3000, 3000), ylab = "Count Frequency")+ ggtitle("3 hour Individual 6" )
>> plotting figure...            2024-03-06 2:57:20 PM 

plotAvgProf(Ind6_TSS_peaks_plot[c(2,4,6,8,10,12)], xlim=c(-3000, 3000),ylab = "Count Frequency")+ ggtitle("24 hour Individual 6" )+ coord_cartesian(xlim = c(-1000, 100))
>> plotting figure...            2024-03-06 2:57:21 PM 

possibleTag <- list("integer"=c("AM", "AS", "CM", "CP", "FI", "H0", "H1", "H2", 
                                "HI", "IH", "MQ", "NH", "NM", "OP", "PQ", "SM",
                                "TC", "UQ"), 
                 "character"=c("BC", "BQ", "BZ", "CB", "CC", "CO", "CQ", "CR",
                               "CS", "CT", "CY", "E2", "FS", "LB", "MC", "MD",
                               "MI", "OA", "OC", "OQ", "OX", "PG", "PT", "PU",
                               "Q2", "QT", "QX", "R2", "RG", "RX", "SA", "TS",
                               "U2"))
library(Rsamtools)
bamTop100 <- scanBam(BamFile(bamfile, yieldSize = 100),
                     param = ScanBamParam(tag=unlist(possibleTag)))[[1]]$tag
tags <- names(bamTop100)[lengths(bamTop100)>0]
tags

outPath <- "splited"
dir.create(outPath)
library(TxDb.Hsapiens.UCSC.hg38.knownGene)
seqlev <- "chr1" 
seqinformation <- seqinfo(TxDb.Hsapiens.UCSC.hg38.knownGene)


which <- as(seqinformation[seqlev], "GRanges")
gal <- readBamFile(bamfile, tag=tags, which=which, asMates=TRUE, bigFile=TRUE)
shiftedBamfile <- file.path(outPath, "shifted.bam")
gal1 <- shiftGAlignmentsList(gal, outbam=shiftedBamfile)

txs <- transcripts(TxDb.Hsapiens.UCSC.hg38.knownGene)
tsse <- TSSEscore(gal1, txs)
tsse$TSSEscore
summary(tsse$values)

sessionInfo()
R version 4.3.1 (2023-06-16 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)

Matrix products: default


locale:
[1] LC_COLLATE=English_United States.utf8 
[2] LC_CTYPE=English_United States.utf8   
[3] LC_MONETARY=English_United States.utf8
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.utf8    

time zone: America/Chicago
tzcode source: internal

attached base packages:
[1] stats4    stats     graphics  grDevices utils     datasets  methods  
[8] base     

other attached packages:
 [1] ATACseqQC_1.26.0                        
 [2] org.Hs.eg.db_3.18.0                     
 [3] TxDb.Hsapiens.UCSC.hg38.knownGene_3.18.0
 [4] GenomicFeatures_1.54.3                  
 [5] AnnotationDbi_1.64.1                    
 [6] Biobase_2.62.0                          
 [7] GenomicRanges_1.54.1                    
 [8] GenomeInfoDb_1.38.6                     
 [9] IRanges_2.36.0                          
[10] S4Vectors_0.40.2                        
[11] BiocGenerics_0.48.1                     
[12] ChIPseeker_1.38.0                       
[13] RColorBrewer_1.1-3                      
[14] kableExtra_1.4.0                        
[15] lubridate_1.9.3                         
[16] forcats_1.0.0                           
[17] stringr_1.5.1                           
[18] dplyr_1.1.4                             
[19] purrr_1.0.2                             
[20] readr_2.1.5                             
[21] tidyr_1.3.1                             
[22] tibble_3.2.1                            
[23] ggplot2_3.5.0                           
[24] tidyverse_2.0.0                         
[25] workflowr_1.7.1                         

loaded via a namespace (and not attached):
  [1] fs_1.6.3                               
  [2] matrixStats_1.2.0                      
  [3] bitops_1.0-7                           
  [4] DirichletMultinomial_1.44.0            
  [5] enrichplot_1.22.0                      
  [6] TFBSTools_1.40.0                       
  [7] HDO.db_0.99.1                          
  [8] httr_1.4.7                             
  [9] InteractionSet_1.30.0                  
 [10] tools_4.3.1                            
 [11] utf8_1.2.4                             
 [12] R6_2.5.1                               
 [13] HDF5Array_1.30.1                       
 [14] lazyeval_0.2.2                         
 [15] rhdf5filters_1.14.1                    
 [16] withr_3.0.0                            
 [17] prettyunits_1.2.0                      
 [18] gridExtra_2.3                          
 [19] VennDiagram_1.7.3                      
 [20] cli_3.6.2                              
 [21] formatR_1.14                           
 [22] scatterpie_0.2.1                       
 [23] labeling_0.4.3                         
 [24] sass_0.4.8                             
 [25] randomForest_4.7-1.1                   
 [26] Rsamtools_2.18.0                       
 [27] systemfonts_1.0.5                      
 [28] yulab.utils_0.1.4                      
 [29] R.utils_2.12.3                         
 [30] DOSE_3.28.2                            
 [31] svglite_2.1.3                          
 [32] plotrix_3.8-4                          
 [33] BSgenome_1.70.2                        
 [34] limma_3.58.1                           
 [35] rstudioapi_0.15.0                      
 [36] RSQLite_2.3.5                          
 [37] generics_0.1.3                         
 [38] gridGraphics_0.5-1                     
 [39] TxDb.Hsapiens.UCSC.hg19.knownGene_3.2.2
 [40] BiocIO_1.12.0                          
 [41] gtools_3.9.5                           
 [42] GO.db_3.18.0                           
 [43] Matrix_1.6-5                           
 [44] futile.logger_1.4.3                    
 [45] fansi_1.0.6                            
 [46] abind_1.4-5                            
 [47] R.methodsS3_1.8.2                      
 [48] lifecycle_1.0.4                        
 [49] whisker_0.4.1                          
 [50] yaml_2.3.8                             
 [51] edgeR_4.0.16                           
 [52] SummarizedExperiment_1.32.0            
 [53] rhdf5_2.46.1                           
 [54] gplots_3.1.3.1                         
 [55] qvalue_2.34.0                          
 [56] SparseArray_1.2.4                      
 [57] BiocFileCache_2.10.1                   
 [58] grid_4.3.1                             
 [59] blob_1.2.4                             
 [60] promises_1.2.1                         
 [61] crayon_1.5.2                           
 [62] lattice_0.22-5                         
 [63] cowplot_1.1.3                          
 [64] annotate_1.80.0                        
 [65] KEGGREST_1.42.0                        
 [66] GenomicScores_2.14.3                   
 [67] pillar_1.9.0                           
 [68] knitr_1.45                             
 [69] fgsea_1.28.0                           
 [70] rjson_0.2.21                           
 [71] boot_1.3-30                            
 [72] codetools_0.2-19                       
 [73] fastmatch_1.1-4                        
 [74] glue_1.7.0                             
 [75] getPass_0.2-4                          
 [76] ggfun_0.1.4                            
 [77] data.table_1.15.2                      
 [78] vctrs_0.6.5                            
 [79] png_0.1-8                              
 [80] treeio_1.26.0                          
 [81] poweRlaw_0.80.0                        
 [82] gtable_0.3.4                           
 [83] cachem_1.0.8                           
 [84] xfun_0.42                              
 [85] S4Arrays_1.2.0                         
 [86] mime_0.12                              
 [87] preseqR_4.0.0                          
 [88] tidygraph_1.3.1                        
 [89] pracma_2.4.4                           
 [90] survival_3.5-8                         
 [91] statmod_1.5.0                          
 [92] interactiveDisplayBase_1.40.0          
 [93] ellipsis_0.3.2                         
 [94] nlme_3.1-164                           
 [95] ggtree_3.10.1                          
 [96] bit64_4.0.5                            
 [97] progress_1.2.3                         
 [98] filelock_1.0.3                         
 [99] rprojroot_2.0.4                        
[100] bslib_0.6.1                            
[101] KernSmooth_2.23-22                     
[102] seqLogo_1.68.0                         
[103] colorspace_2.1-0                       
[104] DBI_1.2.2                              
[105] ade4_1.7-22                            
[106] motifStack_1.46.0                      
[107] tidyselect_1.2.0                       
[108] processx_3.8.3                         
[109] bit_4.0.5                              
[110] compiler_4.3.1                         
[111] curl_5.2.1                             
[112] git2r_0.33.0                           
[113] graph_1.80.0                           
[114] xml2_1.3.6                             
[115] DelayedArray_0.28.0                    
[116] shadowtext_0.1.3                       
[117] rtracklayer_1.62.0                     
[118] scales_1.3.0                           
[119] caTools_1.18.2                         
[120] RBGL_1.78.0                            
[121] callr_3.7.5                            
[122] rappdirs_0.3.3                         
[123] digest_0.6.34                          
[124] rmarkdown_2.25                         
[125] XVector_0.42.0                         
[126] htmltools_0.5.7                        
[127] pkgconfig_2.0.3                        
[128] MatrixGenerics_1.14.0                  
[129] highr_0.10                             
[130] regioneR_1.34.0                        
[131] dbplyr_2.4.0                           
[132] fastmap_1.1.1                          
[133] htmlwidgets_1.6.4                      
[134] rlang_1.1.3                            
[135] shiny_1.8.0                            
[136] farver_2.1.1                           
[137] jquerylib_0.1.4                        
[138] jsonlite_1.8.8                         
[139] BiocParallel_1.36.0                    
[140] R.oo_1.26.0                            
[141] GOSemSim_2.28.1                        
[142] RCurl_1.98-1.14                        
[143] magrittr_2.0.3                         
[144] polynom_1.4-1                          
[145] GenomeInfoDbData_1.2.11                
[146] ggplotify_0.1.2                        
[147] patchwork_1.2.0                        
[148] Rhdf5lib_1.24.2                        
[149] munsell_0.5.0                          
[150] Rcpp_1.0.12                            
[151] ape_5.7-1                              
[152] viridis_0.6.5                          
[153] stringi_1.8.3                          
[154] ggraph_2.2.0                           
[155] zlibbioc_1.48.0                        
[156] MASS_7.3-60.0.1                        
[157] AnnotationHub_3.10.0                   
[158] plyr_1.8.9                             
[159] parallel_4.3.1                         
[160] ggrepel_0.9.5                          
[161] CNEr_1.38.0                            
[162] Biostrings_2.70.2                      
[163] graphlayouts_1.1.0                     
[164] splines_4.3.1                          
[165] multtest_2.58.0                        
[166] hms_1.1.3                              
[167] locfit_1.5-9.9                         
[168] ps_1.7.6                               
[169] igraph_2.0.2                           
[170] reshape2_1.4.4                         
[171] biomaRt_2.58.2                         
[172] TFMPvalue_0.0.9                        
[173] futile.options_1.0.1                   
[174] BiocVersion_3.18.1                     
[175] XML_3.99-0.16.1                        
[176] evaluate_0.23                          
[177] lambda.r_1.2.4                         
[178] BiocManager_1.30.22                    
[179] tzdb_0.4.0                             
[180] tweenr_2.0.3                           
[181] httpuv_1.6.14                          
[182] polyclip_1.10-6                        
[183] ggforce_0.4.2                          
[184] xtable_1.8-4                           
[185] restfulr_0.0.15                        
[186] tidytree_0.4.6                         
[187] later_1.3.2                            
[188] viridisLite_0.4.2                      
[189] ChIPpeakAnno_3.36.1                    
[190] aplot_0.2.2                            
[191] memoise_2.0.1                          
[192] GenomicAlignments_1.38.2               
[193] timechange_0.3.0