Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add GetIdent function #596

Merged
merged 2 commits into from
Jul 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export(GetCentroids)
export(GetClusters)
export(GetDimReduction)
export(GetGeneLoadings)
export(GetIdent)
export(HTODemux)
export(HTOHeatmap)
export(HeatmapNode)
Expand Down
27 changes: 27 additions & 0 deletions R/interaction.R
Original file line number Diff line number Diff line change
Expand Up @@ -1089,6 +1089,33 @@ CombineIdent <- function(object, attribute.1 = "ident",
object <- SetIdent(object = object,cells.use = object@cell.names, ident.use = new_ids)
}

#' Get identity of cells
#'
#' @param object Seurat object
#' @param uniq logic, indicating whether to return unique ident values or ident
#' of all cells
#' @param cells.use A vector of cell names. If specified, only the identity of
#' these cells will be returned.
#'
#' @return Return the cell identites of this Seurat object
#'
#' @export
#'
#' @examples
#' GetIdent(pbmc_small)
#'
GetIdent <- function(object, uniq = TRUE, cells.use = NULL){
ident <- object@ident
if(!is.null(cells.use)){
ident <- ident[names(ident) %in% cells.use]
}
if(uniq){
unique(ident)
}else{
ident
}
}

#' Add Metadata
#'
#' Adds additional data for single cells to the Seurat object. Can be any piece
Expand Down
27 changes: 27 additions & 0 deletions man/GetIdent.Rd

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