Skip to content

Commit

Permalink
Merge branch 'main' of github.com:uclahs-cds/public-R-NanoStringNorm …
Browse files Browse the repository at this point in the history
…into danknight-r-check
  • Loading branch information
dan-knight committed Jan 18, 2025
2 parents ccb328b + da0573d commit e68a8a3
Show file tree
Hide file tree
Showing 10 changed files with 266 additions and 224 deletions.
10 changes: 6 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
Package: NanoStringNorm
Type: Package
Title: Normalize NanoString miRNA and mRNA Data
Version: 2.0.0
Date: 2023-03-21
Version: 3.0.0
Date: 2025-01-15
Authors@R: c(
person(c("Daryl", "M."), "Waggott", role = "aut"),
person("Paul", "Boutros", email = "[email protected]", role = "cre"),
person("Dan", "Knight", role = "ctb"))
Depends: R (>= 2.14.0), gdata (>= 2.8.2), XML (>= 3.98-1.5)
Imports: methods
Depends:
R (>= 2.14.0)
Imports:
methods
Suggests: googleVis (>= 0.2.14), lme4, RUnit (>= 0.4.26)
Description: A set of tools for normalizing, diagnostics and visualization of NanoString nCounter data.
License: GPL-2
Expand Down
6 changes: 1 addition & 5 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export(
'NanoStringNorm',
'Plot.NanoStringNorm',
'Plot.NanoStringNorm.gvis',
'read.xls.RCC',
'read.csv.RCC',
'read.markup.RCC',
'other.normalization',
'norm.comp',
Expand All @@ -20,10 +20,6 @@ importFrom("stats", "aov", "coef", "cor", "density", "lm", "lowess",
importFrom("utils", "download.file", "packageDescription",
"read.table")
importFrom("utils", "read.csv")
import(
'gdata',
'XML'
)



Expand Down
100 changes: 53 additions & 47 deletions NEWS → NEWS.md
Original file line number Diff line number Diff line change
@@ -1,89 +1,98 @@
NanoStringNorm 2.0.0 2023-03-21
----------------------------------------------------------------
REMOVED
# NanoStringNorm 3.0.0 (2025-01-15)

## Removed
* Removed Excel `.xls` support due to broken CRAN dependency

## Added
* Added CSV support for nCounter Excel files. Excel files must be converted externally.

## Changed
* Update changelog to Markdown format


# NanoStringNorm 2.0.0 (2023-03-21)

## Removed
* Removed vsn functionality due to broken CRAN dependency

NanoStringNorm 1.2.1 2017-12-11
----------------------------------------------------------------

BUG
# NanoStringNorm 1.2.1 (2017-12-11)

## Fixed
* Fixed unclosed file connection bug

NanoStringNorm 1.2.0 2017-08-18
----------------------------------------------------------------

# NanoStringNorm 1.2.0 (2017-08-18)

## Fixed
* fixed read.markup.RCC() error on new NanoString nCounter FLEX instrument

NanoStringNorm 1.1.22 2017-06-30
----------------------------------------------------------------

# NanoStringNorm 1.1.22 (2017-06-30)

## Added
* NanoStringNorm
- added parameters "CodeCount.summary.target" and "SampleContent.summary.target"
- these parameters allow users to specify expected positive control and housekeeping probe summary values, which are used during the cross-sample normalization
- this update allows for sample-independent normalization of various CodeCount and SampleContent methods

NanoStringNorm 1.1.17 2014-01-15
----------------------------------------------------------------

# NanoStringNorm 1.1.17 (2014-01-15)

## Fixed
* fixed error using only one control gene. the matrix in the apply statement was getting changed to vector.

NanoStringNorm v1.1.16 2013-09-01
----------------------------------------------------------------

# NanoStringNorm v1.1.16 (2013-09-01)

## Changed
* lme4
-lme4 doesn't work on some platforms
-NSN "suggests" lme4 but errored out if it was missing due to examples
-solution was add if(require(pkg)) in examples
-this was done for all suggests packages

* lme4 doesn't work on some platforms
* NSN "suggests" lme4 but errored out if it was missing due to examples
* solution was add if(require(pkg)) in examples
* this was done for all suggests packages
* Runit
if(require(RUnit)) was added to NanoStringNorm.unitTests.R. Runit was recommended by BR to be a suggests and not a depends.
- package needs to be able to run/test with and without suggest packages

* if(require(RUnit)) was added to NanoStringNorm.unitTests.R. Runit was recommended by BR to be a suggests and not a depends.
* package needs to be able to run/test with and without suggest packages

## Fixed
* Rd line length. R-devel fails on example/usage length of 90.

* ::: dropped in code due to check warning


NanoStringNorm 1.1.15 2014-01-15
----------------------------------------------------------------
# NanoStringNorm 1.1.15 (2014-01-15)

## Fixed
* R check compatablility
- reduced size of high resolution bitmaps used in vignette (100kb saved!)
- changed Nanostring to NanoString in text (seriously!)
- made googleVis example conditional depending on installation. the package is under "suggests"
* reduced size of high resolution bitmaps used in vignette (100kb saved!)
* changed Nanostring to NanoString in text (seriously!)
* made googleVis example conditional depending on installation. the package is under "suggests"
* bug when negative control removes signal from all samples


NanoStringNorm 1.1.14 2013-04-04
----------------------------------------------------------------

BUG FIXES
# NanoStringNorm 1.1.14 (2013-04-04)

## Fixed
* sample.content.norm. added some error handling for cases where rna.content was estimated to be zero, resulting in normalization factors that were infinity and errors in norm.comp

NanoStringNorm 1.1.12 2012-12-01
----------------------------------------------------------------

BUG FIXES
# NanoStringNorm 1.1.12 (2012-12-01)

## Fixed
* read.xls.RCC. more informative error messages and allowed id instead of sample.id in header
* Plot.NanoStringNorm.gvis. set default browser if not set.

NanoStringNorm 1.1.11 2012-10-01
----------------------------------------------------------------

MINOR FEATURES
# NanoStringNorm 1.1.11 (2012-10-01)

## Added
* added parameter "guess.cartridges" in NanoStringNorm function. Cartridge estimates can be estimated from sample order and used in batch effect estimates
* in Plot.NanoStringNorm the control types have different symbols
* added some text to better describe the figures. also replaced the png with pdf for better resolution
* made it so you can add manual and auto labels at the same time
* added options label.n to specify the number of outliers to plot and label.as.legend to allow the labels to be written as a legend to avoid messy overlaps
* output FDR qvalues

BUG FIXES

## Fixed
* Plot.NanoStringNorm had a missing curly brace and forgotten browser statement
* Shifted labels on positive.control plot to avoid overlap if long
* Added regex for positive control names in cv plot, probe.correction function and norm.comp. sometimes the positive controls are named differently causing them to be missed during calculations
Expand All @@ -92,11 +101,10 @@ BUG FIXES
* Fixed norm.factor plot positions when only one plot
* changed low.cv.geo.mean method to better find low cv genes

NanoStringNorm 1.1.10 2012-09-01
----------------------------------------------------------------

MINOR FEATURES
# NanoStringNorm 1.1.10 (2012-09-01)

## Added
* Added colour argument `col` in Plot.NanoStringNorm to change default plotting colours
* Added function read.markup.RCC to process single sample markup RCC files
* Changed NanoStringNorm log argument to `take.log`
Expand All @@ -107,9 +115,7 @@ MINOR FEATURES
* Added argument `icc.method` in norm.comp to choose between anova (fast) and mixed (more appropriate)
* Changed default sample name in read.xls.rcc to file.name


BUG FIXES

## Fixed
* Added check in NanoStringNorm to check if input is a matrix, list, or data.frame
* Added check for `Code.Class` colum in norm.comp. The col is referenced but the data is not exhaustively checked. The check was also added to the read.markup.RCC function
* Added check for problem input in read.xls.RCC
Expand Down
84 changes: 84 additions & 0 deletions R/read.csv.RCC.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
read.csv.RCC <- function(path, sample.id.row = 'File.Name') {
if (!file.exists(path)) {
stop(paste('File not found:', path)) ;
}

prep.rcc <- function(path) {
data <- read.csv(
path,
header = FALSE,
strip.white = TRUE
);
data <- data[!sapply(data, function(x) all(is.na(x)))];

data.start.index <- min(which(data[, 1] == 'Reporter Counts'));
header <- data[1:(data.start.index - 1), ];
data <- data[data.start.index:nrow(data), ];

return(list(
header = header,
x = data
));
}
rcc <- prep.rcc(path);

if (is.null(rcc$header)) {
stop('There appears to be a problem with the RCC CSV file. No header information found.');
}

rcc$header <- rcc$header[is.na(rcc$header[1]) | (rcc$header[1] != ''), ];
rownames(rcc$header) <- rcc$header[, 1];
rcc$header <- rcc$header[, -1];

rownames(rcc$header) <- gsub(' $', '', rownames(rcc$header));
rownames(rcc$header) <- gsub(' ', '.', rownames(rcc$header));
rownames(rcc$header) <- tolower(rownames(rcc$header));

if ('id' %in% rownames(rcc$header)) {
rownames(rcc$header)[rownames(rcc$header) == 'id'] <- 'sample.id';
}

if (!all(c('file.name', 'sample.id', 'binding.density') %in% rownames(rcc$header))) {
stop('There appears to be a problem with the RCC CSV file. Rownames in header are missing "File name", "Sample id", "Binding density"');
}

rcc$header <- rcc$header[!rownames(rcc$header) %in% c('file.attributes', 'lane.attributes'), -c(1,2)];

sample.ids <- rcc$header[rownames(rcc$header) %in% tolower(sample.id.row),];
sample.ids <- gsub(' ', '.', sample.ids);
sample.ids <- gsub('^([0-9])', 'X\\1', sample.ids);
colnames(rcc$header) <- sample.ids;

if (is.null(rcc$x)) {
stop('There appears to be a problem with the RCC CSV file. Likely couldnt find the count specifically "Code Class" in header information.');
}

colnames(rcc$x) <- rcc$x[2, ];
rcc$x <- rcc$x[-c(1:2), 1:(3 + length(sample.ids))];

rows.with.missing.anno <- (rcc$x[, 1] == '' | rcc$x[, 2] == '');
if (any(rows.with.missing.anno)) {
rcc$x <- rcc$x[!rows.with.missing.anno,];
cat(paste('The following row(s)', paste(which(rows.with.missing.anno), collapse = ', '), 'have been dropped due to missing annotation.\n\t You may want to double check the excel file.\n\n'));
}

colnames(rcc$x) <- gsub(' ', '.', colnames(rcc$x));
colnames(rcc$x) <- c(colnames(rcc$x)[1:3], sample.ids);

cat(paste('There were', length(sample.ids), 'samples imported. \nNote that spaces in sample names will be replaced by dots. \n'));

if (length(sample.ids) > 5) {
cat('The first and last 3 sample names found in the dataset are:\n');
cat(paste(c(sample.ids[1:3], rev(sample.ids)[1:3])));
}
else {
cat('The sample names found in the dataset are:\n');
cat(paste(sample.ids));
}

cat(paste('\n\nThere were', nrow(rcc$x), 'genes imported with the following Code Class breakdown:'));
print(table(rcc$x[, 'Code.Class']));

class(rcc) <- 'NanoString';
return(rcc);
}
Loading

0 comments on commit e68a8a3

Please sign in to comment.