diff --git a/.gitignore b/.gitignore index 33275b5..902b304 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,4 @@ *.png Rcheck.txt .Rproj.user -NAMESPACE +*.txt \ No newline at end of file diff --git a/DESCRIPTION b/DESCRIPTION index a174ae8..06bd4a8 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -61,6 +61,11 @@ Imports: png, httr, jsonlite, - plyr + plyr, + colorspace, + dendextend, + dendsort, + pheatmap, + scales Config/testthat/edition: 3 diff --git a/NAMESPACE b/NAMESPACE new file mode 100644 index 0000000..e31abb9 --- /dev/null +++ b/NAMESPACE @@ -0,0 +1,73 @@ +# Generated by roxygen2: do not edit by hand + +export(DotplotMet) +export(DualLabeling) +export(Filter_and_QC) +export(Heatmap) +export(MetadataTable) +export(ModuleScore) +export(NameClusters) +export(Pseudobulk_DEG) +export(SampleNames) +export(ViolinPlot) +export(color_by_genes) +export(harmony_batch_correct) +export(palantir_api_call) +export(tSNE3D) +export(tSNE_3D_Coordinates) +import(RColorBrewer) +import(Seurat) +import(colorspace) +import(cowplot) +import(data.table) +import(dendextend) +import(dendsort) +import(dplyr) +import(edgeR) +import(ggplot2) +import(ggpubr) +import(grid) +import(gridExtra) +import(harmony) +import(httr) +import(jsonlite) +import(limma) +import(magrittr) +import(pheatmap) +import(plyr) +import(png) +import(purrr) +import(quantmod) +import(reshape2) +import(rlang) +import(statmod) +import(stringr) +import(svglite) +import(tidyverse) +import(utils) +importFrom(Seurat,AddMetaData) +importFrom(dplyr,arrange) +importFrom(dplyr,case_when) +importFrom(dplyr,mutate) +importFrom(dplyr,pull) +importFrom(dplyr,select) +importFrom(ggplot2,aes) +importFrom(ggplot2,geom_point) +importFrom(ggplot2,ggplot) +importFrom(ggplot2,ggtitle) +importFrom(ggplot2,scale_y_reverse) +importFrom(ggplot2,theme) +importFrom(ggplot2,theme_classic) +importFrom(ggplot2,ylim) +importFrom(grid,grid.draw) +importFrom(gridExtra,arrangeGrob) +importFrom(methods,slotNames) +importFrom(plotly,as_widget) +importFrom(plotly,ggplotly) +importFrom(plotly,plot_ly) +importFrom(reshape2,melt) +importFrom(scales,rescale) +importFrom(stats,quantile) +importFrom(tibble,deframe) +importFrom(tibble,rownames_to_column) +importFrom(tibble,tibble) diff --git a/R/Dotplot_by_Metadata.R b/R/Dotplot_by_Metadata.R index 79ff776..01d2474 100644 --- a/R/Dotplot_by_Metadata.R +++ b/R/Dotplot_by_Metadata.R @@ -53,7 +53,7 @@ DotplotMet <- function(object, labs(y=metadata) # Generate Contingency Table for Annotated cell types - sample_column = sub("_",".",sample_column) + sample_column = sub("_",".",sample.column) cluster_num <- as.data.frame.matrix(table(object@meta.data[[sample_column]],object@meta.data[[metadata]])) cluster_num %>% rownames_to_column("Samples") -> cluster_num diff --git a/R/Dual_Labeling.R b/R/Dual_Labeling.R index b27c91a..dbf1bd7 100755 --- a/R/Dual_Labeling.R +++ b/R/Dual_Labeling.R @@ -71,17 +71,17 @@ DualLabeling <- function(object, ##--------------- ## ## Error Messages ## ## -------------- ## - - if(!(marker1 %in% rownames(obj))){ + + if(!(marker1 %in% rownames(object))){ stop(paste0("ERROR: ",marker1," is not found in dataset")) } - if(!(marker2 %in% rownames(obj))){ + if(!(marker2 %in% rownames(object))){ stop(paste0("ERROR: ",marker2," is not found in dataset")) } - if(!(marker_1_type %in% names(obj@assays))){ + if(!(marker_1_type %in% names(object@assays))){ stop(paste0("ERROR: ",marker_1_type," slot is not found in dataset")) } - if(!(marker_2_type %in% names(obj@assays))){ + if(!(marker_2_type %in% names(object@assays))){ stop(paste0("ERROR: ",marker_2_type," slot is not found in dataset")) } diff --git a/man/MetadataTable.Rd b/man/MetadataTable.Rd index 17b808d..a0832c7 100644 --- a/man/MetadataTable.Rd +++ b/man/MetadataTable.Rd @@ -28,11 +28,11 @@ head(metadata) # Return dimensional reductions metadata <- MetadataTable(SO = seurat.object, return.cell.embeddings = TRUE) -umap_coordinates <- metadata \%>\% dplyr::select(Barcode, seurat_clusters, contains("UMAP")) +umap.coordinates <- metadata \%>\% dplyr::select(Barcode, seurat_clusters, contains("UMAP")) ## Plot library(ggplot2) -ggplot(umap_coordinates, aes(x = UMAP_1, y = UMAP_2, colour = seurat_clusters)) + +ggplot(umap.coordinates, aes(x = UMAP_1, y = UMAP_2, colour = seurat_clusters)) + geom_point(size = 0.1) + theme_bw() } diff --git a/man/NameClusters.Rd b/man/NameClusters.Rd index 365dbd7..2c49ede 100644 --- a/man/NameClusters.Rd +++ b/man/NameClusters.Rd @@ -6,7 +6,6 @@ \usage{ NameClusters( SO = seurat.object, - metadata, cluster.identities.table, cluster.column.from.SO, cluster.names, @@ -16,8 +15,6 @@ NameClusters( \arguments{ \item{SO}{Seurat-class object with cluster a cluster IDs column and "Likely_CellTypes" column present} -\item{metadata}{a data.frame containing at least a cluster ID column; the column name will be used to retrieve clusters from the input Seurat Object, which then will be matched with the cluster IDs in the Cluster Identities Table} - \item{cluster.identities.table}{a data.frame with 2 columns - one with Cluster IDs (numeric) and the other with Cluster names} \item{cluster.column.from.SO}{name of the cluster ID column present in the meta.data slot in the Seurat Object} diff --git a/man/palantir_api_call.Rd b/man/palantir_api_call.Rd new file mode 100644 index 0000000..ee20921 --- /dev/null +++ b/man/palantir_api_call.Rd @@ -0,0 +1,27 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/palantir_api_call.R +\name{palantir_api_call} +\alias{palantir_api_call} +\title{palantir_api_call +Utility function from 3D tSNE Coordinate Template from v 75#'} +\usage{ +palantir_api_call(service, path, token, data, method) +} +\arguments{ +\item{service}{The NIDAP API service to call} + +\item{path}{The path of NIDAP API service} + +\item{token}{NIDAP user toekn.} + +\item{data}{Data to be uploaded with NIDAP API calls.} + +\item{method}{Method to be used, including POST, GET, and DELETE} +} +\value{ +return the content of API calls +} +\description{ +palantir_api_call +Utility function from 3D tSNE Coordinate Template from v 75#' +} diff --git a/man/tSNE_3D_Coordinates.Rd b/man/tSNE_3D_Coordinates.Rd new file mode 100644 index 0000000..865bb1f --- /dev/null +++ b/man/tSNE_3D_Coordinates.Rd @@ -0,0 +1,30 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/tSNE_3D_Coordinates.R +\name{tSNE_3D_Coordinates} +\alias{tSNE_3D_Coordinates} +\title{3D tSNE Coordinate +Template from v 75} +\usage{ +tSNE_3D_Coordinates( + Combine_and_Renormalize, + Gene = c("Gapdh", "GAPDH"), + Assay = "SCT", + Max_sample = 10000 +) +} +\arguments{ +\item{Combine_and_Renormalize}{Seurat Object output from previous combine and renormalize template/node.} + +\item{Gene}{Default values: Gapdh, GAPDH. Please enter genes which you would like to visualize. If you don't know what genes to look at, consider consulting your DEG table for interest contrasts.} + +\item{Assay}{Default value: SCT. Select from SCT,RNA,integrated. Select Assay to Plot (default is SCT).} + +\item{Max_sample}{Default value: 10000. Random subsampling of cells without replacement. At the moment only ten thousand cells can be displayed in 3d tSNE viewer.} +} +\value{ +return the proccessed 3d coordinate dataset +} +\description{ +3D tSNE Coordinate +Template from v 75 +}