Commit cdbb00b2 authored by Safia Saci's avatar Safia Saci
Browse files

Upload New File

parent c1557a82
# Packages -------
library(DiffBind)
library(tidyverse)
library(rtracklayer)
# input file--------
samples <- read.csv2("data/sampleSheetCons.csv")
DBdata <- dba(sampleSheet = samples, config = list(doBlacklist = FALSE, doGreylist = FALSE, RunParallel = FALSE))
# applicate the greyList
greyList <- import.bed("gl.bed")
DBdata <- dba.blacklist(DBdata, greylist = greyList)
#dba count
db <- dba.count(DBdata, summits = FALSE)
# Export dbaCount -----------
saveRDS(db, "dbCountCons.RDS")
# Post Dba Count--------
dbaCount <- readRDS("dbCountCons.RDS")
info <- dba.show(dbaCount)
libsizes <- cbind(LibReads=info$Reads, FRiP=info$FRiP, PeakReads=round(info$Reads * info$FRiP))
rownames(libsizes) <- info$ID
png("dbaCount.png")
plot(dbaCount)
dev.off()
## Normalizing the data--------
result <- dba.normalize(dbaCount)
## Establishing a model design and contrast --------
# TODO reordonner la ligne
result <- dba.contrast(dbaCount, reorderMeta=list(Condition="fasted"))
## Performing the differential analysis------------
result <- dba.analyze(result)
# dba.show(result, bContrasts=TRUE)
# png("diff_an_dba_cpg.png")
# plot(result, contrast=1)
# dev.off()
#Retrieving the differentially bound sites
result.DB_line <- dba.report(result, contrast = 1)
result.DB_cons <- dba.report(result, contrast = 2)
saveRDS(result.DB_line, "dba_report_Cons_line.RDS")
saveRDS(result.DB_cons, "dba_report_cons_cond.RDS")
# Plotting in DiffBind ------------
png("dba_ven_line_con3.png")
dba.plotVenn(result, bDB=TRUE, bGain=TRUE, bLoss=TRUE)
dev.off()
png("dba_PCA_line_cons2.png")
dba.plotPCA(result, contrast=2, label=DBA_FACTOR)
dev.off()
png("dba_plot_cobs.png")
dba.plotMA(result)
dev.off()
png("dba_volcano_cons.png")
dba.plotVolcano(result)
dev.off()
png("dba_boxplot_cons.png")
pvals <- dba.plotBox(result)
dev.off()
hmap <- colorRampPalette(c("magenta", "white", "blue"))(n = 13)
png("dba_heatMap_cpg.png")
readscores <- dba.plotHeatmap(result, contrast=1, correlations=FALSE, scale="row", colScheme = hmap)
dev.off()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment