Skip to content

Commit

Permalink
debugs
Browse files Browse the repository at this point in the history
store the terminal_state in metadata so that the function downstream could retrieve it when needed.
  • Loading branch information
Jiawei-Yu10 committed Dec 12, 2024
1 parent 658851e commit a8713b8
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ importFrom(Matrix,solve)
importFrom(Matrix,sparseMatrix)
importFrom(Matrix,summary)
importFrom(Matrix,t)
importFrom(S4Vectors,"metadata<-")
importFrom(S4Vectors,DataFrame)
importFrom(S4Vectors,SimpleList)
importFrom(S4Vectors,metadata)
importFrom(SummarizedExperiment,"colData<-")
importFrom(bluster,makeKNNGraph)
importFrom(destiny,eigenvalues)
Expand Down
3 changes: 2 additions & 1 deletion R/markovProbability.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
#' @include projectProbability.R
#' @import SingleCellExperiment
#' @importFrom rlang abort
#' @importFrom S4Vectors DataFrame
#' @importFrom S4Vectors DataFrame metadata metadata<-
#' @importFrom SummarizedExperiment colData<-
#' @export
markovProbability <- function(
Expand Down Expand Up @@ -123,5 +123,6 @@ markovProbability <- function(
}
} # nocov end
colData(milo) <- cbind(colData(milo), new_coldata)
metadata(milo) <- c(metadata(milo), list(branch.tips = terminal_state))
return(milo)
}
12 changes: 11 additions & 1 deletion R/projectPseudotimeToCell.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,18 @@
#' @import miloR
#' @import SingleCellExperiment
#' @importFrom SummarizedExperiment colData<-
#' @importFrom S4Vectors metadata
#' @export
projectPseudotimeToCell <- function(milo, pb_milo, term_states, pseudotime_key = "pseudotime", suffix = "") {
projectPseudotimeToCell <- function(milo, pb_milo, term_states = NULL, pseudotime_key = "pseudotime", suffix = "") {
if(is.null(term_states))
{
if(is.null(metadata(pb_milo)$branch.tips))

Check warning on line 67 in R/projectPseudotimeToCell.R

View check run for this annotation

Codecov / codecov/patch

R/projectPseudotimeToCell.R#L67

Added line #L67 was not covered by tests
{
abort("Parameter Error: Please provide term_state, which should align with parameter terminal_state in function markovProbability")

Check warning on line 69 in R/projectPseudotimeToCell.R

View check run for this annotation

Codecov / codecov/patch

R/projectPseudotimeToCell.R#L69

Added line #L69 was not covered by tests
}
else
term_states <- metadata(pb_milo)$branch.tips

Check warning on line 72 in R/projectPseudotimeToCell.R

View check run for this annotation

Codecov / codecov/patch

R/projectPseudotimeToCell.R#L72

Added line #L72 was not covered by tests
}
nhood <- nhoods(pb_milo) # peudobulk x cells
# leave out cells that do not blongs to any neighbourhood
nhoodsum <- apply(nhoods(pb_milo), 2, sum)
Expand Down
2 changes: 1 addition & 1 deletion man/projectPseudotimeToCell.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a8713b8

Please sign in to comment.