-
Notifications
You must be signed in to change notification settings - Fork 0
/
prepare_data.Rmd
95 lines (67 loc) · 2.75 KB
/
prepare_data.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
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
Preprare Flaveria csv files
========================================================
```{r pringlei}
setwd("~/hydrogen/flaveria/Fp/Fp_2")
tpm <- read.csv("Fp_express.tpm", sep="\t", head=T)
key <- read.csv('key_agi.txt',sep='\t', head=F)
setwd('~/hydrogen/flaveria/robin')
anno <- read.csv('robin_11.txt', sep="\t", head=F)
names(anno) <- c("species", "contig", "annotation")
anno$species <- gsub(anno$species, pattern="_200", replacement="")
library(plyr)
library(reshape2)
anno <- anno[which(anno$species=="Fp"),]
f_2 <- merge(tpm, anno, by.x="contig", by.y="contig")
f_2 <- f_2[,-c(2, 21,22)]
f_tpm <- ddply(f_2, .(annotation), numcolwise(sum)) # sum columns, grouping by annotation
setwd("~/hydrogen/flaveria")
write.table(f_tpm, file="fp.by_agi.tpm.csv", sep=",", row.names=FALSE)
```
```{r robusta}
setwd("~/hydrogen/flaveria/Fr/Fr_2")
tpm <- read.csv("Fr_express.tpm", sep="\t", head=T)
setwd('~/hydrogen/flaveria/robin')
anno <- read.csv('robin_11.txt', sep="\t", head=F)
names(anno) <- c("species", "contig", "annotation")
anno$species <- gsub(anno$species, pattern="_200", replacement="")
library(plyr)
library(reshape2)
anno <- anno[which(anno$species=="Fr"),]
f_2 <- merge(tpm, anno, by.x="contig", by.y="contig")
f_2 <- f_2[,-c(2, 21,22)]
f_tpm <- ddply(f_2, .(annotation), numcolwise(sum)) # sum columns, grouping by annotation
setwd("~/hydrogen/flaveria")
write.table(f_tpm, file="fr.by_agi.tpm.csv", sep=",", row.names=FALSE)
```
```{r trinervia}
setwd("~/hydrogen/flaveria/Ft/Ft_2")
tpm <- read.csv("Ft_express.tpm", sep="\t", head=T)
setwd('~/hydrogen/flaveria/robin')
anno <- read.csv('robin_11.txt', sep="\t", head=F)
names(anno) <- c("species", "contig", "annotation")
anno$species <- gsub(anno$species, pattern="_200", replacement="")
library(plyr)
library(reshape2)
anno <- anno[which(anno$species=="Ft"),]
f_2 <- merge(tpm, anno, by.x="contig", by.y="contig")
f_2 <- f_2[,-c(2, 21,22)]
f_tpm <- ddply(f_2, .(annotation), numcolwise(sum)) # sum columns, grouping by annotation
setwd("~/hydrogen/flaveria")
write.table(f_tpm, file="ft.by_agi.tpm.csv", sep=",", row.names=FALSE)
```
```{r bidentis}
setwd("~/hydrogen/flaveria/Fb/Fb_k")
tpm <- read.csv("Fb_express.tpm", sep="\t", head=T)
setwd('~/hydrogen/flaveria/robin')
anno <- read.csv('robin_11.txt', sep="\t", head=F)
names(anno) <- c("species", "contig", "annotation")
anno$species <- gsub(anno$species, pattern="_200", replacement="")
library(plyr)
library(reshape2)
anno <- anno[which(anno$species=="Fb"),]
f_2 <- merge(tpm, anno, by.x="contig", by.y="contig")
f_2 <- f_2[,-c(2, 21,22)]
f_tpm <- ddply(f_2, .(annotation), numcolwise(sum)) # sum columns, grouping by annotation
setwd("~/hydrogen/flaveria")
write.table(f_tpm, file="fb.by_agi.tpm.csv", sep=",", row.names=FALSE)
```