Skip to content

Instantly share code, notes, and snippets.

@lcolladotor
Created November 4, 2014 22:17
Show Gist options
  • Save lcolladotor/ea9b29d923b0fb780a35 to your computer and use it in GitHub Desktop.
Save lcolladotor/ea9b29d923b0fb780a35 to your computer and use it in GitHub Desktop.
library('derfinder')
## Set global species option
options(species = 'canis_familiaris')
## Load data
bam <- rep('10_130-chr11.bam', 6)
names(bam) <- paste0('Sample', 1:6)
fullCov <- fullCoverage(bam, chrs = c(1:38, 'X'))
## Inspect chr names
names(fullCov)
## Filter
filteredCov <- lapply(fullCov, filterData, cutoff = 2)
## Artificially copy data from chr11 to chr30
filteredCov$chr30 <- filteredCov$chr11
## Change some values because we only have one sample
for(sample in 2:6) {
set.seed(sample)
filteredCov$chr30$coverage[[sample]] <- filteredCov$chr30$coverage[[sample]] + round(runif(1, 0, 10))
}
## Setup
perms <- 2
currentChrom <- 'chr30'
groups <- factor(rep(letters[1:3], each = 2))
models <- list(
mod = model.matrix( ~ groups ),
mod0 = model.matrix( ~0 + rep(1L, 6))
)
## Get results
results <- analyzeChr(chr = currentChrom, filteredCov[[currentChrom]], models,
mc.cores=1, groupInfo = groups, writeOutput = TRUE, cutoffFstat = 0.5,
cutoffType = 'empirical', nPermute = perms,
seeds = 19731107 + seq_len(perms),
lowMemDir = file.path(tempdir(), currentChrom),
returnOutput = TRUE, verbose = TRUE, runAnnotation = FALSE)
## Session information
options(width = 90)
devtools::session_info()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment