Skip to content

Network Visualizations - #58

Draft
GWMcElfresh wants to merge 4 commits into
mainfrom
networks
Draft

Network Visualizations#58
GWMcElfresh wants to merge 4 commits into
mainfrom
networks

Conversation

@GWMcElfresh

@GWMcElfresh GWMcElfresh commented Mar 23, 2026

Copy link
Copy Markdown
Collaborator

TODO on fleshing this out, but the primary goals are to extend this package into network visualizations and analysis.

Example visualization:
image

This network establishes a graph where we can care primarily about two quantities:

  • what is the probability that node of type X (controller) is connected to a node of type Y (progressor).
  • is the typical distance between controllers vs progressors different?

To that end, this now supports on-the-fly network construction via something like this (for the above network):

tcrClustR::TCRDistanceNetwork(
  seuratObj = seuratObjTcrA, 
  chains = "TRA",
  colorBy = "outcome", 
  edgeType = 'continuous'
)

and then a modeling suite for connectivity vs distances like so:

result_diana <- tcrClustR::ModelTCRDyads(
  seuratObj_TCR        = seuratObjTcrA,
  chains               = "TRA",
  groupColumn          = "outcome",
  estimand = 'effects', 
  distanceThreshold    = 50,
  communityMethod      = "DIANA",
  clusterSizeThreshold = 2,
  subjectIdCol         = "SubjectId",
  verbose              = TRUE
)

This modeling result will compute the connectivity and the distance results and store them, so they can be accessed by visualization functions. The models are either estimand = effects or estimand = means, which equates to either a contrast across values or the values of groupColumn themselves.

For instance, for estimand = effects we contrast and plot like so:

tcrClustR::PlotDyadEstimates(result_diana, which = "connectivity")
image
tcrClustR::PlotDyadEstimates(result_diana, which = "distance")
image

but if we run with estimand = 'means':

tcrClustR::PlotDyadEstimates(result_diana, which = "connectivity")
image
tcrClustR::PlotDyadEstimates(result_diana, which = "distance")
image

Specifically for the conditional connectivity probabilities, this function subsets unpaired nodes (e.g. clones with high distance from all other clones). So, by passing showUnpaired = TRUE, we recover those probabilities in a facet.

tcrClustR::PlotDyadEstimates(result_diana, which = "connectivity", showUnpaired = TRUE)
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant