Skip to content
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
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
^\.github$
^metadata\.yaml$
^LICENSE\.md$
^\.cicd-env$
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Package: NanoStringNormCNV
Type: Package
Title: Helper Functions to Normalize NanoString CNV Data
Version: 1.1.2
Date: 2017-11-07
Version: 1.1.3
Date: 2026-01-22
Author: Cindy Yao, Emilie Lalonde, Dorota Sendorek
Maintainer: Paul Boutros <PBoutros@mednet.ucla.edu>
Maintainer: Paul Boutros <pboutros@sbpdiscovery.org>
Depends: R (>= 3.0.2),lattice (>= 0.20-27), BoutrosLab.plotting.general (>= 3.6.20), mclust (>= 4.4), gdata (>= 2.8.2)
Imports: futile.logger (>= 1.3.7), testthat, reshape2 (>= 1.4), vsn (>= 3.22.0), NanoStringNorm (>= 1.1.18), vegan
Suggests: googleVis (>= 0.2.14)
Expand Down
9 changes: 8 additions & 1 deletion NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
NanoStringNormCNV 1.1.3 2026-01-22

CHANGE
* Updated maintainer email

--------------------------------------------------------------------------
NanoStringNormCNV 1.1.0 2017-05-20

CHANGE
Expand Down Expand Up @@ -54,4 +60,5 @@ BUG
--------------------------------------------------------------------------
NanoStringNormCNV 1.0.0 2017-03-28

Initial release
NEW
* Initial release
14 changes: 7 additions & 7 deletions R/apply.kd.cna.thresh.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apply.kd.cna.thresh <- function(ratio.data, kd.values, neutral.cn = 2) {
if (2 != length(kd.values) & 4 != length(kd.values)) {
stop("Must provide either two or four KD values! Please see documentation for details.");

Check warning on line 3 in R/apply.kd.cna.thresh.R

View workflow job for this annotation

GitHub Actions / CICD-base

Only use single-quotes.
}

# assign header names
Expand All @@ -15,7 +15,7 @@
na.counts <- apply(
X = ratio.data[,which.n, drop = FALSE],
MARGIN = 2,
FUN = function(f) { all(is.na(f)) }

Check warning on line 18 in R/apply.kd.cna.thresh.R

View workflow job for this annotation

GitHub Actions / CICD-base

Closing curly-braces should always be on their own line, unless they are followed by an else.

Check warning on line 18 in R/apply.kd.cna.thresh.R

View workflow job for this annotation

GitHub Actions / CICD-base

Opening curly braces should never go on their own line and should always be followed by a new line.
);

if (any(na.counts)) {
Expand All @@ -24,28 +24,28 @@
which.cna <- which.cna[which.n];
}
cna.output <- ratio.data[, which.cna, drop = FALSE];

Check warning on line 27 in R/apply.kd.cna.thresh.R

View workflow job for this annotation

GitHub Actions / CICD-base

Trailing whitespace is superfluous.
# determine the thresholds based on all patients combined
# shown to be more stable if only considering small subset of patients
if (2 == length(kd.values)) {

cna.thresh.single <- NanoStringNormCNV:::get.cna.thresholds(ratios = unlist(cna.output), percent = kd.values[1]); # het
cna.thresh.multi <- NanoStringNormCNV:::get.cna.thresholds(ratios = unlist(cna.output), percent = kd.values[2]); # hom
cna.thresh.single <- get.cna.thresholds(ratios = unlist(cna.output), percent = kd.values[1]); # het
cna.thresh.multi <- get.cna.thresholds(ratios = unlist(cna.output), percent = kd.values[2]); # hom
thresh <- c(cna.thresh.multi[1], cna.thresh.single, cna.thresh.multi[2]);

} else if (4 == length(kd.values)) {

thresh <- vector(length = 4);
thresh[1] <- NanoStringNormCNV:::get.cna.thresholds(ratios = unlist(cna.output), percent = kd.values[1])[[1]]; # hom del
thresh[2] <- NanoStringNormCNV:::get.cna.thresholds(ratios = unlist(cna.output), percent = kd.values[2])[[1]]; # het del
thresh[4] <- NanoStringNormCNV:::get.cna.thresholds(ratios = unlist(cna.output), percent = kd.values[4])[[2]]; # hom gain
thresh[3] <- NanoStringNormCNV:::get.cna.thresholds(ratios = unlist(cna.output), percent = kd.values[3])[[2]]; # het gain
thresh[1] <- get.cna.thresholds(ratios = unlist(cna.output), percent = kd.values[1])[[1]]; # hom del
thresh[2] <- get.cna.thresholds(ratios = unlist(cna.output), percent = kd.values[2])[[1]]; # het del
thresh[4] <- get.cna.thresholds(ratios = unlist(cna.output), percent = kd.values[4])[[2]]; # hom gain
thresh[3] <- get.cna.thresholds(ratios = unlist(cna.output), percent = kd.values[3])[[2]]; # het gain

}

# loop over each sample to call CNA states
for (col.ind in 1:ncol(cna.output)) {
cna.output[, col.ind] <- NanoStringNormCNV:::tumour.normal.ratio.to.cn.state(
cna.output[, col.ind] <- tumour.normal.ratio.to.cn.state(
ratios = cna.output[, col.ind],
thresholds = thresh
);
Expand Down
14 changes: 7 additions & 7 deletions R/call.cnas.with.matched.normals.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ call.cnas.with.matched.normals <- function(
}

# identify and process XY probes separately
xy.processed.data <- NanoStringNormCNV:::process.xy.probes(
xy.processed.data <- process.xy.probes(
normalized.data = normalized.data,
sex.info = phenodata[, c("SampleID", "Sex")]
);
Expand Down Expand Up @@ -76,7 +76,7 @@ call.cnas.with.matched.normals <- function(
c("SampleID", "Cartridge")
];

raw.ratios <- NanoStringNormCNV:::call.copy.number.values(
raw.ratios <- call.copy.number.values(
normalized.data = input.data,
reference = ref,
thresh.method = 'none',
Expand All @@ -89,7 +89,7 @@ call.cnas.with.matched.normals <- function(

# calculate tumour:normal ratios (for male sex chrom probes, if any)
if (!is.null(sex.probes) && tmr %in% has.ref.XY && length(use.genes.XY) > 0) {
raw.ratios.xy <- NanoStringNormCNV:::call.copy.number.values(
raw.ratios.xy <- call.copy.number.values(
normalized.data = input.data.XY,
reference = ref,
thresh.method = 'none',
Expand All @@ -106,7 +106,7 @@ call.cnas.with.matched.normals <- function(
thresh <- c(0.4, 1.5, 2.5, 3.5);

# call CNAs in tumours (for autosome and female sex chrom probes)
round.ratios <- NanoStringNormCNV:::call.copy.number.values(
round.ratios <- call.copy.number.values(
normalized.data = input.data,
reference = ref,
per.chip = per.chip,
Expand All @@ -120,7 +120,7 @@ call.cnas.with.matched.normals <- function(

# call CNAs in tumours (for male sex chrom probes)
if (!is.null(sex.probes) && tmr %in% has.ref.XY && length(use.genes.XY) > 0) {
round.ratios.xy <- NanoStringNormCNV:::call.copy.number.values(
round.ratios.xy <- call.copy.number.values(
normalized.data = input.data.XY,
reference = ref,
per.chip = per.chip,
Expand All @@ -143,7 +143,7 @@ call.cnas.with.matched.normals <- function(
}

# call CNAs in tumours (for autosome and female sex chrom probes)
round.ratios <- NanoStringNormCNV:::call.copy.number.values(
round.ratios <- call.copy.number.values(
normalized.data = input.data,
reference = ref,
per.chip = per.chip,
Expand All @@ -158,7 +158,7 @@ call.cnas.with.matched.normals <- function(

# call CNAs in tumours (for male sex chrom probes)
if (!is.null(sex.probes) && tmr %in% has.ref.XY && length(use.genes.XY) > 0) {
round.ratios.xy <- NanoStringNormCNV:::call.copy.number.values(
round.ratios.xy <- call.copy.number.values(
normalized.data = input.data.XY,
reference = ref,
per.chip = per.chip,
Expand Down
18 changes: 9 additions & 9 deletions R/call.cnas.with.pooled.normals.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ call.cnas.with.pooled.normals <- function(
}

# identify and process XY probes separately
xy.processed.data <- NanoStringNormCNV:::process.xy.probes(
xy.processed.data <- process.xy.probes(
normalized.data = normalized.data,
sex.info = phenodata[, c("SampleID", "Sex")]
);
Expand All @@ -42,7 +42,7 @@ call.cnas.with.pooled.normals <- function(
use.genes <- which(normalized.data$CodeClass %in% use.codeclass);

# calculate tumour:normal ratios (for autosome and female sex chrom probes)
cna.raw <- NanoStringNormCNV:::call.copy.number.values(
cna.raw <- call.copy.number.values(
normalized.data = normalized.data[use.genes,],
reference = phenodata$SampleID[is.ref],
per.chip = per.chip,
Expand All @@ -54,7 +54,7 @@ call.cnas.with.pooled.normals <- function(

# calculate tumour:normal ratios (for male sex chrom probes)
if (!is.null(sex.probes) && ncol(normalized.data.XY) > 0 && length(use.genes.XY) > 0 && length(is.ref.XY) > 0) {
cna.raw.XY <- NanoStringNormCNV:::call.copy.number.values(
cna.raw.XY <- call.copy.number.values(
normalized.data = normalized.data.XY[use.genes.XY,],
reference = phenodata[phenodata$Sex %in% 'M',]$SampleID[is.ref.XY],
per.chip = per.chip,
Expand All @@ -71,7 +71,7 @@ call.cnas.with.pooled.normals <- function(
}

# call CNAs in normals (for autosome and female sex chrom probes)
cna.normals.unadj <- NanoStringNormCNV:::call.copy.number.values(
cna.normals.unadj <- call.copy.number.values(
normalized.data = normalized.data[, c(1:3, (is.ref + 3))],
reference = phenodata$SampleID[is.ref],
per.chip = FALSE,
Expand Down Expand Up @@ -105,7 +105,7 @@ call.cnas.with.pooled.normals <- function(
}

# call CNAs in tumours (for autosome and female sex chrom probes)
cna.rounded <- NanoStringNormCNV:::call.copy.number.values(
cna.rounded <- call.copy.number.values(
normalized.data = normalized.data[use.genes,],
reference = phenodata$SampleID[is.ref],
per.chip = per.chip,
Expand All @@ -117,7 +117,7 @@ call.cnas.with.pooled.normals <- function(

# call CNAs in tumours (for male sex chrom probes)
if (!is.null(sex.probes) && ncol(normalized.data.XY) > 0 && length(use.genes.XY) > 0 && length(is.ref.XY) > 0) {
cna.rounded.XY <- NanoStringNormCNV:::call.copy.number.values(
cna.rounded.XY <- call.copy.number.values(
normalized.data = normalized.data.XY[use.genes.XY,],
reference = phenodata[phenodata$Sex %in% 'M',]$SampleID[is.ref.XY],
per.chip = per.chip,
Expand All @@ -143,7 +143,7 @@ call.cnas.with.pooled.normals <- function(
}

# call CNAs in tumours (for autosome and female sex chrom probes)
cna.rounded <- NanoStringNormCNV:::call.copy.number.values(
cna.rounded <- call.copy.number.values(
normalized.data = normalized.data[use.genes,],
reference = phenodata$SampleID[is.ref],
per.chip = per.chip,
Expand All @@ -156,7 +156,7 @@ call.cnas.with.pooled.normals <- function(

# call CNAs in tumours (for male sex chrom probes)
if (!is.null(sex.probes) && ncol(normalized.data.XY) > 0 && length(use.genes.XY) > 0 && length(is.ref.XY) > 0) {
cna.rounded.XY <- NanoStringNormCNV:::call.copy.number.values(
cna.rounded.XY <- call.copy.number.values(
normalized.data = normalized.data.XY[use.genes.XY,],
reference = phenodata[phenodata$Sex %in% 'M',]$SampleID[is.ref.XY],
per.chip = per.chip,
Expand All @@ -178,7 +178,7 @@ call.cnas.with.pooled.normals <- function(

# call CNAs in normals (for male sex chrom probes)
if (!is.null(sex.probes) && ncol(normalized.data.XY) > 0 && length(use.genes.XY) > 0 && length(is.ref.XY) > 0) {
cna.normals.unadj.XY <- NanoStringNormCNV:::call.copy.number.values(
cna.normals.unadj.XY <- call.copy.number.values(
normalized.data = normalized.data.XY[, c(1:3, (is.ref.XY + 3))],
reference = phenodata[phenodata$Sex %in% 'M',]$SampleID[is.ref.XY],
per.chip = FALSE,
Expand Down
6 changes: 3 additions & 3 deletions R/call.copy.number.values.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ call.copy.number.values <- function(
}

# get tumour:normal ratios
out.cna <- NanoStringNormCNV:::get.tumour.normal.ratio(
out.cna <- get.tumour.normal.ratio(
normalized.data = normalized.data,
reference = reference,
chip.info = chip.info,
Expand All @@ -52,15 +52,15 @@ call.copy.number.values <- function(
if (thresh.method == 'round') {

# segment using set thresholds
out.cna.final <- NanoStringNormCNV:::apply.ns.cna.thresh(
out.cna.final <- apply.ns.cna.thresh(
ratio.data = out.cna,
cna.thresh = cna.thresh
);

} else if (thresh.method == 'KD') {

# segment using thresholds obtained through kernel density approach
out.cna.final <- NanoStringNormCNV:::apply.kd.cna.thresh(
out.cna.final <- apply.kd.cna.thresh(
ratio.data = out.cna,
kd.values = kd.values,
neutral.cn = multi.factor
Expand Down
4 changes: 2 additions & 2 deletions R/evaluate.replicates.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ evaluate.replicates <- function(phenodata, normalized.data = NULL, cna.rounded =

# calculate count variance
if (!is.null(count.reps)) {
var.matrix <- NanoStringNormCNV:::calculate.replicate.variance(
var.matrix <- calculate.replicate.variance(
normalized.data.reps = count.reps,
phenodata.reps = pheno.reps.count
);
}

# calculate CNA concordance
if (!is.null(cna.reps)) {
conc.matrix <- NanoStringNormCNV:::calculate.replicate.concordance(
conc.matrix <- calculate.replicate.concordance(
cna.rounded.reps = cna.reps,
phenodata.reps = pheno.reps.cna
);
Expand Down
4 changes: 2 additions & 2 deletions R/make.cna.heatmap.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ make.cna.heatmap <- function(nano.cnas, fname.stem = NULL, covs.rows = NULL, cov
}

# create covariates
cov.objs <- NanoStringNormCNV:::generate.plot.covariates(
cov.objs <- generate.plot.covariates(
plotting.data = nano.cnas,
sample.covariates = c.row,
gene.covariates = c.col
Expand All @@ -50,7 +50,7 @@ make.cna.heatmap <- function(nano.cnas, fname.stem = NULL, covs.rows = NULL, cov
}

cov.list <- cov.list[!(names(cov.list) %in% c('SampleID', 'Name'))];
covs.legend <- NanoStringNormCNV:::generate.plot.legend(cov.info = cov.list);
covs.legend <- generate.plot.legend(cov.info = cov.list);
} else {
covs.legend <- NULL;
}
Expand Down
4 changes: 2 additions & 2 deletions R/make.counts.heatmap.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ make.counts.heatmap <- function(nano.counts, fname.stem = NULL, covs.rows = NULL

if (!is.null(c.col) | !is.null(c.row)) {
# covariates
cov.objs <- NanoStringNormCNV:::generate.plot.covariates(
cov.objs <- generate.plot.covariates(
plotting.data = nano.counts,
sample.covariates = c.row,
gene.covariates = c.col
Expand All @@ -52,7 +52,7 @@ make.counts.heatmap <- function(nano.counts, fname.stem = NULL, covs.rows = NULL
}

cov.list <- cov.list[!(names(cov.list) %in% c('SampleID', 'Name'))];
covs.legend <- NanoStringNormCNV:::generate.plot.legend(cov.info = cov.list);
covs.legend <- generate.plot.legend(cov.info = cov.list);
} else {
covs.legend <- NULL;
}
Expand Down
4 changes: 2 additions & 2 deletions R/make.positive.control.plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ make.positive.control.plot <- function(correlations, covs = NULL, print.x.labels

if (!is.null(covs) & ncol(covs) > 1) {
# covariates
cov.objs <- NanoStringNormCNV:::generate.plot.covariates(
cov.objs <- generate.plot.covariates(
plotting.data = correlations,
sample.covariates = covs
);
cov.obj <- cov.objs[['sample']];

# legend
covs <- covs[, names(covs) != 'SampleID'];
covs.legend <- NanoStringNormCNV:::generate.plot.legend(cov.info = as.list(covs));
covs.legend <- generate.plot.legend(cov.info = as.list(covs));

clust.dim <- 'columns';
} else {
Expand Down
4 changes: 2 additions & 2 deletions R/make.sample.correlations.heatmap.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ make.sample.correlations.heatmap <- function(nano.counts, cor.method = 'pearson'
}

# covariates
cov.objs <- NanoStringNormCNV:::generate.plot.covariates(
cov.objs <- generate.plot.covariates(
plotting.data = nano.counts,
sample.covariates = covs
);
cov.obj <- cov.objs[['sample']];

# legend
covs <- covs[, names(covs) != 'SampleID', drop = FALSE];
covs.legend <- NanoStringNormCNV:::generate.plot.legend(cov.info = as.list(covs));
covs.legend <- generate.plot.legend(cov.info = as.list(covs));
} else {
covs.legend <- NULL;
cov.obj <- NULL;
Expand Down
2 changes: 1 addition & 1 deletion R/restriction.fragmentation.qc.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ restriction.fragmentation.qc <- function(raw.data){
}

# plot the ratios
NanoStringNormCNV:::make.restriction.fragmentation.plot(
make.restriction.fragmentation.plot(
restr.data = nano.restr.avg,
low.ratio.samples = which.low
);
Expand Down
Loading
Loading