Last active
December 13, 2019 02:36
-
-
Save kozo2/24d3933bd7dce3eda8990f26cd38b4a7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "Exercise2: scTensorのデモ" | |
output: html_notebook | |
--- | |
<p><img alt="logo" width="200" src="https://dl.dropboxusercontent.com/s/nm3k2p6i3k6d6gl/sctensor.png" align="left" /></p> | |
<h1>Exercise2: scTensorのデモ</h1> | |
このノートブックでは、1細胞RNA-Seqデータ内に含まれる細胞間相互作用(CCI)を検出するためのR/Bioconductorパッケージ、scTensorの使い方について説明します | |
まずは、このノートブックの実行に必要なパッケージのインストールとロードを行います | |
```{r} | |
# パッケージロード | |
library("scTensor") | |
library("SingleCellExperiment") | |
library("LRBase.Hsa.eg.db") | |
library("MeSH.Hsa.eg.db") | |
``` | |
今回は、[Li, Li et al., 2017, Cell](https://www.sciencedirect.com/science/article/pii/S1934590917300784?via%3Dihub)で報告された、ヒトの性腺内部に含まれる生殖系細胞(Germline Cells)と、ニッチ環境を形成する体細胞(Somatic Cells)間のCCIについて調べます | |
<p><img alt="logo2" width="1000" src="https://dl.dropboxusercontent.com/s/bax9wbdsulr15tj/germline.jpg" /></p> | |
[RNA-Seq Blog](https://www.rna-seqblog.com/single-cell-rna-seq-analysis-maps-development-of-human-germline-cells/) | |
この論文に関係したデータは、以下の3つのRオブジェクトとして、scTensorパッケージ内に保存されているため、data関数で以下のように呼び出すことができます | |
なお、__発現量行列の遺伝子は、テストデータとして公開する際、データサイズの制限で、[Highly Variable Genes](http://pklab.med.harvard.edu/scw2014/subpop_tutorial.html)という基準のもと、かなり数を減らしているので、ここでは、あくまでツールの操作感を知るためにこのデータを用います__(生物学的考察までは保証しません、例えば、この論文で注目している、BMPシグナル系のリガンド・受容体ペアの発現は、数を減らした関係で再現できていません) | |
```{r} | |
data(GermMale) # 発現量行列 | |
data(labelGermMale) # 細胞型ラベル | |
data(tsneGermMale) # t-SNEの二次元座標 | |
``` | |
以下のように、GermMaleは行列、labelGermMaleはベクトルです | |
tsneGermMaleはRtsneという別のRパッケージの出力オブジェクトであり、tsneGermMale$Yの部分に、t-SNEの二次元座標が保管されています | |
```{r} | |
is(GermMale) # 発現量行列 | |
is(labelGermMale) # 細胞型ラベル | |
is(tsneGermMale) # Rtsne関数の出力オブジェクト | |
is(tsneGermMale$Y) # t-SNEの二次元座標 | |
``` | |
このt-SNEの図を見てわかるように、下側に位置する暖色系(赤、朱色、オレンジ)の点が性細胞、上側に位置する寒色系(薄緑、緑、水色、紫)の点が体細胞です | |
```{r} | |
par(ask=FALSE) | |
plot(tsneGermMale$Y, col=labelGermMale, | |
pch=16, main="Germline - Somatic Niche Interaction", | |
xlab="t-SNE1", ylab="t-SNE2", bty="n") | |
text(14, 5, "FGC-1", col="#9E0142", cex=2) | |
text(-4, -8, "FGC-2", col="#D53E4F", cex=2) | |
text(-10, 3, "FGC-3", col="#F46D43", cex=2) | |
text(5, 13, "Soma-1", col="#ABDDA4", cex=2) | |
text(-5, 22, "Soma-2", col="#66C2A5", cex=2) | |
text(0, 26, "Soma-3", col="#5E4FA2", cex=2) | |
text(13, 21, "Soma-4", col="#3288BD", cex=2) | |
``` | |
scTensorの入力は、[SingleCellExperiment](https://www.bioconductor.org/packages/release/bioc/html/SingleCellExperiment.html)パッケージで定義された、SingleCellExperimentオブジェクトである必要があります | |
SingleCellExperimentオブジェクトの作成は簡単で、SingleCellExperimentという名前の関数に、発現量行列を以下のように指定するだけです | |
```{r} | |
sce <- SingleCellExperiment(assays=list(counts = GermMale)) | |
``` | |
また、必須ではありませんが、最後のレポートの見やすさも考えて、推奨しているタスクとして、以下のようにこのsceオブジェクトに二次元の次元圧縮の座標を登録します | |
```{r} | |
reducedDims(sce) <- SimpleList(TSNE=tsneGermMale$Y) | |
``` | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment