Skip to content

Commit 66b44ce

Browse files
committed
Added plots for semi-NMF to pancreas_annotate analysis.
1 parent 9440e05 commit 66b44ce

File tree

3 files changed

+283
-16
lines changed

3 files changed

+283
-16
lines changed
Loading
Loading

docs/pancreas_annotate.html

+283-16
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ <h4 class="author">Peter Carbonetto</h4>
300300
<div class="tab-content">
301301
<div id="summary" class="tab-pane fade in active">
302302
<p>
303-
<strong>Last updated:</strong> 2025-02-19
303+
<strong>Last updated:</strong> 2025-02-20
304304
</p>
305305
<p>
306306
<strong>Checks:</strong> <span
@@ -432,15 +432,15 @@ <h4 class="author">Peter Carbonetto</h4>
432432
<div class="panel panel-default">
433433
<div class="panel-heading">
434434
<p class="panel-title">
435-
<a data-toggle="collapse" data-parent="#workflowr-checks" href="#strongRepositoryversionstrongahrefhttpsgithubcomstephenslabsinglecelljamboreetreeb36508bf5db1e33dca218ea14dc03f3683da85b7targetblankb36508ba">
435+
<a data-toggle="collapse" data-parent="#workflowr-checks" href="#strongRepositoryversionstrongahrefhttpsgithubcomstephenslabsinglecelljamboreetree9440e05bc58ce8e42a1d61a79ffdfd18896e60cbtargetblank9440e05a">
436436
<span class="glyphicon glyphicon-ok text-success"
437437
aria-hidden="true"></span> <strong>Repository version:</strong>
438-
<a href="https://github.com/stephenslab/single-cell-jamboree/tree/b36508bf5db1e33dca218ea14dc03f3683da85b7" target="_blank">b36508b</a>
438+
<a href="https://github.com/stephenslab/single-cell-jamboree/tree/9440e05bc58ce8e42a1d61a79ffdfd18896e60cb" target="_blank">9440e05</a>
439439
</a>
440440
</p>
441441
</div>
442442
<div
443-
id="strongRepositoryversionstrongahrefhttpsgithubcomstephenslabsinglecelljamboreetreeb36508bf5db1e33dca218ea14dc03f3683da85b7targetblankb36508ba"
443+
id="strongRepositoryversionstrongahrefhttpsgithubcomstephenslabsinglecelljamboreetree9440e05bc58ce8e42a1d61a79ffdfd18896e60cbtargetblank9440e05a"
444444
class="panel-collapse collapse">
445445
<div class="panel-body">
446446
<p>
@@ -450,7 +450,7 @@ <h4 class="author">Peter Carbonetto</h4>
450450
</p>
451451
<p>
452452
The results in this page were generated with repository version
453-
<a href="https://github.com/stephenslab/single-cell-jamboree/tree/b36508bf5db1e33dca218ea14dc03f3683da85b7" target="_blank">b36508b</a>.
453+
<a href="https://github.com/stephenslab/single-cell-jamboree/tree/9440e05bc58ce8e42a1d61a79ffdfd18896e60cb" target="_blank">9440e05</a>.
454454
See the <em>Past versions</em> tab to see a history of the changes made
455455
to the R Markdown and HTML files.
456456
</p>
@@ -519,6 +519,109 @@ <h4 class="author">Peter Carbonetto</h4>
519519
Rmd
520520
</td>
521521
<td>
522+
<a href="https://github.com/stephenslab/single-cell-jamboree/blob/9440e05bc58ce8e42a1d61a79ffdfd18896e60cb/analysis/pancreas_annotate.Rmd" target="_blank">9440e05</a>
523+
</td>
524+
<td>
525+
Peter Carbonetto
526+
</td>
527+
<td>
528+
2025-02-20
529+
</td>
530+
<td>
531+
workflowr::wflow_publish("pancreas_annotate.Rmd", verbose = TRUE,
532+
</td>
533+
</tr>
534+
<tr>
535+
<td>
536+
Rmd
537+
</td>
538+
<td>
539+
<a href="https://github.com/stephenslab/single-cell-jamboree/blob/07d482e89a8eb0c9c4dd09a4956d97eb7f23c27b/analysis/pancreas_annotate.Rmd" target="_blank">07d482e</a>
540+
</td>
541+
<td>
542+
Peter Carbonetto
543+
</td>
544+
<td>
545+
2025-02-19
546+
</td>
547+
<td>
548+
Fixed a few words in the pancreas_annotate analysis.
549+
</td>
550+
</tr>
551+
<tr>
552+
<td>
553+
Rmd
554+
</td>
555+
<td>
556+
<a href="https://github.com/stephenslab/single-cell-jamboree/blob/b2641524e0077583153d91147cffe78c153ea854/analysis/pancreas_annotate.Rmd" target="_blank">b264152</a>
557+
</td>
558+
<td>
559+
Peter Carbonetto
560+
</td>
561+
<td>
562+
2025-02-19
563+
</td>
564+
<td>
565+
A bit of formatting adjustment to the pancreas_annotate rmarkdown.
566+
</td>
567+
</tr>
568+
<tr>
569+
<td>
570+
Rmd
571+
</td>
572+
<td>
573+
<a href="https://github.com/stephenslab/single-cell-jamboree/blob/20ddb4746c716ceb0b761006c0af730ed64aabbe/analysis/pancreas_annotate.Rmd" target="_blank">20ddb47</a>
574+
</td>
575+
<td>
576+
Peter Carbonetto
577+
</td>
578+
<td>
579+
2025-02-19
580+
</td>
581+
<td>
582+
Added another note.
583+
</td>
584+
</tr>
585+
<tr>
586+
<td>
587+
Rmd
588+
</td>
589+
<td>
590+
<a href="https://github.com/stephenslab/single-cell-jamboree/blob/190f7c317ecffc6fda8811a6a7421b347b4171bd/analysis/pancreas_annotate.Rmd" target="_blank">190f7c3</a>
591+
</td>
592+
<td>
593+
Peter Carbonetto
594+
</td>
595+
<td>
596+
2025-02-19
597+
</td>
598+
<td>
599+
Edited a note about interpretation to the pancreas_annotate analysis.
600+
</td>
601+
</tr>
602+
<tr>
603+
<td>
604+
html
605+
</td>
606+
<td>
607+
<a href="https://rawcdn.githack.com/stephenslab/single-cell-jamboree/1f9368602d75ed06fc1c50a66401a25350634cec/docs/pancreas_annotate.html" target="_blank">1f93686</a>
608+
</td>
609+
<td>
610+
Peter Carbonetto
611+
</td>
612+
<td>
613+
2025-02-19
614+
</td>
615+
<td>
616+
Added an ‘interpretable’ annotation plot to the pancreas_annotate
617+
analysis.
618+
</td>
619+
</tr>
620+
<tr>
621+
<td>
622+
Rmd
623+
</td>
624+
<td>
522625
<a href="https://github.com/stephenslab/single-cell-jamboree/blob/b36508bf5db1e33dca218ea14dc03f3683da85b7/analysis/pancreas_annotate.Rmd" target="_blank">b36508b</a>
523626
</td>
524627
<td>
@@ -667,6 +770,43 @@ <h2>Structure plot</h2>
667770
structure_plot(L[,-1],grouping = celltype,gap = 10,perplexity = 70,n = Inf) +
668771
labs(y = &quot;membership&quot;,fill = &quot;factor&quot;,color = &quot;factor&quot;)</code></pre>
669772
<p><img src="figure/pancreas_annotate.Rmd/structure-plot-flashier-nmf-1.png" width="960" style="display: block; margin: auto;" /></p>
773+
<p>
774+
<button type="button" class="btn btn-default btn-xs btn-workflowr btn-workflowr-fig" data-toggle="collapse" data-target="#fig-structure-plot-flashier-nmf-1">
775+
Past versions of structure-plot-flashier-nmf-1.png
776+
</button>
777+
</p>
778+
<div id="fig-structure-plot-flashier-nmf-1" class="collapse">
779+
<div class="table-responsive">
780+
<table class="table table-condensed table-hover">
781+
<thead>
782+
<tr>
783+
<th>
784+
Version
785+
</th>
786+
<th>
787+
Author
788+
</th>
789+
<th>
790+
Date
791+
</th>
792+
</tr>
793+
</thead>
794+
<tbody>
795+
<tr>
796+
<td>
797+
<a href="https://github.com/stephenslab/single-cell-jamboree/blob/1f9368602d75ed06fc1c50a66401a25350634cec/docs/figure/pancreas_annotate.Rmd/structure-plot-flashier-nmf-1.png" target="_blank">1f93686</a>
798+
</td>
799+
<td>
800+
Peter Carbonetto
801+
</td>
802+
<td>
803+
2025-02-19
804+
</td>
805+
</tr>
806+
</tbody>
807+
</table>
808+
</div>
809+
</div>
670810
<p>Note that the first factor was omitted in the Structure plot because
671811
it is a “baseline” factor, and not particularly interesting to look
672812
at.</p>
@@ -708,6 +848,43 @@ <h2>Annotating the factors by “driving genes”</h2>
708848
theme(plot.title = element_text(face = &quot;plain&quot;,size = 9))
709849
plot_grid(p1,p2,nrow = 1,ncol = 2)</code></pre>
710850
<p><img src="figure/pancreas_annotate.Rmd/annotation-plot-flashier-nmf-1.png" width="720" style="display: block; margin: auto;" /></p>
851+
<p>
852+
<button type="button" class="btn btn-default btn-xs btn-workflowr btn-workflowr-fig" data-toggle="collapse" data-target="#fig-annotation-plot-flashier-nmf-1">
853+
Past versions of annotation-plot-flashier-nmf-1.png
854+
</button>
855+
</p>
856+
<div id="fig-annotation-plot-flashier-nmf-1" class="collapse">
857+
<div class="table-responsive">
858+
<table class="table table-condensed table-hover">
859+
<thead>
860+
<tr>
861+
<th>
862+
Version
863+
</th>
864+
<th>
865+
Author
866+
</th>
867+
<th>
868+
Date
869+
</th>
870+
</tr>
871+
</thead>
872+
<tbody>
873+
<tr>
874+
<td>
875+
<a href="https://github.com/stephenslab/single-cell-jamboree/blob/1f9368602d75ed06fc1c50a66401a25350634cec/docs/figure/pancreas_annotate.Rmd/annotation-plot-flashier-nmf-1.png" target="_blank">1f93686</a>
876+
</td>
877+
<td>
878+
Peter Carbonetto
879+
</td>
880+
<td>
881+
2025-02-19
882+
</td>
883+
</tr>
884+
</tbody>
885+
</table>
886+
</div>
887+
</div>
711888
<pre><code># Features selected for plot: INS IAPP SCGN SLC30A8 ABCC8 G6PC2 NPTX2 HADH GCG CHGB TM4SF4 TTR SCG2 SCG5 ALDH1A1 PCSK2 SST RBP4 PCSK1 CPE PPY SEC11C ISL1
712889
c(&quot;INS&quot;, &quot;IAPP&quot;, &quot;SCGN&quot;, &quot;SLC30A8&quot;, &quot;ABCC8&quot;, &quot;G6PC2&quot;, &quot;NPTX2&quot;,
713890
&quot;HADH&quot;, &quot;GCG&quot;, &quot;CHGB&quot;, &quot;TM4SF4&quot;, &quot;TTR&quot;, &quot;SCG2&quot;, &quot;SCG5&quot;, &quot;ALDH1A1&quot;,
@@ -731,8 +908,9 @@ <h2>Annotating the factors by “driving genes”</h2>
731908
provides both options. These selection strategies can also reveal
732909
complementary insights and so in many situations it may be better to use
733910
both.</p>
734-
<div id="a-more-interpretable-annotation-plot" class="section level3">
735-
<h3>A more interpretable annotation plot</h3>
911+
<div id="a-more-interpretable-annotation-heatmap"
912+
class="section level3">
913+
<h3>A more interpretable annotation heatmap</h3>
736914
<p>Above we sounded a note of caution about interpreting elements of L
737915
across factors/columns. The same applies to the F matrix. To provide a
738916
more even footing, above we employed the simple heuristic of scaling the
@@ -754,19 +932,109 @@ <h3>A more interpretable annotation plot</h3>
754932
colnames(F) &lt;- paste0(&quot;k&quot;,1:9)
755933
annotation_heatmap(F,select_features = genes,font_size = 9)</code></pre>
756934
<p><img src="figure/pancreas_annotate.Rmd/annotation-plot-flashier-nmf-2-1.png" width="390" style="display: block; margin: auto;" /></p>
935+
<p>
936+
<button type="button" class="btn btn-default btn-xs btn-workflowr btn-workflowr-fig" data-toggle="collapse" data-target="#fig-annotation-plot-flashier-nmf-2-1">
937+
Past versions of annotation-plot-flashier-nmf-2-1.png
938+
</button>
939+
</p>
940+
<div id="fig-annotation-plot-flashier-nmf-2-1" class="collapse">
941+
<div class="table-responsive">
942+
<table class="table table-condensed table-hover">
943+
<thead>
944+
<tr>
945+
<th>
946+
Version
947+
</th>
948+
<th>
949+
Author
950+
</th>
951+
<th>
952+
Date
953+
</th>
954+
</tr>
955+
</thead>
956+
<tbody>
957+
<tr>
958+
<td>
959+
<a href="https://github.com/stephenslab/single-cell-jamboree/blob/1f9368602d75ed06fc1c50a66401a25350634cec/docs/figure/pancreas_annotate.Rmd/annotation-plot-flashier-nmf-2-1.png" target="_blank">1f93686</a>
960+
</td>
961+
<td>
962+
Peter Carbonetto
963+
</td>
964+
<td>
965+
2025-02-19
966+
</td>
967+
</tr>
968+
</tbody>
969+
</table>
970+
</div>
971+
</div>
757972
<p>Visually, this plot looks quite similar to before, but now the effect
758973
sizes are on a different scale. With this rescaling, the effect sizes
759974
have the following interpretation:</p>
975+
<div style="margin:1em; padding:1em; border:1px solid black;">
760976
<p><span class="math inline">\(f_{jk}\)</span> is (approximately) the
761-
<em>log-fold change</em> (LFC) of gene <span
762-
class="math inline">\(j\)</span> in a cell <span
763-
class="math inline">\(i\)</span> with the largest membership in factor
764-
<span class="math inline">\(k\)</span> (<span
765-
class="math inline">\(l_{ik} =
766-
1\)</span>) relative to a cell <span
767-
class="math inline">\(i&#39;\)</span> with no membership in factor <span
977+
log-fold change (LFC) of gene <span class="math inline">\(j\)</span> in
978+
a hypothetical cell <span class="math inline">\(i\)</span> with the
979+
largest possible membership to factor <span
980+
class="math inline">\(k\)</span> (<span class="math inline">\(l_{ik} =
981+
1\)</span>) relative to another hypothetical cell <span
982+
class="math inline">\(i&#39;\)</span> with no membership to factor <span
768983
class="math inline">\(k\)</span> (<span
769984
class="math inline">\(l_{i&#39;k} = 0\)</span>).</p>
985+
</div>
986+
<p>Also note that this same idea could have been also applied to the
987+
other annotation heatmap (using the first selection strategy)—we showed
988+
this with just the second annotation heatmap for illustration.</p>
989+
</div>
990+
</div>
991+
<div id="annotating-the-semi-nmf" class="section level2">
992+
<h2>Annotating the semi-NMF</h2>
993+
<p>Previously, we found the semi-non-negative matrix factorization
994+
(semi-NMF) produced by flashier yields a more hierarchical decomposition
995+
of the cell types, capturing structure at different levels of
996+
cell-type-specifity:</p>
997+
<pre class="r"><code>L &lt;- fl_snmf_ldf$L
998+
colnames(L) &lt;- paste0(&quot;k&quot;,1:9)
999+
structure_plot(L[,-c(1,5)],grouping = celltype,gap = 10,
1000+
perplexity = 70,n = Inf) +
1001+
labs(y = &quot;membership&quot;,fill = &quot;factor&quot;,color = &quot;factor&quot;)</code></pre>
1002+
<p><img src="figure/pancreas_annotate.Rmd/structure-plot-flashier-snmf-1.png" width="960" style="display: block; margin: auto;" /></p>
1003+
<p>As a result, we would expect that the factors themselves would tend
1004+
to pick more “distinctive” features; for example, factor 8 capturing
1005+
expression specific to dselta, gamma and epsilon cells doesn’t need to
1006+
include the expression that is shared with alpha cells because factor 4
1007+
already captures this. Still, it is helpful to explore these two
1008+
selection strategies for the islet cell factors (3, 4 and 8) in the
1009+
annotation heatmap:</p>
1010+
<pre class="r"><code>F &lt;- fl_snmf_ldf$F
1011+
colnames(F) &lt;- paste0(&quot;k&quot;,1:9)
1012+
kset &lt;- paste0(&quot;k&quot;,c(3,4,8))
1013+
F &lt;- F[,c(3,4,8,1,2,5,6,7,9)]
1014+
p1 &lt;- annotation_heatmap(F,n = 8,dims = kset,
1015+
select_features = &quot;largest&quot;,
1016+
feature_sign = &quot;positive&quot;,
1017+
font_size = 9) +
1018+
labs(title = &quot;select_features = \&quot;largest\&quot;&quot;) +
1019+
theme(plot.title = element_text(face = &quot;plain&quot;,size = 9))
1020+
p2 &lt;- annotation_heatmap(F,n = 8,dims = kset,
1021+
select_features = &quot;distinctive&quot;,
1022+
compare_dims = kset,
1023+
feature_sign = &quot;positive&quot;,
1024+
font_size = 9) +
1025+
labs(title = &quot;select_features = \&quot;distinctive\&quot;&quot;) +
1026+
theme(plot.title = element_text(face = &quot;plain&quot;,size = 9))
1027+
plot_grid(p1,p2,nrow = 1,ncol = 2)</code></pre>
1028+
<p><img src="figure/pancreas_annotate.Rmd/annotation-plot-flashier-snmf-1.png" width="720" style="display: block; margin: auto;" /></p>
1029+
<pre><code># Features selected for plot: GCG TTR TM4SF4 GC CHGB PCSK2 MALAT1 IGFBP7 INS IAPP HADH NPTX2 MAFA RBP4 PCSK1 SCD5 SST AQP3 PPY LEPR DPYSL3 AKAP12
1030+
c(&quot;GCG&quot;, &quot;TTR&quot;, &quot;TM4SF4&quot;, &quot;GC&quot;, &quot;CHGB&quot;, &quot;PCSK2&quot;, &quot;MALAT1&quot;, &quot;IGFBP7&quot;,
1031+
&quot;INS&quot;, &quot;IAPP&quot;, &quot;HADH&quot;, &quot;NPTX2&quot;, &quot;MAFA&quot;, &quot;RBP4&quot;, &quot;PCSK1&quot;, &quot;SCD5&quot;,
1032+
&quot;SST&quot;, &quot;AQP3&quot;, &quot;PPY&quot;, &quot;LEPR&quot;, &quot;DPYSL3&quot;, &quot;AKAP12&quot;)
1033+
# Features selected for plot: GCG GC TTR TM4SF4 FAP LOXL4 IRX2 ALDH1A1 INS IAPP MAFA NPTX2 ADCYAP1 PFKFB2 MEG3 DLK1 SST AQP3 LEPR AKAP12 MTUS1 EGR1 PPY S100A6
1034+
c(&quot;GCG&quot;, &quot;GC&quot;, &quot;TTR&quot;, &quot;TM4SF4&quot;, &quot;FAP&quot;, &quot;LOXL4&quot;, &quot;IRX2&quot;, &quot;ALDH1A1&quot;,
1035+
&quot;INS&quot;, &quot;IAPP&quot;, &quot;MAFA&quot;, &quot;NPTX2&quot;, &quot;ADCYAP1&quot;, &quot;PFKFB2&quot;, &quot;MEG3&quot;,
1036+
&quot;DLK1&quot;, &quot;SST&quot;, &quot;AQP3&quot;, &quot;LEPR&quot;, &quot;AKAP12&quot;, &quot;MTUS1&quot;, &quot;EGR1&quot;, &quot;PPY&quot;,
1037+
&quot;S100A6&quot;)</code></pre>
7701038
<br>
7711039
<p>
7721040
<button type="button" class="btn btn-default btn-workflowr btn-workflowr-sessioninfo" data-toggle="collapse" data-target="#workflowr-sessioninfo" style="display: block;">
@@ -794,7 +1062,7 @@ <h3>A more interpretable annotation plot</h3>
7941062
# [1] stats graphics grDevices utils datasets methods base
7951063
#
7961064
# other attached packages:
797-
# [1] cowplot_1.1.3 ggplot2_3.5.0 fastTopics_0.7-21 flashier_1.0.55
1065+
# [1] cowplot_1.1.3 ggplot2_3.5.0 fastTopics_0.7-24 flashier_1.0.55
7981066
# [5] ebnm_1.1-34 Matrix_1.6-5
7991067
#
8001068
# loaded via a namespace (and not attached):
@@ -830,7 +1098,6 @@ <h3>A more interpretable annotation plot</h3>
8301098
# [88] pkgconfig_2.0.3</code></pre>
8311099
</div>
8321100
</div>
833-
</div>
8341101

8351102

8361103
<!-- Adjust MathJax settings so that all math formulae are shown using

0 commit comments

Comments
 (0)