forked from EmilieT/mutcraft
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
69 lines (53 loc) · 1.74 KB
/
README.Rmd
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
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```
# Getting started
Mutcraft is a package of functions to read somatic mutation information from VCF files and visualize spectra, rainplots, strand bias and mutational signatures.
## Installation
```{r , message=FALSE, warning=FALSE}
library(mutcraft)
```
## Reference genome
In order to extract mutation contexts and mutation strands you need to load a reference genome
```{r, message=FALSE, warning=FALSE}
library(BSgenome)
ref_genome = "BSgenome.Hsapiens.NCBI.GRCh37"
library(ref_genome, character.only = T)
```
## Load files
```{r, message=FALSE, warning=FALSE}
my.files <- list.files(system.file("extdata", package="mutcraft"),
pattern = ".vcf", full.names = TRUE)
s.names <- c("sample1", "sample2")
mutnet <- mc.loadVcfs(my.files, s.names, ref.genome=ref_genome)
```
## Mutation Spectrum
```{r, message=FALSE, warning=FALSE, fig.width=7,fig.height=5}
mutspec <- lapply(mutnet,mc.mutSpectrum,"ref.allele","alt.allele")
mc.plotSpectrum(mutspec,"prop",print.num=F)
```
## Spider Spectrum
```{r, message=FALSE, warning=FALSE, fig.width=7,fig.height=5}
mc.plotSpider(mutspec)
```
## Add mutations context
```{r, message=FALSE, warning=FALSE}
mut.c <- lapply(mutnet, mc.mutContext, ref_genome)
```
## Plot context histogram
```{r, message=FALSE, warning=FALSE, fig.width=8,fig.height=5}
mc.plotContext(mut.c)
```
## Rainfall plots
```{r, message=FALSE, warning=FALSE, fig.width=8,fig.height=5}
mutrain <- lapply(mutnet, mc.mutRain, "chrom","pos", "ref.allele","alt.allele")
mc.plotRain(mutrain[[1]], chrom.to.plot = c(1))
```