#'######################################################################################################
#' Copyright 2021 Regeneron Pharmaceuticals Inc. All rights reserved.
#' License for Non-Commercial Use of ICON code
#' All files in this repository (“source code”) are licensed under the following terms below:
#' “You” refers to an academic institution or academically employed full-time personnel only.
#' “Regeneron” refers to Regeneron Pharmaceuticals, Inc.
#' Regeneron hereby grants You a right to use, reproduce, modify, or distribute the source code to the TCRAI and ICON algorithms, in whole or in part, whether in original or modified form, for academic research purposes only. The foregoing right is royalty-free, worldwide, revocable, non-exclusive, and non-transferable.
#' Prohibited Uses: The rights granted herein do not include any right to use by commercial entities or commercial use of any kind, including, without limitation, any integration into other code or software that is used for further commercialization, any reproduction, copy, modification or creation of a derivative work that is then incorporated into a commercial product or service or otherwise used for any commercial purpose, or distribution of the source code not in conformity with the restrictions set forth above, whether in whole or in part and whether in original or modified form, and any such commercial usage is not permitted.
#' Except as expressly provided for herein, nothing in this License grants to You any right, title or interest in and to the intellectual property of Regeneron (either expressly or by implication or estoppel). Notwithstanding anything else in this License, nothing contained herein shall limit or compromise the rights of Regeneron with respect to its own intellectual property or limit its freedom to practice and to develop its products and product candidates.
#' If the source code, whole or in part and in original or modified form, is reproduced, shared or distributed in any manner, it must (1) identify Regeneron Pharmaceuticals, Inc. as the original creator, and (2) include the terms of this License.
#' UNLESS OTHERWISE SEPARATELY AGREED UPON, THE SOURCE CODE IS PROVIDED ON AN AS-IS BASIS, AND REGENERON PHARMACEUTICALS, INC. MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE SOURCE CODE, IN WHOLE OR IN PART AND IN ORIGINAL OR MODIFIED FORM, WHETHER EXPRESS, IMPLIED, STATUTORY, OR OTHER REPRESENTATIONS OR WARRANTIES. THIS INCLUDES, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT KNOWN OR DISCOVERABLE.
#' In no case shall Regeneron be liable for any loss, claim, damage, or expenses, of any kind, which may arise from or in connection with this License or the use of the source code. You shall indemnify and hold Regeneron and its employees harmless from any loss, claim, damage, expenses, or liability, of any kind, from a third-party which may arise from or in connection with this License or Your use of the source code.
#' You agree that this License and its terms are governed by the laws of the State of New York, without regard to choice of law rules or the United Nations Convention on the International Sale of Goods.
#' Please reach out to Regeneron Pharmaceuticals Inc./Administrator relating to any non-academic or commercial use of the source code.
#'######################################################################################################
#' Inspect single cell data quality
#'
#' @param raw_rna a scRNA data matrix
#'
#' @return a list of RNA and ADT Seurat objects
#' @importFrom graphics par
#' @export
QC <- function(raw_rna) {
if (missing(raw_rna))
stop("Need to input a scRNA data matrix")
nCount_RNA<-colSums(rna.raw)
mito.genes <- rna.raw[grep("^MT-",rownames(rna.raw)),]
mito.genes<-colSums(mito.genes)
percent.mito<-mito.genes/nCount_RNA
rna.raw[which(rna.raw>0)]<-1
nFeature_RNA<-colSums(rna.raw)
orig.ident<-rep("Ident",length(names(nFeature_RNA)))
data<-data.frame(nCount_RNA,nFeature_RNA,percent.mito,orig.ident)
p1 <- ggplot2::ggplot(data, ggplot2::aes(x=orig.ident, y=nCount_RNA, color=orig.ident))+ggplot2::geom_violin(trim=FALSE)+ggplot2::theme(legend.position = 'none',axis.text = ggplot2::element_text(size = 8),plot.title = ggplot2::element_text(size = 12),axis.title.y = ggplot2::element_text(size = 10),axis.title.x = ggplot2::element_text(size = 10),axis.text.x=ggplot2::element_blank(),)+ggplot2::ggtitle("nCount_RNA")
p2 <- ggplot2::ggplot(data, ggplot2::aes(x=orig.ident, y=nFeature_RNA, color=orig.ident))+ggplot2::geom_violin(trim=FALSE)+ggplot2::theme(legend.position = 'none',axis.text = ggplot2::element_text(size = 8),plot.title = ggplot2::element_text(size = 12),axis.title.y = ggplot2::element_text(size = 10),axis.title.x = ggplot2::element_text(size = 10),axis.text.x=ggplot2::element_blank(),)+ggplot2::ggtitle("nFeature_RNA")
p3 <- ggplot2::ggplot(data, ggplot2::aes(x=orig.ident, y=percent.mito, color=orig.ident))+ggplot2::geom_violin(trim=FALSE)+ggplot2::theme(legend.position = 'none',axis.text = ggplot2::element_text(size = 8),plot.title = ggplot2::element_text(size = 12),axis.title.y = ggplot2::element_text(size = 10),axis.title.x = ggplot2::element_text(size = 10),axis.text.x=ggplot2::element_blank(),)+ggplot2::ggtitle("percent.mito")
p4 <- ggplot2::ggplot(data, ggplot2::aes(x=nCount_RNA, y=nFeature_RNA), color=orig.ident)+ggplot2::geom_point(size=1)+ggplot2::theme(legend.position = 'none',axis.text = ggplot2::element_text(size = 6),plot.title = ggplot2::element_text(size = 12),axis.title.y = ggplot2::element_text(size = 10),axis.title.x = ggplot2::element_text(size = 10))
p5 <- ggplot2::ggplot(data, ggplot2::aes(x=percent.mito, y=nFeature_RNA), color=orig.ident)+ggplot2::geom_point(size=1)+ggplot2::theme(legend.position = 'none',axis.text = ggplot2::element_text(size = 8),plot.title = ggplot2::element_text(size = 12),axis.title.y = ggplot2::element_text(size = 10),axis.title.x = ggplot2::element_text(size = 10))
gridExtra::grid.arrange(p1, p2, p3,p4,p5, nrow = 2)
return(data)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.