Mercurial > repos > davidvanzessen > shm_csr
comparison sequence_overview.r @ 32:4c5ba6b5d10d draft
Uploaded
author | davidvanzessen |
---|---|
date | Thu, 15 Dec 2016 09:21:54 -0500 |
parents | fe44a905aee9 |
children | 22fabe161cf3 |
comparison
equal
deleted
inserted
replaced
31:fe44a905aee9 | 32:4c5ba6b5d10d |
---|---|
81 } else if(empty.region.filter == "FR2"){ | 81 } else if(empty.region.filter == "FR2"){ |
82 cat("<caption>CDR2+FR3+CDR3 sequences that show up more than once</caption>", file=main.html, append=T) | 82 cat("<caption>CDR2+FR3+CDR3 sequences that show up more than once</caption>", file=main.html, append=T) |
83 } | 83 } |
84 | 84 |
85 cat("<tr>", file=main.html, append=T) | 85 cat("<tr>", file=main.html, append=T) |
86 cat("<th>Sequence</th><th>Functionality</th><th>ca1</th><th>ca2</th><th>cg1</th><th>cg2</th><th>cg3</th><th>cg4</th><th>cm</th><th>un</th>", file=main.html, append=T) | 86 cat("<th>Sequence</th><th>Functionality</th><th>IGA1</th><th>IGA2</th><th>IGG1</th><th>IGG2</th><th>IGG3</th><th>IGG4</th><th>IGM</th><th>IGE</th><th>UN</th>", file=main.html, append=T) |
87 cat("<th>total CA</th><th>total CG</th><th>number of subclasses</th><th>present in both Ca and Cg</th><th>Ca1+Ca2</th>", file=main.html, append=T) | 87 cat("<th>total IGA</th><th>total IGG</th><th>total IGE</th><th>total IGM</th><th>number of subclasses</th><th>present in both IGA and IGG</th><th>present in IGA, IGG and IGM</th><th>present in IGA, IGG and IGE</th><th>present in IGA, IGG, IGM and IGE</th><th>IGA1+IGA2</th>", file=main.html, append=T) |
88 cat("<th>Cg1+Cg2</th><th>Cg1+Cg3</th><th>Cg1+Cg4</th><th>Cg2+Cg3</th><th>Cg2+Cg4</th><th>Cg3+Cg4</th>", file=main.html, append=T) | 88 cat("<th>IGG1+IGG2</th><th>IGG1+IGG3</th><th>IGG1+IGG4</th><th>IGG2+IGG3</th><th>IGG2+IGG4</th><th>IGG3+IGG4</th>", file=main.html, append=T) |
89 cat("<th>Cg1+Cg2+Cg3</th><th>Cg2+Cg3+Cg4</th><th>Cg1+Cg2+Cg4</th><th>Cg1+Cg3+Cg4</th><th>Cg1+Cg2+Cg3+Cg4</th>", file=main.html, append=T) | 89 cat("<th>IGG1+IGG2+IGG3</th><th>IGG2+IGG3+IGG4</th><th>IGG1+IGG2+IGG4</th><th>IGG1+IGG3+IGG4</th><th>IGG1+IGG2+IGG3+IGG4</th>", file=main.html, append=T) |
90 cat("</tr>", file=main.html, append=T) | 90 cat("</tr>", file=main.html, append=T) |
91 | 91 |
92 | 92 |
93 | 93 |
94 single.sequences=0 #sequence only found once, skipped | 94 single.sequences=0 #sequence only found once, skipped |
110 cg3 = IDs[IDs$seq_conc == dat[i,c("seq_conc")] & grepl("^IGG3", IDs$best_match),] | 110 cg3 = IDs[IDs$seq_conc == dat[i,c("seq_conc")] & grepl("^IGG3", IDs$best_match),] |
111 cg4 = IDs[IDs$seq_conc == dat[i,c("seq_conc")] & grepl("^IGG4", IDs$best_match),] | 111 cg4 = IDs[IDs$seq_conc == dat[i,c("seq_conc")] & grepl("^IGG4", IDs$best_match),] |
112 | 112 |
113 cm = IDs[IDs$seq_conc == dat[i,c("seq_conc")] & grepl("^IGM", IDs$best_match),] | 113 cm = IDs[IDs$seq_conc == dat[i,c("seq_conc")] & grepl("^IGM", IDs$best_match),] |
114 | 114 |
115 ce = IDs[IDs$seq_conc == dat[i,c("seq_conc")] & grepl("^IGE", IDs$best_match),] | |
116 | |
115 un = IDs[IDs$seq_conc == dat[i,c("seq_conc")] & grepl("^unmatched", IDs$best_match),] | 117 un = IDs[IDs$seq_conc == dat[i,c("seq_conc")] & grepl("^unmatched", IDs$best_match),] |
116 allc = rbind(ca1, ca2, cg1, cg2, cg3, cg4, cm, un) | 118 |
119 allc = rbind(ca1, ca2, cg1, cg2, cg3, cg4, cm, ce, un) | |
117 | 120 |
118 ca1.n = nrow(ca1) | 121 ca1.n = nrow(ca1) |
119 ca2.n = nrow(ca2) | 122 ca2.n = nrow(ca2) |
120 | 123 |
121 cg1.n = nrow(cg1) | 124 cg1.n = nrow(cg1) |
123 cg3.n = nrow(cg3) | 126 cg3.n = nrow(cg3) |
124 cg4.n = nrow(cg4) | 127 cg4.n = nrow(cg4) |
125 | 128 |
126 cm.n = nrow(cm) | 129 cm.n = nrow(cm) |
127 | 130 |
131 ce.n = nrow(ce) | |
132 | |
128 un.n = nrow(un) | 133 un.n = nrow(un) |
129 | 134 |
130 classes = c(ca1.n, ca2.n, cg1.n, cg2.n, cg3.n, cg4.n, cm.n, un.n) | 135 classes = c(ca1.n, ca2.n, cg1.n, cg2.n, cg3.n, cg4.n, cm.n, ce.n, un.n) |
131 | 136 |
132 classes.sum = sum(classes) | 137 classes.sum = sum(classes) |
133 | 138 |
134 if(classes.sum == 1){ | 139 if(classes.sum == 1){ |
135 single.sequences = single.sequences + 1 | 140 single.sequences = single.sequences + 1 |
143 | 148 |
144 in.classes = sum(classes > 0) | 149 in.classes = sum(classes > 0) |
145 | 150 |
146 matched = matched + in.classes #count in how many subclasses the sequence occurs. | 151 matched = matched + in.classes #count in how many subclasses the sequence occurs. |
147 | 152 |
148 if(any(classes == classes.sum)){ | 153 if(any(classes == classes.sum)){ |
149 multiple.in.one = multiple.in.one + 1 | 154 multiple.in.one = multiple.in.one + 1 |
150 } else if (un.n > 0) { | 155 } else if (un.n > 0) { |
151 some.unmatched = some.unmatched + 1 | 156 some.unmatched = some.unmatched + 1 |
152 } else { | 157 } else { |
153 in.multiple = in.multiple + 1 | 158 in.multiple = in.multiple + 1 |
185 | 190 |
186 if(cm.n > 0){ | 191 if(cm.n > 0){ |
187 cat(tbl(cm), file=paste("IGM_", id, ".html", sep="")) | 192 cat(tbl(cm), file=paste("IGM_", id, ".html", sep="")) |
188 } | 193 } |
189 | 194 |
195 if(ce.n > 0){ | |
196 cat(tbl(ce), file=paste("IGE_", id, ".html", sep="")) | |
197 } | |
198 | |
190 if(un.n > 0){ | 199 if(un.n > 0){ |
191 cat(tbl(un), file=paste("un_", id, ".html", sep="")) | 200 cat(tbl(un), file=paste("un_", id, ".html", sep="")) |
192 } | 201 } |
193 | 202 |
194 ca1.html = make.link(id, "IGA1", ca1.n) | 203 ca1.html = make.link(id, "IGA1", ca1.n) |
199 cg3.html = make.link(id, "IGG3", cg3.n) | 208 cg3.html = make.link(id, "IGG3", cg3.n) |
200 cg4.html = make.link(id, "IGG4", cg4.n) | 209 cg4.html = make.link(id, "IGG4", cg4.n) |
201 | 210 |
202 cm.html = make.link(id, "IGM", cm.n) | 211 cm.html = make.link(id, "IGM", cm.n) |
203 | 212 |
213 ce.html = make.link(id, "IGE", ce.n) | |
214 | |
204 un.html = make.link(id, "un", un.n) | 215 un.html = make.link(id, "un", un.n) |
205 | 216 |
206 #extra columns | 217 #extra columns |
207 ca.n = ca1.n + ca2.n | 218 ca.n = ca1.n + ca2.n |
208 | 219 |
209 cg.n = cg1.n + cg2.n + cg3.n + cg4.n | 220 cg.n = cg1.n + cg2.n + cg3.n + cg4.n |
210 | 221 |
211 #in.classes | 222 #in.classes |
212 | 223 |
213 in.ca.cg = (ca.n > 0 & cg.n > 0) | 224 in.ca.cg = (ca.n > 0 & cg.n > 0) |
225 | |
226 in.ca.cg.cm = (ca.n > 0 & cg.n > 0 & cm.n > 0) | |
227 | |
228 in.ca.cg.ce = (ca.n > 0 & cg.n > 0 & ce.n > 0) | |
229 | |
230 in.ca.cg.cm.ce = (ca.n > 0 & cg.n > 0 & cm.n > 0 & ce.n > 0) | |
214 | 231 |
215 in.ca1.ca2 = (ca1.n > 0 & ca2.n > 0) | 232 in.ca1.ca2 = (ca1.n > 0 & ca2.n > 0) |
216 | 233 |
217 in.cg1.cg2 = (cg1.n > 0 & cg2.n > 0) | 234 in.cg1.cg2 = (cg1.n > 0 & cg2.n > 0) |
218 in.cg1.cg3 = (cg1.n > 0 & cg3.n > 0) | 235 in.cg1.cg3 = (cg1.n > 0 & cg3.n > 0) |
230 | 247 |
231 | 248 |
232 | 249 |
233 | 250 |
234 #rw = c(as.character(dat[i,"seq_conc"]), functionality, ca1.html, ca2.html, cg1.html, cg2.html, cg3.html, cg4.html, cm.html, un.html) | 251 #rw = c(as.character(dat[i,"seq_conc"]), functionality, ca1.html, ca2.html, cg1.html, cg2.html, cg3.html, cg4.html, cm.html, un.html) |
235 rw = c(as.character(dat[i,"seq_conc"]), functionality, ca1.html, ca2.html, cg1.html, cg2.html, cg3.html, cg4.html, cm.html, un.html) | 252 rw = c(as.character(dat[i,"seq_conc"]), functionality, ca1.html, ca2.html, cg1.html, cg2.html, cg3.html, cg4.html, cm.html, ce.html, un.html) |
236 rw = c(rw, ca.n, cg.n, in.classes, in.ca.cg, in.ca1.ca2, in.cg1.cg2, in.cg1.cg3, in.cg1.cg4, in.cg2.cg3, in.cg2.cg4, in.cg3.cg4, in.cg1.cg2.cg3, in.cg2.cg3.cg4, in.cg1.cg2.cg4, in.cg1.cg3.cg4, in.cg.all) | 253 rw = c(rw, ca.n, cg.n, cm.n, ce.n, in.classes, in.ca.cg, in.ca.cg.cm, in.ca.cg.ce, in.ca.cg.cm.ce, in.ca1.ca2, in.cg1.cg2, in.cg1.cg3, in.cg1.cg4, in.cg2.cg3, in.cg2.cg4, in.cg3.cg4, in.cg1.cg2.cg3, in.cg2.cg3.cg4, in.cg1.cg2.cg4, in.cg1.cg3.cg4, in.cg.all) |
237 | 254 |
238 cat(tr(rw), file=main.html, append=T) | 255 cat(tr(rw), file=main.html, append=T) |
239 | 256 |
240 | 257 |
241 for(i in 1:nrow(allc)){ #generate html by id | 258 for(i in 1:nrow(allc)){ #generate html by id |