### Load scDist Package Source: https://github.com/phillipnicol/scdist/blob/master/README.md Loads the scDist package in R. Ensure the package is installed before running this command. ```r library(scDist) set.seed(1126490984) ``` -------------------------------- ### Display Simulated Metadata Source: https://github.com/phillipnicol/scdist/blob/master/README.md Shows the first few rows of the metadata associated with the simulated data. The metadata should include columns for response, patient, and clusters. ```r rownames(sim$Y) <- 1:1000 head(sim$meta.data) ``` -------------------------------- ### Inspect Simulated Data Dimensions Source: https://github.com/phillipnicol/scdist/blob/master/README.md Prints the dimensions of the normalized counts matrix (sim$Y) from the simulated data. This helps verify the structure of the input data. ```r dim(sim$Y) #Normalized counts ``` -------------------------------- ### View scDist Results Summary Source: https://github.com/phillipnicol/scdist/blob/master/README.md Displays the results data frame from the scDist output. This summary includes estimated distances, confidence intervals, and p-values for each cell type. ```r out$results ``` -------------------------------- ### Display True Distances Source: https://github.com/phillipnicol/scdist/blob/master/README.md Shows the true distances used in the simulation for comparison with the scDist results. The true distances are stored in sim$D.true. ```r names(sim$D.true) <- letters[1:length(sim$D.true)] sim$D.true ``` -------------------------------- ### Simulate Single-Cell Data Source: https://github.com/phillipnicol/scdist/blob/master/README.md Generates simulated single-cell RNA-seq data with specified number of cell types and patients per group. This function is used to create sample data for testing scDist. ```r sim <- simData(nct=10,N1=5,N2=5) ``` -------------------------------- ### Plot scDist Results Source: https://github.com/phillipnicol/scdist/blob/master/README.md Generates a plot visualizing the results from the scDist analysis. The DistPlot function creates a graphical representation of the estimated distances. ```r DistPlot(out) ``` -------------------------------- ### Apply scDist to Simulated Data Source: https://github.com/phillipnicol/scdist/blob/master/README.md Applies the scDist function to the simulated normalized counts and metadata. Specifies fixed and random effects, and the cluster column for analysis. ```r out <- scDist(sim$Y,sim$meta.data,fixed.effects = "response", random.effects="patient", clusters="clusters") ``` -------------------------------- ### Plot Genes Associated with Perturbation Source: https://github.com/phillipnicol/scdist/blob/master/README.md Generates a plot showing genes associated with a specific perturbed cluster using the distGenes function. This helps in identifying the genes driving the observed cell type changes. ```r distGenes(out, cluster = "a") ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.