diff --git a/DESCRIPTION b/DESCRIPTION index e1c353a..0a54c7b 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: imsig Type: Package Title: Immune Cell Gene Signatures for Profiling the Microenvironment of Solid Tumours -Version: 1.1.0 +Version: 1.1.1 Author: Ajit Johnson Nirmal Maintainer: Ajit Johnson Nirmal Description: Estimate the relative abundance of tissue-infiltrating immune subpopulations abundances using gene expression data. @@ -17,5 +17,5 @@ Imports: ggplot2 (>= 2.2), gridExtra (>= 2.3), survival (>= 2.4) -RoxygenNote: 6.0.1 +RoxygenNote: 7.1.1 Suggests: testthat diff --git a/R/imsig.R b/R/imsig.R index 58d1e38..c396285 100644 --- a/R/imsig.R +++ b/R/imsig.R @@ -6,7 +6,7 @@ #' @param sort_by Can be used to sort the samples by predicted abundance of a particular cell type. All other cell types follow this sorting. By default it is sorted by `T cells` #' @return Relative abundance of immune cells across samples. Returns a dataframe. #' @examples -#' cell_abundance = imsig (exp = example_data, r = 0.7) +#' cell_abundance = imsig (exp = example_data, r = 0.7, sort=TRUE, sort_by='T cells') #' head(cell_abundance) #' @seealso \code{\link{feature_select}}, \code{\link{example_data}} #' @export diff --git a/R/imsig_survival.R b/R/imsig_survival.R index f204182..b7d6379 100644 --- a/R/imsig_survival.R +++ b/R/imsig_survival.R @@ -7,7 +7,7 @@ #' @param r Use a value between 0 and 1. Default is 0.6. This is a user defined correlation cut-off to perform feature selection (\code{\link{feature_select}}). Feature selection aids to enrich the prediction of relative abundance of immune cells by filtering off poorly correlated ImSig genes. To get an idea of what cut-off to use check the results of (\code{\link{gene_stat}}) and choose a cut-off that displays high median correlation and maintains a high proportion of genes after feature selection. #' @return Hazard Ratio #' @examples \donttest{ -#' survival = imsig_survival (exp = example_data) +#' survival = imsig_survival (exp = example_data, cli = example_cli) #' head(survival) #' } #' @import survival @@ -25,7 +25,7 @@ imsig_survival <- function(exp, cli, time = 'time', status= 'status', r = 0.6){ for (i in 1: length(levels(sig$cell))){ cell_ordered <- cell_cli[sort.list(cell_cli[,i]),] cell_ordered$group <- ifelse(cell_ordered[,i] <= median(cell_cli[,i]), "low", "high") - cox <- coxph(Surv(time, status) ~ group, cell_ordered) + cox <- survival::coxph(Surv(time, status) ~ group, cell_ordered) x <- summary(cox)[8] HR.OS <- data.frame(log2(x[[1]][1])) HR.UP <- data.frame(log2(x[[1]][4])) diff --git a/man/corr_matrix.Rd b/man/corr_matrix.Rd index e3e2245..126e9a5 100644 --- a/man/corr_matrix.Rd +++ b/man/corr_matrix.Rd @@ -9,7 +9,7 @@ corr_matrix(exp, r) \arguments{ \item{exp}{Dataframe of transcriptomic data (natural scale) containing genes as rows and samples as columns. Note: Gene names should be set as row names and duplicates are not allowed. Missing values are not allowed within the expression matrix. Check example- head(example_data): \code{\link{example_data}}.} -\item{r}{Use a value between 0 and 1. Default is 0.6. This is a user defined correlation cut-off to perform feature selection (\code{\link{feature_select}}). Feature selection aids to enrich the prediction of relative abundance of immune cells by filtering off poorly correlated ImSig genes. To get an idea of what cut-off to use check the results of (\code{\link{gene_stat}} and choose a cut-off that displays high median correlation and maintains a high proportion of genes after feature selection.} +\item{r}{Use a value between 0 and 1. Default is 0.6. This is a user defined correlation cut-off to perform feature selection (\code{\link{feature_select}}). Feature selection aids to enrich the prediction of relative abundance of immune cells by filtering off poorly correlated ImSig genes. To get an idea of what cut-off to use check the results of (\code{\link{gene_stat}}) and choose a cut-off that displays high median correlation and maintains a high proportion of genes after feature selection.} } \value{ Gene-gene correlation matrix of ImSig genes. diff --git a/man/example_cli.Rd b/man/example_cli.Rd index f3eb517..f2fc3df 100644 --- a/man/example_cli.Rd +++ b/man/example_cli.Rd @@ -4,7 +4,9 @@ \name{example_cli} \alias{example_cli} \title{Example clinical data file for survival analysis with ImSig} -\format{dataframe} +\format{ +dataframe +} \usage{ example_cli } diff --git a/man/example_data.Rd b/man/example_data.Rd index 8cc702a..1447a7b 100644 --- a/man/example_data.Rd +++ b/man/example_data.Rd @@ -4,7 +4,9 @@ \name{example_data} \alias{example_data} \title{Example transcriptomics data} -\format{dataframe} +\format{ +dataframe +} \usage{ example_data } diff --git a/man/feature_select.Rd b/man/feature_select.Rd index 1ff6365..e06d9f4 100644 --- a/man/feature_select.Rd +++ b/man/feature_select.Rd @@ -9,7 +9,7 @@ feature_select(exp, r = 0.6) \arguments{ \item{exp}{Dataframe of transcriptomic data (natural scale) containing genes as rows and samples as columns. Note: Gene names should be set as row names and duplicates are not allowed. Missing values are not allowed within the expression matrix. Check example- head(example_data): \code{\link{example_data}}.} -\item{r}{Use a value between 0 and 1. Default is 0.6. This is a user defined correlation cut-off to perform feature selection. To get an idea of what cut-off to use check the results of (\code{\link{gene_stat}} and choose a cut-off that displays high median correlation and maintains a high proportion of genes after feature selection.} +\item{r}{Use a value between 0 and 1. Default is 0.6. This is a user defined correlation cut-off to perform feature selection. To get an idea of what cut-off to use check the results of (\code{\link{gene_stat}}) and choose a cut-off that displays high median correlation and maintains a high proportion of genes after feature selection.} } \value{ Returns a list of 'feature selected' genes based on the set r value. diff --git a/man/gene_stat.Rd b/man/gene_stat.Rd index f8fafed..5a2518c 100644 --- a/man/gene_stat.Rd +++ b/man/gene_stat.Rd @@ -9,7 +9,7 @@ gene_stat(exp, r = 0.6) \arguments{ \item{exp}{Dataframe of transcriptomic data (natural scale) containing genes as rows and samples as columns. Note: Gene names should be set as row names and duplicates are not allowed. Missing values are not allowed within the expression matrix. Check example- head(example_data): \code{\link{example_data}}.} -\item{r}{Use a value between 0 and 1. Default is 0.6. This is a user defined correlation cut-off to perform feature selection (\code{\link{feature_select}}). Feature selection aids to enrich the prediction of relative abundance of immune cells by filtering off poorly correlated ImSig genes. To get an idea of what cut-off to use check the results of (\code{\link{gene_stat}} and choose a cut-off that displays high median correlation and maintains a high proportion of genes after feature selection.} +\item{r}{Use a value between 0 and 1. Default is 0.6. This is a user defined correlation cut-off to perform feature selection (\code{\link{feature_select}}). Feature selection aids to enrich the prediction of relative abundance of immune cells by filtering off poorly correlated ImSig genes. To get an idea of what cut-off to use check the results of (\code{\link{gene_stat}}) and choose a cut-off that displays high median correlation and maintains a high proportion of genes after feature selection.} } \value{ Dataframe of general statistics of ImSig analysis. diff --git a/man/imsig.Rd b/man/imsig.Rd index 6e398de..2cca08a 100644 --- a/man/imsig.Rd +++ b/man/imsig.Rd @@ -4,12 +4,16 @@ \alias{imsig} \title{Estimate the relative abundance of tissue-infiltrating immune subpopulations abundances using gene expression data} \usage{ -imsig(exp, r = 0.6) +imsig(exp, r = 0.6, sort = TRUE, sort_by = "T cells") } \arguments{ \item{exp}{Dataframe of transcriptomic data (natural scale) containing genes as rows and samples as columns. Note: Gene names should be set as row names and duplicates are not allowed. Missing values are not allowed within the expression matrix. Check example- head(example_data): \code{\link{example_data}}.} -\item{r}{Use a value between 0 and 1. Default is 0.6. This is a user defined correlation cut-off to perform feature selection (\code{\link{feature_select}}). Feature selection aids to enrich the prediction of relative abundance of immune cells by filtering off poorly correlated ImSig genes. To get an idea of what cut-off to use check the results of (\code{\link{gene_stat}} and choose a cut-off that displays high median correlation and maintains a high proportion of genes after feature selection.} +\item{r}{Use a value between 0 and 1. Default is 0.6. This is a user defined correlation cut-off to perform feature selection (\code{\link{feature_select}}). Feature selection aids to enrich the prediction of relative abundance of immune cells by filtering off poorly correlated ImSig genes. To get an idea of what cut-off to use check the results of (\code{\link{gene_stat}}) and choose a cut-off that displays high median correlation and maintains a high proportion of genes after feature selection.} + +\item{sort}{Sort the samples based on abundance of a particular cell type. `Set sort = FALSE` if you wish not to apply sorting. By default the function sorts by abundance of T cells. The cell type of interest for sorting can be controlled by the `sort_by` parameter.} + +\item{sort_by}{Can be used to sort the samples by predicted abundance of a particular cell type. All other cell types follow this sorting. By default it is sorted by `T cells`} } \value{ Relative abundance of immune cells across samples. Returns a dataframe. @@ -18,7 +22,7 @@ Relative abundance of immune cells across samples. Returns a dataframe. Estimates the relative abundance of immune cells across patients/samples. } \examples{ -cell_abundance = imsig (exp = example_data, r = 0.7) +cell_abundance = imsig (exp = example_data, r = 0.7, sort=TRUE, sort_by='T cells') head(cell_abundance) } \seealso{ diff --git a/man/imsig_survival.Rd b/man/imsig_survival.Rd index 9b54ede..a950f97 100644 --- a/man/imsig_survival.Rd +++ b/man/imsig_survival.Rd @@ -15,7 +15,7 @@ imsig_survival(exp, cli, time = "time", status = "status", r = 0.6) \item{status}{Column name of event (dead or alive) parameter.} -\item{r}{Use a value between 0 and 1. Default is 0.6. This is a user defined correlation cut-off to perform feature selection (\code{\link{feature_select}}). Feature selection aids to enrich the prediction of relative abundance of immune cells by filtering off poorly correlated ImSig genes. To get an idea of what cut-off to use check the results of (\code{\link{gene_stat}} and choose a cut-off that displays high median correlation and maintains a high proportion of genes after feature selection.} +\item{r}{Use a value between 0 and 1. Default is 0.6. This is a user defined correlation cut-off to perform feature selection (\code{\link{feature_select}}). Feature selection aids to enrich the prediction of relative abundance of immune cells by filtering off poorly correlated ImSig genes. To get an idea of what cut-off to use check the results of (\code{\link{gene_stat}}) and choose a cut-off that displays high median correlation and maintains a high proportion of genes after feature selection.} } \value{ Hazard Ratio @@ -25,7 +25,7 @@ Patients are split into two groups based on their immune cell abundance (median } \examples{ \donttest{ -survival = imsig_survival (exp = example_data) +survival = imsig_survival (exp = example_data, cli = example_cli) head(survival) } } diff --git a/man/plot_abundance.Rd b/man/plot_abundance.Rd index 172f995..a316b8f 100644 --- a/man/plot_abundance.Rd +++ b/man/plot_abundance.Rd @@ -9,7 +9,7 @@ plot_abundance(exp, r = 0.6) \arguments{ \item{exp}{Dataframe of transcriptomic data (natural scale) containing genes as rows and samples as columns. Note: Gene names should be set as row names and duplicates are not allowed. Missing values are not allowed within the expression matrix. Check example- head(example_data): \code{\link{example_data}}.} -\item{r}{Use a value between 0 and 1. Default is 0.6. This is a user defined correlation cut-off to perform feature selection (\code{\link{feature_select}}). Feature selection aids to enrich the prediction of relative abundance of immune cells by filtering off poorly correlated ImSig genes. To get an idea of what cut-off to use check the results of (\code{\link{gene_stat}} and choose a cut-off that displays high median correlation and maintains a high proportion of genes after feature selection.} +\item{r}{Use a value between 0 and 1. Default is 0.6. This is a user defined correlation cut-off to perform feature selection (\code{\link{feature_select}}). Feature selection aids to enrich the prediction of relative abundance of immune cells by filtering off poorly correlated ImSig genes. To get an idea of what cut-off to use check the results of (\code{\link{gene_stat}}) and choose a cut-off that displays high median correlation and maintains a high proportion of genes after feature selection.} } \value{ ggplot diff --git a/man/plot_network.Rd b/man/plot_network.Rd index 4036565..3e7600a 100644 --- a/man/plot_network.Rd +++ b/man/plot_network.Rd @@ -4,14 +4,22 @@ \alias{plot_network} \title{Network graph of ImSig genes} \usage{ -plot_network(exp, r = 0.6, pt.cex = 2, cex = 1, inset = 0, - x.intersp = 2, vertex.size = 3, vertex.label = NA, - layout = layout_with_fr) +plot_network( + exp, + r = 0.6, + pt.cex = 2, + cex = 1, + inset = 0, + x.intersp = 2, + vertex.size = 3, + vertex.label = NA, + layout = layout_with_fr +) } \arguments{ \item{exp}{Dataframe of transcriptomic data (natural scale) containing genes as rows and samples as columns. Note: Gene names should be set as row names and duplicates are not allowed. Missing values are not allowed within the expression matrix. Check example- head(example_data): \code{\link{example_data}}.} -\item{r}{Use a value between 0 and 1. Default is 0.6. This is a user defined correlation cut-off to perform feature selection (\code{\link{feature_select}}). Feature selection aids to enrich the prediction of relative abundance of immune cells by filtering off poorly correlated ImSig genes. To get an idea of what cut-off to use check the results of (\code{\link{gene_stat}} and choose a cut-off that displays high median correlation and maintains a high proportion of genes after feature selection.} +\item{r}{Use a value between 0 and 1. Default is 0.6. This is a user defined correlation cut-off to perform feature selection (\code{\link{feature_select}}). Feature selection aids to enrich the prediction of relative abundance of immune cells by filtering off poorly correlated ImSig genes. To get an idea of what cut-off to use check the results of (\code{\link{gene_stat}}) and choose a cut-off that displays high median correlation and maintains a high proportion of genes after feature selection.} \item{pt.cex}{expansion factor(s) for the points.} diff --git a/man/plot_survival.Rd b/man/plot_survival.Rd index a7a18b4..b4f1a06 100644 --- a/man/plot_survival.Rd +++ b/man/plot_survival.Rd @@ -15,7 +15,7 @@ plot_survival(exp, cli, time = "time", status = "status", r = 0.6) \item{status}{Column name of event (dead or alive) parameter.} -\item{r}{Use a value between 0 and 1. Default is 0.6. This is a user defined correlation cut-off to perform feature selection (\code{\link{feature_select}}). Feature selection aids to enrich the prediction of relative abundance of immune cells by filtering off poorly correlated ImSig genes. To get an idea of what cut-off to use check the results of (\code{\link{gene_stat}} and choose a cut-off that displays high median correlation and maintains a high proportion of genes after feature selection.} +\item{r}{Use a value between 0 and 1. Default is 0.6. This is a user defined correlation cut-off to perform feature selection (\code{\link{feature_select}}). Feature selection aids to enrich the prediction of relative abundance of immune cells by filtering off poorly correlated ImSig genes. To get an idea of what cut-off to use check the results of (\code{\link{gene_stat}}) and choose a cut-off that displays high median correlation and maintains a high proportion of genes after feature selection.} } \value{ Forest plot diff --git a/man/sig.Rd b/man/sig.Rd index 4fcdb55..ad46d17 100644 --- a/man/sig.Rd +++ b/man/sig.Rd @@ -4,7 +4,9 @@ \name{sig} \alias{sig} \title{ImSig genes} -\format{dataframe} +\format{ +dataframe +} \usage{ sig } diff --git a/tests/testthat/test_imsig.R b/tests/testthat/test_imsig.R index 1a5557c..f6cb6a5 100644 --- a/tests/testthat/test_imsig.R +++ b/tests/testthat/test_imsig.R @@ -1,2 +1,2 @@ -cell_abundance = imsig (exp = example_data, r = 0.7) +cell_abundance = imsig (exp = example_data, r = 0.7, sort=TRUE, sort_by='T cells') head(cell_abundance)