-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCPMValues_script.R
147 lines (127 loc) · 6.79 KB
/
CPMValues_script.R
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
## Collecting the CPMr1 and CPMr23 values , gene by gene
binded_frame <- read.csv("D:/R/Rtuts/Data/WG__Discussion_Alina's_EPEC_project/csv/Data_Alina_MasterTable_13strains.csv")
by_gene <- binded_frame %>%
group_by(symbol) %>%
summarise(Strain_name, CPM_infected_R1,
CPM_infected_R2) %>% ungroup()
head(by_gene)
### bygene_number
bygene_476 <- by_gene %>%
group_by(symbol, Strain_name) %>%
filter(Strain_name == "S476") %>%
summarise(cpm_476_r1 = paste0(CPM_infected_R1, collapse = ","),
cpm_476_r2 = paste0(CPM_infected_R2, collapse = ","))%>%
select(-Strain_name)
bygene_755 <- by_gene %>%
group_by(symbol, Strain_name) %>%
filter(Strain_name == "S755") %>%
summarise(cpm_755_r1 = paste0(CPM_infected_R1, collapse = ","),
cpm_755_r2 = paste0(CPM_infected_R2, collapse = ",")) %>%
select(-Strain_name)
bygene_754 <- by_gene %>%
group_by(symbol, Strain_name) %>%
filter(Strain_name == "S754") %>%
summarise(cpm_754_r1 = paste0(CPM_infected_R1, collapse = ","),
cpm_754_r2 = paste0(CPM_infected_R2, collapse = ",")) %>%
select(-Strain_name)
bygene_757 <- by_gene %>%
group_by(symbol, Strain_name) %>%
filter(Strain_name == "S757") %>%
summarise(cpm_757_r1 = paste0(CPM_infected_R1, collapse = ","),
cpm_757_r2 = paste0(CPM_infected_R2, collapse = ",")) %>%
select(-Strain_name)
bygene_758 <- by_gene %>%
group_by(symbol, Strain_name) %>%
filter(Strain_name == "S758") %>%
summarise(cpm_758_r1 = paste0(CPM_infected_R1, collapse = ","),
cpm_758_r2 = paste0(CPM_infected_R2, collapse = ",")) %>%
select(-Strain_name)
bygene_760 <- by_gene %>%
group_by(symbol, Strain_name) %>%
filter(Strain_name == "S760") %>%
summarise(cpm_760_r1 = paste0(CPM_infected_R1, collapse = ","),
cpm_760_r2 = paste0(CPM_infected_R2, collapse = ",")) %>%
select(-Strain_name)
bygene_761 <- by_gene %>%
group_by(symbol, Strain_name) %>%
filter(Strain_name == "S761") %>%
summarise(cpm_761_r1 = paste0(CPM_infected_R1, collapse = ","),
cpm_761_r2 = paste0(CPM_infected_R2, collapse = ",")) %>%
select(-Strain_name)
bygene_762 <- by_gene %>%
group_by(symbol, Strain_name) %>%
filter(Strain_name == "S762") %>%
summarise(cpm_762_r1 = paste0(CPM_infected_R1, collapse = ","),
cpm_762_r2 = paste0(CPM_infected_R2, collapse = ",")) %>%
select(-Strain_name)
bygene_763 <- by_gene %>%
group_by(symbol, Strain_name) %>%
filter(Strain_name == "S763") %>%
summarise(cpm_763_r1 = paste0(CPM_infected_R1, collapse = ","),
cpm_763_r2 = paste0(CPM_infected_R2, collapse = ",")) %>%
select(-Strain_name)
bygene_764 <- by_gene %>%
group_by(symbol, Strain_name) %>%
filter(Strain_name == "S764") %>%
summarise(cpm_764_r1 = paste0(CPM_infected_R1, collapse = ","),
cpm_764_r2 = paste0(CPM_infected_R2, collapse = ",")) %>%
select(-Strain_name)
bygene_765 <- by_gene %>%
group_by(symbol, Strain_name) %>%
filter(Strain_name == "S765") %>%
summarise(cpm_765_r1 = paste0(CPM_infected_R1, collapse = ","),
cpm_765_r2 = paste0(CPM_infected_R2, collapse = ",")) %>%
select(-Strain_name)
bygene_766 <- by_gene %>%
group_by(symbol, Strain_name) %>%
filter(Strain_name == "S766") %>%
summarise(cpm_766_r1 = paste0(CPM_infected_R1, collapse = ","),
cpm_766_r2 = paste0(CPM_infected_R2, collapse = ",")) %>%
select(-Strain_name)
bygene_768 <- by_gene %>%
group_by(symbol, Strain_name) %>%
filter(Strain_name == "S768") %>%
summarise(cpm_768_r1 = paste0(CPM_infected_R1, collapse = ","),
cpm_768_r2 = paste0(CPM_infected_R2, collapse = ",")) %>%
select(-Strain_name)
bygene_769 <- by_gene %>%
group_by(symbol, Strain_name) %>%
filter(Strain_name == "S769") %>%
summarise(cpm_769_r1 = paste0(CPM_infected_R1, collapse = ","),
cpm_769_r2 = paste0(CPM_infected_R2, collapse = ",")) %>%
select(-Strain_name)
# Now lets try to merge the dataframe for respective genes, row-wise
# Merging two df at a time.
merged_df1 <- merge(data.frame(bygene_476, row.names=NULL), data.frame(bygene_754, row.names=NULL), by = 1, all = TRUE)
merged_df2 <- merge(data.frame(bygene_755, row.names=NULL), data.frame(bygene_757, row.names=NULL), by = 1, all = TRUE)
merged_df3 <- merge(data.frame(bygene_758, row.names=NULL), data.frame(bygene_760, row.names=NULL), by = 1, all = TRUE)
merged_df4 <- merge(data.frame(bygene_761, row.names=NULL), data.frame(bygene_762, row.names=NULL), by = 1, all = TRUE)
merged_df5 <- merge(data.frame(bygene_763, row.names=NULL), data.frame(bygene_764, row.names=NULL), by = 1, all = TRUE)
merged_df6 <- merge(data.frame(bygene_765, row.names=NULL), data.frame(bygene_766, row.names=NULL), by = 1, all = TRUE)
merged_df7 <- merge(data.frame(bygene_768, row.names=NULL), data.frame(bygene_769, row.names=NULL), by = 1, all = TRUE)
CPM_Merged12 <- merge(
data.frame(merged_df1, row.names=NULL),
data.frame(merged_df2, row.names=NULL), all = TRUE)
CPM_Merged12
CPM_Merged34 <- merge(
data.frame(merged_df3, row.names=NULL),
data.frame(merged_df4, row.names=NULL), all = TRUE)
CPM_Merged34
CPM_Merged56 <- merge(
data.frame(merged_df5, row.names=NULL),
data.frame(merged_df6, row.names=NULL), all = TRUE)
CPM_Merged56
CPM_Merged567 <- merge(
data.frame(CPM_Merged56, row.names=NULL),
data.frame(merged_df7, row.names=NULL), all = TRUE)
CPM_Merged567
CPM_MergedTable_1234 <- merge(
data.frame(CPM_Merged12, row.names=NULL),
data.frame(CPM_Merged34, row.names=NULL), all = TRUE)
CPM_MergedTable_1234
# Finally open the complete merged table
CPM_MergedTable_ByGene <- merge(
data.frame(CPM_MergedTable_1234, row.names=NULL),
data.frame(CPM_Merged567, row.names=NULL), all = TRUE)
CPM_MergedTable_ByGene
write.csv(CPM_MergedTable_ByGene,"D:/R/Rtuts/Data/WG__Discussion_Alina's_EPEC_project/csv/CPM_MergedTable_ByGene.csv")