Skip to content

Commit

Permalink
fixed order for R 4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ajitjohnson committed Dec 25, 2020
1 parent d5b474a commit 42954b6
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 7 deletions.
Binary file removed .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: imsig
Type: Package
Title: Immune Cell Gene Signatures for Profiling the Microenvironment of Solid Tumours
Version: 1.0.1
Version: 1.1.0
Author: Ajit Johnson Nirmal
Maintainer: Ajit Johnson Nirmal <[email protected]>
Description: Estimate the relative abundance of tissue-infiltrating immune subpopulations abundances using gene expression data.
Expand Down
Binary file removed R/.DS_Store
Binary file not shown.
6 changes: 4 additions & 2 deletions R/imsig.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@
#' @description Estimates the relative abundance of immune cells across patients/samples.
#' @param 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}}.
#' @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.
#' @param 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.
#' @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)
#' head(cell_abundance)
#' @seealso \code{\link{feature_select}}, \code{\link{example_data}}
#' @export

imsig <- function(exp, r = 0.6){
imsig <- function(exp, r = 0.6, sort=TRUE, sort_by='T cells'){
exp <- pp_exp(exp)
sig <- pp_sig(exp)
fg <- feature_select(exp, r)
Expand All @@ -24,7 +26,7 @@ imsig <- function(exp, r = 0.6){
colnames(e_avg) <- i
cc <- cbind(cc, e_avg)
}
cc <- cc[order(data.frame(cc$'T cells')),]
if (sort == TRUE){cc <- cc[sort.list(data.frame(cc[,sort_by])),]}
return(cc)
}

2 changes: 1 addition & 1 deletion R/imsig_survival.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ imsig_survival <- function(exp, cli, time = 'time', status= 'status', r = 0.6){
cell_cli <- cell_cli[,-1]
HR <- data.frame()
for (i in 1: length(levels(sig$cell))){
cell_ordered <- cell_cli[order(cell_cli[,i]),]
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)
x <- summary(cox)[8]
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The basic **principle** behind *ImSig* analysis is that for a given immune cell
### Citation
Immune Cell Gene Signatures for Profiling the Microenvironment of Solid Tumors <br>
Ajit J. Nirmal, Tim Regan, Barbara B. Shih, David A. Hume, Andrew H. Sims and Tom C. Freeman <br>
Cancer Immunol Res November 1 2018 (6) (11) 1388-1400; DOI: 10.1158/2326-6066.CIR-18-0342 <br>
[Cancer Immunol Res](https://cancerimmunolres.aacrjournals.org/content/6/11/1388) November 1 2018 (6) (11) 1388-1400; DOI: 10.1158/2326-6066.CIR-18-0342 <br>

# Requirements
### Mandatory
Expand All @@ -28,8 +28,10 @@ The survival metadata can be imported into R using something similar to the basi

#### Install package

**`install.packages("imsig")`**
**`library("imsig")`**
```
install.packages("imsig")
library("imsig")
```

#### To use the latest developmental version

Expand Down
Binary file removed data/.DS_Store
Binary file not shown.
Binary file removed man/.DS_Store
Binary file not shown.
Binary file removed tests/.DS_Store
Binary file not shown.
Binary file removed tests/testthat/.DS_Store
Binary file not shown.

0 comments on commit 42954b6

Please sign in to comment.