-
Notifications
You must be signed in to change notification settings - Fork 0
/
prepare_data_count.Rmd
95 lines (67 loc) · 2.81 KB
/
prepare_data_count.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")
count <- read.csv("Fp_express.eff_count", 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(count, anno, by.x="contig", by.y="contig")
f_2 <- f_2[,-c(2, 21,22)]
f_count <- ddply(f_2, .(annotation), numcolwise(sum)) # sum columns, grouping by annotation
setwd("~/hydrogen/flaveria")
write.table(f_count, file="fp.by_agi.count.csv", sep=",", row.names=FALSE)
```
```{r robusta}
setwd("~/hydrogen/flaveria/Fr/Fr_2")
count <- read.csv("Fr_express.eff_count", 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(count, anno, by.x="contig", by.y="contig")
f_2 <- f_2[,-c(2, 21,22)]
f_count <- ddply(f_2, .(annotation), numcolwise(sum)) # sum columns, grouping by annotation
setwd("~/hydrogen/flaveria")
write.table(f_count, file="fr.by_agi.count.csv", sep=",", row.names=FALSE)
```
```{r trinervia}
setwd("~/hydrogen/flaveria/Ft/Ft_2")
count <- read.csv("Ft_express.eff_count", 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(count, anno, by.x="contig", by.y="contig")
f_2 <- f_2[,-c(2, 21,22)]
f_count <- ddply(f_2, .(annotation), numcolwise(sum)) # sum columns, grouping by annotation
setwd("~/hydrogen/flaveria")
write.table(f_count, file="ft.by_agi.count.csv", sep=",", row.names=FALSE)
```
```{r bidentis}
setwd("~/hydrogen/flaveria/Fb/Fb_k")
count <- read.csv("Fb_express.eff_count", 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(count, anno, by.x="contig", by.y="contig")
f_2 <- f_2[,-c(2, 21,22)]
f_count <- ddply(f_2, .(annotation), numcolwise(sum)) # sum columns, grouping by annotation
setwd("~/hydrogen/flaveria")
write.table(f_count, file="fb.by_agi.count.csv", sep=",", row.names=FALSE)
```