-
Notifications
You must be signed in to change notification settings - Fork 0
/
mutSOMA.Rmd
69 lines (56 loc) · 1.61 KB
/
mutSOMA.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
---
title: "mutSOMA"
output:
pdf_document: default
html_document: default
geometry: margin=0.5in
mainfont: Arial
fontsize: 8pt
---
```{r, include=FALSE}
library(Biostrings)
library(vcfR)
library(expm)
library(optimx)
```
```{r, echo=FALSE}
## Setting file pathways
input.data.dir <- "/Users/rashmi/Desktop/Rmarkdown/mutSOMA/RAW/"
out.data.dir <- "/Users/rashmi/Desktop/Rmarkdown/mutSOMA/PRODUCED/"
func.dir <- "/Users/rashmi/Desktop/Rmarkdown/mutSOMA/FUNC/"
## Loading source code
source(paste(func.dir, "makePHYLO.R", sep=""))
source(paste(func.dir, "makeVCFpedigreeTEMP.R", sep=""))
source(paste(func.dir, "mutSOMA.R", sep=""))
```
## 1) Loading data and determine nucleotide frequency
```{r}
## Reading in the poplar fasta file and determining the nucleotide frequency
poplar <- readDNAStringSet(paste(input.data.dir, "PtrichocarpaStettler14_532_v1.0.fa", sep=""))
freqBASE <- letterFrequency(poplar, letters = c("A", "C", "T", "G"), as.prob=FALSE)
freqBASE <- colSums(freqBASE[1:19,])
probBASE <- freqBASE/sum(freqBASE)
freqBASE
probBASE
```
## 2) Constructing pedigree
```{r }
pedigree <- makeVCFpedigreeTEMP(genome.size=sum(freqBASE), input.dir = input.data.dir)
pedigree<-pedigree[[1]]
pedigree<-pedigree[-21,]
head(pedigree)
```
## 3) Run models
```{r}
out <- mutSOMA(pedigree.data = pedigree,
p0aa= probBASE[1],
p0cc= probBASE[2],
p0tt= probBASE[3],
p0gg= probBASE[4],
Nstarts=20,
out.dir = out.data.dir,
out.name = "test_mutSOMA")
summary(out)
head(out$estimates)
head(out$pedigree)
```