-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathREADME.Rmd
More file actions
executable file
·101 lines (74 loc) · 3.91 KB
/
README.Rmd
File metadata and controls
executable file
·101 lines (74 loc) · 3.91 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
---
output:
md_document:
variant: markdown_github
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/"
)
```
# cofeatureR
[](http://cran.r-project.org/package=cofeatureR)
[](https://travis-ci.org/tinyheero/cofeatureR)
[](https://cran.rstudio.com/web/packages/cofeatureR)
[](https://cran.rstudio.com/web/packages/cofeatureR)
[](https://anaconda.org/fongchun/r-cofeaturer)
[](https://saythanks.io/to/tinyheero)
cofeatureR is an R Package that provides functions for plotting cofeature matrices (aka. feature-sample matrices). For example:
```{r example, dev = "png", echo = FALSE, message = FALSE}
library("cofeatureR")
v1 <- c("RCOR1", "NCOR1", "LCOR", "RCOR1", "RCOR1", "RCOR1", "RCOR1")
v2 <- c("sampleA", "sampleC", "sampleB", "sampleC", "sampleA", "sampleC", "sampleC")
v3 <- c("Deletion", "Deletion", "SNV", "Rearrangement", "SNV", "Rearrangement", "SNV")
feature.order <- c("RCOR1", "NCOR1", "LCOR")
sample.id.order <- c("sampleA", "sampleB", "sampleC")
in.df <- dplyr::data_frame(feature = v1, sampleID = v2, type = v3)
fill.colors <- c("Deletion" = "Blue", "Rearrangement" = "Green", "SNV" = "Red")
plot_cofeature_mat(in.df, tile.col = "black",
feature.order = c("RCOR1", "LCOR", "NCOR1"),
sample.id.order = c("sampleA", "sampleB", "sampleC"))
```
# Installation
To get the released version from CRAN:
```{r, eval = FALSE}
install.packages("cofeatureR")
```
You can also get cofeatureR through conda:
```{bash, eval = FALSE}
conda install -c fongchun r-cofeaturer
```
To install the latest developmental version from github:
```{r, eval = FALSE}
devtools::install_github("tinyheero/cofeatureR")
```
# How to Use
The main function of cofeatureR is the `plot_cofeature_mat` function. It will produce a matrix plot (feature x sample) showing how the different "types" correlate between samples and features. This function only has one required input which is a data.frame containing 3 columns:
* feature: Feature name
* sampleID: Sample name
* type: Type associated with the feature-sample.
For instance in the field of cancer genomics, we are often interested in knowing how different mutations (type) in different samples (sampleID) correlate between genes (feature). The input data.frame would have this format:
```{r}
library("cofeatureR")
v1 <- c("RCOR1", "NCOR1", "LCOR", "RCOR1", "RCOR1", "RCOR1", "RCOR1")
v2 <- c("sampleA", "sampleC", "sampleB", "sampleC", "sampleA", "sampleC", "sampleC")
v3 <- c("Deletion", "Deletion", "SNV", "Rearrangement", "SNV", "Rearrangement", "SNV")
in.df <- dplyr::data_frame(feature = v1, sampleID = v2, type = v3)
knitr::kable(in.df)
```
This input data.frame can now be used as input into `plot_cofeature_mat`:
```{r how-to-use-example, message = FALSE}
plot_cofeature_mat(in.df, tile.col = "black")
```
Notice how we are NOT restricted to having only one type per feature-sample. In other words, a feature-sample may have multiple types and `plot_cofeature_mat` will display all of the types.
There are many different parameters that can be passed into the `plot_cofeature_mat` for customization of the plot. For instance:
* `fill.colors`: Custom colors for each type.
* `feature.order` and `sample.id.order`: Custom ordering of features and samples respectively.
* `tile.col`: Add borders around each type.
# Citing cofeatureR
```{r, results = "asis", echo = FALSE}
citation(package = "cofeatureR")
```