Skip to content

Commit

Permalink
fix a few bugsi
Browse files Browse the repository at this point in the history
  • Loading branch information
ococrook committed May 5, 2024
1 parent 352acbf commit b042bd3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
16 changes: 8 additions & 8 deletions R/Rex-differential.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@
##'
##' @export
processDifferential <- function(HdxData,
params,
whichChain = 1,
num_montecarlo = 5000) {
params,
whichChain = 1,
num_montecarlo = 5000) {
# check for comptability
stopifnot(
"Residues are incompatible between expreiments" =
Expand Down Expand Up @@ -125,9 +125,9 @@ processDifferential <- function(HdxData,

Rex.estimates <- DataFrame(
Residues = Residues,
signedARE = t(signedARE),
ARE = t(ARE),
TRE = t(TRE)
signedARE = t(signedARE)[Residues,],
ARE = t(ARE)[Residues,],
TRE = t(TRE)[Residues,]
)

colnames(Rex.estimates) <- c(
Expand All @@ -142,8 +142,8 @@ processDifferential <- function(HdxData,

Rex.probs <- DataFrame(
Residues = Residues,
probs = t(probs),
totalprobs = totalprobs
probs = t(probs)[Residues,],
totalprobs = totalprobs[Residues]
)

colnames(Rex.probs) <- c(
Expand Down
10 changes: 8 additions & 2 deletions R/Rex-error.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
##' @return Returns exchange indexes as a list
##'
error_prediction <- function(res, blong, pilong, qlong, dlong, phi) {

timepoints <- unique(res$Exposure)
out_res <- sapply(seq.int(length(blong)), function(z) {
doublelogisticFunction(timepoints,
Expand All @@ -18,9 +19,14 @@ error_prediction <- function(res, blong, pilong, qlong, dlong, phi) {
pi = pilong[z], d = dlong[z]
)
})

numtimepoints <- length(unique(res$Exposure))
numRep <- table(res$Sequence)[1] / numtimepoints


min_index <- min(res$Start)
max_index <- max(res$End)
colnames(out_res) <- seq(min_index, max_index)


diff_coupling <- matrix(NA, nrow = length(unique(res$Sequence)), ncol = numtimepoints)

Expand All @@ -32,7 +38,7 @@ error_prediction <- function(res, blong, pilong, qlong, dlong, phi) {
seq <- strsplit(unique(res$Sequence)[j], "")[[1]]
seq <- seq[-c(1:2)]
index <- which(seq != "P") + start + 1
mu <- rowSums(out_res[, index])
mu <- rowSums(out_res[, as.character(index)])

diff_coupling[j, ] <- mu - colMeans(matrix(res$Uptake[res$Sequence == unique(res$Sequence)[j]], nrow = numRep))
}
Expand Down

0 comments on commit b042bd3

Please sign in to comment.