-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtabus.R
More file actions
30 lines (22 loc) · 1.24 KB
/
tabus.R
File metadata and controls
30 lines (22 loc) · 1.24 KB
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
rppa.tabus <- function(spots, nrep=1, ...){
spots <- subset(spots, SpotClass=="Sample")
#convert input table so that each dilution is in one column
spots.c <- rppa.serialDilution.format(spots)
#extract number of different dilutions that are not NA
numOfDilutions <- length(unique(spots$DilutionFactor[!is.na(spots$DilutionFactor)]))
#calculate matrix of dilutions
spots.m <- rppa.serialDilution.dilutionMatrix(spots.c, numOfDilutions, highestDilutionFirst=F)
tabus<-dilutionFitrep(spots.m, nrep);
fittedData <- data.frame(x=spots$Signal, y=predict(tabus$fit, data.frame(x=spots$Signal)))
plot(fittedData$x, fittedData$y)
#combine estimates with signal information
spots.result <- cbind(spots.c[,1:(ncol(spots.c)-numOfDilutions)], x.weighted.mean=tabus$pass2, x.err=NA)
spots.summarize <- rppa.serialDilution.summarize(spots.result, ...)
spots.summarize$concentrations <- 2^spots.summarize$x.weighted.mean
spots.summarize$upper <- 0
spots.summarize$lower <- 0
spots.summarize <- spots.summarize[,!(colnames(spots.summarize) %in% c("x.weighted.mean", "x.err"))]
attr(spots.summarize, "title") <- attr(spots, "title")
attr(spots.summarize, "antibody") <- attr(spots, "antibody")
return(spots.summarize)
}