comparison all stuff/.Rhistory @ 9:033dd86d3e0c draft

Uploaded
author jfb
date Fri, 21 Feb 2020 13:07:45 -0500
parents
children
comparison
equal deleted inserted replaced
8:4dd15c41d9e7 9:033dd86d3e0c
1 ?rnorm
2 ?rnorm
3 ?rnorm
4 pwr
5 ?pwr
6 ??pwr
7 power.t.test(n=6, power = .7, type = "two.sample", alternative = "two.sided")
8 power.t.test(n=6, power = .9, type = "two.sample", alternative = "two.sided")
9 ?power.t.test
10 power.t.test(n=5, sd=1000, power = .7, type = "paired", alternative = "one.sided")
11 10^4
12 power.t.test(n=5, sd=10000, power = .7, type = "paired", alternative = "one.sided")
13 power.t.test(n=10, delta = 7, sd=10, type = "paired", alternative = "one.sided")
14 setwd("C:/Users/John Blankenhor/Downloads/difference_finder-4dd15c41d9e7/difference_finder-4dd15c41d9e7/all stuff")
15 #put the names of your input files here
16 FirstSubstrateSet<- read.csv("S1.csv", stringsAsFactors=FALSE)
17 Firstsubbackfreq<- read.csv("SBF1.csv", header=FALSE, stringsAsFactors=FALSE)
18 FirstSubstrateSet
19 EmptySubHeader<-First_unshared_motifs_table[1,]
20 First_unshared_motifs_table<-"1RS.csv"
21 First_unshared_subbackfreq<-"1RSBF.csv"
22 #put the names of your input files here
23 FirstSubstrateSet<- read.csv("S1.csv", stringsAsFactors=FALSE)
24 Firstsubbackfreq<- read.csv("SBF1.csv", header=FALSE, stringsAsFactors=FALSE)
25 EmptySubHeader<-FirstSubstrateSet[1,]
26 head(Firstsubbackfreq)
27 EmptySBFHeader<-Firstsubbackfreq[,1]
28 #ff you want ONLY FULL MOTIFS, put "YES" here, please use all caps
29 FullMotifsOnly_questionmark<-"NO"
30 #If you want ONLY TRUNCATED MOTIFS, put "YES" here, please use all caps
31 TruncatedMotifsOnly_questionmark<-"NO"
32 #if you want to find the overlap, put a "YES" here (all caps), if you want to find the non-overlap, put "NO" (all caps)
33 Are_You_Looking_For_Commonality<-"NO"
34 #put the names of your input files here
35 FirstSubstrateSet<- read.csv("S1.csv", stringsAsFactors=FALSE)
36 Firstsubbackfreq<- read.csv("SBF1.csv", header=FALSE, stringsAsFactors=FALSE)
37 SecondSubstrateSet<- read.csv("S2.csv", stringsAsFactors=FALSE)
38 Secondsubbackfreq<- read.csv("SBF2.csv", header=FALSE, stringsAsFactors=FALSE)
39 First_unshared_motifs_table<-"1RS.csv"
40 First_unshared_subbackfreq<-"1RSBF.csv"
41 Second_unshared_motifs_table<-"2RS.csv"
42 Second_unshared_subbackfreq<-"2RSBF.csv"
43 EmptySubHeader<-FirstSubstrateSet[1,]
44 EmptySBFHeader<-Firstsubbackfreq[,1]
45 FirstCentralLetters<-FirstSubstrateSet[,11]
46 SecondCentralLetters<-SecondSubstrateSet[,11]
47 FirstEsses<-sapply(FirstCentralLetters, grepl, pattern="S", ignore.case=TRUE)
48 FirstTees<-sapply(FirstCentralLetters, grepl, pattern="T", ignore.case=TRUE)
49 FirstWys<-sapply(FirstCentralLetters, grepl, pattern="Y", ignore.case=TRUE)
50 SecondEsses<-sapply(SecondCentralLetters, grepl, pattern="S", ignore.case=TRUE)
51 SecondTees<-sapply(SecondCentralLetters, grepl, pattern="T", ignore.case=TRUE)
52 SecondWys<-sapply(SecondCentralLetters, grepl, pattern="Y", ignore.case=TRUE)
53 FirstCentralLetters<-replace(FirstCentralLetters,FirstEsses,"xS")
54 FirstCentralLetters<-replace(FirstCentralLetters,FirstTees,"xT")
55 FirstCentralLetters<-replace(FirstCentralLetters,FirstWys,"xY")
56 SecondCentralLetters<-replace(SecondCentralLetters,SecondEsses,"xS")
57 SecondCentralLetters<-replace(SecondCentralLetters,SecondTees,"xT")
58 SecondCentralLetters<-replace(SecondCentralLetters,SecondWys,"xY")
59 FirstCentralLetters->FirstSubstrateSet[,11]
60 SecondCentralLetters->SecondSubstrateSet[,11]
61 if (FullMotifsOnly_questionmark!="YES"&&TruncatedMotifsOnly_questionmark!="YES"){
62 FTLwtmotifs=matrix(,nrow = nrow(FirstSubstrateSet),ncol=1)
63 FTLwtAccessionNumbers=matrix(,nrow = nrow(FirstSubstrateSet),ncol=1)
64 for (i in 1:nrow(FirstSubstrateSet)){
65 FTLwtletters<-FirstSubstrateSet[i,4:18]
66 FTLwtletters<-FTLwtletters[FTLwtletters !="XXXXX"]
67 FTLwtletters<-paste(FTLwtletters, sep="", collapse="")
68 leftspaces<-c()
69 rightspaces<-c()
70 YYYmotif <- unlist(strsplit(FTLwtletters, split = ""))
71 YYYposition <- match(x = "x", table = YYYmotif)
72 #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
73 #just 3 letters to the left of x
74 YYYLettersToTheLeft <- YYYposition - 1
75 #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
76 #just 1 spot to the right of Y so LettersToTheRight<-1 because 5-3-1=1
77 YYYLettersToTheRight <- length(YYYmotif) - YYYposition - 1
78 #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
79 #variable the user puts in is
80 if (YYYLettersToTheLeft < 7 | YYYLettersToTheRight < 7) {
81 leftspaces<-rep(" ",times=(7-YYYLettersToTheLeft))
82 rightspaces<-rep(" ",times=7-(YYYLettersToTheRight))
83 #add blank spaces if the motif has less than 4 letters to the left/right
84 motif<-c(leftspaces,YYYmotif,rightspaces)
85 #save that motif, which is the Y and +/- 4 amino acids, including truncation
86 motif<-motif[!motif %in% "x"]
87 motif<-paste(motif, sep="", collapse="")
88 FTLwtletters<-motif
89 FTLwtmotifs[i,1]<-FTLwtletters
90 FTLwtAccessionNumbers[i,1]<-FirstSubstrateSet[i,3]
91 }
92 if(YYYLettersToTheLeft>6 && YYYLettersToTheRight>6){
93 motif<-YYYmotif
94 #add blank spaces if the motif has less than 4 letters to the left/right
95 motif<-c(leftspaces,YYYmotif,rightspaces)
96 #save that motif, which is the Y and +/- 4 amino acids, including truncation
97 motif<-motif[!motif %in% "x"]
98 motif<-paste(motif, sep="", collapse="")
99 FTLwtletters<-motif
100 FTLwtmotifs[i,1]<-FTLwtletters
101 FTLwtAccessionNumbers[i,1]<-FirstSubstrateSet[i,3]
102 }
103 }
104 D835Ymotifs=matrix(,nrow = nrow(SecondSubstrateSet),ncol=1)
105 D835YAccessionNumbers<-matrix(,nrow = nrow(SecondSubstrateSet),ncol = 1)
106 for (i in 1:nrow(SecondSubstrateSet)){
107 D835letters<-SecondSubstrateSet[i,4:18]
108 D835letters<-D835letters[D835letters !="XXXXX"]
109 D835letters<-paste(D835letters, sep="", collapse="")
110 leftspaces<-c()
111 rightspaces<-c()
112 YYYmotif <- unlist(strsplit(D835letters, split = ""))
113 YYYposition <- match(x = "x", table = YYYmotif)
114 #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
115 #just 3 letters to the left of x
116 YYYLettersToTheLeft <- YYYposition - 1
117 #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
118 #just 1 spot to the right of Y so LettersToTheRight<-1 because 5-3-1=1
119 YYYLettersToTheRight <- length(YYYmotif) - YYYposition - 1
120 #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
121 #variable the user puts in is
122 if (YYYLettersToTheLeft < 7 | YYYLettersToTheRight < 7) {
123 leftspaces<-rep(" ",times=(7-YYYLettersToTheLeft))
124 rightspaces<-rep(" ",times=7-(YYYLettersToTheRight))
125 #add blank spaces if the motif has less than 4 letters to the left/right
126 motif<-c(leftspaces,YYYmotif,rightspaces)
127 #save that motif, which is the Y and +/- 4 amino acids, including truncation
128 motif<-motif[!motif %in% "x"]
129 motif<-paste(motif, sep="", collapse="")
130 D835letters<-motif
131 D835Ymotifs[i,1]<-D835letters
132 D835YAccessionNumbers[i,1]<-SecondSubstrateSet[i,3]
133 }
134 if(YYYLettersToTheLeft>6 && YYYLettersToTheRight>6){
135 motif<-YYYmotif
136 #add blank spaces if the motif has less than 4 letters to the left/right
137 motif<-c(leftspaces,YYYmotif,rightspaces)
138 #save that motif, which is the Y and +/- 4 amino acids, including truncation
139 motif<-motif[!motif %in% "x"]
140 motif<-paste(motif, sep="", collapse="")
141 D835letters<-motif
142 D835Ymotifs[i,1]<-D835letters
143 D835YAccessionNumbers[i,1]<-SecondSubstrateSet[i,3]
144 }
145 }
146 names(FTLwtmotifs)<-FTLwtAccessionNumbers
147 names(D835Ymotifs)<-D835YAccessionNumbers
148 }
149 FTLwtmotifsFINAL<-FTLwtmotifs[!FTLwtmotifs %in% D835Ymotifs]
150 FTLwtmotifsFINAL<-FTLwtmotifsFINAL[!duplicated(FTLwtmotifsFINAL)]
151 D835YmotifsFINAL<-D835Ymotifs[!D835Ymotifs %in% FTLwtmotifs]
152 D835YmotifsFINAL<-D835YmotifsFINAL[!duplicated(D835YmotifsFINAL)]
153 if (FullMotifsOnly_questionmark!="YES"&&TruncatedMotifsOnly_questionmark!="YES"){
154 FTLwtmotifs=matrix(,nrow = nrow(FirstSubstrateSet),ncol=1)
155 FTLwtAccessionNumbers=matrix(,nrow = nrow(FirstSubstrateSet),ncol=1)
156 for (i in 1:nrow(FirstSubstrateSet)){
157 FTLwtletters<-FirstSubstrateSet[i,4:18]
158 FTLwtletters<-FTLwtletters[FTLwtletters !="XXXXX"]
159 FTLwtletters<-paste(FTLwtletters, sep="", collapse="")
160 leftspaces<-c()
161 rightspaces<-c()
162 YYYmotif <- unlist(strsplit(FTLwtletters, split = ""))
163 YYYposition <- match(x = "x", table = YYYmotif)
164 #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
165 #just 3 letters to the left of x
166 YYYLettersToTheLeft <- YYYposition - 1
167 #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
168 #just 1 spot to the right of Y so LettersToTheRight<-1 because 5-3-1=1
169 YYYLettersToTheRight <- length(YYYmotif) - YYYposition - 1
170 #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
171 #variable the user puts in is
172 if (YYYLettersToTheLeft < 7 | YYYLettersToTheRight < 7) {
173 leftspaces<-rep(" ",times=(7-YYYLettersToTheLeft))
174 rightspaces<-rep(" ",times=7-(YYYLettersToTheRight))
175 #add blank spaces if the motif has less than 4 letters to the left/right
176 motif<-c(leftspaces,YYYmotif,rightspaces)
177 #save that motif, which is the Y and +/- 4 amino acids, including truncation
178 motif<-motif[!motif %in% "x"]
179 motif<-paste(motif, sep="", collapse="")
180 FTLwtletters<-motif
181 FTLwtmotifs[i,1]<-FTLwtletters
182 FTLwtAccessionNumbers[i,1]<-FirstSubstrateSet[i,3]
183 }
184 if(YYYLettersToTheLeft>6 && YYYLettersToTheRight>6){
185 motif<-YYYmotif
186 #add blank spaces if the motif has less than 4 letters to the left/right
187 motif<-c(leftspaces,YYYmotif,rightspaces)
188 #save that motif, which is the Y and +/- 4 amino acids, including truncation
189 motif<-motif[!motif %in% "x"]
190 motif<-paste(motif, sep="", collapse="")
191 FTLwtletters<-motif
192 FTLwtmotifs[i,1]<-FTLwtletters
193 FTLwtAccessionNumbers[i,1]<-FirstSubstrateSet[i,3]
194 }
195 }
196 D835Ymotifs=matrix(,nrow = nrow(SecondSubstrateSet),ncol=1)
197 D835YAccessionNumbers<-matrix(,nrow = nrow(SecondSubstrateSet),ncol = 1)
198 for (i in 1:nrow(SecondSubstrateSet)){
199 D835letters<-SecondSubstrateSet[i,4:18]
200 D835letters<-D835letters[D835letters !="XXXXX"]
201 D835letters<-paste(D835letters, sep="", collapse="")
202 leftspaces<-c()
203 rightspaces<-c()
204 YYYmotif <- unlist(strsplit(D835letters, split = ""))
205 YYYposition <- match(x = "x", table = YYYmotif)
206 #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
207 #just 3 letters to the left of x
208 YYYLettersToTheLeft <- YYYposition - 1
209 #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
210 #just 1 spot to the right of Y so LettersToTheRight<-1 because 5-3-1=1
211 YYYLettersToTheRight <- length(YYYmotif) - YYYposition - 1
212 #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
213 #variable the user puts in is
214 if (YYYLettersToTheLeft < 7 | YYYLettersToTheRight < 7) {
215 leftspaces<-rep(" ",times=(7-YYYLettersToTheLeft))
216 rightspaces<-rep(" ",times=7-(YYYLettersToTheRight))
217 #add blank spaces if the motif has less than 4 letters to the left/right
218 motif<-c(leftspaces,YYYmotif,rightspaces)
219 #save that motif, which is the Y and +/- 4 amino acids, including truncation
220 motif<-motif[!motif %in% "x"]
221 motif<-paste(motif, sep="", collapse="")
222 D835letters<-motif
223 D835Ymotifs[i,1]<-D835letters
224 D835YAccessionNumbers[i,1]<-SecondSubstrateSet[i,3]
225 }
226 if(YYYLettersToTheLeft>6 && YYYLettersToTheRight>6){
227 motif<-YYYmotif
228 #add blank spaces if the motif has less than 4 letters to the left/right
229 motif<-c(leftspaces,YYYmotif,rightspaces)
230 #save that motif, which is the Y and +/- 4 amino acids, including truncation
231 motif<-motif[!motif %in% "x"]
232 motif<-paste(motif, sep="", collapse="")
233 D835letters<-motif
234 D835Ymotifs[i,1]<-D835letters
235 D835YAccessionNumbers[i,1]<-SecondSubstrateSet[i,3]
236 }
237 }
238 names(FTLwtmotifs)<-FTLwtAccessionNumbers
239 names(D835Ymotifs)<-D835YAccessionNumbers
240 }
241 #ff you want ONLY FULL MOTIFS, put "YES" here, please use all caps
242 FullMotifsOnly_questionmark<-"NO"
243 #If you want ONLY TRUNCATED MOTIFS, put "YES" here, please use all caps
244 TruncatedMotifsOnly_questionmark<-"NO"
245 #if you want to find the overlap, put a "YES" here (all caps), if you want to find the non-overlap, put "NO" (all caps)
246 Are_You_Looking_For_Commonality<-"NO"
247 #put the names of your input files here
248 FirstSubstrateSet<- read.csv("S1.csv", stringsAsFactors=FALSE)
249 Firstsubbackfreq<- read.csv("SBF1.csv", header=FALSE, stringsAsFactors=FALSE)
250 SecondSubstrateSet<- read.csv("S2.csv", stringsAsFactors=FALSE)
251 Secondsubbackfreq<- read.csv("SBF2.csv", header=FALSE, stringsAsFactors=FALSE)
252 First_unshared_motifs_table<-"1RS.csv"
253 First_unshared_subbackfreq<-"1RSBF.csv"
254 Second_unshared_motifs_table<-"2RS.csv"
255 Second_unshared_subbackfreq<-"2RSBF.csv"
256 EmptySubHeader<-FirstSubstrateSet[1,]
257 EmptySBFHeader<-Firstsubbackfreq[,1]
258 FirstCentralLetters<-FirstSubstrateSet[,11]
259 SecondCentralLetters<-SecondSubstrateSet[,11]
260 FirstEsses<-sapply(FirstCentralLetters, grepl, pattern="S", ignore.case=TRUE)
261 FirstTees<-sapply(FirstCentralLetters, grepl, pattern="T", ignore.case=TRUE)
262 FirstWys<-sapply(FirstCentralLetters, grepl, pattern="Y", ignore.case=TRUE)
263 SecondEsses<-sapply(SecondCentralLetters, grepl, pattern="S", ignore.case=TRUE)
264 SecondTees<-sapply(SecondCentralLetters, grepl, pattern="T", ignore.case=TRUE)
265 SecondWys<-sapply(SecondCentralLetters, grepl, pattern="Y", ignore.case=TRUE)
266 FirstCentralLetters<-replace(FirstCentralLetters,FirstEsses,"xS")
267 FirstCentralLetters<-replace(FirstCentralLetters,FirstTees,"xT")
268 FirstCentralLetters<-replace(FirstCentralLetters,FirstWys,"xY")
269 SecondCentralLetters<-replace(SecondCentralLetters,SecondEsses,"xS")
270 SecondCentralLetters<-replace(SecondCentralLetters,SecondTees,"xT")
271 SecondCentralLetters<-replace(SecondCentralLetters,SecondWys,"xY")
272 FirstCentralLetters->FirstSubstrateSet[,11]
273 SecondCentralLetters->SecondSubstrateSet[,11]
274 FirstSubstrateSet
275 #put the names of your input files here
276 FirstSubstrateSet<- read.csv("S1.csv", stringsAsFactors=FALSE)
277 FirstSubstrateSet
278 head(SecondSubstrateSet)
279 #put the names of your input files here
280 FirstSubstrateSet<- read.csv("S1.csv", stringsAsFactors=FALSE)
281 head(SecondSubstrateSet)
282 FirstSubstrateSet
283 #put the names of your input files here
284 FirstSubstrateSet<- read.csv("S1.csv", stringsAsFactors=FALSE)
285 FirstSubstrateSet
286 #put the names of your input files here
287 FirstSubstrateSet<- read.csv("S1.csv", stringsAsFactors=FALSE)
288 SecondSubstrateSet<- read.csv("S2.csv", stringsAsFactors=FALSE)