18.1 Myeloid Trajectory - Monocyte Differentiation

In this section, we will create a cellular trajectory that approximates the differentiation of HSCs into fully differentiated monocytes. To start, lets review the clusters and cell types that we defined previously, stored in cellColData in columns named “Clusters” and “Clusters2”. Overlaying these cell groupings on our UMAP embedding shows the different cell types that we are interested in.

p1 <- plotEmbedding(ArchRProj = projHeme5, colorBy = "cellColData", name = "Clusters", embedding = "UMAP")
## ArchR logging to : ArchRLogs/ArchR-plotEmbedding-371b02bcbfad4-Date-2022-12-23_Time-09-01-25.log
## If there is an issue, please report to github with logFile!
## Getting UMAP Embedding
## ColorBy = cellColData
## Plotting Embedding
## 1 
## ArchR logging successful to : ArchRLogs/ArchR-plotEmbedding-371b02bcbfad4-Date-2022-12-23_Time-09-01-25.log
p2 <- plotEmbedding(ArchRProj = projHeme5, colorBy = "cellColData", name = "Clusters2", embedding = "UMAP")
## ArchR logging to : ArchRLogs/ArchR-plotEmbedding-371b0678faa84-Date-2022-12-23_Time-09-01-28.log
## If there is an issue, please report to github with logFile!
## Getting UMAP Embedding
## ColorBy = cellColData
## Plotting Embedding
## 1 
## ArchR logging successful to : ArchRLogs/ArchR-plotEmbedding-371b0678faa84-Date-2022-12-23_Time-09-01-28.log
ggAlignPlots(p1, p2, type = "h")

18.1.1 Pseudo-time UMAPs and individual feature plots

We will use the cell type definitions that are stored in “Clusters2”. As mentioned above, we are creating a trajectory from stem cells (“Progenitor”), through the committed myeloid progenitor (“GMP”), to monocytes (“Mono”). The first step in creating a trajectory is to create a trajectory backbone in the form of an ordered vector of cell group labels.

trajectory <- c("Progenitor", "GMP", "Mono")
trajectory
## [1] "Progenitor" "GMP"        "Mono"

We use the addTrajectory() function to create a trajectory and we add this to our ArchRProject. We will call this trajectory “MyeloidU”. What this does is it creates a new column in cellColData called “MyeloidU” that stores the pseudo-time value for each cell in the trajectory. Cells that are not part of the trajectory are labeled with NA.

projHeme5 <- addTrajectory(
    ArchRProj = projHeme5, 
    name = "MyeloidU", 
    groupBy = "Clusters2",
    trajectory = trajectory, 
    embedding = "UMAP", 
    force = TRUE
)
## ArchR logging to : ArchRLogs/ArchR-addTrajectory-371b075d8b869-Date-2022-12-23_Time-09-01-32.log
## If there is an issue, please report to github with logFile!
## Filtering outliers
## Initial Alignment Before Spline Fit
## Spline Fit
## KNN to Spline
## ArchR logging successful to : ArchRLogs/ArchR-addTrajectory-371b075d8b869-Date-2022-12-23_Time-09-01-32.log

We can look at this information and see that each cell has a unique pseudotime value between 0 and 100. We exclude cells with NA values because these are not part of the trajectory.

head(projHeme5$MyeloidU[!is.na(projHeme5$MyeloidU)])
## [1] 44.46083 45.38753 50.35805 51.43218 44.33446 41.95451

To plot this trajectory, we use the plotTrajectory() function which overlays the pseudo-time values on our UMAP embedding and displays an arrow approximating the trajectory path from the spline-fit. Cells that are not part of the trajectory are colored gray. In this example, we use colorBy = "cellColData" to tell ArchR to look within cellColData for the column specified by name - in this case, the “MyeloidU” pseudo-time trajectory. While it may seem conterintuitive to list “MyeloidU” for both trajectory and name, this is done because trajectory tells ArchR which subset of cells we are interested in and name tells ArchR how to color that subset of cells.

p <- plotTrajectory(projHeme5, trajectory = "MyeloidU", colorBy = "cellColData", name = "MyeloidU")
## ArchR logging to : ArchRLogs/ArchR-plotTrajectory-371b03b1147a5-Date-2022-12-23_Time-09-01-34.log
## If there is an issue, please report to github with logFile!
## Plotting
## Plotting Trajectory
## Adding Inferred Arrow Trajectory to Plot
## ArchR logging successful to : ArchRLogs/ArchR-plotTrajectory-371b03b1147a5-Date-2022-12-23_Time-09-01-34.log
p[[1]]
## Warning: Removed 5502 rows containing non-finite values (stat_summary_hex).

To save an editable vectorized version of this plot, we use plotPDF().

plotPDF(p, name = "Plot-MyeloidU-Traj-UMAP.pdf", ArchRProj = projHeme5, addDOC = FALSE, width = 5, height = 5)
## Plotting Ggplot!
## Plotting Ggplot!
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'

We can also overlay other features on the trajectory within our UMAP embedding. This allows us to display specific features only within the cells that are relevant to our trajectory.

If you have not already added impute weights to your projHeme5 project, lets do that now.

projHeme5 <- addImputeWeights(projHeme5)
## ArchR logging to : ArchRLogs/ArchR-addImputeWeights-371b055603961-Date-2022-12-23_Time-09-01-48.log
## If there is an issue, please report to github with logFile!
## 2022-12-23 09:01:49 : Computing Impute Weights Using Magic (Cell 2018), 0 mins elapsed.

Then, we can plot the “MyeloidU” trajectory but color the cells by the gene score value of the CEBPB gene, a known regulator of monocyte function that becomes active during the differentiation process. We indicate the matrix to use via the colorBy parameter and the feature to use via the name parameter.

p1 <- plotTrajectory(projHeme5, trajectory = "MyeloidU", colorBy = "GeneScoreMatrix", name = "CEBPB", continuousSet = "horizonExtra")
## Getting ImputeWeights
## ArchR logging to : ArchRLogs/ArchR-plotTrajectory-371b0689e159c-Date-2022-12-23_Time-09-01-58.log
## If there is an issue, please report to github with logFile!
## Getting Matrix Values...
## 2022-12-23 09:02:01 :
## 
## Imputing Matrix
## Using weights on disk
## Using weights on disk
## Plotting
## Plotting Trajectory
## Adding Inferred Arrow Trajectory to Plot
## ArchR logging successful to : ArchRLogs/ArchR-plotTrajectory-371b0689e159c-Date-2022-12-23_Time-09-01-58.log

We can repeat this process but color the cells by their linked gene expression via the GeneIntegrationMatrix.

p2 <- plotTrajectory(projHeme5, trajectory = "MyeloidU", colorBy = "GeneIntegrationMatrix", name = "CEBPB", continuousSet = "blueYellow")
## Getting ImputeWeights
## ArchR logging to : ArchRLogs/ArchR-plotTrajectory-371b0d2b3e5a-Date-2022-12-23_Time-09-02-09.log
## If there is an issue, please report to github with logFile!
## Getting Matrix Values...
## 2022-12-23 09:02:12 :
## 
## Imputing Matrix
## Using weights on disk
## Using weights on disk
## Plotting
## Plotting Trajectory
## Adding Inferred Arrow Trajectory to Plot
## ArchR logging successful to : ArchRLogs/ArchR-plotTrajectory-371b0d2b3e5a-Date-2022-12-23_Time-09-02-09.log

The plotTrajectory() function actually returns a list of relevant plots. The first plot in the list is a UMAP embedding, colorized as specified in the function call.

Comparing these UMAP plots side-by-side for the gene score and gene expression, we see that the activity of the CEBPB gene is highly specific to monocyte cells in the later part of the pseudo-time trajectory.

ggAlignPlots(p1[[1]], p2[[1]], type = "h")
## Warning: Removed 5502 rows containing non-finite values (stat_summary_hex).
## Removed 5502 rows containing non-finite values (stat_summary_hex).

The second plot in the list that is returned by plotTrajectory() is a dot plot of pseudo-time versus the value of the relevant feature, in this case, the gene score or gene expression of CEBPB. In this case, the cells are colored by their pseudo-time.

ggAlignPlots(p1[[2]], p2[[2]], type = "h")
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'

18.1.2 Pseudo-time heatmaps

We can visualize changes in many features across pseudo-time using heatmaps. To do this, we first retrieve the trajectory of interest from the ArchRProject using the getTrajectory() function which returns the trajectory as a SummarizedExperiment object. We will create these pseudo-time heatmaps for motifs, gene scores, gene expression, and peak accessibility by passing the corresponding matrix to the useMatrix parameter. When calling getTrajectory() we can provide as argument to the trajectoryLabel parameter which allows for labeling of the heatmap pseudo-time bins based on the group (eg. stem cell, progenitor cell, differentiated cell). Typically, the value passed to trajectoryLabel should be the same as the column in cellColData used in the groupBy parameter when addTrajectory() was called.

trajMM  <- getTrajectory(ArchRProj = projHeme5, name = "MyeloidU", useMatrix = "MotifMatrix", log2Norm = FALSE, trajectoryLabel = "Clusters2")
## Creating Trajectory Group Matrix..
## Some values are below 0, this could be a DeviationsMatrix in which scaleTo should be set = NULL.
## Continuing without depth normalization!
## Smoothing...
## Attempting to add labels to the trajectory based on the trajectoryLabel parameter.
trajMM
## class: SummarizedExperiment 
## dim: 1740 100 
## metadata(1): Params
## assays(2): smoothMat mat
## rownames(1740): deviations:TFAP2B_1 deviations:TFAP2D_2 ... z:TBX18_869
##   z:TBX22_870
## rowData names(3): seqnames idx name
## colnames(100): T.0_1 T.1_2 ... T.98_99 T.99_100
## colData names(1): label

getTrajectory() returns a Summarized Experiment where the rows are the features of interest and the columns are pseudo-time bins. The size of the pseudo-time bins can be controlled by the groupEvery parameter.

We then pass this SummarizedExperiment to the plotTrajectoryHeatmap() function. To include a color label across the top of the heatmap that represents the groups of the pseudo-time bins, we additionally use the colorColumns and columnPal arguments.

p1 <- plotTrajectoryHeatmap(trajMM, pal = paletteContinuous(set = "solarExtra"), colorColumns = TRUE, columnPal = paletteDiscrete(values = unique(colData(trajMM)$label)))
## ArchR logging to : ArchRLogs/ArchR-plotTrajectoryHeatmap-371b03a675203-Date-2022-12-23_Time-09-02-40.log
## If there is an issue, please report to github with logFile!
## useSeqnames is NULL or greater than 1 with a Sparse.Assays.Matrix trajectory input.
## 2022-12-23 09:02:42 :
## force=FALSE thus continuing with subsetting useSeqnames = z
## 2022-12-23 09:02:42 :
## Adding Annotations..
## Preparing Main Heatmap..
## 'magick' package is suggested to install to give better rasterization.
## 
## Set `ht_opt$message = FALSE` to turn off this message.
## ArchR logging successful to : ArchRLogs/ArchR-plotTrajectoryHeatmap-371b03a675203-Date-2022-12-23_Time-09-02-40.log
p1

We can perform the same steps to obtain a pseudo-time heatmap of gene scores by setting useMatrix = "GeneScoreMatrix".

trajGSM <- getTrajectory(ArchRProj = projHeme5, name = "MyeloidU", useMatrix = "GeneScoreMatrix", log2Norm = TRUE, trajectoryLabel = "Clusters2")
## Creating Trajectory Group Matrix..
## Smoothing...
## Attempting to add labels to the trajectory based on the trajectoryLabel parameter.
p2 <- plotTrajectoryHeatmap(trajGSM,  pal = paletteContinuous(set = "horizonExtra"), colorColumns = TRUE, columnPal = paletteDiscrete(values = unique(colData(trajGSM)$label)))
## ArchR logging to : ArchRLogs/ArchR-plotTrajectoryHeatmap-371b02ef0db07-Date-2022-12-23_Time-09-03-07.log
## If there is an issue, please report to github with logFile!
## Adding Annotations..
## Preparing Main Heatmap..
## 'magick' package is suggested to install to give better rasterization.
## 
## Set `ht_opt$message = FALSE` to turn off this message.
## ArchR logging successful to : ArchRLogs/ArchR-plotTrajectoryHeatmap-371b02ef0db07-Date-2022-12-23_Time-09-03-07.log
p2

Similarly, we can obtain a pseudo-time heatmap of gene expression by setting useMatrix = "GeneIntegrationMatrix".

trajGIM <- getTrajectory(ArchRProj = projHeme5, name = "MyeloidU", useMatrix = "GeneIntegrationMatrix", log2Norm = FALSE, trajectoryLabel = "Clusters2")
## Creating Trajectory Group Matrix..
## Smoothing...
## Attempting to add labels to the trajectory based on the trajectoryLabel parameter.
p3 <- plotTrajectoryHeatmap(trajGIM,  pal = paletteContinuous(set = "blueYellow"), colorColumns = TRUE, columnPal = paletteDiscrete(values = unique(colData(trajGIM)$label)))
## ArchR logging to : ArchRLogs/ArchR-plotTrajectoryHeatmap-371b07071953e-Date-2022-12-23_Time-09-03-35.log
## If there is an issue, please report to github with logFile!
## Adding Annotations..
## Preparing Main Heatmap..
## 'magick' package is suggested to install to give better rasterization.
## 
## Set `ht_opt$message = FALSE` to turn off this message.
## ArchR logging successful to : ArchRLogs/ArchR-plotTrajectoryHeatmap-371b07071953e-Date-2022-12-23_Time-09-03-35.log
p3

Lastly, we can obtain a pseudo-time heatmap of peak accessibility by setting useMatrix = "PeakMatrix".

trajPM  <- getTrajectory(ArchRProj = projHeme5, name = "MyeloidU", useMatrix = "PeakMatrix", log2Norm = TRUE, trajectoryLabel = "Clusters2")
## Creating Trajectory Group Matrix..
## Smoothing...
## Attempting to add labels to the trajectory based on the trajectoryLabel parameter.
p4 <- plotTrajectoryHeatmap(trajPM, pal = paletteContinuous(set = "solarExtra"), colorColumns = TRUE, columnPal = paletteDiscrete(values = unique(colData(trajPM)$label)))
## ArchR logging to : ArchRLogs/ArchR-plotTrajectoryHeatmap-371b0711e7086-Date-2022-12-23_Time-09-04-09.log
## If there is an issue, please report to github with logFile!
## Adding Annotations..
## Preparing Main Heatmap..
## 'magick' package is suggested to install to give better rasterization.
## 
## Set `ht_opt$message = FALSE` to turn off this message.
## ArchR logging successful to : ArchRLogs/ArchR-plotTrajectoryHeatmap-371b0711e7086-Date-2022-12-23_Time-09-04-09.log
p4

To save an editable vectorized version of these plots, we use plotPDF().

plotPDF(p1, p2, p3, p4, name = "Plot-MyeloidU-Traj-Heatmaps.pdf", ArchRProj = projHeme5, addDOC = FALSE, width = 6, height = 8)
## Plotting ComplexHeatmap!
## Plotting ComplexHeatmap!
## Plotting ComplexHeatmap!
## Plotting ComplexHeatmap!

18.1.3 Integrative pseudo-time analyses

We can also perform integrative analyses, such as identification of positive TF regulators by integration of gene scores / gene expression with motif accessibility across pseudo-time. This can be very powerful, for example in identifying drivers of differentiation. To do this, we use the correlateTrajectories() function which takes two SummarizedExperiment objects retrived from the getTrajectories() function.

First, lets find motifs whose accessibility across pseudo-time is correlated with the gene score of the TF gene. Since we are ultimately going to only correlate with the deviation z-scores, we filter out any entries that correlate based on raw deviations.

corGSM_MM <- correlateTrajectories(trajGSM, trajMM)
## ArchR logging to : ArchRLogs/ArchR-correlateTrajectories-371b044dd16c1-Date-2022-12-23_Time-09-04-28.log
## If there is an issue, please report to github with logFile!
## Found 36 Correlated Pairings!
## 2022-12-23 09:04:44 :
idxToRemove <- grep(pattern = "deviations", x = corGSM_MM[["correlatedMappings"]]$name2)
if(length(idxToRemove > 1)){
  corGSM_MM[["correlatedMappings"]] <- corGSM_MM[["correlatedMappings"]][-idxToRemove,]
}

The primary output of correlateTrajectories() is a list object containing a DataFrame object as the first entry in the list. This DataFrame has columns named idx1, matchname1, name1, and VarAssay1 which correspond to the index, match name, unaltered name, and the variance quantile of the features from the first trajectory (gene scores) passed to the correlateTrajectories() function. A “variance quantile” is a normalized measure of the given feature which allows us to derive a correlation across disparate assays. This DataFrame contains all of the features that met the cutoffs specified in the correlateTrajectories() function.

corGSM_MM[["correlatedMappings"]]
## DataFrame with 34 rows and 12 columns
##          idx1      idx2  matchname1  matchname2       name1        name2
##     <integer> <integer> <character> <character> <character>  <character>
## 1          82      1081      PRDM16      PRDM16 chr1:PRDM16 z:PRDM16_211
## 2         731       932        TAL1        TAL1   chr1:TAL1    z:TAL1_62
## 3         818      1013         JUN         JUN    chr1:JUN    z:JUN_143
## 4        2034      1002        ATF3        ATF3   chr1:ATF3   z:ATF3_132
## 5        2369      1254       GATA3       GATA3 chr10:GATA3  z:GATA3_384
## ...       ...       ...         ...         ...         ...          ...
## 30      20780      1031       SNAI2       SNAI2  chr8:SNAI2  z:SNAI2_161
## 31      21658      1003       NFIL3       NFIL3  chr9:NFIL3  z:NFIL3_133
## 32      21753      1538       NR4A3       NR4A3  chr9:NR4A3  z:NR4A3_668
## 33      21793      1078        KLF4        KLF4   chr9:KLF4   z:KLF4_208
## 34      22097      1565        RXRA        RXRA   chr9:RXRA   z:RXRA_695
##     Correlation VarAssay1 VarAssay2     TStat        Pval         FDR
##       <numeric> <numeric> <numeric> <numeric>   <numeric>   <numeric>
## 1      0.819155  0.999784  0.882184  14.13808 2.14496e-25 1.07485e-22
## 2      0.713021  0.892896  0.989080  10.06721 8.65013e-17 4.04332e-15
## 3      0.513938  0.994984  0.966667   5.93095 4.53019e-08 4.90821e-07
## 4      0.745019  0.986034  0.908621  11.05673 6.26185e-19 4.87828e-17
## 5      0.742689  0.816275  0.995977  10.97946 9.18709e-19 6.83186e-17
## ...         ...       ...       ...       ...         ...         ...
## 30     0.647908  0.847408  0.964943   8.42039 3.18965e-13 8.02810e-12
## 31     0.731252  0.992952  0.943678  10.61274 5.68866e-18 3.57948e-16
## 32     0.590540  0.836857  0.938506   7.24411 1.00053e-10 1.68749e-09
## 33     0.829245  0.999049  0.833908  14.68834 1.66821e-26 1.36460e-23
## 34     0.592085  0.913607  0.927011   7.27326 8.69748e-11 1.49780e-09

We can then subset our corresponding trajectory SummarizedExperiment objects to only contain the elements that passed significance above.

trajGSM2 <- trajGSM[corGSM_MM[["correlatedMappings"]]$name1, ]
trajMM2 <- trajMM[corGSM_MM[["correlatedMappings"]]$name2, ]

To best order these features, we can create a new trajectory where the values of these two trajectories are multiplied. This will allow us to create side-by-side heatmaps that are identically ordered by row.

trajCombined <- trajGSM2
assay(trajCombined, withDimnames=FALSE) <- t(apply(assay(trajGSM2), 1, scale)) + t(apply(assay(trajMM2), 1, scale))

We can extract the optimal row order from the return of the plotTrajectoryHeatmap() function.

combinedMat <- plotTrajectoryHeatmap(trajCombined, returnMat = TRUE, varCutOff = 0)
## ArchR logging to : ArchRLogs/ArchR-plotTrajectoryHeatmap-371b020e96276-Date-2022-12-23_Time-09-04-44.log
## If there is an issue, please report to github with logFile!
## Preparing Main Heatmap..
## 'magick' package is suggested to install to give better rasterization.
## 
## Set `ht_opt$message = FALSE` to turn off this message.
## ArchR logging successful to : ArchRLogs/ArchR-plotTrajectoryHeatmap-371b020e96276-Date-2022-12-23_Time-09-04-44.log
rowOrder <- match(rownames(combinedMat), rownames(trajGSM2))

With this, we are now ready to create our paired heatmaps. First, we will create the heatmap for the gene score trajectory. We specify the desired row order via the rowOrder parameter.

ht1 <- plotTrajectoryHeatmap(trajGSM2,  pal = paletteContinuous(set = "horizonExtra"),  varCutOff = 0, rowOrder = rowOrder)
## ArchR logging to : ArchRLogs/ArchR-plotTrajectoryHeatmap-371b072a3d0d3-Date-2022-12-23_Time-09-04-45.log
## If there is an issue, please report to github with logFile!
## Preparing Main Heatmap..
## 'magick' package is suggested to install to give better rasterization.
## 
## Set `ht_opt$message = FALSE` to turn off this message.
## ArchR logging successful to : ArchRLogs/ArchR-plotTrajectoryHeatmap-371b072a3d0d3-Date-2022-12-23_Time-09-04-45.log

Then, we will create the heatmap for the motif trajectory, again specifying the row order via the rowOrder parameter. Here, we’ve used force = TRUE. In the context of the MotifMatrix trajectory, this would allow correlations to both “z” and “deviations”. In this example, we’ve removed the raw deviations above but if we had not done this, force = TRUE would be essential here.

ht2 <- plotTrajectoryHeatmap(trajMM2, pal = paletteContinuous(set = "solarExtra"), varCutOff = 0, rowOrder = rowOrder, force = TRUE)
## ArchR logging to : ArchRLogs/ArchR-plotTrajectoryHeatmap-371b03bca867d-Date-2022-12-23_Time-09-04-46.log
## If there is an issue, please report to github with logFile!
## useSeqnames is NULL or greater than 1 with a Sparse.Assays.Matrix trajectory input.
## 2022-12-23 09:04:47 :
## force=TRUE thus continuing
## 2022-12-23 09:04:47 :
## Preparing Main Heatmap..
## 'magick' package is suggested to install to give better rasterization.
## 
## Set `ht_opt$message = FALSE` to turn off this message.
## ArchR logging successful to : ArchRLogs/ArchR-plotTrajectoryHeatmap-371b03bca867d-Date-2022-12-23_Time-09-04-46.log

Plotting these two heatmaps side-by-side, we see that the rows are matched across the two heatmaps. You may notice that the analysis captures both GATA3 and GATA3-AS1 (an anti-sense transcript of GATA3). This is due to how feature matching is performed and the anti-sense transcript entry could be removed manually in post-processing or programatically if desired.

ComplexHeatmap::draw(ht1 + ht2)

We can repeat this same exact process but use gene expression from the GeneIntegrationMatrix instead of gene scores. Because this is the same analytical workflow, we do not repeat our explanations for each step.

corGIM_MM <- correlateTrajectories(trajGIM, trajMM)
## ArchR logging to : ArchRLogs/ArchR-correlateTrajectories-371b05824f690-Date-2022-12-23_Time-09-04-49.log
## If there is an issue, please report to github with logFile!
## Found 45 Correlated Pairings!
## 2022-12-23 09:05:02 :
idxToRemove2 <- grep(pattern = "deviations", x = corGIM_MM[["correlatedMappings"]]$name2)
if(length(idxToRemove2 > 1)){
  corGIM_MM[["correlatedMappings"]] <- corGIM_MM[["correlatedMappings"]][-idxToRemove2,]
}
corGIM_MM[[1]]
## DataFrame with 44 rows and 12 columns
##          idx1      idx2  matchname1  matchname2       name1       name2
##     <integer> <integer> <character> <character> <character> <character>
## 1         680      1612        NFIA        NFIA   chr1:NFIA  z:NFIA_742
## 2        1063      1597        RFX5        RFX5   chr1:RFX5  z:RFX5_727
## 3        1227      1512       MEF2D       MEF2D  chr1:MEF2D z:MEF2D_642
## 4        2036      1027        ZEB1        ZEB1  chr10:ZEB1  z:ZEB1_157
## 5        2625      1505        IRF7        IRF7  chr11:IRF7  z:IRF7_635
## ...       ...       ...         ...         ...         ...         ...
## 40      16280       897        TFEC        TFEC   chr7:TFEC   z:TFEC_27
## 41      16783      1022       CEBPD       CEBPD  chr8:CEBPD z:CEBPD_152
## 42      17463      1003       NFIL3       NFIL3  chr9:NFIL3 z:NFIL3_133
## 43      17560      1078        KLF4        KLF4   chr9:KLF4  z:KLF4_208
## 44      17803      1565        RXRA        RXRA   chr9:RXRA  z:RXRA_695
##     Correlation VarAssay1 VarAssay2     TStat        Pval         FDR
##       <numeric> <numeric> <numeric> <numeric>   <numeric>   <numeric>
## 1      0.816706  0.824472  0.929310  14.01080 3.89203e-25 5.62575e-24
## 2      0.638387  0.853019  0.937356   8.21046 9.00279e-13 3.92176e-12
## 3      0.835393  0.879791  0.882759  15.04577 3.23752e-27 6.05606e-26
## 4      0.864641  0.888608  0.908046  17.03757 4.66633e-31 1.30932e-29
## 5      0.805066  0.914252  0.940230  13.43551 5.88449e-24 7.01726e-23
## ...         ...       ...       ...       ...         ...         ...
## 40     0.671862  0.845062  0.903448   8.97976 1.97876e-14 9.98802e-14
## 41     0.853428  0.993818  0.998851  16.20941 1.73662e-29 4.35982e-28
## 42     0.746816  0.910973  0.943678  11.11694 4.64619e-19 3.51783e-18
## 43     0.866690  0.984141  0.833908  17.19925 2.32666e-31 7.39879e-30
## 44     0.885431  0.957744  0.927011  18.85945 2.21963e-34 1.11449e-32
trajGIM2 <- trajGIM[corGIM_MM[[1]]$name1, ]
trajMM2 <- trajMM[corGIM_MM[[1]]$name2, ]
trajCombined <- trajGIM2
assay(trajCombined, withDimnames=FALSE) <- t(apply(assay(trajGIM2), 1, scale)) + t(apply(assay(trajMM2), 1, scale))
combinedMat <- plotTrajectoryHeatmap(trajCombined, returnMat = TRUE, varCutOff = 0)
## ArchR logging to : ArchRLogs/ArchR-plotTrajectoryHeatmap-371b0309760ff-Date-2022-12-23_Time-09-05-02.log
## If there is an issue, please report to github with logFile!
## Preparing Main Heatmap..
## 'magick' package is suggested to install to give better rasterization.
## 
## Set `ht_opt$message = FALSE` to turn off this message.
## ArchR logging successful to : ArchRLogs/ArchR-plotTrajectoryHeatmap-371b0309760ff-Date-2022-12-23_Time-09-05-02.log
rowOrder <- match(rownames(combinedMat), rownames(trajGIM2))
ht1 <- plotTrajectoryHeatmap(trajGIM2,  pal = paletteContinuous(set = "blueYellow"),  varCutOff = 0, rowOrder = rowOrder)
## ArchR logging to : ArchRLogs/ArchR-plotTrajectoryHeatmap-371b04c6d931c-Date-2022-12-23_Time-09-05-03.log
## If there is an issue, please report to github with logFile!
## Preparing Main Heatmap..
## 'magick' package is suggested to install to give better rasterization.
## 
## Set `ht_opt$message = FALSE` to turn off this message.
## ArchR logging successful to : ArchRLogs/ArchR-plotTrajectoryHeatmap-371b04c6d931c-Date-2022-12-23_Time-09-05-03.log
ht2 <- plotTrajectoryHeatmap(trajMM2, pal = paletteContinuous(set = "solarExtra"), varCutOff = 0, rowOrder = rowOrder)
## ArchR logging to : ArchRLogs/ArchR-plotTrajectoryHeatmap-371b06066a463-Date-2022-12-23_Time-09-05-04.log
## If there is an issue, please report to github with logFile!
## useSeqnames is NULL or greater than 1 with a Sparse.Assays.Matrix trajectory input.
## 2022-12-23 09:05:06 :
## force=FALSE thus continuing with subsetting useSeqnames = z
## 2022-12-23 09:05:06 :
## Preparing Main Heatmap..
## 'magick' package is suggested to install to give better rasterization.
## 
## Set `ht_opt$message = FALSE` to turn off this message.
## ArchR logging successful to : ArchRLogs/ArchR-plotTrajectoryHeatmap-371b06066a463-Date-2022-12-23_Time-09-05-04.log
ComplexHeatmap::draw(ht1 + ht2)