Last active
June 26, 2017 11:59
-
-
Save tgambin/f43937ce98a0300b11a15647e24f2318 to your computer and use it in GitHub Desktop.
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
# Install missing packages from CRAN | |
list.of.packages <- c("RCurl", "data.table", "parallel") | |
new.packages <- list.of.packages[!(list.of.packages %in% installed.packages()[,"Package"])] | |
if(length(new.packages)) install.packages(new.packages) | |
# Install missing packages from Bioconductor | |
# Note: for Windows users: Rsubread has to be installed from file | |
biocLitePackages <- c(GenomicRanges", "Rsubread","WES.1KG.WUGSC") | |
new.biocLitePackage <- biocLitePackages[!(biocLitePackages %in% installed.packages()[,"Package"])] | |
if(length(new.biocLitePackage)) { source("http://bioconductor.org/biocLite.R"); biocLite(new.biocLitePackage)} | |
library(WES.1KG.WUGSC) | |
library(data.table) | |
library(parallel) | |
library(GenomicRanges) | |
library(Rsubread) | |
library(RCurl) | |
mc.cores <- 8 | |
dirPath <- system.file("extdata", package = "WES.1KG.WUGSC") | |
bamFile <- list.files(dirPath, pattern = '*.bam$') | |
bamdir <- file.path(dirPath, bamFile) | |
sampname <- as.matrix(read.table(file.path(dirPath, "sampname"))) | |
bf <- file.path(dirPath, "chr22_400_to_500.bed") | |
tmpDir <- "~/tmp/" | |
outputRPKM <- "~/RPKMs/" | |
bedFile <- paste0(tmpDir,"chr22_400_to_500.bed") | |
dir.create(outputRPKM) | |
dir.create(tmpDir) | |
bed <- fread(bf) | |
bed$V1 <- paste0("chr", bed$V1) | |
bed$GeneName <- "dummy_gene" | |
write.table(bed, file=bedFile , sep="\t", quote=F, row.names=F, col.names=F) | |
# load HMZDelFinder source code | |
# Note: source ("https://....") does not work on some platforms | |
eval( expr = parse( text = getURL("https://raw.githubusercontent.com/BCM-Lupskilab/HMZDelFinder/master/src/HMZDelFinder.R") )) | |
calcRPKMsFromBAMs (bedFile, paste0(dirPath, "/", bamFile), sampname, outputRPKM, mc.cores) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment