This vignette covers what takes place following the generation of SCONE output detailed in TheSconeWorkflow.Rmd. The obvious step that needs to take place is the Scone generated columns being merged into the original input data. The user gets the option of log base 10 transforming q values, which is easier to visualize. The user also gets the option to run t-SNE on the data, such that said maps can be colored by SCONE generated values. In this case, t-SNE is run utilizing the Rtsne package, using the same markers that were used as input for the KNN. generation.
library(Sconify)
wand.final <- PostProcessing(scone.output = wand.scone,
cell.data = wand.combined,
input = input.markers)
## Read the 1000 x 27 data matrix successfully!
## OpenMP is working. 1 threads.
## Using no_dims = 2, perplexity = 30.000000, and theta = 0.500000
## Computing input similarities...
## Building tree...
## Done in 0.11 seconds (sparsity = 0.126174)!
## Learning embedding...
## Iteration 50: error is 64.530231 (50 iterations in 0.23 seconds)
## Iteration 100: error is 60.279152 (50 iterations in 0.15 seconds)
## Iteration 150: error is 59.921166 (50 iterations in 0.14 seconds)
## Iteration 200: error is 59.786130 (50 iterations in 0.14 seconds)
## Iteration 250: error is 59.693083 (50 iterations in 0.14 seconds)
## Iteration 300: error is 1.332114 (50 iterations in 0.12 seconds)
## Iteration 350: error is 1.219874 (50 iterations in 0.12 seconds)
## Iteration 400: error is 1.188903 (50 iterations in 0.12 seconds)
## Iteration 450: error is 1.175484 (50 iterations in 0.12 seconds)
## Iteration 500: error is 1.168205 (50 iterations in 0.12 seconds)
## Iteration 550: error is 1.164039 (50 iterations in 0.12 seconds)
## Iteration 600: error is 1.161848 (50 iterations in 0.12 seconds)
## Iteration 650: error is 1.158910 (50 iterations in 0.12 seconds)
## Iteration 700: error is 1.157568 (50 iterations in 0.12 seconds)
## Iteration 750: error is 1.156387 (50 iterations in 0.12 seconds)
## Iteration 800: error is 1.155022 (50 iterations in 0.12 seconds)
## Iteration 850: error is 1.153997 (50 iterations in 0.12 seconds)
## Iteration 900: error is 1.152346 (50 iterations in 0.12 seconds)
## Iteration 950: error is 1.150439 (50 iterations in 0.12 seconds)
## Iteration 1000: error is 1.149121 (50 iterations in 0.12 seconds)
## Fitting performed in 2.58 seconds.
## # A tibble: 1,000 × 51
## CD3(Cd110)D…¹ CD3(C…² CD3(C…³ CD235…⁴ CD3(C…⁵ CD45(…⁶ CD19(…⁷ CD22(…⁸ IgD(N…⁹
## <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 -0.249 -0.105 0.988 -0.718 1.09 2.01 1.95 -0.253 -0.0921
## 2 -0.161 -0.241 -0.232 -1.92 -0.436 2.52 2.43 1.68 -0.157
## 3 -0.983 -1.42 -2.20 -1.20 -1.72 -2.22 0.718 -0.479 -0.525
## 4 0.130 -0.167 1.26 0.959 -0.228 0.850 -0.217 -0.217 1.76
## 5 -0.0527 0.330 0.262 -0.0624 -0.386 2.50 2.75 -0.166 1.77
## 6 -0.154 0.535 0.0881 -1.33 1.76 0.758 1.34 -0.231 0.889
## 7 -0.171 0.0286 -0.508 -0.823 -0.234 3.75 2.84 1.92 0.399
## 8 -0.914 -0.996 -0.512 0.304 -0.420 3.00 2.84 0.440 -0.0654
## 9 -0.592 -0.433 -0.360 -0.0968 1.44 2.15 -0.0166 -0.329 0.582
## 10 0.356 -0.131 -0.431 -0.859 -0.746 3.94 2.16 0.663 1.59
## # … with 990 more rows, 42 more variables: `CD79b(Nd146)Di` <dbl>,
## # `CD20(Sm147)Di` <dbl>, `CD34(Nd148)Di` <dbl>, `CD179a(Sm149)Di` <dbl>,
## # `CD72(Eu151)Di` <dbl>, `IgM(Eu153)Di` <dbl>, `Kappa(Sm154)Di` <dbl>,
## # `CD10(Gd156)Di` <dbl>, `Lambda(Gd157)Di` <dbl>, `CD24(Dy161)Di` <dbl>,
## # `TdT(Dy163)Di` <dbl>, `Rag1(Dy164)Di` <dbl>, `PreBCR(Ho165)Di` <dbl>,
## # `CD43(Er167)Di` <dbl>, `CD38(Er168)Di` <dbl>, `CD40(Er170)Di` <dbl>,
## # `CD33(Yb173)Di` <dbl>, `HLA-DR(Yb174)Di` <dbl>, Time <dbl>, …
## # A tibble: 1,000 × 34
## pCrkL(Lu175…¹ pCREB…² pBTK(…³ pS6(Y…⁴ cPARP…⁵ pPLCg…⁶ pSrc(…⁷ Ki67(…⁸ pErk1…⁹
## <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 0.996 1 0.963 0.976 1 0.849 0.931 0.992 1
## 2 0.994 1 0.878 0.995 0.938 0.849 0.993 0.992 1
## 3 0.943 1 0.878 1 0.932 1 0.943 0.992 1
## 4 0.996 1 0.878 1 1 0.797 0.931 0.992 1
## 5 0.982 1 0.963 0.976 0.932 0.976 0.925 0.992 0.998
## 6 1 1 0.949 0.996 1 0.797 0.946 0.992 1
## 7 0.939 1 0.878 0.976 0.989 0.794 0.981 0.992 0.977
## 8 0.982 1 0.878 1 1 0.895 0.944 0.894 0.977
## 9 0.982 1 0.963 0.714 0.989 0.960 0.931 0.997 0.977
## 10 0.943 1 0.975 0.976 0.984 0.834 0.992 0.920 0.977
## # … with 990 more rows, 25 more variables: `pSTAT3(Gd158)Di.IL7.qvalue` <dbl>,
## # `pAKT(Tb159)Di.IL7.qvalue` <dbl>, `pBLNK(Gd160)Di.IL7.qvalue` <dbl>,
## # `pP38(Tm169)Di.IL7.qvalue` <dbl>, `pSTAT5(Nd150)Di.IL7.qvalue` <dbl>,
## # `pSyk(Dy162)Di.IL7.qvalue` <dbl>, `tIkBa(Er166)Di.IL7.qvalue` <dbl>,
## # `pCrkL(Lu175)Di.IL7.change` <dbl>, `pCREB(Yb176)Di.IL7.change` <dbl>,
## # `pBTK(Yb171)Di.IL7.change` <dbl>, `pS6(Yb172)Di.IL7.change` <dbl>,
## # `cPARP(La139)Di.IL7.change` <dbl>, `pPLCg2(Pr141)Di.IL7.change` <dbl>, …
## # A tibble: 1,000 × 87
## CD3(Cd110)D…¹ CD3(C…² CD3(C…³ CD235…⁴ CD3(C…⁵ CD45(…⁶ CD19(…⁷ CD22(…⁸ IgD(N…⁹
## <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 -0.249 -0.105 0.988 -0.718 1.09 2.01 1.95 -0.253 -0.0921
## 2 -0.161 -0.241 -0.232 -1.92 -0.436 2.52 2.43 1.68 -0.157
## 3 -0.983 -1.42 -2.20 -1.20 -1.72 -2.22 0.718 -0.479 -0.525
## 4 0.130 -0.167 1.26 0.959 -0.228 0.850 -0.217 -0.217 1.76
## 5 -0.0527 0.330 0.262 -0.0624 -0.386 2.50 2.75 -0.166 1.77
## 6 -0.154 0.535 0.0881 -1.33 1.76 0.758 1.34 -0.231 0.889
## 7 -0.171 0.0286 -0.508 -0.823 -0.234 3.75 2.84 1.92 0.399
## 8 -0.914 -0.996 -0.512 0.304 -0.420 3.00 2.84 0.440 -0.0654
## 9 -0.592 -0.433 -0.360 -0.0968 1.44 2.15 -0.0166 -0.329 0.582
## 10 0.356 -0.131 -0.431 -0.859 -0.746 3.94 2.16 0.663 1.59
## # … with 990 more rows, 78 more variables: `CD79b(Nd146)Di` <dbl>,
## # `CD20(Sm147)Di` <dbl>, `CD34(Nd148)Di` <dbl>, `CD179a(Sm149)Di` <dbl>,
## # `CD72(Eu151)Di` <dbl>, `IgM(Eu153)Di` <dbl>, `Kappa(Sm154)Di` <dbl>,
## # `CD10(Gd156)Di` <dbl>, `Lambda(Gd157)Di` <dbl>, `CD24(Dy161)Di` <dbl>,
## # `TdT(Dy163)Di` <dbl>, `Rag1(Dy164)Di` <dbl>, `PreBCR(Ho165)Di` <dbl>,
## # `CD43(Er167)Di` <dbl>, `CD38(Er168)Di` <dbl>, `CD40(Er170)Di` <dbl>,
## # `CD33(Yb173)Di` <dbl>, `HLA-DR(Yb174)Di` <dbl>, Time <dbl>, …
# tSNE map shows highly responsive population of interest
TsneVis(wand.final,
"pSTAT5(Nd150)Di.IL7.change",
"IL7 -> pSTAT5 change")
If one has a large number of cells in the dataset (>100K), then t-SNE can become time-consuming and produce results that are less clean. As such, I provide a wrapper that allows one to subsample the final data and run t-SNE on the subsampled data, producing a new tibble that contains the subsampled data along with two t-SNE dimensions added to it. Note the two added dimensions at the end of the tibble are called “bh-SNE11” and “bh-SNE21”. This is because the dimensions “bh-SNE1” and “bh-SNE2” are already in the data, because t-SNE was run during the post processing step in this example. As I have stated, a user would realistically use this function with a much larger number of cells, in which case the user would have selected “tsne = FALSE” in the post.processing function detailed above in this vignette.
## Read the 500 x 27 data matrix successfully!
## OpenMP is working. 1 threads.
## Using no_dims = 2, perplexity = 30.000000, and theta = 0.500000
## Computing input similarities...
## Building tree...
## Done in 0.04 seconds (sparsity = 0.237872)!
## Learning embedding...
## Iteration 50: error is 55.028609 (50 iterations in 0.08 seconds)
## Iteration 100: error is 53.559055 (50 iterations in 0.07 seconds)
## Iteration 150: error is 53.254402 (50 iterations in 0.07 seconds)
## Iteration 200: error is 53.187679 (50 iterations in 0.07 seconds)
## Iteration 250: error is 53.151125 (50 iterations in 0.07 seconds)
## Iteration 300: error is 0.898450 (50 iterations in 0.07 seconds)
## Iteration 350: error is 0.826987 (50 iterations in 0.07 seconds)
## Iteration 400: error is 0.809513 (50 iterations in 0.07 seconds)
## Iteration 450: error is 0.802930 (50 iterations in 0.07 seconds)
## Iteration 500: error is 0.798355 (50 iterations in 0.07 seconds)
## Iteration 550: error is 0.792590 (50 iterations in 0.07 seconds)
## Iteration 600: error is 0.788515 (50 iterations in 0.07 seconds)
## Iteration 650: error is 0.786438 (50 iterations in 0.07 seconds)
## Iteration 700: error is 0.785089 (50 iterations in 0.07 seconds)
## Iteration 750: error is 0.784291 (50 iterations in 0.07 seconds)
## Iteration 800: error is 0.783552 (50 iterations in 0.07 seconds)
## Iteration 850: error is 0.782555 (50 iterations in 0.07 seconds)
## Iteration 900: error is 0.781214 (50 iterations in 0.07 seconds)
## Iteration 950: error is 0.780750 (50 iterations in 0.07 seconds)
## Iteration 1000: error is 0.780583 (50 iterations in 0.07 seconds)
## Fitting performed in 1.42 seconds.
## # A tibble: 500 × 89
## CD3(Cd110)…¹ CD3(C…² CD3(C…³ CD235…⁴ CD3(C…⁵ CD45(…⁶ CD19(…⁷ CD22(N…⁸ IgD(N…⁹
## <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 0.765 2.46 1.04 0.986 0.496 2.91 1.42 -1.42e-1 1.16
## 2 -0.124 0.525 0.280 -0.231 -0.250 3.72 2.69 -2.09e-1 1.35
## 3 -0.224 -0.501 -0.133 -0.477 -0.678 3.49 2.08 1.02e+0 -0.138
## 4 -0.499 -0.574 -0.696 -0.611 -1.01 2.41 -0.0616 -1.37e-1 1.18
## 5 -0.663 -0.394 -0.675 -1.18 1.30 2.43 1.76 3.72e-1 -0.0486
## 6 -0.200 0.0834 -0.187 0.644 0.235 3.79 -0.212 2.31e+0 -0.173
## 7 0.785 0.387 -0.380 -0.207 0.141 3.00 1.19 -2.42e-1 -0.177
## 8 -0.264 1.77 2.83 -1.57 0.912 2.59 -0.178 1.28e+0 0.270
## 9 0.00481 -0.0967 0.210 -1.45 -0.0709 0.573 0.916 -1.08e-1 -0.0144
## 10 -0.518 -0.304 1.99 0.172 -0.428 -1.33 -0.0252 -5.72e-4 0.972
## # … with 490 more rows, 80 more variables: `CD79b(Nd146)Di` <dbl>,
## # `CD20(Sm147)Di` <dbl>, `CD34(Nd148)Di` <dbl>, `CD179a(Sm149)Di` <dbl>,
## # `CD72(Eu151)Di` <dbl>, `IgM(Eu153)Di` <dbl>, `Kappa(Sm154)Di` <dbl>,
## # `CD10(Gd156)Di` <dbl>, `Lambda(Gd157)Di` <dbl>, `CD24(Dy161)Di` <dbl>,
## # `TdT(Dy163)Di` <dbl>, `Rag1(Dy164)Di` <dbl>, `PreBCR(Ho165)Di` <dbl>,
## # `CD43(Er167)Di` <dbl>, `CD38(Er168)Di` <dbl>, `CD40(Er170)Di` <dbl>,
## # `CD33(Yb173)Di` <dbl>, `HLA-DR(Yb174)Di` <dbl>, Time <dbl>, …