Skip to content

Commit

Permalink
Docs files for scanpy labs 02-06
Browse files Browse the repository at this point in the history
  • Loading branch information
asabjorklund committed Jan 19, 2024
1 parent 8b6886e commit ec15d5a
Show file tree
Hide file tree
Showing 91 changed files with 899 additions and 917 deletions.
42 changes: 26 additions & 16 deletions docs/labs/scanpy/scanpy_02_dimred.html
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ <h1 class="title"><i class="fa-brands fa-hubspot" aria-label="hubspot"></i> Dime
<div>
<div class="quarto-title-meta-heading">Published</div>
<div class="quarto-title-meta-contents">
<p class="date">16-Jan-2024</p>
<p class="date">19-Jan-2024</p>
</div>
</div>

Expand Down Expand Up @@ -282,10 +282,10 @@ <h2 data-number="1" class="anchored" data-anchor-id="meta-dimred_prep"><span cla
<span id="cb2-12"><a href="#cb2-12" aria-hidden="true" tabindex="-1"></a>adata <span class="op">=</span> sc.read_h5ad(path_file)</span>
<span id="cb2-13"><a href="#cb2-13" aria-hidden="true" tabindex="-1"></a>adata</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="2">
<pre><code>AnnData object with n_obs × n_vars = 5725 × 18830
<pre><code>AnnData object with n_obs × n_vars = 7222 × 19468
obs: 'type', 'sample', 'batch', 'n_genes_by_counts', 'total_counts', 'total_counts_mt', 'pct_counts_mt', 'total_counts_ribo', 'pct_counts_ribo', 'total_counts_hb', 'pct_counts_hb', 'percent_mt2', 'n_counts', 'n_genes', 'percent_chrY', 'XIST-counts', 'S_score', 'G2M_score', 'phase', 'doublet_scores', 'predicted_doublets', 'doublet_info'
var: 'gene_ids', 'feature_types', 'genome', 'mt', 'ribo', 'hb', 'n_cells_by_counts', 'mean_counts', 'pct_dropout_by_counts', 'total_counts', 'n_cells'
uns: 'doublet_info_colors', 'hvg', 'log1p', 'neighbors', 'pca', 'sample_colors', 'umap'
uns: 'doublet_info_colors', 'hvg', 'log1p', 'neighbors', 'pca', 'phase_colors', 'sample_colors', 'umap'
obsm: 'X_pca', 'X_umap'
obsp: 'connectivities', 'distances'</code></pre>
</div>
Expand All @@ -309,10 +309,10 @@ <h2 data-number="1" class="anchored" data-anchor-id="meta-dimred_prep"><span cla
WARNING: adata.X seems to be already log-transformed.</code></pre>
</div>
<div class="cell-output cell-output-display" data-execution_count="3">
<pre><code>AnnData object with n_obs × n_vars = 5725 × 18830
<pre><code>AnnData object with n_obs × n_vars = 7222 × 19468
obs: 'type', 'sample', 'batch', 'n_genes_by_counts', 'total_counts', 'total_counts_mt', 'pct_counts_mt', 'total_counts_ribo', 'pct_counts_ribo', 'total_counts_hb', 'pct_counts_hb', 'percent_mt2', 'n_counts', 'n_genes', 'percent_chrY', 'XIST-counts', 'S_score', 'G2M_score', 'phase', 'doublet_scores', 'predicted_doublets', 'doublet_info'
var: 'gene_ids', 'feature_types', 'genome', 'mt', 'ribo', 'hb', 'n_cells_by_counts', 'mean_counts', 'pct_dropout_by_counts', 'total_counts', 'n_cells'
uns: 'doublet_info_colors', 'hvg', 'log1p', 'neighbors', 'pca', 'sample_colors', 'umap'
uns: 'doublet_info_colors', 'hvg', 'log1p', 'neighbors', 'pca', 'phase_colors', 'sample_colors', 'umap'
obsm: 'X_pca', 'X_umap'
obsp: 'connectivities', 'distances'</code></pre>
</div>
Expand All @@ -339,7 +339,7 @@ <h2 data-number="2" class="anchored" data-anchor-id="meta-dimred_fs"><span class
'means', float vector (adata.var)
'dispersions', float vector (adata.var)
'dispersions_norm', float vector (adata.var)
Highly variable genes: 2727</code></pre>
Highly variable genes: 2626</code></pre>
</div>
<div class="cell-output cell-output-display">
<div class="quarto-figure quarto-figure-left">
Expand All @@ -365,7 +365,7 @@ <h2 data-number="3" class="anchored" data-anchor-id="meta-dimred_zs"><span class
<div class="cell-output cell-output-stdout">
<pre><code>regressing out ['total_counts', 'pct_counts_mt']
sparse input is densified and may lead to high memory use
finished (0:00:37)</code></pre>
finished (0:00:46)</code></pre>
</div>
</div>
</section>
Expand Down Expand Up @@ -476,7 +476,7 @@ <h2 data-number="5" class="anchored" data-anchor-id="meta-dimred_tsne"><span cla
using 'X_pca' with n_pcs = 30
using sklearn.manifold.TSNE
finished: added
'X_tsne', tSNE coordinates (adata.obsm) (0:00:10)</code></pre>
'X_tsne', tSNE coordinates (adata.obsm) (0:00:13)</code></pre>
</div>
</div>
<p>We can now plot the tSNE colored per dataset. We can clearly see the effect of batches present in the dataset.</p>
Expand Down Expand Up @@ -511,7 +511,7 @@ <h2 data-number="6" class="anchored" data-anchor-id="meta-dimred_umap"><span cla
<div class="cell-output cell-output-stdout">
<pre><code>computing UMAP
finished: added
'X_umap', UMAP coordinates (adata.obsm) (0:00:09)</code></pre>
'X_umap', UMAP coordinates (adata.obsm) (0:00:12)</code></pre>
</div>
<div class="cell-output cell-output-display">
<div class="quarto-figure quarto-figure-left">
Expand Down Expand Up @@ -539,7 +539,7 @@ <h2 data-number="6" class="anchored" data-anchor-id="meta-dimred_umap"><span cla
<div class="cell-output cell-output-stdout">
<pre><code>computing UMAP
finished: added
'X_umap', UMAP coordinates (adata.obsm) (0:00:10)</code></pre>
'X_umap', UMAP coordinates (adata.obsm) (0:00:13)</code></pre>
</div>
<div class="cell-output cell-output-display">
<div class="quarto-figure quarto-figure-left">
Expand Down Expand Up @@ -678,12 +678,22 @@ <h2 data-number="8" class="anchored" data-anchor-id="meta-dimred_save"><span cla
<div class="cell" data-execution_count="19">
<div class="sourceCode cell-code" id="cb30"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb30-1"><a href="#cb30-1" aria-hidden="true" tabindex="-1"></a>adata.write_h5ad(<span class="st">'data/covid/results/scanpy_covid_qc_dr.h5ad'</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<p>Just a reminder, you need to keep in mind what you have in the X matrix. After these operations you have an X matrix with only variable genes, that are normalized, logtransformed and scaled.</p>
<p>We stored the expression of all genes in <code>raw.X</code> after doing lognormalization so that matrix is a sparse matrix with logtransformed values.</p>
<div class="cell" data-execution_count="20">
<div class="sourceCode cell-code" id="cb31"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb31-1"><a href="#cb31-1" aria-hidden="true" tabindex="-1"></a><span class="bu">print</span>(adata.X.shape)</span>
<span id="cb31-2"><a href="#cb31-2" aria-hidden="true" tabindex="-1"></a><span class="bu">print</span>(adata.raw.X.shape)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<span id="cb31-2"><a href="#cb31-2" aria-hidden="true" tabindex="-1"></a><span class="bu">print</span>(adata.raw.X.shape)</span>
<span id="cb31-3"><a href="#cb31-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb31-4"><a href="#cb31-4" aria-hidden="true" tabindex="-1"></a><span class="bu">print</span>(adata.X[:<span class="dv">3</span>,:<span class="dv">3</span>])</span>
<span id="cb31-5"><a href="#cb31-5" aria-hidden="true" tabindex="-1"></a><span class="bu">print</span>(adata.raw.X[:<span class="dv">10</span>,:<span class="dv">10</span>])</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>(5725, 2727)
(5725, 18830)</code></pre>
<pre><code>(7222, 2626)
(7222, 19468)
[[-0.16998859 -0.06050171 -0.08070081]
[-0.19315341 -0.09975121 -0.31379319]
[-0.2051203 -0.11680799 -0.43194618]]
(1, 4) 0.7825693876867097
(8, 7) 1.1311041336746985</code></pre>
</div>
</div>
</section>
Expand Down Expand Up @@ -815,9 +825,9 @@ <h2 data-number="9" class="anchored" data-anchor-id="meta-session"><span class="
notebook 6.5.4
-----
Python 3.10.11 | packaged by conda-forge | (main, May 10 2023, 18:58:44) [GCC 11.3.0]
Linux-6.5.11-linuxkit-x86_64-with-glibc2.35
Linux-6.4.16-linuxkit-x86_64-with-glibc2.35
-----
Session information updated at 2024-01-16 23:19</code></pre>
Session information updated at 2024-01-19 14:53</code></pre>
</div>
</div>
</details>
Expand Down Expand Up @@ -1069,7 +1079,7 @@ <h2 data-number="9" class="anchored" data-anchor-id="meta-session"><span class="
<div class="nav-footer-right">Published with <a href="https://quarto.org/">Quarto</a> v1.3.450</div>
</div>
</footer>
<script>var lightboxQuarto = GLightbox({"closeEffect":"zoom","selector":".lightbox","descPosition":"bottom","loop":true,"openEffect":"zoom"});</script>
<script>var lightboxQuarto = GLightbox({"closeEffect":"zoom","selector":".lightbox","openEffect":"zoom","loop":true,"descPosition":"bottom"});</script>



Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit ec15d5a

Please sign in to comment.