Skip to content

simoncmo/celltrekplot

Repository files navigation

CellTrek Neighborhood Analysis

Neighborhood analysis and plotting functions for CellTrek obj

Change log

  • 6/20/2022
  • function_CellTrek_neighbor_edge.R -> function_CellTrek_Graph_edge.R
  • function_CellTrek_plot.R -> function_CellTrek_Plot_helper.R
  • function_CellTrek_spatial.r -> function_CellTrek_MakePlotObject.R
  • function_CellTrek_neighbor_plot.r a few function seemed redundent.
    • merge with function_CellTrek_neighbor_profile.R Need to review and clean
  • function_CellTrek_wrapper.R -> function_CellTrek_coexpression.R
  • Created New folder structure

required package

library(tripack)
library(igraph)

Make Delaunay Plot from CellTrek obj

  • MakeDelaunayPlot - Make CellTrek ST plot and connnect each dot by edges of Delaunay graph
MakeDelaunayPlot(obj = result_list_celltrek$cell_type_Abbr$W12_M, cell_column = cell_column,
                  cell_plot = c('PT(dual_identity)','PT(S3)','PT(S1+S2)'),
                  palette = col_cell_type, vertex.size = 1.5)

NOTE: Current version haven't consider maximum neighborhood distance

drawing

Delauney and Neighborhood Percentage

  • MakeCellTrekDelaunayGraph - Delany triangulation and make graph using iGraph
  • GetAllNeighbors - Get n-hop, n-order neighbor
  • GetNeighborByIdent - Get n-hop, n-order neighbor using ident in the celltrek obj

MakeCellNeighborhoodRatioPlot - Make Neighborhood plot. support bar or matrix

cell_column = 'cell_type_Abbr' # Column for the cell type
celltype_plt = c('PT(dual_identity)','PT(S1+S2)','PT(S3)') # remove this value if want to plot All cell types 
obj_graph = MakeCellTrekDelaunayGraph(celltrek_obj)
MakeCellNeighborhoodRatioPlot(obj = celltrek_obj, 
                         obj_graph = obj_graph,
                         cell_column  = cell_column, 
                         plot_type = 'bar',
                         celltype_plt = celltype_plt) 

NOTE: This is order 3 (3 hops) neighborhood cell type proportion

drawing

About

plotting functions for cell trek

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages