Skip to content

Commit

Permalink
v0.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ShixiangWang committed Jan 8, 2019
1 parent de61e30 commit a5de2cb
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: sigminer
Title: Capture Genomic Variation Signatures using 'NMF'
Version: 0.1.0
Version: 0.1.1
Authors@R:
person(given = "Shixiang",
family = "Wang",
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Generated by roxygen2: do not edit by hand

S3method(subset,CopyNumber)
export("%>%")
export(CopyNumber)
export(GenomicVariation)
Expand Down
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@

# sigminer 0.1.1

* add `subset.CopyNumber()` for subset CopyNumber object
* add `genome_measure` slot for CopyNumber object

# sigminer 0.1.0

* Added a `NEWS.md` file to track changes to the package.
Expand Down
36 changes: 36 additions & 0 deletions R/class.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ setMethod(
#' @slot data data.table of absolute copy number calling.
#' @slot summary.per.sample data.table of copy number variation summary per sample.
#' @slot genome_build genome build version, should be one of 'hg19' or 'hg38'.
#' @slot genome_measure Set 'called' will use autosomo called segments size to compute total size
#' for CNA burden calculation, this option is useful for WES and target sequencing.
#' Set 'wg' will autosome size from genome build, this option is useful for WGS, SNP etc..
#' @slot annotation data.table of annotation for copy number segments.
#' @slot dropoff.segs data.table of copy number segments dropped from raw input.
#' @slot clinical.data data associated with each sample in copy number profile.
Expand All @@ -58,6 +61,7 @@ CopyNumber = setClass(
data = "data.table",
summary.per.sample = 'data.table',
genome_build = "character",
genome_measure = "character",
annotation = "data.table",
dropoff.segs = "data.table",
clinical.data = "data.table"
Expand Down Expand Up @@ -100,3 +104,35 @@ setMethod(
str(object, max.level = 2)
}
)



# Methods -----------------------------------------------------------------

#' Subsetting CopyNumber object
#'
#' Subset data slot of [CopyNumber] object, un-selected rows will move to
#' dropoff.segs slot, annotation slot will update in the same way.
#'
#' @param x a [CopyNumber] object to be subsetted.
#' @param subset logical expression indicating rows to keep.
#' @param ... further arguments to be passed to or from other methods.
#' Useless here.
#' @author Shixiang Wang
#' @return a [CopyNumber] object
#' @export
subset.CopyNumber = function(x, subset = TRUE, ...) {
data = x@data
enclos = parent.frame()
subset = substitute(subset)
row_selector = eval(subset, data, enclos)

x@dropoff.segs = rbind(x@dropoff.segs, data[!row_selector])
x@data = data[row_selector]
x@annotation = x@annotation[row_selector]

x@summary.per.sample = get_cnsummary_sample(x@data,
genome_build = x@genome_build,
genome_measure = x@genome_measure)
x
}
2 changes: 2 additions & 0 deletions R/read_series.R
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ read_copynumber = function(input,
data = data_df,
summary.per.sample = sum_sample,
genome_build = genome_build,
genome_measure = genome_measure,
annotation = annot,
dropoff.segs = dropoff_df,
clinical.data = data.table::data.table()
Expand All @@ -355,6 +356,7 @@ read_copynumber = function(input,
data = data_df,
summary.per.sample = sum_sample,
genome_build = genome_build,
genome_measure = genome_measure,
annotation = annot,
dropoff.segs = dropoff_df,
clinical.data = data.table::as.data.table(clinical_data)
Expand Down
4 changes: 4 additions & 0 deletions man/CopyNumber-class.Rd

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

26 changes: 26 additions & 0 deletions man/subset.CopyNumber.Rd

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

0 comments on commit a5de2cb

Please sign in to comment.