diff --git a/R/utils.R b/R/utils.R index 15ce011..ddc72fa 100644 --- a/R/utils.R +++ b/R/utils.R @@ -34,8 +34,8 @@ filterEmptyChr <- function(gr){ #################################### ##### FUNCTION GET SEQINFO ###### #################################### -getSeqInfo <- function(genomeBuild = "hg19", genomeStyle = "NCBI"){ - bsg <- paste0("BSgenome.Hsapiens.UCSC.", genomeBuild) +getSeqInfo <- function(genomeSpecies = "Hsapiens", genomeBuild = "hg19", genomeStyle = "NCBI"){ + bsg <- paste0("BSgenome.", genomeSpecies, ".", genomeStyle, ".", genomeBuild) if (!require(bsg, character.only=TRUE, quietly=TRUE, warn.conflicts=FALSE)) { seqinfo <- Seqinfo(genome=genomeBuild) } else { diff --git a/scripts/createPanelOfNormals.R b/scripts/createPanelOfNormals.R index 6a7123f..41c6e17 100644 --- a/scripts/createPanelOfNormals.R +++ b/scripts/createPanelOfNormals.R @@ -17,7 +17,8 @@ option_list <- list( make_option(c("--chrNormalize"), type="character", default="c(1:22)", help = "Specify chromosomes to normalize GC/mappability biases"), make_option(c("--maleChrXLogRThres"), type="numeric", default=-0.80, help = "ChrX Log ratio threshold to confirm as male gender."), make_option(c("-e", "--exons.bed"), type = "character", default=NULL, help = "Path to bed file containing exon regions."), - make_option(c("--method"), type = "character", default="median", help="Median or Mean.") + make_option(c("--method"), type = "character", default="median", help="Median or Mean."), + make_option(c("--normalizeX"), type="logical", default=TRUE, help = "Normalize chrX by median. Default: [%default]") #make_option(c("--ylim"), type = "character", default="c(-2,2)", help="Y-limits for plotting of mean/median log ratios") ) parseobj <- OptionParser(option_list=option_list) @@ -35,6 +36,7 @@ outfile <- opt$outfile genomeStyle <- opt$genomeStyle #ylim <- eval(parse(text = opt$ylim)) maleChrXLogRThres <- opt$maleChrXLogRThres +normalizeX <- as.logical(opt$normalizeX) chrs <- as.character(eval(parse(text = opt$chrs))) chrNormalize <- as.character(eval(parse(text=opt$chrNormalize))); seqlevelsStyle(chrs) <- genomeStyle @@ -94,8 +96,9 @@ for (i in 1:length(files)){ chrXStr <- grep("X", chrs, value = TRUE) chrXInd <- as.character(seqnames(normalGR)) == chrXStr ## Normalize chrX ## - values(normalGR)[[sid]][chrXInd] <- values(normalGR)[[sid]][chrXInd] - chrXMedian - + if (normalizeX){ + values(normalGR)[[sid]][chrXInd] <- values(normalGR)[[sid]][chrXInd] - chrXMedian + } } diff --git a/scripts/runIchorCNA.R b/scripts/runIchorCNA.R index 376dab2..036f552 100644 --- a/scripts/runIchorCNA.R +++ b/scripts/runIchorCNA.R @@ -45,6 +45,7 @@ option_list <- list( make_option(c("--chrs"), type="character", default="c(1:22,\"X\")", help = "Specify chromosomes to analyze. Default: [%default]"), make_option(c("--genomeBuild"), type="character", default="hg19", help="Geome build. Default: [%default]"), make_option(c("--genomeStyle"), type = "character", default = "NCBI", help = "NCBI or UCSC chromosome naming convention; use UCSC if desired output is to have \"chr\" string. [Default: %default]"), + make_option(c("--genomeSpecies"), type="character", default="Hsapiens", help="Geome species. Default: [%default]"), make_option(c("--normalizeMaleX"), type="logical", default=TRUE, help = "If male, then normalize chrX by median. Default: [%default]"), make_option(c("--minTumFracToCorrect"), type="numeric", default=0.1, help = "Tumor-fraction correction of bin and segment-level CNA if sample has minimum estimated tumor fraction. [Default: %default]"), make_option(c("--fracReadsInChrYForMale"), type="numeric", default=0.001, help = "Threshold for fraction of reads in chrY to assign as male. Default: [%default]"), @@ -106,6 +107,7 @@ gender <- NULL outImage <- paste0(outDir,"/", patientID,".RData") genomeBuild <- opt$genomeBuild genomeStyle <- opt$genomeStyle +genomeSpecies <- opt$genomeSpecies chrs <- as.character(eval(parse(text = opt$chrs))) chrTrain <- as.character(eval(parse(text=opt$chrTrain))); chrNormalize <- as.character(eval(parse(text=opt$chrNormalize))); @@ -125,7 +127,7 @@ if (!is.null(libdir) && libdir != "None"){ } ## load seqinfo -seqinfo <- getSeqInfo(genomeBuild, genomeStyle) +seqinfo <- getSeqInfo(genomeSpecies, genomeBuild, genomeStyle) if (substr(tumour_file,nchar(tumour_file)-2,nchar(tumour_file)) == "wig") { wigFiles <- data.frame(cbind(patientID, tumour_file))