-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME.Rmd
More file actions
115 lines (77 loc) · 3.01 KB
/
Copy pathREADME.Rmd
File metadata and controls
115 lines (77 loc) · 3.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%",
eval = FALSE
)
```
# GuanRankR
<!-- badges: start -->
[](https://lifecycle.r-lib.org/articles/stages.html#experimental)
<!-- badges: end -->
## Overview
An R Package for computing [Guan Rank](https://web.cse.ohio-state.edu/~zhang.10631/files/survival_2021.pdf),
which transforms survival data in to an easy to model ranking
The method was used in many of [Prof. Yuanfang Guan's](https://medicine.umich.edu/dept/dcmb/yuanfang-guan-phd) top performing
[DREAM Challenge models](https://www.synapse.org/#!Synapse:syn6180942/wiki/401735)
## Installation
Install the released version of GuanRankR from Github:
```{r}
remotes::install_github(repo = "Systems-Methods/GuanRankR")
```
Or:
```{r}
remotes::install_git(
'https://github.com/Systems-Methods/GuanRankR.git'
)
```
Or install the development version
```{r}
remotes::install_github(repo = "Systems-Methods/GuanRankR",
ref = "develop")
```
## Example
### Example Data
First we can use the [{UCSCXenaTools}](https://cran.r-project.org/web/packages/UCSCXenaTools/vignettes/USCSXenaTools.html)
package to download an example mRNASeq dataset.
```{r, eval = TRUE}
dat <- UCSCXenaTools::getTCGAdata(project = "LUAD",
clinical = TRUE,
download = TRUE,
quiet = TRUE)
clin <- data.table::fread(dat$destfiles, data.table = FALSE)
```
### Create Survival Data and Run Ranks
```{r, eval = TRUE}
survData <- data.frame(
time = ifelse(!is.na(clin$days_to_last_followup),
as.numeric(clin$days_to_last_followup),
as.numeric(clin$days_to_death)),
status = dplyr::recode(
clin$vital_status, 'LIVING' = 0,'DECEASED' = 1, .default = NA_real_
)
)
gr <- GuanRankR::calculate_guan_rank(surv_data = survData)
```
### Plotting Results
```{r, eval = TRUE}
Col <- as.vector(factor(gr$status, labels = c('slategrey', 'cyan')))
par(mfrow = c(2,2))
plot(survival::survfit(survival::Surv(gr$time, gr$status)~1), xlab = "Days",
ylab = "Survival %", conf.int = FALSE, mark.time = TRUE, col = "slategrey",
cex = .5, main = 'LUAD')
plot(gr$time,gr$guan_rank, pch = 19, col = Col, cex = .5, xlab = "Days",
ylab = "Guan Rank", main = "Guan Rank vs Time")
boxplot(gr$guan_rank ~ gr$status, xlab = "Status", ylab = "Guan Rank",
main = "Guan Rank vs Status")
hist(gr$guan_rank, breaks = 30, xlab = "Guan Rank",
main = "Guan Rank Distribution")
```
## Code of Conduct
Please note that the GuanRankR project is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.