annotate C and D finder/commonality-working jul 13 2020.R @ 4:830e8dc3acac draft default tip

Uploaded
author jfb
date Tue, 14 Jul 2020 19:51:12 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4
830e8dc3acac Uploaded
jfb
parents:
diff changeset
1 FirstSubstrateSet<- read.csv("input1.csv", stringsAsFactors=FALSE, header = FALSE)
830e8dc3acac Uploaded
jfb
parents:
diff changeset
2 Firstsubbackfreq<- read.csv("input2.csv", header=FALSE, stringsAsFactors=FALSE)
830e8dc3acac Uploaded
jfb
parents:
diff changeset
3 SubstrateHeader<-FirstSubstrateSet[1,]
830e8dc3acac Uploaded
jfb
parents:
diff changeset
4 FirstSubstrateSet<- FirstSubstrateSet[2:nrow(FirstSubstrateSet),]
830e8dc3acac Uploaded
jfb
parents:
diff changeset
5 if(nrow(Firstsubbackfreq[1,]>35)){
830e8dc3acac Uploaded
jfb
parents:
diff changeset
6 if(grepl(pattern = "Properties", x=Firstsubbackfreq[1,22])){
830e8dc3acac Uploaded
jfb
parents:
diff changeset
7 Firstsubbackfreq<-t(Firstsubbackfreq)
830e8dc3acac Uploaded
jfb
parents:
diff changeset
8 }
830e8dc3acac Uploaded
jfb
parents:
diff changeset
9 }
830e8dc3acac Uploaded
jfb
parents:
diff changeset
10
830e8dc3acac Uploaded
jfb
parents:
diff changeset
11
830e8dc3acac Uploaded
jfb
parents:
diff changeset
12 SecondSubstrateSet<- read.csv("input3.csv", stringsAsFactors=FALSE, header = FALSE)
830e8dc3acac Uploaded
jfb
parents:
diff changeset
13 Secondsubbackfreq<- read.csv("input4.csv", header=FALSE, stringsAsFactors=FALSE)
830e8dc3acac Uploaded
jfb
parents:
diff changeset
14 SecondSubstrateSet<- SecondSubstrateSet[2:nrow(SecondSubstrateSet),]
830e8dc3acac Uploaded
jfb
parents:
diff changeset
15 if(nrow(Secondsubbackfreq[1,]>35)){
830e8dc3acac Uploaded
jfb
parents:
diff changeset
16 if(grepl(pattern = "Properties", x=Secondsubbackfreq[1,22])){
830e8dc3acac Uploaded
jfb
parents:
diff changeset
17 Secondsubbackfreq<-t(Secondsubbackfreq)
830e8dc3acac Uploaded
jfb
parents:
diff changeset
18 }
830e8dc3acac Uploaded
jfb
parents:
diff changeset
19 }
830e8dc3acac Uploaded
jfb
parents:
diff changeset
20
830e8dc3acac Uploaded
jfb
parents:
diff changeset
21
830e8dc3acac Uploaded
jfb
parents:
diff changeset
22 ThirdSubstrateSet<- read.csv("input5.csv", stringsAsFactors=FALSE, header = FALSE)
830e8dc3acac Uploaded
jfb
parents:
diff changeset
23 Thirdsubbackfreq<- read.csv("input6.csv", header=FALSE, stringsAsFactors=FALSE)
830e8dc3acac Uploaded
jfb
parents:
diff changeset
24 ThirdSubstrateSet<- ThirdSubstrateSet[2:nrow(ThirdSubstrateSet),]
830e8dc3acac Uploaded
jfb
parents:
diff changeset
25 if(nrow(Thirdsubbackfreq[1,]>35)){
830e8dc3acac Uploaded
jfb
parents:
diff changeset
26 if(grepl(pattern = "Properties", x=Thirdsubbackfreq[1,22])){
830e8dc3acac Uploaded
jfb
parents:
diff changeset
27 Thirdsubbackfreq<-t(Thirdsubbackfreq)
830e8dc3acac Uploaded
jfb
parents:
diff changeset
28 }
830e8dc3acac Uploaded
jfb
parents:
diff changeset
29 }
830e8dc3acac Uploaded
jfb
parents:
diff changeset
30
830e8dc3acac Uploaded
jfb
parents:
diff changeset
31 #the above three sections bring in the input files and ensure they are properly aligned. The if statements align them if they are misaligned
830e8dc3acac Uploaded
jfb
parents:
diff changeset
32
830e8dc3acac Uploaded
jfb
parents:
diff changeset
33 First_unshared_motifs_table<-"R1 substrates.csv"
830e8dc3acac Uploaded
jfb
parents:
diff changeset
34 First_unshared_subbackfreq<-"R1 SBF.csv"
830e8dc3acac Uploaded
jfb
parents:
diff changeset
35
830e8dc3acac Uploaded
jfb
parents:
diff changeset
36 Second_unshared_motifs_table<-"R2 subs.csv"
830e8dc3acac Uploaded
jfb
parents:
diff changeset
37 Second_unshared_subbackfreq<-"R2 SBf.csv"
830e8dc3acac Uploaded
jfb
parents:
diff changeset
38
830e8dc3acac Uploaded
jfb
parents:
diff changeset
39 Third_unshared_motifs_table<-"R3 subs.csv"
830e8dc3acac Uploaded
jfb
parents:
diff changeset
40 Third_unshared_subbackfreq<-"R3 SBF.csv"
830e8dc3acac Uploaded
jfb
parents:
diff changeset
41
830e8dc3acac Uploaded
jfb
parents:
diff changeset
42 #the above 4 sections create the names of the output files that this tool can create
830e8dc3acac Uploaded
jfb
parents:
diff changeset
43
830e8dc3acac Uploaded
jfb
parents:
diff changeset
44
830e8dc3acac Uploaded
jfb
parents:
diff changeset
45
830e8dc3acac Uploaded
jfb
parents:
diff changeset
46
830e8dc3acac Uploaded
jfb
parents:
diff changeset
47 FirstxY<-rep("xY",times=nrow(FirstSubstrateSet))
830e8dc3acac Uploaded
jfb
parents:
diff changeset
48 FirstSubstrateSet[,11]<-FirstxY
830e8dc3acac Uploaded
jfb
parents:
diff changeset
49
830e8dc3acac Uploaded
jfb
parents:
diff changeset
50 SecondxY<-rep("xY",times=nrow(SecondSubstrateSet))
830e8dc3acac Uploaded
jfb
parents:
diff changeset
51 SecondSubstrateSet[,11]<-SecondxY
830e8dc3acac Uploaded
jfb
parents:
diff changeset
52
830e8dc3acac Uploaded
jfb
parents:
diff changeset
53 ThirdxY<-rep("xY",times=nrow(ThirdSubstrateSet))
830e8dc3acac Uploaded
jfb
parents:
diff changeset
54 ThirdSubstrateSet[,11]<-ThirdxY
830e8dc3acac Uploaded
jfb
parents:
diff changeset
55
830e8dc3acac Uploaded
jfb
parents:
diff changeset
56 #for each input file, mark the phospho-Tyrosine (which is always housed in column 11)
830e8dc3acac Uploaded
jfb
parents:
diff changeset
57 #with an xY to denote that is it a phospho and not regular tyrosine
830e8dc3acac Uploaded
jfb
parents:
diff changeset
58
830e8dc3acac Uploaded
jfb
parents:
diff changeset
59
830e8dc3acac Uploaded
jfb
parents:
diff changeset
60 #currently the substrates are a dataframe with many values, I want to collapse each substrate into a single variable,
830e8dc3acac Uploaded
jfb
parents:
diff changeset
61 #but if I simply use the paste() function then I lose any information about whether the substrate was truncated on the C or N terminal.
830e8dc3acac Uploaded
jfb
parents:
diff changeset
62 #so the for loops below then are constructed so as to retain that information on how any substrate is truncated.
830e8dc3acac Uploaded
jfb
parents:
diff changeset
63
830e8dc3acac Uploaded
jfb
parents:
diff changeset
64 FTLwtmotifs=matrix(,nrow = nrow(FirstSubstrateSet),ncol=1)
830e8dc3acac Uploaded
jfb
parents:
diff changeset
65 FTLwtAccessionNumbers=matrix(data = Firstsubbackfreq[1,],ncol=1)
830e8dc3acac Uploaded
jfb
parents:
diff changeset
66 #create the vectors which will house the first set of substrates and the first set of accession numbers
830e8dc3acac Uploaded
jfb
parents:
diff changeset
67
830e8dc3acac Uploaded
jfb
parents:
diff changeset
68
830e8dc3acac Uploaded
jfb
parents:
diff changeset
69 for (i in 1:nrow(FirstSubstrateSet)){
830e8dc3acac Uploaded
jfb
parents:
diff changeset
70 FTLwtletters<-FirstSubstrateSet[i,4:18]
830e8dc3acac Uploaded
jfb
parents:
diff changeset
71 FTLwtletters<-FTLwtletters[FTLwtletters !="XXXXX"]
830e8dc3acac Uploaded
jfb
parents:
diff changeset
72 FTLwtletters<-paste(FTLwtletters, sep="", collapse="")
830e8dc3acac Uploaded
jfb
parents:
diff changeset
73 leftspaces<-c()
830e8dc3acac Uploaded
jfb
parents:
diff changeset
74 rightspaces<-c()
830e8dc3acac Uploaded
jfb
parents:
diff changeset
75
830e8dc3acac Uploaded
jfb
parents:
diff changeset
76 YYYmotif <- unlist(strsplit(FTLwtletters, split = ""))
830e8dc3acac Uploaded
jfb
parents:
diff changeset
77 YYYposition <- match(x = "x", table = YYYmotif)
830e8dc3acac Uploaded
jfb
parents:
diff changeset
78 #position itself tells me how much is to the left of that X by what it's number is. x at position 4 tells me that there are
830e8dc3acac Uploaded
jfb
parents:
diff changeset
79 #just 3 letters to the left of x
830e8dc3acac Uploaded
jfb
parents:
diff changeset
80
830e8dc3acac Uploaded
jfb
parents:
diff changeset
81 YYYLettersToTheLeft <- YYYposition - 1
830e8dc3acac Uploaded
jfb
parents:
diff changeset
82 YYYLettersToTheRight <- length(YYYmotif) - YYYposition - 1
830e8dc3acac Uploaded
jfb
parents:
diff changeset
83 #how many letters to the right SHOULD just be length(motif)-position-1 if it's 5 long and x is at 3 then Y is at 4 and there is
830e8dc3acac Uploaded
jfb
parents:
diff changeset
84 #just 1 spot to the right of Y so LettersToTheRight<-1 because 5-3-1=1
830e8dc3acac Uploaded
jfb
parents:
diff changeset
85
830e8dc3acac Uploaded
jfb
parents:
diff changeset
86
830e8dc3acac Uploaded
jfb
parents:
diff changeset
87
830e8dc3acac Uploaded
jfb
parents:
diff changeset
88 if (YYYLettersToTheLeft < 7 | YYYLettersToTheRight < 7) {
830e8dc3acac Uploaded
jfb
parents:
diff changeset
89 leftspaces<-rep(" ",times=(7-YYYLettersToTheLeft))
830e8dc3acac Uploaded
jfb
parents:
diff changeset
90 rightspaces<-rep(" ",times=7-(YYYLettersToTheRight))
830e8dc3acac Uploaded
jfb
parents:
diff changeset
91 #add blank spaces if the motif has less than 4 letters to the left/right
830e8dc3acac Uploaded
jfb
parents:
diff changeset
92 motif<-c(leftspaces,YYYmotif,rightspaces)
830e8dc3acac Uploaded
jfb
parents:
diff changeset
93 #save that motif, which is the Y and +/- 4 amino acids, including truncation
830e8dc3acac Uploaded
jfb
parents:
diff changeset
94 motif<-motif[!motif %in% "x"]
830e8dc3acac Uploaded
jfb
parents:
diff changeset
95 motif<-paste(motif, sep="", collapse="")
830e8dc3acac Uploaded
jfb
parents:
diff changeset
96 FTLwtletters<-motif
830e8dc3acac Uploaded
jfb
parents:
diff changeset
97 FTLwtmotifs[i,1]<-FTLwtletters
830e8dc3acac Uploaded
jfb
parents:
diff changeset
98 }
830e8dc3acac Uploaded
jfb
parents:
diff changeset
99
830e8dc3acac Uploaded
jfb
parents:
diff changeset
100 if(YYYLettersToTheLeft>6 && YYYLettersToTheRight>6){
830e8dc3acac Uploaded
jfb
parents:
diff changeset
101 motif<-YYYmotif
830e8dc3acac Uploaded
jfb
parents:
diff changeset
102 #add blank spaces if the motif has less than 4 letters to the left/right
830e8dc3acac Uploaded
jfb
parents:
diff changeset
103 motif<-c(leftspaces,YYYmotif,rightspaces)
830e8dc3acac Uploaded
jfb
parents:
diff changeset
104 #save that motif, which is the Y and +/- 4 amino acids, including truncation
830e8dc3acac Uploaded
jfb
parents:
diff changeset
105 motif<-motif[!motif %in% "x"]
830e8dc3acac Uploaded
jfb
parents:
diff changeset
106 motif<-paste(motif, sep="", collapse="")
830e8dc3acac Uploaded
jfb
parents:
diff changeset
107 FTLwtletters<-motif
830e8dc3acac Uploaded
jfb
parents:
diff changeset
108 FTLwtmotifs[i,1]<-FTLwtletters
830e8dc3acac Uploaded
jfb
parents:
diff changeset
109 }
830e8dc3acac Uploaded
jfb
parents:
diff changeset
110 }
830e8dc3acac Uploaded
jfb
parents:
diff changeset
111
830e8dc3acac Uploaded
jfb
parents:
diff changeset
112 D835Ymotifs=matrix(,nrow = nrow(SecondSubstrateSet),ncol=1)
830e8dc3acac Uploaded
jfb
parents:
diff changeset
113 D835YAccessionNumbers<-matrix(data = Secondsubbackfreq[1,],ncol = 1)
830e8dc3acac Uploaded
jfb
parents:
diff changeset
114 #vectors to house the second set of substrates and accession numbers
830e8dc3acac Uploaded
jfb
parents:
diff changeset
115
830e8dc3acac Uploaded
jfb
parents:
diff changeset
116 for (i in 1:nrow(SecondSubstrateSet)){
830e8dc3acac Uploaded
jfb
parents:
diff changeset
117 D835letters<-SecondSubstrateSet[i,4:18]
830e8dc3acac Uploaded
jfb
parents:
diff changeset
118 D835letters<-D835letters[D835letters !="XXXXX"]
830e8dc3acac Uploaded
jfb
parents:
diff changeset
119 D835letters<-paste(D835letters, sep="", collapse="")
830e8dc3acac Uploaded
jfb
parents:
diff changeset
120 leftspaces<-c()
830e8dc3acac Uploaded
jfb
parents:
diff changeset
121 rightspaces<-c()
830e8dc3acac Uploaded
jfb
parents:
diff changeset
122
830e8dc3acac Uploaded
jfb
parents:
diff changeset
123 YYYmotif <- unlist(strsplit(D835letters, split = ""))
830e8dc3acac Uploaded
jfb
parents:
diff changeset
124 YYYposition <- match(x = "x", table = YYYmotif)
830e8dc3acac Uploaded
jfb
parents:
diff changeset
125 #position itself tells me how much is to the left of that X by what it's number is. x at position 4 tells me that there are
830e8dc3acac Uploaded
jfb
parents:
diff changeset
126 #just 3 letters to the left of x
830e8dc3acac Uploaded
jfb
parents:
diff changeset
127
830e8dc3acac Uploaded
jfb
parents:
diff changeset
128 YYYLettersToTheLeft <- YYYposition - 1
830e8dc3acac Uploaded
jfb
parents:
diff changeset
129 #how many letters to the right SHOULD just be length(motif)-position-1 if it's 5 long and x is at 3 then Y is at 4 and there is
830e8dc3acac Uploaded
jfb
parents:
diff changeset
130 #just 1 spot to the right of Y so LettersToTheRight<-1 because 5-3-1=1
830e8dc3acac Uploaded
jfb
parents:
diff changeset
131 YYYLettersToTheRight <- length(YYYmotif) - YYYposition - 1
830e8dc3acac Uploaded
jfb
parents:
diff changeset
132 #then sanity check, we're currently looking only at +/-4, but this spot allows for up to +/- 7 as well, just depends on what the
830e8dc3acac Uploaded
jfb
parents:
diff changeset
133 #variable the user puts in is
830e8dc3acac Uploaded
jfb
parents:
diff changeset
134 if (YYYLettersToTheLeft < 7 | YYYLettersToTheRight < 7) {
830e8dc3acac Uploaded
jfb
parents:
diff changeset
135 leftspaces<-rep(" ",times=(7-YYYLettersToTheLeft))
830e8dc3acac Uploaded
jfb
parents:
diff changeset
136 rightspaces<-rep(" ",times=7-(YYYLettersToTheRight))
830e8dc3acac Uploaded
jfb
parents:
diff changeset
137 #add blank spaces if the motif has less than 4 letters to the left/right
830e8dc3acac Uploaded
jfb
parents:
diff changeset
138 motif<-c(leftspaces,YYYmotif,rightspaces)
830e8dc3acac Uploaded
jfb
parents:
diff changeset
139 #save that motif, which is the Y and +/- 4 amino acids, including truncation
830e8dc3acac Uploaded
jfb
parents:
diff changeset
140 motif<-motif[!motif %in% "x"]
830e8dc3acac Uploaded
jfb
parents:
diff changeset
141 motif<-paste(motif, sep="", collapse="")
830e8dc3acac Uploaded
jfb
parents:
diff changeset
142 D835letters<-motif
830e8dc3acac Uploaded
jfb
parents:
diff changeset
143 D835Ymotifs[i,1]<-D835letters
830e8dc3acac Uploaded
jfb
parents:
diff changeset
144 }
830e8dc3acac Uploaded
jfb
parents:
diff changeset
145
830e8dc3acac Uploaded
jfb
parents:
diff changeset
146 if(YYYLettersToTheLeft>6 && YYYLettersToTheRight>6){
830e8dc3acac Uploaded
jfb
parents:
diff changeset
147 motif<-YYYmotif
830e8dc3acac Uploaded
jfb
parents:
diff changeset
148 #add blank spaces if the motif has less than 4 letters to the left/right
830e8dc3acac Uploaded
jfb
parents:
diff changeset
149 motif<-c(leftspaces,YYYmotif,rightspaces)
830e8dc3acac Uploaded
jfb
parents:
diff changeset
150 #save that motif, which is the Y and +/- 4 amino acids, including truncation
830e8dc3acac Uploaded
jfb
parents:
diff changeset
151 motif<-motif[!motif %in% "x"]
830e8dc3acac Uploaded
jfb
parents:
diff changeset
152 motif<-paste(motif, sep="", collapse="")
830e8dc3acac Uploaded
jfb
parents:
diff changeset
153 D835letters<-motif
830e8dc3acac Uploaded
jfb
parents:
diff changeset
154 D835Ymotifs[i,1]<-D835letters
830e8dc3acac Uploaded
jfb
parents:
diff changeset
155 }
830e8dc3acac Uploaded
jfb
parents:
diff changeset
156 }
830e8dc3acac Uploaded
jfb
parents:
diff changeset
157
830e8dc3acac Uploaded
jfb
parents:
diff changeset
158
830e8dc3acac Uploaded
jfb
parents:
diff changeset
159 ITDmotifs=matrix(,nrow = nrow(ThirdSubstrateSet),ncol=1)
830e8dc3acac Uploaded
jfb
parents:
diff changeset
160 ITDAccessionNumbers<-matrix(data = Thirdsubbackfreq[1,],ncol = 1)
830e8dc3acac Uploaded
jfb
parents:
diff changeset
161 #third set of substrates and accession numbers
830e8dc3acac Uploaded
jfb
parents:
diff changeset
162
830e8dc3acac Uploaded
jfb
parents:
diff changeset
163
830e8dc3acac Uploaded
jfb
parents:
diff changeset
164 for (i in 1:nrow(ThirdSubstrateSet)){
830e8dc3acac Uploaded
jfb
parents:
diff changeset
165 ITDletters<-ThirdSubstrateSet[i,4:18]
830e8dc3acac Uploaded
jfb
parents:
diff changeset
166 ITDletters<-ITDletters[ITDletters !="XXXXX"]
830e8dc3acac Uploaded
jfb
parents:
diff changeset
167 ITDletters<-paste(ITDletters, sep="", collapse="")
830e8dc3acac Uploaded
jfb
parents:
diff changeset
168 YYYmotif <- unlist(strsplit(ITDletters, split = ""))
830e8dc3acac Uploaded
jfb
parents:
diff changeset
169 leftspaces<-c()
830e8dc3acac Uploaded
jfb
parents:
diff changeset
170 rightspaces<-c()
830e8dc3acac Uploaded
jfb
parents:
diff changeset
171 YYYposition <- match(x = "x", table = YYYmotif)
830e8dc3acac Uploaded
jfb
parents:
diff changeset
172 #position itself tells me how much is to the left of that X by what it's number is. x at position 4 tells me that there are
830e8dc3acac Uploaded
jfb
parents:
diff changeset
173 #just 3 letters to the left of x
830e8dc3acac Uploaded
jfb
parents:
diff changeset
174
830e8dc3acac Uploaded
jfb
parents:
diff changeset
175 YYYLettersToTheLeft <- YYYposition - 1
830e8dc3acac Uploaded
jfb
parents:
diff changeset
176 #how many letters to the right SHOULD just be length(motif)-position-1 if it's 5 long and x is at 3 then Y is at 4 and there is
830e8dc3acac Uploaded
jfb
parents:
diff changeset
177 #just 1 spot to the right of Y so LettersToTheRight<-1 because 5-3-1=1
830e8dc3acac Uploaded
jfb
parents:
diff changeset
178 YYYLettersToTheRight <- length(YYYmotif) - YYYposition - 1
830e8dc3acac Uploaded
jfb
parents:
diff changeset
179 #then sanity check, we're currently looking only at +/-4, but this spot allows for up to +/- 7 as well, just depends on what the
830e8dc3acac Uploaded
jfb
parents:
diff changeset
180 #variable the user puts in is
830e8dc3acac Uploaded
jfb
parents:
diff changeset
181 if (YYYLettersToTheLeft < 7 | YYYLettersToTheRight < 7) {
830e8dc3acac Uploaded
jfb
parents:
diff changeset
182 leftspaces<-rep(" ",times=(7-YYYLettersToTheLeft))
830e8dc3acac Uploaded
jfb
parents:
diff changeset
183 rightspaces<-rep(" ",times=7-(YYYLettersToTheRight))
830e8dc3acac Uploaded
jfb
parents:
diff changeset
184 #add blank spaces if the motif has less than 4 letters to the left/right
830e8dc3acac Uploaded
jfb
parents:
diff changeset
185 motif<-c(leftspaces,YYYmotif,rightspaces)
830e8dc3acac Uploaded
jfb
parents:
diff changeset
186 #save that motif, which is the Y and +/- 4 amino acids, including truncation
830e8dc3acac Uploaded
jfb
parents:
diff changeset
187 motif<-motif[!motif %in% "x"]
830e8dc3acac Uploaded
jfb
parents:
diff changeset
188 motif<-paste(motif, sep="", collapse="")
830e8dc3acac Uploaded
jfb
parents:
diff changeset
189 ITDletters<-motif
830e8dc3acac Uploaded
jfb
parents:
diff changeset
190 ITDmotifs[i,1]<-ITDletters
830e8dc3acac Uploaded
jfb
parents:
diff changeset
191 # ITDAccessionNumbers[i,1]<-FirstSubstrateSet[i,3]
830e8dc3acac Uploaded
jfb
parents:
diff changeset
192 }
830e8dc3acac Uploaded
jfb
parents:
diff changeset
193
830e8dc3acac Uploaded
jfb
parents:
diff changeset
194 if(YYYLettersToTheLeft>6 && YYYLettersToTheRight>6){
830e8dc3acac Uploaded
jfb
parents:
diff changeset
195 motif<-YYYmotif
830e8dc3acac Uploaded
jfb
parents:
diff changeset
196 #add blank spaces if the motif has less than 4 letters to the left/right
830e8dc3acac Uploaded
jfb
parents:
diff changeset
197 motif<-c(leftspaces,YYYmotif,rightspaces)
830e8dc3acac Uploaded
jfb
parents:
diff changeset
198 #save that motif, which is the Y and +/- 4 amino acids, including truncation
830e8dc3acac Uploaded
jfb
parents:
diff changeset
199 motif<-motif[!motif %in% "x"]
830e8dc3acac Uploaded
jfb
parents:
diff changeset
200 motif<-paste(motif, sep="", collapse="")
830e8dc3acac Uploaded
jfb
parents:
diff changeset
201 ITDletters<-motif
830e8dc3acac Uploaded
jfb
parents:
diff changeset
202 ITDmotifs[i,1]<-ITDletters
830e8dc3acac Uploaded
jfb
parents:
diff changeset
203 # ITDAccessionNumbers[i,1]<-FirstSubstrateSet[i,3]
830e8dc3acac Uploaded
jfb
parents:
diff changeset
204 }
830e8dc3acac Uploaded
jfb
parents:
diff changeset
205 }
830e8dc3acac Uploaded
jfb
parents:
diff changeset
206
830e8dc3acac Uploaded
jfb
parents:
diff changeset
207
830e8dc3acac Uploaded
jfb
parents:
diff changeset
208 SubstrateOverlap1<-intersect(D835Ymotifs,ITDmotifs)
830e8dc3acac Uploaded
jfb
parents:
diff changeset
209 SubstrateOverlap1<-as.matrix(SubstrateOverlap1)
830e8dc3acac Uploaded
jfb
parents:
diff changeset
210 SubstrateOverlapFINAL<-intersect(FTLwtmotifs,SubstrateOverlap1)
830e8dc3acac Uploaded
jfb
parents:
diff changeset
211 #this tool is essentially looking for the intersection of three sets, and to do so it performs 1 intersection at a time
830e8dc3acac Uploaded
jfb
parents:
diff changeset
212 #this find the intersection of the substrate sets
830e8dc3acac Uploaded
jfb
parents:
diff changeset
213
830e8dc3acac Uploaded
jfb
parents:
diff changeset
214 AccessionOverlap1<-intersect(D835YAccessionNumbers,ITDAccessionNumbers)
830e8dc3acac Uploaded
jfb
parents:
diff changeset
215 AccessionOverlapFinal<-intersect(AccessionOverlap1,FTLwtAccessionNumbers)
830e8dc3acac Uploaded
jfb
parents:
diff changeset
216 AccessionOverlapFinal<-unlist(AccessionOverlapFinal)
830e8dc3acac Uploaded
jfb
parents:
diff changeset
217 #this tool is essentially looking for the intersection of three sets, and to do so it performs 1 intersection at a time
830e8dc3acac Uploaded
jfb
parents:
diff changeset
218 #this find the intersection of the accession number sets
830e8dc3acac Uploaded
jfb
parents:
diff changeset
219
830e8dc3acac Uploaded
jfb
parents:
diff changeset
220
830e8dc3acac Uploaded
jfb
parents:
diff changeset
221 for (x in 1:length(AccessionOverlapFinal)) {
830e8dc3acac Uploaded
jfb
parents:
diff changeset
222 for (y in 1:ncol(Firstsubbackfreq)) {
830e8dc3acac Uploaded
jfb
parents:
diff changeset
223 Acc<-AccessionOverlapFinal[x]
830e8dc3acac Uploaded
jfb
parents:
diff changeset
224 SBF<-Firstsubbackfreq[1,y]
830e8dc3acac Uploaded
jfb
parents:
diff changeset
225 if(Acc==SBF){
830e8dc3acac Uploaded
jfb
parents:
diff changeset
226 FinalMatrix<-cbind(FinalMatrix,Firstsubbackfreq[,y])
830e8dc3acac Uploaded
jfb
parents:
diff changeset
227 }
830e8dc3acac Uploaded
jfb
parents:
diff changeset
228 }
830e8dc3acac Uploaded
jfb
parents:
diff changeset
229 }
830e8dc3acac Uploaded
jfb
parents:
diff changeset
230 #for every accession number, go back to the original substrate background frequency file and find the protein statistics associated with that number
830e8dc3acac Uploaded
jfb
parents:
diff changeset
231 #columnbind all those protein statistics together
830e8dc3acac Uploaded
jfb
parents:
diff changeset
232 FinalMatrix<-FinalMatrix[,2:ncol(FinalMatrix)]
830e8dc3acac Uploaded
jfb
parents:
diff changeset
233
830e8dc3acac Uploaded
jfb
parents:
diff changeset
234
830e8dc3acac Uploaded
jfb
parents:
diff changeset
235 #write all files, in the proper format so that the files coming out look like the files coming in
830e8dc3acac Uploaded
jfb
parents:
diff changeset
236
830e8dc3acac Uploaded
jfb
parents:
diff changeset
237 if(grepl(pattern = "Properties", x=FinalMatrix[22,1])==FALSE){
830e8dc3acac Uploaded
jfb
parents:
diff changeset
238 Outputmatrix<-cbind(Firstsubbackfreq[,1],FinalMatrix)
830e8dc3acac Uploaded
jfb
parents:
diff changeset
239 write.table(x=Outputmatrix,file = Shared_subbackfreq_table,quote = FALSE,sep = ",",row.names = FALSE,col.names = FALSE,na="")
830e8dc3acac Uploaded
jfb
parents:
diff changeset
240 } else {
830e8dc3acac Uploaded
jfb
parents:
diff changeset
241 write.table(x=FinalMatrix,file = Shared_subbackfreq_table,quote = FALSE,sep = ",",row.names = FALSE,col.names = FALSE,na="")
830e8dc3acac Uploaded
jfb
parents:
diff changeset
242 }
830e8dc3acac Uploaded
jfb
parents:
diff changeset
243
830e8dc3acac Uploaded
jfb
parents:
diff changeset
244 SubstrateMatrix<-SubstrateHeader
830e8dc3acac Uploaded
jfb
parents:
diff changeset
245 if(ncol(SubstrateMatrix)>18){
830e8dc3acac Uploaded
jfb
parents:
diff changeset
246 SubstrateMatrix<-SubstrateMatrix[,1:18]
830e8dc3acac Uploaded
jfb
parents:
diff changeset
247 }
830e8dc3acac Uploaded
jfb
parents:
diff changeset
248
830e8dc3acac Uploaded
jfb
parents:
diff changeset
249 for (z in 1:length(SubstrateOverlapFINAL)) {
830e8dc3acac Uploaded
jfb
parents:
diff changeset
250 motif<-SubstrateOverlapFINAL[z]
830e8dc3acac Uploaded
jfb
parents:
diff changeset
251 newmotif<-unlist(strsplit(motif,split = ""))
830e8dc3acac Uploaded
jfb
parents:
diff changeset
252
830e8dc3acac Uploaded
jfb
parents:
diff changeset
253 Addition<-""
830e8dc3acac Uploaded
jfb
parents:
diff changeset
254 outputmotif<-c(Addition,Addition,Addition,newmotif)
830e8dc3acac Uploaded
jfb
parents:
diff changeset
255 SubstrateMatrix<-rbind(SubstrateMatrix,outputmotif)
830e8dc3acac Uploaded
jfb
parents:
diff changeset
256 }
830e8dc3acac Uploaded
jfb
parents:
diff changeset
257 write.table(x=SubstrateMatrix,file = Shared_motifs_table,quote = FALSE,sep = ",",row.names = FALSE,col.names = FALSE,na="")