From 3a37275551a20f29f3e56e0e44a451bc9fc043c7 Mon Sep 17 00:00:00 2001 From: Quentin Date: Tue, 4 Apr 2023 17:35:11 +0200 Subject: [PATCH] Changing frags to track --- R/analyseTimeBoots.r | 8 ++++---- R/convert2frags.R | 2 +- R/convert2list.R | 2 +- R/mirrorYFunc.R | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/R/analyseTimeBoots.r b/R/analyseTimeBoots.r index d3eecd8..5e27469 100644 --- a/R/analyseTimeBoots.r +++ b/R/analyseTimeBoots.r @@ -312,7 +312,7 @@ analyseTimeBoots <- data.frame( Res = Res[[x]], len = len[[x]], - fragId = names(WhoWhen) + trackId = names(WhoWhen) )) names(Reslen) <- names(Res) # create an equivalent of na.rm = T, useful to compute the weighed mean for each metric and @@ -346,7 +346,7 @@ analyseTimeBoots <- } # create a list of the fragment that could be sampled for each customfunc (after removing fragments which return NA) toSample <- lapply(Reslen, function (x) - x$fragId) + x$trackId) # check the number of fragments that could be sampled for each customfunc (after removing fragments which return NA) toSampleLen <- lapply(toSample, length) # in case the number of fragments that could be sampled differ among customfunc, identify for which customfunc it is the case @@ -431,7 +431,7 @@ analyseTimeBoots <- bootsamplesVal <- lapply(names(bootsamples), function(x) { array(unlist(lapply(seq(bootn), function(y) { - Reslen[[x]]$Res[match(bootsamples[[x]][, y], Reslen[[x]]$fragId)] + Reslen[[x]]$Res[match(bootsamples[[x]][, y], Reslen[[x]]$trackId)] })), dim = c(length(bootsamples[[x]]) / bootn, bootn)) }) names(bootsamplesVal) <- names(bootsamples) @@ -439,7 +439,7 @@ analyseTimeBoots <- bootsampleslen <- lapply(names(bootsamples), function(x) { array(unlist(lapply(seq(bootn), function(y) { - Reslen[[x]]$len[match(bootsamples[[x]][, y], Reslen[[x]]$fragId)] + Reslen[[x]]$len[match(bootsamples[[x]][, y], Reslen[[x]]$trackId)] })), dim = c(length(bootsamples[[x]]) / bootn, bootn)) }) names(bootsampleslen) <- names(bootsamples) diff --git a/R/convert2frags.R b/R/convert2frags.R index 12ea8d4..b265913 100644 --- a/R/convert2frags.R +++ b/R/convert2frags.R @@ -32,7 +32,7 @@ #'trackDatList <- convert2list(fragsList) #' #'# convert the list of variable to a liost of fragment based on fragments identity -#'trackDat <- convert2frags(trackDatList, by = "fragsId") +#'trackDat <- convert2frags(trackDatList, by = "trackId") #' #' @export diff --git a/R/convert2list.R b/R/convert2list.R index f614331..c3d5412 100644 --- a/R/convert2list.R +++ b/R/convert2list.R @@ -36,7 +36,7 @@ convert2list <- function(trackDat) { # convert the fragments' list to a data frame and add the fragment id trackDatdf <- do.call("rbind", trackDat) - trackDatdf[["fragsId"]] <- + trackDatdf[["trackId"]] <- gsub("[.][0-9]*", "", rownames(trackDatdf)) # then transform the data frame to a list trackDatList <- as.list(trackDatdf) diff --git a/R/mirrorYFunc.R b/R/mirrorYFunc.R index 5e28ddb..fa014c7 100644 --- a/R/mirrorYFunc.R +++ b/R/mirrorYFunc.R @@ -39,7 +39,7 @@ #' mirrorYFunc(trackDatList[["y.pos"]], imgHeight = imgHeight) #' #' # convert the new dataset to a list of fragment -#' fragsListMirrored <- convert2frags(trackDatList, by = "frags_id") +#' fragsListMirrored <- convert2frags(trackDatList, by = "trackId") #' #' # draw the result #' # here we can see that both trajectory are mirrored, with the original trajectory