Last active
January 22, 2019 01:30
-
-
Save rbronste/bdc4061c5aab0fa8c1171c7c0123d9d2 to your computer and use it in GitHub Desktop.
Creating a Ranged Summarized Experiment object from DiffBind matrix output. R packages: DiffBind, BiocParallel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create a dba.count object | |
library("BiocParallel") | |
library("DiffBind") | |
parallel=TRUE | |
BPPARAM=MulticoreParam(4) | |
ATAC_adult_BNST<- dba(sampleSheet = "Adult_ATAC_BNST1.csv", config=data.frame(AnalysisMethod=DBA_DESEQ2, fragmentSize = 0, th=.05),peakFormat="narrow") | |
ATAC_Adult_BNST_count<-dba.count(ATAC_adult_BNST, score = DBA_SCORE_READS, fragmentSize = 0) | |
# Retrieve counts from dba.count | |
rangedCounts <- dba.peakset(ATAC_Adult_BNST_count, bRetrieve=TRUE) | |
# Retrieve counts from dba.count without the site interval ranges | |
counts <- as.matrix(mcols(rangedCounts)) | |
# Construct a SummarizedExperiment | |
nrows <- 1054182 | |
ncols <- 16 | |
counts <- matrix(runif(nrows * ncols, 1, 1e4), nrows) | |
rowRanges<-GRanges(rangedCounts) | |
sampleNames<-c("MBV1", "MBV2", "MBV3", "FBV1", "FBV2", "FBV3", "MBE7", "MBE8", "MBE9", "FBE1", "FBE2", "FBE3") | |
sampleSex<-c("male", "male", "male", "female", "female", "female", "male", "male", "male", "female", "female", "female") | |
sampleTreatment<-c("vehicle", "vehicle", "vehicle", "vehicle", "vehicle", "vehicle", "EB", "EB", "EB", "EB", "EB", "EB") | |
colData<-data.frame(sampleName=sampleNames, sex=sampleSex, treatment=sampleTreatment) | |
se<-SummarizedExperiment(assays=list(counts=counts),rowRanges=rowRanges, colData=colData) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment