Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to turn off the chrX Normalization in createPanelOfNormals.R #91

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
9 changes: 6 additions & 3 deletions scripts/createPanelOfNormals.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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
}
}


Expand Down
4 changes: 3 additions & 1 deletion scripts/runIchorCNA.R
Original file line number Diff line number Diff line change
Expand Up @@ -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]"),
Expand Down Expand Up @@ -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)));
Expand All @@ -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))
Expand Down