R/shinyInput.r

#' prepare Shiny input
#'
#' This function prepares the input for the shiny app
#' @param object A \code{ClusterInput} object 
#'
#' @details This function takes the \code{ClusterInput}object as the input and turns it into a dataframe that can be directly used as input of our shiny app.
#'   The shiny app allows users to intuitively investigate how the clustering tuning parameters affect clustering results
#'
#' @import Seurat
#' @import dplyr
#' @import tidyverse
#'
#' @export
#'
#' @return A data frame with cell clonotype and UMAP coordinates . 
#' 
#' @examples
#' TCR <-read.csv("/PATH/TO/YOUR/scTCR-seqData/",header=T)
#' load('Mice.sub.rda')
#' Combined <- getCombinedDataSet(TCR,Mice.sub)
#' Trajectory <- getClonotyoeLineages(Combined,start.clus = NULL, end.clus = NULL, dist.method = 'simple', use.median = TRUE)
#' clustInput <- getClusteringInput(Trajectory)
#' shinyInput <- shinyInput(clustInput)
#' write.csv(shinyInput,file='/path/to/folder/shiny.csv')
#' 
#'
setMethod(f = 'shinyInput',
		signature = signature('ClusterInput'),
		definition = function(ClusterInput){
			temp <- ClusterInput@lineages		
			tt <- bind_rows(temp,.id='names')
			return(tt)	
		}
	)
JuanXie19/TCRlineageClust documentation built on Feb. 26, 2022, 12:33 a.m.