Skip to content

Commit

Permalink
corrected copy number string fix
Browse files Browse the repository at this point in the history
Fixes #56 where the corrected_copy_number is accurate but the corrected_call is HLAMP by default - now the corrected_call will show the proper copy state string
Also modified setGenomeStyle so that there is an option to not exclude extra chromosomes that are not the major 1:22, X, Y chrs
  • Loading branch information
gavinha committed Dec 7, 2018
1 parent 60408ca commit c3061ea
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
15 changes: 9 additions & 6 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -484,16 +484,19 @@ getPositionOverlap <- function(chr, posn, dataVal) {
return(hitVal)
}

setGenomeStyle <- function(x, genomeStyle = "NCBI", species = "Homo_sapiens"){
setGenomeStyle <- function(x, genomeStyle = "NCBI", species = "Homo_sapiens",
filterExtraChr = TRUE){
#chrs <- genomeStyles(species)[c("NCBI","UCSC")]
if (!genomeStyle %in% seqlevelsStyle(as.character(x))){
x <- suppressWarnings(mapSeqlevels(as.character(x),
genomeStyle, drop = FALSE)[1,])
}

autoSexMChr <- extractSeqlevelsByGroup(species = species,
style = genomeStyle, group = "all")
x <- x[x %in% autoSexMChr]
if (filterExtraChr){
autoSexMChr <- extractSeqlevelsByGroup(species = species,
style = genomeStyle, group = "all")
x <- x[x %in% autoSexMChr]
}
return(x)
}

Expand Down Expand Up @@ -1194,9 +1197,9 @@ correctIntegerCN <- function(cn, segs, purity, ploidy, maxCNtoCorrect.autosomes

# TITAN calls adjusted for >= copies - HLAMP
segs[Chromosome %in% chrs & Copy_Number >= maxCNtoCorrect.autosomes, Corrected_Copy_Number := as.integer(round(logR_Copy_Number))]
segs[Chromosome %in% chrs & Copy_Number >= maxCNtoCorrect.autosomes, Corrected_Call := "HLAMP"]
segs[Chromosome %in% chrs & Copy_Number >= maxCNtoCorrect.autosomes, names[Corrected_Copy_Number + 1]]
cn[Chr %in% chrs & CopyNumber >= maxCNtoCorrect.autosomes, Corrected_Copy_Number := as.integer(round(logR_Copy_Number))]
cn[Chr %in% chrs & CopyNumber >= maxCNtoCorrect.autosomes, Corrected_Call := "HLAMP"]
cn[Chr %in% chrs & CopyNumber >= maxCNtoCorrect.autosomes, names[Corrected_Copy_Number + 1]]

# TITAN calls adjust for HOMD
if (correctHOMD){
Expand Down
5 changes: 4 additions & 1 deletion man/loadAlleleCounts.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
loadAlleleCounts(inCounts, symmetric = TRUE,
genomeStyle = "NCBI", sep = "\t", header = TRUE)

setGenomeStyle(x, genomeStyle = "NCBI", species = "Homo_sapiens")
setGenomeStyle(x, genomeStyle = "NCBI", species = "Homo_sapiens", filterExtraChr = TRUE)
}

\arguments{
Expand All @@ -39,6 +39,9 @@
\item{species}{
\code{character} denoting the species
}
\item{filterExtraChr}{
\code{logical}; if \code{TRUE}, then will return the list of chromosomes given by \code{extractSeqlevelsByGroup} for the \code{species} and for autosomes and sex chromosomes, which means that only the major chromosomes are returned (i.e. 1:22, X, Y).
}
}

\value{
Expand Down

0 comments on commit c3061ea

Please sign in to comment.