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

Ranch #316

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open

Ranch #316

Prev Previous commit
Next Next commit
lohspec 12/19
  • Loading branch information
Jason Kunisaki authored and Jason Kunisaki committed Dec 20, 2017
commit 5b6a7b24a3c8f720877a8c9438c2e169d354c4bb
4 changes: 4 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -47,6 +47,8 @@ Collate:
'VEP_Virtual-class.R'
'VEP-class.R'
'VEP_v88-class.R'
'VarScanFormat_Virtual-class.R'
'VarScanFormat-class.R'
'Waterfall-class.R'
'cnFreq.R'
'cnFreq_buildMain.R'
@@ -95,6 +97,8 @@ Collate:
'ideoView_buildMain.R'
'ideoView_formatCytobands.R'
'ideoView_qual.R'
'lohSpec-class.R'
'lohSpec-methods.R'
'lohSpec.R'
'lohSpec_buildMain.R'
'lohSpec_fileGlob.R'
7 changes: 7 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@ export(MutSpectra)
export(MutationAnnotationFormat)
export(TvTi)
export(VEP)
export(VarScanFormat)
export(Waterfall)
export(cnFreq)
export(cnSpec)
@@ -24,17 +25,23 @@ exportClasses(GMS)
exportClasses(MutSpectra)
exportClasses(MutationAnnotationFormat)
exportClasses(VEP)
exportClasses(VarScanFormat)
exportClasses(Waterfall)
exportClasses(lohSpec)
exportMethods(drawPlot)
exportMethods(getChrBoundaries)
exportMethods(getData)
exportMethods(getDescription)
exportMethods(getGrob)
exportMethods(getHeader)
exportMethods(getLohData)
exportMethods(getLohSlidingWindow)
exportMethods(getMeta)
exportMethods(getMutation)
exportMethods(getPath)
exportMethods(getPosition)
exportMethods(getSample)
exportMethods(getVarScan)
exportMethods(getVersion)
exportMethods(writeData)
import(data.table)
1 change: 0 additions & 1 deletion R/AllGenerics.R
Original file line number Diff line number Diff line change
@@ -535,7 +535,6 @@ setGeneric(
#' @rdname lohSpec_qual-methods
#' @param object Object of class VarScanFormat
#' @param ... additional arguments to passed
#' @exportMethod lohSpec_qual
setGeneric(
name="lohSpec_qual",
def=function(object, ...){standardGeneric("lohSpec_qual")}
1 change: 0 additions & 1 deletion R/MutationAnnotationFormat-class.R
Original file line number Diff line number Diff line change
@@ -35,7 +35,6 @@ setClass("MutationAnnotationFormat",
#' @importFrom data.table fread
#' @export
MutationAnnotationFormat <- function(path, version="auto", verbose=FALSE){
browser()
mafData <- suppressWarnings(data.table::fread(input=path,
stringsAsFactors=TRUE,
verbose=verbose))
12 changes: 12 additions & 0 deletions R/VarScanFormat-class.R
Original file line number Diff line number Diff line change
@@ -42,6 +42,17 @@ setClass("VarScanFormat",
http://varscan.sourceforge.net/somatic-calling.html#somatic-output
for appropriate columns and column names.")
}

## Check to see if the VAF columns are percentages as opposed to proportions
tumor_false <- any(grepl("%", object@varscan$tumor_var_freq) == FALSE)
normal_false <- any(grepl("%", object@varscan$normal_var_freq) == FALSE)
if (tumor_false == TRUE | normal_false == TRUE) {
stop("Make sure the tumor/normal VAF column is in percentages and not proportion.
(i.e. 75.00% as opposed to 0.75)")
}

## Check to see if the VAF provided are somatic or not

return(TRUE)
}
)
@@ -64,6 +75,7 @@ VarScanFormat <- function(path, verbose=FALSE) {
varscanData$sample <- "HCC1395"
## Get the sample names
sample <- varscanData[,which(colnames(varscanData)=="sample"), with=FALSE]
length(colnames(varscanData))

## Create the varscan object
varscanObject <- new(Class="VarScanFormat", path=path, varscan=varscanData, sample=sample)
1 change: 1 addition & 0 deletions R/VarScanFormat_Virtual-class.R
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@
#' @slot sample data.table object holding sample data.
#' @importClassesFrom data.table data.table
#' @import methods
#'
setClass(
Class="VarScanFormat_Virtual",
representation=representation(varscan="data.table",
14 changes: 7 additions & 7 deletions R/lohSpec-class.R
Original file line number Diff line number Diff line change
@@ -14,10 +14,6 @@
#' @exportClass lohSpec
#' @importFrom data.table data.table
#' @importFrom gtable gtable
#' @importFrom GenVisR multi_cytobandRet
#' @importFrom GenVisR multi_chrBound
#' @importFrom GenVisR cytoGeno
#' @import methods
methods::setOldClass("gtable")
setClass(
Class="lohSpec",
@@ -55,9 +51,7 @@ setClass(
#' normal variant allele frequency to be used in Loss of Heterozygosity
#' calculations. defaults to .50\%

path <- "~/Google Drive/varscan.example.tsv"
varscanObject <- VarScanFormat(path = path)
input <- varscanObject

lohSpec <- function(input, chr=NULL, samples=NULL, y=NULL, genome='hg19',
gender=NULL, step=1000000, window_size=2500000,
normal=.50, gradient_midpoint=.2, gradient_low="#ffffff",
@@ -98,11 +92,17 @@ setClass("lohData",
lohData <- function(object, chr, samples, y, genome, step, window_size,
normal, verbose) {
## Get the primary loh data
object <- VarScanFormat(path = "~/Google Drive/HCC1395.varscan.tsv")
primaryData <- getLohData(object=object, chr=chr, verbose = verbose)

## Quality check on the primary data
## To-Do: Put the quality check in the validity check
primaryData <- lohSpec_qual(object=primaryData)

library(BiocInstaller)
biocLite("BSgenome.Hsapiens.UCSC.hg19")
BSgenome <- getBSgenome(genome = "BSgenome.Hsapiens.UCSC.hg19")

## Get the chromosome data
if(is.null(y)) {
y <- data.table()
16 changes: 0 additions & 16 deletions R/lohSpec-methods.R

This file was deleted.

30 changes: 30 additions & 0 deletions man/VarScanFormat-class.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions man/VarScanFormat_Virtual-class.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions man/getChrBoundaries-methods.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions man/getLohCalculation-methods.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions man/getLohData-methods.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions man/getLohSlidingWindow-methods.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions man/getLohStepCalculation-methods.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion man/getSample-methods.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions man/getVarScan-methods.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading