annotate scoring function/.Rhistory @ 5:2f5855ff5a04 draft

Uploaded
author jfb
date Sat, 27 Apr 2019 15:51:34 -0400
parents ed9068208721
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
ed9068208721 Uploaded
jfb
parents:
diff changeset
1 install.packages("xlsx")
ed9068208721 Uploaded
jfb
parents:
diff changeset
2 package("xlsx")
ed9068208721 Uploaded
jfb
parents:
diff changeset
3 require(xlsx)
ed9068208721 Uploaded
jfb
parents:
diff changeset
4 ?read.xlsx
ed9068208721 Uploaded
jfb
parents:
diff changeset
5 ?read.xlsx("C:\Users\parkerlab\Downloads\ppse.xlsx")
ed9068208721 Uploaded
jfb
parents:
diff changeset
6 ?read.xlsx("C:/Users/parkerlab/Downloads/ppse.xlsx")
ed9068208721 Uploaded
jfb
parents:
diff changeset
7 figs<-read.xlsx("C:/Users/parkerlab/Downloads/ppse.xlsx")
ed9068208721 Uploaded
jfb
parents:
diff changeset
8 figs<-read.xlsx("C:/Users/parkerlab/Downloads/ppse.xlsx",sheetIndex = 1)
ed9068208721 Uploaded
jfb
parents:
diff changeset
9 setwd("C:/Users/parkerlab/Desktop/Laura Difference Finder files/LKB1 trypsin")
ed9068208721 Uploaded
jfb
parents:
diff changeset
10 setwd("C:/Users/parkerlab/Desktop/Laura Difference Finder files/LKB1 trypsin/No duplicates")
ed9068208721 Uploaded
jfb
parents:
diff changeset
11 source('F:/ParkerLab Dropbox/Dropbox (Parker Lab)/Parker Lab Shared Files/Dropbox (Parker Lab)/Parker Lab Shared Files/CURRENT LAB MEMBERS/John B/Parker Lab/GalaxyP tools/Difference Finder/all stuff/Difference finderMADE 7 TO 7 fastversion 2-14-2019.R', echo=TRUE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
12 setwd("C:/Users/parkerlab/Desktop/Laura Difference Finder files/LKB1 trypsin/No duplicates")
ed9068208721 Uploaded
jfb
parents:
diff changeset
13 source('F:/ParkerLab Dropbox/Dropbox (Parker Lab)/Parker Lab Shared Files/Dropbox (Parker Lab)/Parker Lab Shared Files/CURRENT LAB MEMBERS/John B/Parker Lab/GalaxyP tools/Difference Finder/all stuff/difference finder for 2 overlaps proper names 7-7_1-15-2019.R', echo=TRUE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
14 source('F:/ParkerLab Dropbox/Dropbox (Parker Lab)/Parker Lab Shared Files/Dropbox (Parker Lab)/Parker Lab Shared Files/CURRENT LAB MEMBERS/John B/Parker Lab/GalaxyP tools/Difference Finder/all stuff/Difference finderMADE 7 TO 7 fastversion 2-14-2019.R', echo=TRUE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
15 setwd("C:/Users/parkerlab/Desktop/Laura Difference Finder files/LKB1 trypsin/No duplicates")
ed9068208721 Uploaded
jfb
parents:
diff changeset
16 source('C:/Users/parkerlab/Desktop/Laura Difference Finder files/LKB1 trypsin/difference_finder-beba4066121e/difference_finder-beba4066121e/all stuff/Difference finderMADE 7 TO 7 1-15-2019.R', echo=TRUE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
17 source('C:/Users/parkerlab/Desktop/Laura Difference Finder files/LKB1 trypsin/difference_finder-beba4066121e/difference_finder-beba4066121e/all stuff/Difference finderMADE 7 TO 7 1-15-2019.R', echo=TRUE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
18 source('C:/Users/parkerlab/Desktop/Laura Difference Finder files/LKB1 trypsin/difference_finder-beba4066121e/difference_finder-beba4066121e/all stuff/Difference finderMADE 7 TO 7 1-15-2019.R', echo=TRUE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
19 D835YFinalMatrix
ed9068208721 Uploaded
jfb
parents:
diff changeset
20 FTLwtmotifs
ed9068208721 Uploaded
jfb
parents:
diff changeset
21 DataFilename<-"stRequiredData.RData"
ed9068208721 Uploaded
jfb
parents:
diff changeset
22 load(DataFilename)
ed9068208721 Uploaded
jfb
parents:
diff changeset
23 setwd("F:/ParkerLab Dropbox/Dropbox (Parker Lab)/Parker Lab Shared Files/Dropbox (Parker Lab)/Parker Lab Shared Files/CURRENT LAB MEMBERS/John B/Parker Lab/GalaxyP tools/Kinatest Fishertest/KT-ID fisher test")
ed9068208721 Uploaded
jfb
parents:
diff changeset
24 load(DataFilename)
ed9068208721 Uploaded
jfb
parents:
diff changeset
25 setwd("F:/ParkerLab Dropbox/Dropbox (Parker Lab)/Parker Lab Shared Files/Dropbox (Parker Lab)/Parker Lab Shared Files/CURRENT LAB MEMBERS/John B/Parker Lab/GalaxyP tools/ST fishertest/KT-ID fisher test")
ed9068208721 Uploaded
jfb
parents:
diff changeset
26 load(DataFilename)
ed9068208721 Uploaded
jfb
parents:
diff changeset
27 setwd("C:/Users/parkerlab/Downloads/stuff")
ed9068208721 Uploaded
jfb
parents:
diff changeset
28 source('C:/Users/parkerlab/Desktop/Laura Difference Finder files/Difference finderMADE 7 TO 7 1-15-2019.R', echo=TRUE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
29 #put the names of your input files here
ed9068208721 Uploaded
jfb
parents:
diff changeset
30 FirstSubstrateSet<- read.csv("Galaxy1071-(17A_TiO2_Substrates.csv).csv", stringsAsFactors=FALSE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
31 Firstsubbackfreq<- read.csv("Galaxy1072-(17A_TiO2_SubstrateBackgroundFrequency.csv).csv", header=FALSE, stringsAsFactors=FALSE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
32 SecondSubstrateSet<- read.csv("Galaxy1073-(17A_FeNTA_Substrates.csv) (1).csv", stringsAsFactors=FALSE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
33 Secondsubbackfreq<- read.csv("Galaxy1074-(17A_FeNTA_SubstrateBackgroundFrequency.csv).csv", header=FALSE, stringsAsFactors=FALSE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
34 #I should make an SOP for this. Problems we encountered: no x in the xY motif, and the kilodemon
ed9068208721 Uploaded
jfb
parents:
diff changeset
35 #the output files have both Y and xY, they shouldn't why is that happening? make it not happen
ed9068208721 Uploaded
jfb
parents:
diff changeset
36 #make sure that accession numbers stay locked to each motif, somehow
ed9068208721 Uploaded
jfb
parents:
diff changeset
37 #output should look just like the KALIP input
ed9068208721 Uploaded
jfb
parents:
diff changeset
38 #ff you want ONLY FULL MOTIFS, put "YES" here, please use all caps
ed9068208721 Uploaded
jfb
parents:
diff changeset
39 FullMotifsOnly_questionmark<-"NO"
ed9068208721 Uploaded
jfb
parents:
diff changeset
40 #If you want ONLY TRUNCATED MOTIFS, put "YES" here, please use all caps
ed9068208721 Uploaded
jfb
parents:
diff changeset
41 TruncatedMotifsOnly_questionmark<-"NO"
ed9068208721 Uploaded
jfb
parents:
diff changeset
42 #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)
ed9068208721 Uploaded
jfb
parents:
diff changeset
43 Are_You_Looking_For_Commonality<-"NO"
ed9068208721 Uploaded
jfb
parents:
diff changeset
44 First_unshared_motifs_table<-"Substrates 3A no negatives.csv"
ed9068208721 Uploaded
jfb
parents:
diff changeset
45 First_unshared_subbackfreq<-"SBF 3A no negatives.csv"
ed9068208721 Uploaded
jfb
parents:
diff changeset
46 Second_unshared_motifs_table<-"Substrates 3B negatives.csv"
ed9068208721 Uploaded
jfb
parents:
diff changeset
47 Second_unshared_subbackfreq<-"SBF 3B negatives.csv"
ed9068208721 Uploaded
jfb
parents:
diff changeset
48 FirstCentralLetters<-FirstSubstrateSet[,11]
ed9068208721 Uploaded
jfb
parents:
diff changeset
49 SecondCentralLetters<-SecondSubstrateSet[,11]
ed9068208721 Uploaded
jfb
parents:
diff changeset
50 FirstEsses<-sapply(FirstCentralLetters, grepl, pattern="S", ignore.case=TRUE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
51 FirstTees<-sapply(FirstCentralLetters, grepl, pattern="T", ignore.case=TRUE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
52 FirstWys<-sapply(FirstCentralLetters, grepl, pattern="Y", ignore.case=TRUE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
53 SecondEsses<-sapply(SecondCentralLetters, grepl, pattern="S", ignore.case=TRUE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
54 SecondTees<-sapply(SecondCentralLetters, grepl, pattern="T", ignore.case=TRUE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
55 SecondWys<-sapply(SecondCentralLetters, grepl, pattern="Y", ignore.case=TRUE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
56 FirstCentralLetters<-replace(FirstCentralLetters,FirstEsses,"xS")
ed9068208721 Uploaded
jfb
parents:
diff changeset
57 FirstCentralLetters<-replace(FirstCentralLetters,FirstTees,"xT")
ed9068208721 Uploaded
jfb
parents:
diff changeset
58 FirstCentralLetters<-replace(FirstCentralLetters,FirstWys,"xY")
ed9068208721 Uploaded
jfb
parents:
diff changeset
59 SecondCentralLetters<-replace(SecondCentralLetters,SecondEsses,"xS")
ed9068208721 Uploaded
jfb
parents:
diff changeset
60 SecondCentralLetters<-replace(SecondCentralLetters,SecondTees,"xT")
ed9068208721 Uploaded
jfb
parents:
diff changeset
61 SecondCentralLetters<-replace(SecondCentralLetters,SecondWys,"xY")
ed9068208721 Uploaded
jfb
parents:
diff changeset
62 FirstCentralLetters->FirstSubstrateSet[,11]
ed9068208721 Uploaded
jfb
parents:
diff changeset
63 SecondCentralLetters->SecondSubstrateSet[,11]
ed9068208721 Uploaded
jfb
parents:
diff changeset
64 if (FullMotifsOnly_questionmark!="YES"&&TruncatedMotifsOnly_questionmark!="YES"){
ed9068208721 Uploaded
jfb
parents:
diff changeset
65 FTLwtmotifs=matrix(,nrow = nrow(FirstSubstrateSet),ncol=1)
ed9068208721 Uploaded
jfb
parents:
diff changeset
66 FTLwtAccessionNumbers=matrix(,nrow = nrow(FirstSubstrateSet),ncol=1)
ed9068208721 Uploaded
jfb
parents:
diff changeset
67 for (i in 1:nrow(FirstSubstrateSet)){
ed9068208721 Uploaded
jfb
parents:
diff changeset
68 FTLwtletters<-FirstSubstrateSet[i,4:18]
ed9068208721 Uploaded
jfb
parents:
diff changeset
69 FTLwtletters<-FTLwtletters[FTLwtletters !="XXXXX"]
ed9068208721 Uploaded
jfb
parents:
diff changeset
70 FTLwtletters<-paste(FTLwtletters, sep="", collapse="")
ed9068208721 Uploaded
jfb
parents:
diff changeset
71 leftspaces<-c()
ed9068208721 Uploaded
jfb
parents:
diff changeset
72 rightspaces<-c()
ed9068208721 Uploaded
jfb
parents:
diff changeset
73 YYYmotif <- unlist(strsplit(FTLwtletters, split = ""))
ed9068208721 Uploaded
jfb
parents:
diff changeset
74 YYYposition <- match(x = "x", table = YYYmotif)
ed9068208721 Uploaded
jfb
parents:
diff changeset
75 #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
ed9068208721 Uploaded
jfb
parents:
diff changeset
76 #just 3 letters to the left of x
ed9068208721 Uploaded
jfb
parents:
diff changeset
77 YYYLettersToTheLeft <- YYYposition - 1
ed9068208721 Uploaded
jfb
parents:
diff changeset
78 #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
ed9068208721 Uploaded
jfb
parents:
diff changeset
79 #just 1 spot to the right of Y so LettersToTheRight<-1 because 5-3-1=1
ed9068208721 Uploaded
jfb
parents:
diff changeset
80 YYYLettersToTheRight <- length(YYYmotif) - YYYposition - 1
ed9068208721 Uploaded
jfb
parents:
diff changeset
81 #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
ed9068208721 Uploaded
jfb
parents:
diff changeset
82 #variable the user puts in is
ed9068208721 Uploaded
jfb
parents:
diff changeset
83 if (YYYLettersToTheLeft < 7 | YYYLettersToTheRight < 7) {
ed9068208721 Uploaded
jfb
parents:
diff changeset
84 leftspaces<-rep(" ",times=(7-YYYLettersToTheLeft))
ed9068208721 Uploaded
jfb
parents:
diff changeset
85 rightspaces<-rep(" ",times=7-(YYYLettersToTheRight))
ed9068208721 Uploaded
jfb
parents:
diff changeset
86 #add blank spaces if the motif has less than 4 letters to the left/right
ed9068208721 Uploaded
jfb
parents:
diff changeset
87 motif<-c(leftspaces,YYYmotif,rightspaces)
ed9068208721 Uploaded
jfb
parents:
diff changeset
88 #save that motif, which is the Y and +/- 4 amino acids, including truncation
ed9068208721 Uploaded
jfb
parents:
diff changeset
89 motif<-motif[!motif %in% "x"]
ed9068208721 Uploaded
jfb
parents:
diff changeset
90 motif<-paste(motif, sep="", collapse="")
ed9068208721 Uploaded
jfb
parents:
diff changeset
91 FTLwtletters<-motif
ed9068208721 Uploaded
jfb
parents:
diff changeset
92 FTLwtmotifs[i,1]<-FTLwtletters
ed9068208721 Uploaded
jfb
parents:
diff changeset
93 FTLwtAccessionNumbers[i,1]<-FirstSubstrateSet[i,3]
ed9068208721 Uploaded
jfb
parents:
diff changeset
94 }
ed9068208721 Uploaded
jfb
parents:
diff changeset
95 if(YYYLettersToTheLeft>6 && YYYLettersToTheRight>6){
ed9068208721 Uploaded
jfb
parents:
diff changeset
96 motif<-YYYmotif
ed9068208721 Uploaded
jfb
parents:
diff changeset
97 #add blank spaces if the motif has less than 4 letters to the left/right
ed9068208721 Uploaded
jfb
parents:
diff changeset
98 motif<-c(leftspaces,YYYmotif,rightspaces)
ed9068208721 Uploaded
jfb
parents:
diff changeset
99 #save that motif, which is the Y and +/- 4 amino acids, including truncation
ed9068208721 Uploaded
jfb
parents:
diff changeset
100 motif<-motif[!motif %in% "x"]
ed9068208721 Uploaded
jfb
parents:
diff changeset
101 motif<-paste(motif, sep="", collapse="")
ed9068208721 Uploaded
jfb
parents:
diff changeset
102 FTLwtletters<-motif
ed9068208721 Uploaded
jfb
parents:
diff changeset
103 FTLwtmotifs[i,1]<-FTLwtletters
ed9068208721 Uploaded
jfb
parents:
diff changeset
104 FTLwtAccessionNumbers[i,1]<-FirstSubstrateSet[i,3]
ed9068208721 Uploaded
jfb
parents:
diff changeset
105 }
ed9068208721 Uploaded
jfb
parents:
diff changeset
106 }
ed9068208721 Uploaded
jfb
parents:
diff changeset
107 D835Ymotifs=matrix(,nrow = nrow(SecondSubstrateSet),ncol=1)
ed9068208721 Uploaded
jfb
parents:
diff changeset
108 D835YAccessionNumbers<-matrix(,nrow = nrow(SecondSubstrateSet),ncol = 1)
ed9068208721 Uploaded
jfb
parents:
diff changeset
109 for (i in 1:nrow(SecondSubstrateSet)){
ed9068208721 Uploaded
jfb
parents:
diff changeset
110 D835letters<-SecondSubstrateSet[i,4:18]
ed9068208721 Uploaded
jfb
parents:
diff changeset
111 D835letters<-D835letters[D835letters !="XXXXX"]
ed9068208721 Uploaded
jfb
parents:
diff changeset
112 D835letters<-paste(D835letters, sep="", collapse="")
ed9068208721 Uploaded
jfb
parents:
diff changeset
113 leftspaces<-c()
ed9068208721 Uploaded
jfb
parents:
diff changeset
114 rightspaces<-c()
ed9068208721 Uploaded
jfb
parents:
diff changeset
115 YYYmotif <- unlist(strsplit(D835letters, split = ""))
ed9068208721 Uploaded
jfb
parents:
diff changeset
116 YYYposition <- match(x = "x", table = YYYmotif)
ed9068208721 Uploaded
jfb
parents:
diff changeset
117 #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
ed9068208721 Uploaded
jfb
parents:
diff changeset
118 #just 3 letters to the left of x
ed9068208721 Uploaded
jfb
parents:
diff changeset
119 YYYLettersToTheLeft <- YYYposition - 1
ed9068208721 Uploaded
jfb
parents:
diff changeset
120 #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
ed9068208721 Uploaded
jfb
parents:
diff changeset
121 #just 1 spot to the right of Y so LettersToTheRight<-1 because 5-3-1=1
ed9068208721 Uploaded
jfb
parents:
diff changeset
122 YYYLettersToTheRight <- length(YYYmotif) - YYYposition - 1
ed9068208721 Uploaded
jfb
parents:
diff changeset
123 #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
ed9068208721 Uploaded
jfb
parents:
diff changeset
124 #variable the user puts in is
ed9068208721 Uploaded
jfb
parents:
diff changeset
125 if (YYYLettersToTheLeft < 7 | YYYLettersToTheRight < 7) {
ed9068208721 Uploaded
jfb
parents:
diff changeset
126 leftspaces<-rep(" ",times=(7-YYYLettersToTheLeft))
ed9068208721 Uploaded
jfb
parents:
diff changeset
127 rightspaces<-rep(" ",times=7-(YYYLettersToTheRight))
ed9068208721 Uploaded
jfb
parents:
diff changeset
128 #add blank spaces if the motif has less than 4 letters to the left/right
ed9068208721 Uploaded
jfb
parents:
diff changeset
129 motif<-c(leftspaces,YYYmotif,rightspaces)
ed9068208721 Uploaded
jfb
parents:
diff changeset
130 #save that motif, which is the Y and +/- 4 amino acids, including truncation
ed9068208721 Uploaded
jfb
parents:
diff changeset
131 motif<-motif[!motif %in% "x"]
ed9068208721 Uploaded
jfb
parents:
diff changeset
132 motif<-paste(motif, sep="", collapse="")
ed9068208721 Uploaded
jfb
parents:
diff changeset
133 D835letters<-motif
ed9068208721 Uploaded
jfb
parents:
diff changeset
134 D835Ymotifs[i,1]<-D835letters
ed9068208721 Uploaded
jfb
parents:
diff changeset
135 D835YAccessionNumbers[i,1]<-FirstSubstrateSet[i,3]
ed9068208721 Uploaded
jfb
parents:
diff changeset
136 }
ed9068208721 Uploaded
jfb
parents:
diff changeset
137 if(YYYLettersToTheLeft>6 && YYYLettersToTheRight>6){
ed9068208721 Uploaded
jfb
parents:
diff changeset
138 motif<-YYYmotif
ed9068208721 Uploaded
jfb
parents:
diff changeset
139 #add blank spaces if the motif has less than 4 letters to the left/right
ed9068208721 Uploaded
jfb
parents:
diff changeset
140 motif<-c(leftspaces,YYYmotif,rightspaces)
ed9068208721 Uploaded
jfb
parents:
diff changeset
141 #save that motif, which is the Y and +/- 4 amino acids, including truncation
ed9068208721 Uploaded
jfb
parents:
diff changeset
142 motif<-motif[!motif %in% "x"]
ed9068208721 Uploaded
jfb
parents:
diff changeset
143 motif<-paste(motif, sep="", collapse="")
ed9068208721 Uploaded
jfb
parents:
diff changeset
144 D835letters<-motif
ed9068208721 Uploaded
jfb
parents:
diff changeset
145 D835Ymotifs[i,1]<-D835letters
ed9068208721 Uploaded
jfb
parents:
diff changeset
146 D835YAccessionNumbers[i,1]<-FirstSubstrateSet[i,3]
ed9068208721 Uploaded
jfb
parents:
diff changeset
147 }
ed9068208721 Uploaded
jfb
parents:
diff changeset
148 }
ed9068208721 Uploaded
jfb
parents:
diff changeset
149 names(FTLwtmotifs)<-FTLwtAccessionNumbers
ed9068208721 Uploaded
jfb
parents:
diff changeset
150 names(D835Ymotifs)<-D835YAccessionNumbers
ed9068208721 Uploaded
jfb
parents:
diff changeset
151 }
ed9068208721 Uploaded
jfb
parents:
diff changeset
152 length(names(FTLwtmotifs))
ed9068208721 Uploaded
jfb
parents:
diff changeset
153 length(names(D835Ymotifs))
ed9068208721 Uploaded
jfb
parents:
diff changeset
154 FTLwtmotifsFINAL<-FTLwtmotifs[!FTLwtmotifs %in% D835Ymotifs]
ed9068208721 Uploaded
jfb
parents:
diff changeset
155 FTLwtmotifsFINAL<-FTLwtmotifsFINAL[!duplicated(FTLwtmotifsFINAL)]
ed9068208721 Uploaded
jfb
parents:
diff changeset
156 D835YmotifsFINAL<-D835Ymotifs[!D835Ymotifs %in% FTLwtmotifs]
ed9068208721 Uploaded
jfb
parents:
diff changeset
157 D835YmotifsFINAL<-D835YmotifsFINAL[!duplicated(D835YmotifsFINAL)]
ed9068208721 Uploaded
jfb
parents:
diff changeset
158 length(names(D835Ymotifs))
ed9068208721 Uploaded
jfb
parents:
diff changeset
159 length(names(D835YmotifsFINAL))
ed9068208721 Uploaded
jfb
parents:
diff changeset
160 for (k in 1:length(FTLwtmotifsFINAL)) {
ed9068208721 Uploaded
jfb
parents:
diff changeset
161 AN<-00000
ed9068208721 Uploaded
jfb
parents:
diff changeset
162 #I don't remember why, but I felt it necessary to destroy the accession number multiple times to ensure it is
ed9068208721 Uploaded
jfb
parents:
diff changeset
163 #destroyed immediately after use
ed9068208721 Uploaded
jfb
parents:
diff changeset
164 for (m in 1:ncol(Firstsubbackfreq)) {
ed9068208721 Uploaded
jfb
parents:
diff changeset
165 AN <- as.character(Firstsubbackfreq[1, m])
ed9068208721 Uploaded
jfb
parents:
diff changeset
166 if (grepl(pattern = AN,
ed9068208721 Uploaded
jfb
parents:
diff changeset
167 x = names(FTLwtmotifsFINAL[k]),
ed9068208721 Uploaded
jfb
parents:
diff changeset
168 fixed = TRUE) == TRUE) {
ed9068208721 Uploaded
jfb
parents:
diff changeset
169 outputmatrix <- as.character(Firstsubbackfreq[, m])
ed9068208721 Uploaded
jfb
parents:
diff changeset
170 outputmatrix <- matrix(outputmatrix, nrow = 1)
ed9068208721 Uploaded
jfb
parents:
diff changeset
171 #with that accession number, find a match in the subbackfreq file and save it here
ed9068208721 Uploaded
jfb
parents:
diff changeset
172 FTLFinalMatrix<-rbind(FTLFinalMatrix,outputmatrix)
ed9068208721 Uploaded
jfb
parents:
diff changeset
173 }
ed9068208721 Uploaded
jfb
parents:
diff changeset
174 }
ed9068208721 Uploaded
jfb
parents:
diff changeset
175 }
ed9068208721 Uploaded
jfb
parents:
diff changeset
176 columnalheader<-c(rep(NA,36))
ed9068208721 Uploaded
jfb
parents:
diff changeset
177 FTLFinalMatrix<-matrix(data =columnalheader,nrow = 1)
ed9068208721 Uploaded
jfb
parents:
diff changeset
178 for (k in 1:length(FTLwtmotifsFINAL)) {
ed9068208721 Uploaded
jfb
parents:
diff changeset
179 AN<-00000
ed9068208721 Uploaded
jfb
parents:
diff changeset
180 #I don't remember why, but I felt it necessary to destroy the accession number multiple times to ensure it is
ed9068208721 Uploaded
jfb
parents:
diff changeset
181 #destroyed immediately after use
ed9068208721 Uploaded
jfb
parents:
diff changeset
182 for (m in 1:ncol(Firstsubbackfreq)) {
ed9068208721 Uploaded
jfb
parents:
diff changeset
183 AN <- as.character(Firstsubbackfreq[1, m])
ed9068208721 Uploaded
jfb
parents:
diff changeset
184 if (grepl(pattern = AN,
ed9068208721 Uploaded
jfb
parents:
diff changeset
185 x = names(FTLwtmotifsFINAL[k]),
ed9068208721 Uploaded
jfb
parents:
diff changeset
186 fixed = TRUE) == TRUE) {
ed9068208721 Uploaded
jfb
parents:
diff changeset
187 outputmatrix <- as.character(Firstsubbackfreq[, m])
ed9068208721 Uploaded
jfb
parents:
diff changeset
188 outputmatrix <- matrix(outputmatrix, nrow = 1)
ed9068208721 Uploaded
jfb
parents:
diff changeset
189 #with that accession number, find a match in the subbackfreq file and save it here
ed9068208721 Uploaded
jfb
parents:
diff changeset
190 FTLFinalMatrix<-rbind(FTLFinalMatrix,outputmatrix)
ed9068208721 Uploaded
jfb
parents:
diff changeset
191 }
ed9068208721 Uploaded
jfb
parents:
diff changeset
192 }
ed9068208721 Uploaded
jfb
parents:
diff changeset
193 }
ed9068208721 Uploaded
jfb
parents:
diff changeset
194 FTLFinalMatrix<-FTLFinalMatrix[!duplicated(FTLFinalMatrix),]
ed9068208721 Uploaded
jfb
parents:
diff changeset
195 FTLFinalMatrix<-FTLFinalMatrix[2:nrow(FTLFinalMatrix),]
ed9068208721 Uploaded
jfb
parents:
diff changeset
196 columnalheader<-c(rep(NA,36))
ed9068208721 Uploaded
jfb
parents:
diff changeset
197 D835YFinalMatrix<-matrix(data =columnalheader,nrow = 1)
ed9068208721 Uploaded
jfb
parents:
diff changeset
198 for (k in 1:length(D835YmotifsFINAL)) {
ed9068208721 Uploaded
jfb
parents:
diff changeset
199 #I don't remember why, but I felt it necessary to destroy the accession number multiple times to ensure it is
ed9068208721 Uploaded
jfb
parents:
diff changeset
200 #destroyed immediately after use
ed9068208721 Uploaded
jfb
parents:
diff changeset
201 for (m in 1:ncol(Secondsubbackfreq)) {
ed9068208721 Uploaded
jfb
parents:
diff changeset
202 AN <- as.character(Secondsubbackfreq[1, m])
ed9068208721 Uploaded
jfb
parents:
diff changeset
203 if (grepl(pattern = AN,
ed9068208721 Uploaded
jfb
parents:
diff changeset
204 x = names(D835YmotifsFINAL[k]),
ed9068208721 Uploaded
jfb
parents:
diff changeset
205 fixed = TRUE) == TRUE) {
ed9068208721 Uploaded
jfb
parents:
diff changeset
206 outputmatrix <- as.character(Secondsubbackfreq[, m])
ed9068208721 Uploaded
jfb
parents:
diff changeset
207 outputmatrix <- matrix(outputmatrix, nrow = 1)
ed9068208721 Uploaded
jfb
parents:
diff changeset
208 #with that accession number, find a match in the subbackfreq file and save it here
ed9068208721 Uploaded
jfb
parents:
diff changeset
209 D835YFinalMatrix<-rbind(D835YFinalMatrix,outputmatrix)
ed9068208721 Uploaded
jfb
parents:
diff changeset
210 }
ed9068208721 Uploaded
jfb
parents:
diff changeset
211 }
ed9068208721 Uploaded
jfb
parents:
diff changeset
212 }
ed9068208721 Uploaded
jfb
parents:
diff changeset
213 D835YFinalMatrix<-D835YFinalMatrix[!duplicated(D835YFinalMatrix),]
ed9068208721 Uploaded
jfb
parents:
diff changeset
214 D835YFinalMatrix<-D835YFinalMatrix[2:nrow(D835YFinalMatrix),]
ed9068208721 Uploaded
jfb
parents:
diff changeset
215 FTLoutputmatrix<-matrix(data=c(FTLwtmotifsFINAL,names(FTLwtmotifsFINAL)),ncol = 2)
ed9068208721 Uploaded
jfb
parents:
diff changeset
216 tail(FTLoutputmatrix)
ed9068208721 Uploaded
jfb
parents:
diff changeset
217 D835Youtputmatrix<-matrix(data=c(D835YmotifsFINAL,names(D835YmotifsFINAL)),ncol = 2)
ed9068208721 Uploaded
jfb
parents:
diff changeset
218 source('C:/Users/parkerlab/Desktop/Laura Difference Finder files/Difference finderMADE 7 TO 7 1-15-2019.R', echo=TRUE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
219 D835Youtputmatrix<-matrix(data=c(D835YmotifsFINAL,names(D835YmotifsFINAL)),ncol = 2)
ed9068208721 Uploaded
jfb
parents:
diff changeset
220 tail(D835Youtputmatrix)
ed9068208721 Uploaded
jfb
parents:
diff changeset
221 length(names(D835YmotifsFINAL))
ed9068208721 Uploaded
jfb
parents:
diff changeset
222 tail(D835YmotifsFINAL)
ed9068208721 Uploaded
jfb
parents:
diff changeset
223 tail(D835Ymotifs)
ed9068208721 Uploaded
jfb
parents:
diff changeset
224 tail(FTLwtmotifs)
ed9068208721 Uploaded
jfb
parents:
diff changeset
225 names(tail(D835Ymotifs))
ed9068208721 Uploaded
jfb
parents:
diff changeset
226 names((D835Ymotifs))
ed9068208721 Uploaded
jfb
parents:
diff changeset
227 names(FTLwtmotifs)
ed9068208721 Uploaded
jfb
parents:
diff changeset
228 head(FirstSubstrateSet)
ed9068208721 Uploaded
jfb
parents:
diff changeset
229 head(SecondSubstrateSet)
ed9068208721 Uploaded
jfb
parents:
diff changeset
230 source('C:/Users/parkerlab/Desktop/Laura Difference Finder files/Difference finderMADE 7 TO 7 1-15-2019.R', echo=TRUE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
231 source('C:/Users/parkerlab/Desktop/Laura Difference Finder files/Difference finderMADE 7 TO 7 1-15-2019.R', echo=TRUE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
232 source('C:/Users/parkerlab/Desktop/Laura Difference Finder files/Difference finderMADE 7 TO 7 1-15-2019.R', echo=TRUE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
233 source('C:/Users/parkerlab/Desktop/Laura Difference Finder files/Difference finder MADE 7 TO 7 4-18-2019.R', echo=TRUE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
234 ThisKinSheet<-read.csv("Fisher-Table.csv" header=FALSE, stringsAsFactors=FALSE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
235 CharTable<-read.csv("Fisher-Char.csv", header = FALSE,stringsAsFactors = FALSE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
236 setwd("F:/ParkerLab Dropbox/Dropbox (Parker Lab)/Parker Lab Shared Files/Dropbox (Parker Lab)/Parker Lab Shared Files/CURRENT LAB MEMBERS/John B/Parker Lab/GalaxyP tools/scoring function KTID")
ed9068208721 Uploaded
jfb
parents:
diff changeset
237 CharTable<-read.csv("Fisher-Char.csv", header = FALSE,stringsAsFactors = FALSE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
238 ThisKinSheet<-read.csv("Fisher-Table.csv", header=FALSE, stringsAsFactors=FALSE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
239 ThisKinTable<-ThisKinSheet[2:22,]
ed9068208721 Uploaded
jfb
parents:
diff changeset
240 View(ThisKinTable)
ed9068208721 Uploaded
jfb
parents:
diff changeset
241 source('F:/ParkerLab Dropbox/Dropbox (Parker Lab)/Parker Lab Shared Files/Dropbox (Parker Lab)/Parker Lab Shared Files/CURRENT LAB MEMBERS/John B/Parker Lab/GalaxyP tools/scoring function KTID/KinatestFisherScoring.R', echo=TRUE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
242 source('F:/ParkerLab Dropbox/Dropbox (Parker Lab)/Parker Lab Shared Files/Dropbox (Parker Lab)/Parker Lab Shared Files/CURRENT LAB MEMBERS/John B/Parker Lab/GalaxyP tools/scoring function KTID/KinatestFisherScoring.R', echo=TRUE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
243 CharTable<-read.csv("Fisher-Char.csv", header = FALSE,stringsAsFactors = FALSE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
244 ThisKinSheet<-read.csv("Fisher-Table.csv", header=FALSE, stringsAsFactors=FALSE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
245 NormalizationScore<-ThisKinSheet[2,1]
ed9068208721 Uploaded
jfb
parents:
diff changeset
246 NormalizationScore<-CharTable[2,1]
ed9068208721 Uploaded
jfb
parents:
diff changeset
247 source('F:/ParkerLab Dropbox/Dropbox (Parker Lab)/Parker Lab Shared Files/Dropbox (Parker Lab)/Parker Lab Shared Files/CURRENT LAB MEMBERS/John B/Parker Lab/GalaxyP tools/scoring function KTID/KinatestFisherScoring.R', echo=TRUE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
248 RanksPeptides<-with(PeptidesWithRanks, order(Scores,AllActive))
ed9068208721 Uploaded
jfb
parents:
diff changeset
249 write.table(RanksPeptides,file = "output.csv",append = FALSE,row.names = FALSE,col.names = TRUE,sep = ",")
ed9068208721 Uploaded
jfb
parents:
diff changeset
250 RanksPeptides<-PeptidesWithRanks[order(PeptidesWithRanks[,5), PeptidesWithRanks[,3]])]
ed9068208721 Uploaded
jfb
parents:
diff changeset
251 RanksPeptides<-PeptidesWithRanks[order(PeptidesWithRanks[,5], PeptidesWithRanks[,3])]
ed9068208721 Uploaded
jfb
parents:
diff changeset
252 source('F:/ParkerLab Dropbox/Dropbox (Parker Lab)/Parker Lab Shared Files/Dropbox (Parker Lab)/Parker Lab Shared Files/CURRENT LAB MEMBERS/John B/Parker Lab/GalaxyP tools/scoring function KTID/KinatestFisherScoring.R', echo=TRUE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
253 Scores = Scores*-1
ed9068208721 Uploaded
jfb
parents:
diff changeset
254 source('F:/ParkerLab Dropbox/Dropbox (Parker Lab)/Parker Lab Shared Files/Dropbox (Parker Lab)/Parker Lab Shared Files/CURRENT LAB MEMBERS/John B/Parker Lab/GalaxyP tools/scoring function KTID/KinatestFisherScoring.R', echo=TRUE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
255 source('F:/ParkerLab Dropbox/Dropbox (Parker Lab)/Parker Lab Shared Files/Dropbox (Parker Lab)/Parker Lab Shared Files/CURRENT LAB MEMBERS/John B/Parker Lab/GalaxyP tools/scoring function KTID/KinatestFisherScoring.R', echo=TRUE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
256 Scores<-ThisKinGeneratedScores
ed9068208721 Uploaded
jfb
parents:
diff changeset
257 Scores<-Scores*-1
ed9068208721 Uploaded
jfb
parents:
diff changeset
258 order(scores)
ed9068208721 Uploaded
jfb
parents:
diff changeset
259 order(Scores)
ed9068208721 Uploaded
jfb
parents:
diff changeset
260 Scores[order(Scores)]
ed9068208721 Uploaded
jfb
parents:
diff changeset
261 source('F:/ParkerLab Dropbox/Dropbox (Parker Lab)/Parker Lab Shared Files/Dropbox (Parker Lab)/Parker Lab Shared Files/CURRENT LAB MEMBERS/John B/Parker Lab/GalaxyP tools/scoring function KTID/KinatestFisherScoring.R', echo=TRUE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
262 source('F:/ParkerLab Dropbox/Dropbox (Parker Lab)/Parker Lab Shared Files/Dropbox (Parker Lab)/Parker Lab Shared Files/CURRENT LAB MEMBERS/John B/Parker Lab/GalaxyP tools/scoring function KTID/KinatestFisherScoring.R', echo=TRUE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
263 source('F:/ParkerLab Dropbox/Dropbox (Parker Lab)/Parker Lab Shared Files/Dropbox (Parker Lab)/Parker Lab Shared Files/CURRENT LAB MEMBERS/John B/Parker Lab/GalaxyP tools/scoring function KTID/KinatestFisherScoring.R', echo=TRUE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
264 source('F:/ParkerLab Dropbox/Dropbox (Parker Lab)/Parker Lab Shared Files/Dropbox (Parker Lab)/Parker Lab Shared Files/CURRENT LAB MEMBERS/John B/Parker Lab/GalaxyP tools/scoring function KTID/KinatestFisherScoring.R', echo=TRUE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
265 source('F:/ParkerLab Dropbox/Dropbox (Parker Lab)/Parker Lab Shared Files/Dropbox (Parker Lab)/Parker Lab Shared Files/CURRENT LAB MEMBERS/John B/Parker Lab/GalaxyP tools/scoring function KTID/KinatestFisherScoring.R', echo=TRUE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
266 source('F:/ParkerLab Dropbox/Dropbox (Parker Lab)/Parker Lab Shared Files/Dropbox (Parker Lab)/Parker Lab Shared Files/CURRENT LAB MEMBERS/John B/Parker Lab/GalaxyP tools/scoring function KTID/KinatestFisherScoring.R', echo=TRUE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
267 source('F:/ParkerLab Dropbox/Dropbox (Parker Lab)/Parker Lab Shared Files/Dropbox (Parker Lab)/Parker Lab Shared Files/CURRENT LAB MEMBERS/John B/Parker Lab/GalaxyP tools/scoring function KTID/KinatestFisherScoring.R', echo=TRUE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
268 source('F:/ParkerLab Dropbox/Dropbox (Parker Lab)/Parker Lab Shared Files/Dropbox (Parker Lab)/Parker Lab Shared Files/CURRENT LAB MEMBERS/John B/Parker Lab/GalaxyP tools/scoring function KTID/KinatestFisherScoring.R', echo=TRUE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
269 LynActive
ed9068208721 Uploaded
jfb
parents:
diff changeset
270 source('F:/ParkerLab Dropbox/Dropbox (Parker Lab)/Parker Lab Shared Files/Dropbox (Parker Lab)/Parker Lab Shared Files/CURRENT LAB MEMBERS/John B/Parker Lab/GalaxyP tools/scoring function KTID/KinatestFisherScoring.R', echo=TRUE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
271 source('F:/ParkerLab Dropbox/Dropbox (Parker Lab)/Parker Lab Shared Files/Dropbox (Parker Lab)/Parker Lab Shared Files/CURRENT LAB MEMBERS/John B/Parker Lab/GalaxyP tools/scoring function KTID/KinatestFisherScoring.R', echo=TRUE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
272 source('F:/ParkerLab Dropbox/Dropbox (Parker Lab)/Parker Lab Shared Files/Dropbox (Parker Lab)/Parker Lab Shared Files/CURRENT LAB MEMBERS/John B/Parker Lab/GalaxyP tools/scoring function KTID/KinatestFisherScoring.R', echo=TRUE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
273 source('F:/ParkerLab Dropbox/Dropbox (Parker Lab)/Parker Lab Shared Files/Dropbox (Parker Lab)/Parker Lab Shared Files/CURRENT LAB MEMBERS/John B/Parker Lab/GalaxyP tools/scoring function KTID/KinatestFisherScoring.R', echo=TRUE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
274 source('F:/ParkerLab Dropbox/Dropbox (Parker Lab)/Parker Lab Shared Files/Dropbox (Parker Lab)/Parker Lab Shared Files/CURRENT LAB MEMBERS/John B/Parker Lab/GalaxyP tools/scoring function KTID/KinatestFisherScoring.R', echo=TRUE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
275 source('F:/ParkerLab Dropbox/Dropbox (Parker Lab)/Parker Lab Shared Files/Dropbox (Parker Lab)/Parker Lab Shared Files/CURRENT LAB MEMBERS/John B/Parker Lab/GalaxyP tools/scoring function KTID/KinatestFisherScoring.R', echo=TRUE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
276 source('F:/ParkerLab Dropbox/Dropbox (Parker Lab)/Parker Lab Shared Files/Dropbox (Parker Lab)/Parker Lab Shared Files/CURRENT LAB MEMBERS/John B/Parker Lab/GalaxyP tools/scoring function KTID/KinatestFisherScoring.R', echo=TRUE)
ed9068208721 Uploaded
jfb
parents:
diff changeset
277 args
ed9068208721 Uploaded
jfb
parents:
diff changeset
278 toupper(6)
ed9068208721 Uploaded
jfb
parents:
diff changeset
279 Positionm6<-"123kjhsdfk245 23ddddd"
ed9068208721 Uploaded
jfb
parents:
diff changeset
280 Positionm6<-toupper(M6)
ed9068208721 Uploaded
jfb
parents:
diff changeset
281 M6<-"123kjhsdfk245 23ddddd"
ed9068208721 Uploaded
jfb
parents:
diff changeset
282 Positionm6<-toupper(M6)
ed9068208721 Uploaded
jfb
parents:
diff changeset
283 Positionm6<-gsub("[^a-zA-Z]", "", Positionm6)
ed9068208721 Uploaded
jfb
parents:
diff changeset
284 Positionm6<-unlist(strsplit(Positionm6,""))