diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..930dc8d Binary files /dev/null and b/.DS_Store differ diff --git a/.Rbuildignore b/.Rbuildignore new file mode 100644 index 0000000..91114bf --- /dev/null +++ b/.Rbuildignore @@ -0,0 +1,2 @@ +^.*\.Rproj$ +^\.Rproj\.user$ diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5b6a065 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.Rproj.user +.Rhistory +.RData +.Ruserdata diff --git a/DESCRIPTION b/DESCRIPTION new file mode 100644 index 0000000..699e28b --- /dev/null +++ b/DESCRIPTION @@ -0,0 +1,13 @@ +Package: imsig +Type: Package +Title: Immune Cell Gene Signatures for Profiling the Microenvironment of Solid Tumours +Version: 0.1.0 +Author: Ajit Johnson Nirmal +Maintainer: Ajit Johnson Nirmal +Description: Estimating relative abundance of tissue-infiltrating immune subpopulations abundances using gene expression data. +License: MIT +Encoding: UTF-8 +LazyData: true +Imports: + HiClimR (>= 1.2.3) +RoxygenNote: 6.0.1 diff --git a/NAMESPACE b/NAMESPACE new file mode 100644 index 0000000..3b0de36 --- /dev/null +++ b/NAMESPACE @@ -0,0 +1,4 @@ +# Generated by roxygen2: do not edit by hand + +export(corr_matrix) +importFrom(HiClimR,fastCor) diff --git a/R/.DS_Store b/R/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/R/.DS_Store differ diff --git a/R/corr_matrix.R b/R/corr_matrix.R new file mode 100644 index 0000000..a78be16 --- /dev/null +++ b/R/corr_matrix.R @@ -0,0 +1,16 @@ +#' @title Generation of a correlation matrix +#' @description Creates a correlation matrix using ImSig signature genes. +#' @param exp Expression matrix with genes as rows and samples as columns [data.frame] +#' @param r Correlation cut-off to use. Correlations below the defined cut-off will be replaced with zero before returning the final correlation matrix. +#' @return Gene-gene correlation matrix of the ImSig genes. +#' @importFrom HiClimR fastCor +#' @export + +corr_matrix <- function(exp, r){ + sig_su <- sig[which(as.character(sig$gene) %in% row.names(exp)), ] + data <- exp[as.character(sig_su$gene),] + cor_data <- fastCor(t(data)) + cor_data[cor_data <= r]= 0 + diag(cor_data) = 0 + return(cor_data) +} diff --git a/R/sig.R b/R/sig.R new file mode 100644 index 0000000..5d440d8 --- /dev/null +++ b/R/sig.R @@ -0,0 +1,8 @@ +#' @title ImSig genes +#' @description ImSig signature genes and the cell type they represent +#' @name sig +#' @docType data +#' @usage sig +#' @format dataframe +#' @keywords datasets +NULL diff --git a/data/.DS_Store b/data/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/data/.DS_Store differ diff --git a/data/sig.rda b/data/sig.rda new file mode 100644 index 0000000..b56e5a8 Binary files /dev/null and b/data/sig.rda differ diff --git a/imsig.Rproj b/imsig.Rproj new file mode 100644 index 0000000..e5c3f7c --- /dev/null +++ b/imsig.Rproj @@ -0,0 +1,22 @@ +Version: 1.0 + +RestoreWorkspace: Default +SaveWorkspace: Default +AlwaysSaveHistory: Default + +EnableCodeIndexing: Yes +UseSpacesForTab: Yes +NumSpacesForTab: 2 +Encoding: UTF-8 + +RnwWeave: Sweave +LaTeX: pdfLaTeX + +AutoAppendNewline: Yes +StripTrailingWhitespace: Yes + +BuildType: Package +PackageUseDevtools: Yes +PackageInstallArgs: --no-multiarch --with-keep.source +PackageCheckArgs: --as-cran +PackageRoxygenize: rd,collate,namespace,vignette diff --git a/man/.DS_Store b/man/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/man/.DS_Store differ diff --git a/man/corr_matrix.Rd b/man/corr_matrix.Rd new file mode 100644 index 0000000..fe0d29f --- /dev/null +++ b/man/corr_matrix.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/corr_matrix.R +\name{corr_matrix} +\alias{corr_matrix} +\title{Generation of a correlation matrix} +\usage{ +corr_matrix(exp, r) +} +\arguments{ +\item{exp}{Expression matrix with genes as rows and samples as columns [data.frame]} + +\item{r}{Correlation cut-off to use. Correlations below the defined cut-off will be replaced with zero before returning the final correlation matrix.} +} +\value{ +Gene-gene correlation matrix of the ImSig genes. +} +\description{ +Creates a correlation matrix using ImSig signature genes. +} diff --git a/man/sig.Rd b/man/sig.Rd new file mode 100644 index 0000000..4fcdb55 --- /dev/null +++ b/man/sig.Rd @@ -0,0 +1,14 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/sig.R +\docType{data} +\name{sig} +\alias{sig} +\title{ImSig genes} +\format{dataframe} +\usage{ +sig +} +\description{ +ImSig signature genes and the cell type they represent +} +\keyword{datasets}