Coder Social home page Coder Social logo

nanostring-biostats / nanostringnctools Goto Github PK

View Code? Open in Web Editor NEW
6.0 17.0 6.0 3.67 MB

Tools for NanoString Technologies nCounter Technology for reading RCC files into an ExpressionSet derived object, QC and normalization.

License: MIT License

R 100.00%

nanostringnctools's Introduction

NanoStringNCTools

Overview

The NanoStringNCTools package contains tools for analyzing data from NanoString nCounter Technology. It provides functions to read, quality control (QC) and normalize starting from Nanostring RCC and RLF files generated from the NanoString nCounter.

It contains the definition of the NanoStringRCCSet which inherits from Biobase’s ExpressionSet class and complimentary functions that will help in starting analysis.

Installation

Download the release version from Bioconductor

https://bioconductor.org/packages/release/bioc/html/NanoStringNCTools.html

Install the release version from Bioconductor

if (!requireNamespace("BiocManager", quietly=TRUE))
    install.packages("BiocManager")

BiocManager::install(version="release")

BiocManager::install("NanoStringNCTools")

Install the development version from GitHub

devtools::install_github("Nanostring-Biostats/NanoStringNCTools", 
                         build_vignettes = TRUE, ref = "dev")

Documentation

To learn how to start using NanoStringNCTools, view documentation for the version of this package installed in your system, start R and enter:

browseVignettes("NanoStringNCTools")

Branches

The release version on Bioconductor is the stable version. https://bioconductor.org/packages/release/bioc/html/NanoStringNCTools.html

The devel version on Bioconductor is upstream of master on GitHub. It is under active development and no guarantee is made on usability at any given time.

The dev branch on GitHub is under active development and no guarantee is made on usability at any given time.

Citation

Aboyoun, P.; Ortogero, N.; Yang, Z.; Reeves, J.; Gorman, K.; Vitancol, R.; Smith, T.; Ren, Y.; Henderson, D. NanoStringNCTools: NanoString nCounter Tools. R Package Version 1.0.0. NanoString Technologies Inc.; Seattle, WA 98109, USA. 2021.

License

This project is licensed under the MIT license.

nanostringnctools's People

Contributors

aboyoun avatar dnadave avatar gary-procogia avatar jasonwreeves avatar jwokaty avatar karagorman avatar maddygriz avatar nicoleeo avatar nranthony avatar nturaga avatar oisin-procogia avatar rvitancol avatar thomashsmith avatar yuqiren avatar zhiiiyang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nanostringnctools's Issues

Error in `check_aesthetics() when following Introduction vignette

Hello!
I am attempting to follow the Introduction vignette for this package. When I reach the Built-in Quality Control Assessment section and try to plot QC metrics using the command:
girafe( ggobj = autoplot( demoData , "bindingDensity-mean" ) ) (or use any of the other metric types)
I get the error:
Error in check_aesthetics(): ! Aesthetics must be either length 1 or the same as the data (12): tooltip_fill

I would appreciate any help you could provide me to solve this issue. Thank you very much!

My session info:
sessionInfo()
R version 4.1.0 (2021-05-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19043)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252

attached base packages:
[1] stats4 parallel stats graphics grDevices utils datasets methods base

other attached packages:
[1] ggiraph_0.8.2 ggthemes_4.2.4 NanoStringNCTools_1.0.0 ggplot2_3.3.6 S4Vectors_0.30.2 Biobase_2.52.0
[7] BiocGenerics_0.38.0

loaded via a namespace (and not attached):
[1] beeswarm_0.4.0 tidyselect_1.1.2 purrr_0.3.4 colorspace_2.0-3 vctrs_0.3.8 generics_0.1.3
[7] htmltools_0.5.1.1 yaml_2.2.1 utf8_1.2.2 rlang_1.0.3 pillar_1.7.0 glue_1.6.2
[13] withr_2.5.0 DBI_1.1.3 RColorBrewer_1.1-3 uuid_1.1-0 GenomeInfoDbData_1.2.6 lifecycle_1.0.1
[19] stringr_1.4.0 zlibbioc_1.38.0 Biostrings_2.60.2 munsell_0.5.0 gtable_0.3.0 htmlwidgets_1.5.4
[25] evaluate_0.15 labeling_0.4.2 IRanges_2.26.0 GenomeInfoDb_1.28.4 vipor_0.4.5 fansi_0.5.0
[31] Rcpp_1.0.8.3 scales_1.2.0 BiocManager_1.30.18 XVector_0.32.0 systemfonts_1.0.4 digest_0.6.27
[37] stringi_1.7.6 dplyr_1.0.7 grid_4.1.0 cli_3.3.0 tools_4.1.0 bitops_1.0-7
[43] magrittr_2.0.1 RCurl_1.98-1.7 tibble_3.1.3 crayon_1.5.1 pkgconfig_2.0.3 ellipsis_0.3.2
[49] pheatmap_1.0.12 ggbeeswarm_0.6.0 assertthat_0.2.1 rstudioapi_0.13 R6_2.5.1 compiler_4.1.0

Transfer edits from Rpackages

The following are edits from Rpackages missing from NCTools

Autoplot:

  • Add the function shiftfromzero to the beginning of ercc-lod. This function is in 360 so will need to define as well add call.
    image
  • Add labels to autoplot scale_colour_manual. Note: sapply needs to be replaced with vapply for bioc here.
    image

@rvitancol and @dnadave, I confirmed that these are the only edits still missing that didn't make it into NCTools during the repo split.

Update .rccMetadata for reading one rcc file

Currently, .rccMetadata is required to read one rcc file. Either the readRccFile function should not be exported or this function should access rccMetadata through a member access function instead of directly calling.

build warnings from bioconductor

  • checking replacement functions ... WARNING

    setSigFuncs<- \S4method{setSigFuncs<-}{SignatureSet,character}
    The argument of a replacement function which corresponds to the right
    hand side must be named value.

  • checking Rd files ... [0s/0s] WARNING

checkRd: (7) NanoStringRccSet-autoplot.Rd:14-49: Tag \code is invalid in a \usage block
prepare_Rd: SignatureSet.Rd:74-75: Dropping empty section \examples
prepare_Rd: geom_beeswarm_interactive.Rd:53-54: Dropping empty section \examples
checkRd: (7) normalize.Rd:10: Tag \code is invalid in a \usage block
checkRd: (7) setQCFlags.Rd:10-20: Tag \code is invalid in a \usage block

  • checking Rd metadata ... WARNING

Rd files with duplicated alias 'autoplot.NanoStringRccSet':
NanoStringRccSet-autoplot.Rd NanoStringRccSet-class.Rd
Rd files with duplicated alias 'setQCFlags':
NanoStringRccSet-class.Rd setQCFlags.Rd

  • checking for missing documentation entries ... WARNING

Undocumented code objects:
getSigFuncs groups groups<- setSignatureFuncs<-
setSignatureGroups<- signatureFuncs signatureGroups version
version<-
Undocumented S4 methods:
generic 'getSigFuncs' and siglist 'SignatureSet'
generic 'groups' and siglist 'SignatureSet'
generic 'groups<-' and siglist 'SignatureSet,ANY'
generic 'groups<-' and siglist 'SignatureSet,NULL'
generic 'groups<-' and siglist 'SignatureSet,factor'
generic 'setSignatureFuncs<-' and siglist
'NanoStringRccSet,character'
generic 'setSignatureGroups<-' and siglist
'NanoStringRccSet,character'
generic 'setSignatureGroups<-' and siglist 'NanoStringRccSet,factor'
generic 'signatureFuncs' and siglist 'NanoStringRccSet'
generic 'signatureGroups' and siglist 'NanoStringRccSet'
generic 'version' and siglist 'SignatureSet'
generic 'version<-' and siglist 'SignatureSet,ANY'
generic 'version<-' and siglist 'SignatureSet,NULL'
generic 'version<-' and siglist 'SignatureSet,character'
generic 'weights<-' and siglist 'SignatureSet,CompressedNumericList'
All user-level objects in a package (including S4 classes and methods)
should have documentation entries.
See chapter Writing R documentation files in the Writing R
Extensions manual.

  • checking for code/documentation mismatches ... WARNING

Codoc mismatches from documentation object 'SignatureSet-class':
SignatureSet
Code: function(weights = NumericList(), groups = factor(), func =
character(), version = character(), ...)
Docs: function(weights = NumericList(), ...)
Argument names in code not in docs:
groups func version
Mismatches in argument names:
Position: 2 Code: groups Docs: ...

  • checking Rd \usage sections ... WARNING

Assignments in \usage in documentation object 'NanoStringRccSet-autoplot':
ERCCLoD = c(standardDeviations = 2)

  • Checking for proper Description: field...

    • WARNING: Description field in the DESCRIPTION file is too concise
  • Checking R Version dependency...

    • WARNING: Update R version dependency from 3.6 to 4.1.

pData and sData

I'm going through the GeoMX tutorial on bioconductor.
The tutorial utilizes/mentions pData and sData extensively. I wasn't able to figure out what these functions do through google searches.
Could you point me to the right direction please?
Thanks a lot!

Comments from the Bioconductor reviewer

NanoStringNCTools review (Bioconductor/Contributions#1815 (comment))

NAMESPACE

  • being done manually, instead of by roxygen2. Please make sure functions/clases exported are all needed.

Build report warnings

NOTE: These are the NOTES i'm particular about, please address these. The rest of them are also solvable for the most part (at least the ones you see on the linux builder)

  • NOTE: Avoid sapply(); use vapply()

  • NOTE: Consider adding runnable examples to the following man
    pages which document exported objects:
    geom_beeswarm_interactive.Rd, SignatureSet.Rd

  • NOTE: Consider adding a NEWS file, so your package news will be
    included in Bioconductor release announcements.

  • The windows build machine issue can be addressed by @hpages better.

R

  • There is a NOTE about indentation too(2 spaces vs 4 spaces), please

check http://bioconductor.org/developers/how-to/coding-style/ .

  • Remove commented out lines of code.

  • I'm not sure why your zzz.R has the 'testPackage' function called inside of it. This usually isn't the way zzz.R is used.

autoplot heatmap-genes - parameter passing

currently autoplot does not pass ... arguments to pheatmap in the protoheatmap section.
It would be advantageous for users to update the heatmap at least to include clustering changes (linkage & distance row/column), but also have more general flexibility based on pheatmap itself. Determine if ... should be passed directly to pheatmap in protoheatmap or if additional explicit functions should be added.

Consider reformatting the apply functions

Per Bioconductor preferences we should switch the last sapply to at least a vapply. The issue with this is we allow the user to have any input and return type and apply as they wish across feature or sample annotations. They have accepted our package as is with the last sapply, but we should consider if there are ways to keep the flexibility whilst removing the sapply.

Expand the SignatureSet class constructors

Some of the constructors for the signature set class require more flexible type matching. Specifically if you only have the signatures or if you have signatures and weights without functions.

build issue from bioconductor

  • Description file: * Checking for valid maintainer...

    • ERROR: Do not use Author/Maintainer fields. Use Authors@R.
  • Unit Tests

  • checking tests ...
    Running run_unitTests.R [14s/14s]
    [15s/15s] ERROR
    Running the tests in tests/run_unitTests.R failed.
    Last 20 lines of output:
    test_NanoStringRccSet_valid_signatures

    test_NanoStringRccSet-munge.R
    /home/pkgbuild/packagebuilder/workers/jobs/1815/NanoStringNCTools_20201216223312/NanoStringNCTools.Rcheck/NanoStringNCTools/unitTests/test_NanoStringRccSet-munge.R

    test_NanoStringRccSet-signatures.R
    /home/pkgbuild/packagebuilder/workers/jobs/1815/NanoStringNCTools_20201216223312/NanoStringNCTools.Rcheck/NanoStringNCTools/unitTests/test_NanoStringRccSet-signatures.R

    test_NanoStringRccSet-subset.R
    /home/pkgbuild/packagebuilder/workers/jobs/1815/NanoStringNCTools_20201216223312/NanoStringNCTools.Rcheck/NanoStringNCTools/unitTests/test_NanoStringRccSet-subset.R

    test_NanoStringRccSet-summary.R
    /home/pkgbuild/packagebuilder/workers/jobs/1815/NanoStringNCTools_20201216223312/NanoStringNCTools.Rcheck/NanoStringNCTools/unitTests/test_NanoStringRccSet-summary.R

    test_NanoStringRccSet-utils.R
    /home/pkgbuild/packagebuilder/workers/jobs/1815/NanoStringNCTools_20201216223312/NanoStringNCTools.Rcheck/NanoStringNCTools/unitTests/test_NanoStringRccSet-utils.R

    Error in BiocGenerics:::testPackage("NanoStringNCTools") :
    unit tests failed for package NanoStringNCTools

360 Report Error

Error running \hades\share\Rona\360v110\QC2\BareBonesReport using NCTools outside Rpackages

Report Error:

Quitting from lines 170-203 (BareBonesReport.Rmd)
Error in h(simpleError(msg, call)) :
error in evaluating the argument 'x' in selecting a method for function 't': values must be length 1,
but FUN(X[[1]]) result is length 17
Calls: ... .local -> .sigCalc -> t -> vapply -> .handleSimpleError -> h
Execution halted

mean(pcG) and mean(hkG)

nSolver normalization method multiplies endogenous gene counts with the mean of Geomean of housekeeping gene counts.

Would not mean(pcG) and mean(hkG) cause cartridge-specific batch effect as the mean value will be depending on how many samples you are using in the normalization process?

And they also make nSolver option unsuitable for the normalization of only one sample as mean(hkG)/hkG will be 1, and it will ignore the housekeeping genes.

https://github.com/Nanostring-Biostats/NanoStringNCTools/blob/master/R/NanoStringRccSet-normalize.R

Best wishes
Cankut

Background Correction?

I am currently using this package with a dataset that has been taken through the nSolver software to see if i can get the same answers as doing the entire thing in R would greatly improve our workflow. However, I do not see an option in this package for background correction. I see there are functions for QC flagging and normalization but no background correction (thresholding or subtraction). Are these not included in this package or am I missing something? I am using version 1.8.0

A permanent error in running your software

Hi

After reading RCC and annotation file I get this error

> ## QC plots 
  > girafe( ggobj = autoplot( demoData , "lane-bindingDensity" ) )
Error:
  ! Problem while setting up geom aesthetics.
ℹ Error occurred in the 1st layer.
Caused by error in `cli::cli_abort()`:
  ! Aesthetics must be either length 1 or the same as the data (75)
x Fix the following mappings: `hover_nearest`
Run `rlang::last_error()` to see where the error occurred.
> girafe( ggobj = autoplot( demoData , "lane-fov" ) )
Error:
  ! Problem while setting up geom aesthetics.
ℹ Error occurred in the 1st layer.
Caused by error in `cli::cli_abort()`:
  ! Aesthetics must be either length 1 or the same as the data (75)
x Fix the following mappings: `hover_nearest`
Run `rlang::last_error()` to see where the error occurred.
> girafe( ggobj = autoplot( demoData, "housekeep-geom" ) ) 
Error:
  ! Problem while setting up geom aesthetics.
ℹ Error occurred in the 1st layer.
Caused by error in `cli::cli_abort()`:
  ! Aesthetics must be either length 1 or the same as the data (75)
x Fix the following mappings: `hover_nearest`
Run `rlang::last_error()` to see where the error occurred.
> girafe( ggobj = autoplot( demoData , "ercc-linearity" ) )
Error:
  ! Problem while setting up geom aesthetics.
ℹ Error occurred in the 1st layer.
Caused by error in `cli::cli_abort()`:
  ! Aesthetics must be either length 1 or the same as the data (375)
x Fix the following mappings: `hover_nearest`
Run `rlang::last_error()` to see where the error occurred.
> girafe( ggobj = autoplot( demoData , "ercc-lod" ) )
Error:
  ! Problem while setting up geom aesthetics.
ℹ Error occurred in the 2nd layer.
Caused by error in `cli::cli_abort()`:
  ! Aesthetics must be either length 1 or the same as the data (75)
x Fix the following mappings: `hover_nearest`, `outlier.data_id`, `outlier.tooltip`, `outlier.onclick`,
`outlier.hover_css`, `outlier.selected_css`, `outlier.tooltip_fill`, and `outlier.hover_nearest`
Run `rlang::last_error()` to see where the error occurred.
> girafe( ggobj = autoplot( demoData , "boxplot-feature" , index = featureNames(demoData)[3] , elt = "exprs" ) )
Error in `stat_boxplot()`:
  ! Problem while setting up geom aesthetics.
ℹ Error occurred in the 1st layer.
Caused by error in `cli::cli_abort()`:
  ! Aesthetics must be either length 1 or the same as the data (1)
x Fix the following mappings: `width`
Run `rlang::last_error()` to see where the error occurred.
> demoData <- normalize( demoData , type="nSolver", fromELT = "exprs" , toELT = "exprs_norm" )
Error in normalize(demoData, type = "nSolver", fromELT = "exprs", toELT = "exprs_norm") : 
  unused arguments (type = "nSolver", fromELT = "exprs", toELT = "exprs_norm")
> autoplot( demoData , "heatmap-genes" , elt = "exprs_norm" )
Error in h(simpleError(msg, call)) : 
  error in evaluating the argument 'x' in selecting a method for function 't': 'elt' not present in assayData(object)
> 
> demoData
NanoStringRccSet (storageMode: lockedEnvironment)
assayData: 784 features, 75 samples 
element names: exprs 
protocolData
sampleNames: _01_04.RCC _01_05.RCC ...
(75 total)
varLabels: FileVersion SoftwareVersion ... Sample ID (18 total)
varMetadata: labelDescription
phenoData
sampleNames: _01_04.RCC _01_05.RCC ...
(75 total)
varLabels: Group
varMetadata: labelDescription
featureData
featureNames: Endogenous_CCNO_NM_021147.4 Endogenous_MYC_NM_002467.3 ... Housekeeping_ERCC3_NM_000122.1 (784
                                                                                                         total)
fvarLabels: CodeClass GeneName ... BarcodeComments (10 total)
fvarMetadata: labelDescription
experimentData: use 'experimentData(object)'
Annotation: NS_IO_360_v1.0 
signature: none
> 

Thanks for any help

Enable Gen 2.5 RCC Compatability

Describe the bug
Gen 2.5 RCCs use a new letter in the scanner ID, E. This needs to be added to NCTools autoplot QC functions

To Reproduce
test Rmd and files can be found here: \hades\share\kgorman\360 Dev\Gen2.5

Fix
Add E as an option for scanner ID in NanoStringRccSet-autoplot and NanoStringRccSet-qc

Tutorial link

Could you please provide the tutorial link on the Github page? or relevant documents

Add news file

News file should track versions and give list of features added, bugs fixes and things users should note.

Prajan's comments on NCTools vignette

  • Add this to intro:

Introduction

The NanostringNCTools package enables independent analysis of NanoString nCounter data (e.g. RCC/RLF data) in R.

In this vignette we will:

  • Create a Nanostring data object (e.g. NanoStringRCCSet) integrating RCC + RLF + Annotation data
  • Learn to summarize, subset, transform the data object
  • Perform and visualize quality control assessments of the data
  • Perform data normalization for downstream analyses

NanoStringRCCSet was inherited from Biobase's ExpressionSet class. The NanoStringRCCSet class was designed to encapsulate data and corresponding methods for Nanostring RCC files generated from the NanoString nCounter platform.

  • For QC PDiv: User inputs? What decisions do they make?
  • For normalization:
    PDiv:Options include other normalization options and how to choose?
  • check demoData plots for QC only has 2 lanes
  • check demoData plots for QC only has 2 lanes for binding density
  • labels for plots, label axis and descriptions for plots, ensure that it is labeled or explained
  • if plots can take additional inputs, state and explain
  • description of what each code line does. like walking the reader on what is happening in the code.
  • how to change annotation to show in the analysis (for QC, plots, normalization)
  • Show heatmap after normalization
  • Briefly explain each part - like what is binding density, etc. can reference 360 report.

Bug/typo with normalization calculations in NanoStringRccSet-normalize.R

Normalization values do not match those calculated using nSolver.

I suspect that object on line 13 should be posCtrl from the line above:

posCtrl <- positiveControlSubset(object)

pcG <- summary(object, 2L, elt = toElt)[, "GeomMean"]

If I change object on line 13 to be posCtrl the Content Normalization Factors and resulting normalized counts match that of nSolver. As it stands the positive control normalization factors are calculated from the entire gene set passed using object.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.