diff --git a/articles/how_to_create_supercells.html b/articles/how_to_create_supercells.html index 855f2ac..7a5e1d5 100644 --- a/articles/how_to_create_supercells.html +++ b/articles/how_to_create_supercells.html @@ -146,19 +146,19 @@

Preparing your datasetdat <- simCytoData(nmarkers = n_markers, ncells = rep(10000, n_samples)) head(dat) #> Marker_1 Marker_2 Marker_3 Marker_4 Marker_5 Marker_6 Marker_7 Marker_8 -#> 1: 13.26051 16.93396 4.648167 7.614336 13.16527 14.20685 10.26838 18.69479 -#> 2: 12.31247 15.55551 5.845648 7.817869 12.13161 11.19494 11.29331 19.37165 -#> 3: 11.53995 18.01155 5.942080 9.169292 13.05679 11.74417 11.04089 17.84166 -#> 4: 14.37444 15.63743 5.660410 6.981808 12.29892 12.14983 12.39524 21.86125 -#> 5: 13.33747 17.32484 5.236502 6.711492 12.98148 11.70372 11.43519 18.31638 -#> 6: 11.42664 19.57554 5.718882 8.022608 13.08475 13.07168 11.13570 19.33357 -#> Marker_9 Marker_10 Marker_11 Marker_12 Marker_13 Marker_14 Marker_15 -#> 1: 15.09595 12.22340 13.13038 5.465730 6.259695 11.323180 9.723435 -#> 2: 17.49136 13.57375 13.03428 4.579316 7.412500 10.282344 10.752968 -#> 3: 15.97173 13.56235 13.58457 6.016201 8.553632 10.141480 10.421929 -#> 4: 15.87837 14.80048 13.92161 5.487170 6.675427 9.753265 11.417760 -#> 5: 17.07165 13.23186 13.36450 4.306789 7.423704 11.166471 8.460497 -#> 6: 16.03938 15.14831 13.21584 5.540360 4.816466 11.185558 8.625391 +#> 1: 3.911267 14.83726 12.51689 12.62375 8.223708 5.362362 10.63506 13.02567 +#> 2: 6.200052 13.92824 13.61499 11.72022 8.738842 5.649981 11.36196 16.58609 +#> 3: 3.440594 14.40114 14.14425 11.37746 9.476859 4.804920 10.56520 13.92912 +#> 4: 4.885428 14.98846 14.01897 13.10771 8.504240 5.036536 13.29726 12.90628 +#> 5: 4.136757 15.66933 14.83591 11.48224 9.315948 5.070950 12.82232 14.35390 +#> 6: 6.410793 12.30549 15.27480 11.32005 7.359705 3.812325 10.87147 14.51132 +#> Marker_9 Marker_10 Marker_11 Marker_12 Marker_13 Marker_14 Marker_15 +#> 1: 10.154119 15.92435 10.523631 20.31748 11.505223 9.992914 11.14838 +#> 2: 9.423623 16.85166 12.061645 16.93791 10.458019 10.240393 13.23612 +#> 3: 11.599579 15.03120 10.417631 19.40872 10.181382 9.272730 11.52143 +#> 4: 11.757270 17.60875 11.159880 19.17082 9.333655 10.400236 10.80259 +#> 5: 12.839921 16.06602 9.659734 17.40636 10.951341 9.470453 11.68651 +#> 6: 13.366770 15.09505 8.911489 19.76572 9.150376 10.223870 11.96007 #> Sample Cell_Id #> 1: Sample_1 Cell_1 #> 2: Sample_1 Cell_2 @@ -187,33 +187,33 @@

Preparing your dataset head(dat[, marker_cols_asinh, with = FALSE]) #> Marker_1_asinh Marker_2_asinh Marker_3_asinh Marker_4_asinh Marker_5_asinh -#> 1: 1.702285 1.934145 0.8307316 1.207381 1.695544 -#> 2: 1.633211 1.853006 0.9960593 1.229518 1.619515 -#> 3: 1.573460 1.993454 1.0085360 1.366767 1.687812 -#> 4: 1.778122 1.858008 0.9717564 1.135865 1.632191 -#> 5: 1.707702 1.956051 0.9144276 1.103980 1.682413 -#> 6: 1.564413 2.073915 0.9794760 1.251377 1.689810 +#> 1: 0.7187504 1.808103 1.648485 1.656384 1.272460 +#> 2: 1.0413374 1.748391 1.727010 1.587700 1.324790 +#> 3: 0.6429059 1.779875 1.762888 1.560462 1.395841 +#> 4: 0.8650775 1.817716 1.754504 1.691449 1.301250 +#> 5: 0.7538839 1.859950 1.808017 1.568861 1.380723 +#> 6: 1.0675259 1.632686 1.835685 1.555833 1.179097 #> Marker_6_asinh Marker_7_asinh Marker_8_asinh Marker_9_asinh Marker_10_asinh -#> 1: 1.767052 1.467386 2.029376 1.824497 1.626487 -#> 2: 1.545676 1.553670 2.063773 1.965246 1.724163 -#> 3: 1.589578 1.533039 1.984325 1.878176 1.723374 -#> 4: 1.620903 1.639422 2.181253 1.872582 1.805752 -#> 5: 1.586405 1.565098 2.009634 1.941915 1.700262 -#> 6: 1.688877 1.540834 2.061869 1.882210 1.827785 +#> 1: 0.9317023 1.499036 1.685584 1.457336 1.875341 +#> 2: 0.9703748 1.559215 1.914255 1.390861 1.929474 +#> 3: 0.8535143 1.493075 1.748450 1.578191 1.820418 +#> 4: 0.8865311 1.704875 1.676993 1.590604 1.971679 +#> 5: 0.8913720 1.670910 1.776772 1.672188 1.883794 +#> 6: 0.7030894 1.518971 1.787078 1.709757 1.824441 #> Marker_11_asinh Marker_12_asinh Marker_13_asinh Marker_14_asinh -#> 1: 1.693063 0.9457285 1.0488038 1.556086 -#> 2: 1.686202 0.8206116 1.1850166 1.468608 -#> 3: 1.724910 1.0180458 1.3062462 1.456219 -#> 4: 1.747942 0.9486197 1.0996630 1.421346 -#> 5: 1.709598 0.7798671 1.1862691 1.543352 -#> 6: 1.699128 0.9557659 0.8551784 1.544911 +#> 1: 1.489513 2.109999 1.570695 1.443001 +#> 2: 1.614170 1.934369 1.483867 1.464932 +#> 3: 1.480377 2.065625 1.459742 1.376628 +#> 4: 1.542813 2.053686 1.382396 1.478871 +#> 5: 1.412780 1.960563 1.525626 1.395243 +#> 6: 1.341811 2.083285 1.364954 1.463482 #> Marker_15_asinh -#> 1: 1.418622 -#> 2: 1.509024 -#> 3: 1.480749 -#> 4: 1.563701 -#> 5: 1.296808 -#> 6: 1.313466 +#> 1: 1.541872 +#> 2: 1.700563 +#> 3: 1.571986 +#> 4: 1.513200 +#> 5: 1.585051 +#> 6: 1.606362

We will also create a column Cell_id_dummy which uniquely identify each cell. It will have values such as Cell_1, Cell_2, all the way until Cell_x where @@ -287,33 +287,33 @@

Supercell expression matrix
 head(supercells$supercell_expression_matrix)
 #>    Marker_1_asinh Marker_2_asinh Marker_3_asinh Marker_4_asinh Marker_5_asinh
-#> 1:       1.643158       1.907332      0.8153221       1.169835       1.649817
-#> 2:       1.621103       1.892630      0.9636129       1.096485       1.597267
-#> 3:       1.661288       1.900047      0.6995604       1.191519       1.667012
-#> 4:       1.634313       1.915696      1.0754045       1.247078       1.619922
-#> 5:       1.616409       1.890359      0.7616117       1.143792       1.646885
-#> 6:       1.703777       1.916678      0.9373116       1.158010       1.577142
+#> 1:      0.7887688       1.785356       1.754431       1.588763       1.263602
+#> 2:      1.0797385       1.803940       1.720184       1.534222       1.250625
+#> 3:      0.9234995       1.817283       1.755081       1.546211       1.280063
+#> 4:      1.0205243       1.796828       1.736790       1.487011       1.202033
+#> 5:      0.9996782       1.800857       1.736689       1.618613       1.274462
+#> 6:      1.0275357       1.799934       1.729462       1.568709       1.274037
 #>    Marker_6_asinh Marker_7_asinh Marker_8_asinh Marker_9_asinh Marker_10_asinh
-#> 1:       1.641203       1.504391       2.056454       1.923121        1.773593
-#> 2:       1.623322       1.507671       2.062644       1.892218        1.752730
-#> 3:       1.593256       1.489894       2.042796       1.898490        1.751634
-#> 4:       1.630673       1.458372       2.066243       1.907359        1.760180
-#> 5:       1.679005       1.554171       2.055716       1.916725        1.750212
-#> 6:       1.671758       1.473018       2.039974       1.904624        1.780050
+#> 1:      1.0568480       1.471808       1.742531       1.536523        1.895745
+#> 2:      0.8973970       1.548641       1.778694       1.584895        1.914465
+#> 3:      1.0854014       1.638187       1.796407       1.566501        1.913043
+#> 4:      1.0318368       1.555554       1.750030       1.557390        1.908506
+#> 5:      0.7619424       1.606388       1.761063       1.400137        1.906447
+#> 6:      1.0985402       1.537728       1.747352       1.440771        1.913271
 #>    Marker_11_asinh Marker_12_asinh Marker_13_asinh Marker_14_asinh
-#> 1:        1.710697       1.0844890        1.151371        1.456152
-#> 2:        1.706101       1.0261988        1.171544        1.506499
-#> 3:        1.677037       0.9669220        1.166216        1.401009
-#> 4:        1.708883       0.7747316        1.089448        1.492407
-#> 5:        1.694421       0.7652433        1.098150        1.328574
-#> 6:        1.715706       0.9424568        1.268092        1.541633
+#> 1:        1.336033        2.028860        1.298781        1.440736
+#> 2:        1.308154        2.013720        1.423327        1.240937
+#> 3:        1.324362        2.023927        1.432922        1.274848
+#> 4:        1.246893        2.011844        1.508924        1.328908
+#> 5:        1.474889        2.011993        1.415524        1.386133
+#> 6:        1.424232        2.024207        1.453296        1.243065
 #>    Marker_15_asinh   Sample                 SuperCellId
-#> 1:        1.410715 Sample_1 SuperCell_1_Sample_Sample_1
-#> 2:        1.257193 Sample_1 SuperCell_2_Sample_Sample_1
-#> 3:        1.261979 Sample_1 SuperCell_3_Sample_Sample_1
-#> 4:        1.499962 Sample_1 SuperCell_4_Sample_Sample_1
-#> 5:        1.394656 Sample_1 SuperCell_5_Sample_Sample_1
-#> 6:        1.202334 Sample_1 SuperCell_6_Sample_Sample_1
+#> 1: 1.625278 Sample_1 SuperCell_1_Sample_Sample_1 +#> 2: 1.579759 Sample_1 SuperCell_2_Sample_Sample_1 +#> 3: 1.605998 Sample_1 SuperCell_3_Sample_Sample_1 +#> 4: 1.533573 Sample_1 SuperCell_4_Sample_Sample_1 +#> 5: 1.537838 Sample_1 SuperCell_5_Sample_Sample_1 +#> 6: 1.625689 Sample_1 SuperCell_6_Sample_Sample_1

Therein, we will have the following columns:

  1. All the markers we previously specified in the @@ -363,12 +363,12 @@

    Supercell cell map
     head(supercells$supercell_cell_map)
     #>                      SuperCellID CellId   Sample
    -#> 1:  SuperCell_38_Sample_Sample_1 Cell_1 Sample_1
    -#> 2: SuperCell_242_Sample_Sample_1 Cell_2 Sample_1
    -#> 3:  SuperCell_99_Sample_Sample_1 Cell_3 Sample_1
    -#> 4: SuperCell_282_Sample_Sample_1 Cell_4 Sample_1
    -#> 5: SuperCell_300_Sample_Sample_1 Cell_5 Sample_1
    -#> 6: SuperCell_426_Sample_Sample_1 Cell_6 Sample_1
    +#> 1: SuperCell_59_Sample_Sample_1 Cell_1 Sample_1 +#> 2: SuperCell_249_Sample_Sample_1 Cell_2 Sample_1 +#> 3: SuperCell_427_Sample_Sample_1 Cell_3 Sample_1 +#> 4: SuperCell_107_Sample_Sample_1 Cell_4 Sample_1 +#> 5: SuperCell_164_Sample_Sample_1 Cell_5 Sample_1 +#> 6: SuperCell_227_Sample_Sample_1 Cell_6 Sample_1

    This map is very useful if we later need to expand the supercells out. Additionally, this is also the reason why we need to have a column in the dataset which uniquely identify each cell.

    @@ -484,53 +484,53 @@

    Adjusting gamma supercells_addt_gamma[[1]] #> $supercell_expression_matrix #> Marker_1_asinh Marker_2_asinh Marker_3_asinh Marker_4_asinh -#> 1: 1.618907 1.907631 1.0072563 1.252648 -#> 2: 1.535807 1.878555 0.8230414 1.249378 -#> 3: 1.653043 1.884893 0.8829517 1.025791 -#> 4: 1.696478 1.926849 1.1740522 1.082426 -#> 5: 1.631592 1.905014 0.9199998 1.163173 +#> 1: 0.9320018 1.789335 1.731283 1.551380 +#> 2: 0.9060277 1.803178 1.741394 1.563690 +#> 3: 0.8033353 1.787410 1.700738 1.607098 +#> 4: 0.9489170 1.790874 1.734983 1.607087 +#> 5: 1.0178860 1.785430 1.733907 1.568372 #> --- -#> 2996: 1.139950 1.900943 1.3575769 1.958551 -#> 2997: 1.148204 1.783714 1.5540021 1.898327 -#> 2998: 1.138231 1.830399 1.4115217 1.925456 -#> 2999: 1.115342 1.819121 1.5356779 1.871019 -#> 3000: 1.230601 1.768583 1.3584141 1.912769 +#> 2996: 0.9427250 2.009554 1.279477 1.978510 +#> 2997: 1.0374571 1.996219 1.213171 1.923864 +#> 2998: 1.1224420 1.963518 1.317463 1.878919 +#> 2999: 0.9671641 2.008227 1.209016 1.829963 +#> 3000: 1.0507669 2.033083 1.252428 1.944653 #> Marker_5_asinh Marker_6_asinh Marker_7_asinh Marker_8_asinh -#> 1: 1.675394 1.594356 1.587978 2.0507386 -#> 2: 1.653235 1.626521 1.505604 2.0272368 -#> 3: 1.591307 1.662946 1.441340 2.0604707 -#> 4: 1.655110 1.573602 1.477954 2.0853431 -#> 5: 1.568925 1.653362 1.457803 2.0496127 +#> 1: 1.242994 0.9710434 1.5448413 1.7654222 +#> 2: 1.209378 0.7442933 1.6038634 1.7762536 +#> 3: 1.258348 0.9915318 1.5835597 1.7227574 +#> 4: 1.201311 1.0286385 1.4992039 1.7676266 +#> 5: 1.109505 0.6948621 1.5383390 1.7583671 #> --- -#> 2996: 1.795176 2.016813 1.849205 0.9122364 -#> 2997: 1.718403 2.021645 1.748029 0.7384978 -#> 2998: 1.810082 2.054379 1.652067 1.0630050 -#> 2999: 1.695296 2.064753 1.831022 0.8525944 -#> 3000: 1.703556 2.021000 1.770719 0.8914033 +#> 2996: 1.994188 1.9802987 1.0635962 1.0653876 +#> 2997: 2.000958 2.0201239 1.0456459 1.1448839 +#> 2998: 1.930298 1.9384819 0.7539548 1.2508786 +#> 2999: 1.983897 2.0046537 1.3703910 0.9789633 +#> 3000: 1.956602 2.0301099 1.3507904 1.1403825 #> Marker_9_asinh Marker_10_asinh Marker_11_asinh Marker_12_asinh -#> 1: 1.894422 1.752005 1.669240 1.0244124 -#> 2: 1.895347 1.738378 1.700202 0.8180268 -#> 3: 1.901746 1.727937 1.704476 1.0978080 -#> 4: 1.907193 1.811203 1.731037 1.0957119 -#> 5: 1.917960 1.775126 1.708457 0.8937115 +#> 1: 1.518542 1.907634 1.3911387 2.024894 +#> 2: 1.474904 1.898395 1.3712703 2.038662 +#> 3: 1.538333 1.858689 1.3449131 2.015894 +#> 4: 1.562792 1.911530 1.3972428 2.023205 +#> 5: 1.558192 1.917227 1.4352655 2.023435 #> --- -#> 2996: 1.819999 2.049516 1.896457 1.8650795 -#> 2997: 1.779117 2.040142 1.825453 1.8925735 -#> 2998: 1.825389 2.105406 1.882257 1.8739584 -#> 2999: 1.887215 2.064012 1.872201 1.6840172 -#> 3000: 1.847472 2.053358 1.868725 1.7958683 +#> 2996: 1.884170 1.265114 0.9446541 1.644660 +#> 2997: 1.893034 1.295976 0.9170071 1.513924 +#> 2998: 1.884689 1.223292 1.0582967 1.720190 +#> 2999: 1.862444 1.305982 1.0628570 1.653478 +#> 3000: 1.818277 1.170495 1.0605986 1.706870 #> Marker_13_asinh Marker_14_asinh Marker_15_asinh Sample -#> 1: 1.1931847 1.413249 1.5268084 Sample_1 -#> 2: 1.2093831 1.376127 1.4043985 Sample_1 -#> 3: 1.0345544 1.543852 1.3807248 Sample_1 -#> 4: 0.9364784 1.461238 1.2827517 Sample_1 -#> 5: 1.2105299 1.467063 1.2485890 Sample_1 +#> 1: 1.431277 1.357182 1.592556 Sample_1 +#> 2: 1.420618 1.234898 1.567322 Sample_1 +#> 3: 1.373082 1.419728 1.495968 Sample_1 +#> 4: 1.424757 1.195623 1.597984 Sample_1 +#> 5: 1.448395 1.314179 1.545810 Sample_1 #> --- -#> 2996: 1.9040646 1.406372 0.6992414 Sample_3 -#> 2997: 1.9379146 1.384341 1.0892370 Sample_3 -#> 2998: 2.0041233 1.420623 1.3140576 Sample_3 -#> 2999: 1.9097184 1.542547 1.2369247 Sample_3 -#> 3000: 1.9039728 1.335958 1.1536828 Sample_3 +#> 2996: 1.586902 1.929914 1.742345 Sample_3 +#> 2997: 1.368702 1.904601 1.687283 Sample_3 +#> 2998: 1.400606 1.827703 1.639502 Sample_3 +#> 2999: 1.499801 1.876100 1.678882 Sample_3 +#> 3000: 1.540135 1.895232 1.587085 Sample_3 #> SuperCellId #> 1: SuperCell_1_Sample_Sample_1 #> 2: SuperCell_2_Sample_Sample_1 @@ -546,17 +546,17 @@

    Adjusting gamma #> #> $supercell_cell_map #> SuperCellID CellId Sample -#> 1: SuperCell_297_Sample_Sample_1 Cell_1 Sample_1 -#> 2: SuperCell_488_Sample_Sample_1 Cell_2 Sample_1 -#> 3: SuperCell_326_Sample_Sample_1 Cell_3 Sample_1 -#> 4: SuperCell_756_Sample_Sample_1 Cell_4 Sample_1 -#> 5: SuperCell_50_Sample_Sample_1 Cell_5 Sample_1 +#> 1: SuperCell_143_Sample_Sample_1 Cell_1 Sample_1 +#> 2: SuperCell_316_Sample_Sample_1 Cell_2 Sample_1 +#> 3: SuperCell_641_Sample_Sample_1 Cell_3 Sample_1 +#> 4: SuperCell_60_Sample_Sample_1 Cell_4 Sample_1 +#> 5: SuperCell_202_Sample_Sample_1 Cell_5 Sample_1 #> --- -#> 29996: SuperCell_750_Sample_Sample_3 Cell_29996 Sample_3 -#> 29997: SuperCell_76_Sample_Sample_3 Cell_29997 Sample_3 -#> 29998: SuperCell_525_Sample_Sample_3 Cell_29998 Sample_3 -#> 29999: SuperCell_390_Sample_Sample_3 Cell_29999 Sample_3 -#> 30000: SuperCell_850_Sample_Sample_3 Cell_30000 Sample_3 +#> 29996: SuperCell_619_Sample_Sample_3 Cell_29996 Sample_3 +#> 29997: SuperCell_352_Sample_Sample_3 Cell_29997 Sample_3 +#> 29998: SuperCell_258_Sample_Sample_3 Cell_29998 Sample_3 +#> 29999: SuperCell_727_Sample_Sample_3 Cell_29999 Sample_3 +#> 30000: SuperCell_685_Sample_Sample_3 Cell_30000 Sample_3

    The output generated by recomputeSupercells is essentially a list:

      @@ -629,29 +629,29 @@

      Specifying diffe )
       rbind(head(supercell_expression_matrix, n = 3), tail(supercell_expression_matrix, n = 3))
      -#>     Marker_1  Marker_2 Marker_3 Marker_4  Marker_5  Marker_6 Marker_7  Marker_8
      -#> 1: 13.528431 20.197100 10.66962 11.43262 10.198854 10.951377 12.45046 14.331914
      -#> 2: 14.031970 19.657061 10.68137 10.91435  9.265711 10.175718 11.45509 15.841867
      -#> 3: 11.959244 21.721450 10.49142 12.80011  9.537898  9.331802 11.69437 15.274758
      -#> 4:  7.421480  8.787201 10.12896 13.78613  4.413287 16.935269 15.66850  8.789575
      -#> 5:  6.064651  9.652777 10.31984 13.88382  5.851171 17.073543 15.40189 12.185972
      -#> 6:  6.185106  7.476987 10.27299 13.09735  6.625321 15.175355 16.92339 11.788283
      -#>     Marker_9 Marker_10   Sample                   SuperCellId
      -#> 1: 11.295812  9.974660 Sample_1   SuperCell_1_Sample_Sample_1
      -#> 2:  9.674440 10.696429 Sample_1   SuperCell_2_Sample_Sample_1
      -#> 3: 11.342987  9.905015 Sample_1   SuperCell_3_Sample_Sample_1
      -#> 4:  4.833940 12.890006 Sample_2 SuperCell_498_Sample_Sample_2
      -#> 5:  4.876665 13.454078 Sample_2 SuperCell_499_Sample_Sample_2
      -#> 6:  5.844867 12.651590 Sample_2 SuperCell_500_Sample_Sample_2
      +#> Marker_1 Marker_2 Marker_3 Marker_4 Marker_5 Marker_6 Marker_7 +#> 1: 7.870171 7.669862 9.460745 10.02700 8.646107 18.42406 15.146836 +#> 2: 9.006217 7.107131 8.475524 10.57840 10.408356 20.23030 14.908706 +#> 3: 8.590865 7.512493 8.732528 10.86877 8.094644 20.79423 14.747559 +#> 4: 9.525966 11.244675 12.196923 13.84914 16.215898 17.48151 4.877098 +#> 5: 12.627982 9.954570 9.915641 16.24578 15.424371 17.09875 7.492686 +#> 6: 11.682684 10.393288 10.688327 17.24582 17.115084 19.99054 6.360460 +#> Marker_8 Marker_9 Marker_10 Sample SuperCellId +#> 1: 11.543838 6.714235 11.67504 Sample_1 SuperCell_1_Sample_Sample_1 +#> 2: 10.779079 6.117674 10.66601 Sample_1 SuperCell_2_Sample_Sample_1 +#> 3: 12.833208 6.660056 12.10731 Sample_1 SuperCell_3_Sample_Sample_1 +#> 4: 7.538974 9.070998 18.20164 Sample_2 SuperCell_498_Sample_Sample_2 +#> 5: 7.860059 8.863589 19.69940 Sample_2 SuperCell_499_Sample_Sample_2 +#> 6: 6.384969 8.443979 19.44794 Sample_2 SuperCell_500_Sample_Sample_2
       rbind(head(supercell_cell_map, n = 3), tail(supercell_cell_map, n = 3))
       #>                      SuperCellID     CellId   Sample
      -#> 1: SuperCell_101_Sample_Sample_1     Cell_1 Sample_1
      -#> 2: SuperCell_869_Sample_Sample_1     Cell_2 Sample_1
      -#> 3: SuperCell_413_Sample_Sample_1     Cell_3 Sample_1
      -#> 4: SuperCell_115_Sample_Sample_2 Cell_19998 Sample_2
      -#> 5:  SuperCell_99_Sample_Sample_2 Cell_19999 Sample_2
      -#> 6: SuperCell_273_Sample_Sample_2 Cell_20000 Sample_2
      +#> 1: SuperCell_176_Sample_Sample_1 Cell_1 Sample_1 +#> 2: SuperCell_710_Sample_Sample_1 Cell_2 Sample_1 +#> 3: SuperCell_295_Sample_Sample_1 Cell_3 Sample_1 +#> 4: SuperCell_217_Sample_Sample_2 Cell_19998 Sample_2 +#> 5: SuperCell_51_Sample_Sample_2 Cell_19999 Sample_2 +#> 6: SuperCell_175_Sample_Sample_2 Cell_20000 Sample_2
      diff --git a/index.html b/index.html index 06c57f3..0771e6d 100644 --- a/index.html +++ b/index.html @@ -74,7 +74,7 @@

      -

      SuperCellCyto is an extension of the SuperCell R package. Initially developed for scRNAseq data, SuperCell aggregates cells with similar transcriptomic profiles into “supercells” (also known as “metacells” in the scRNAseq literature).

      +

      SuperCellCyto is an extension of the SuperCell R package. Initially developed for scRNAseq data, SuperCell aggregates cells with similar transcriptomic profiles into “supercells” (also known as “metacells” in the scRNAseq literature).

      In SuperCellCyto, we’ve tailored the SuperCell package to specifically cater to cytometry data:

      1. Supercells are now aggregating cells that are similar marker expressions.
      2. diff --git a/pkgdown.yml b/pkgdown.yml index 2fbc092..694cdd6 100644 --- a/pkgdown.yml +++ b/pkgdown.yml @@ -7,7 +7,7 @@ articles: interoperability_with_sce: interoperability_with_sce.html interoperability_with_seurat: interoperability_with_seurat.html using_supercellcyto_for_stratified_summarising: using_supercellcyto_for_stratified_summarising.html -last_built: 2024-01-24T04:07Z +last_built: 2024-01-24T04:11Z urls: reference: https://phipsonlab.github.io/SuperCellCyto/reference article: https://phipsonlab.github.io/SuperCellCyto/articles diff --git a/search.json b/search.json index 4fb4535..78314e9 100644 --- a/search.json +++ b/search.json @@ -1 +1 @@ -[{"path":[]},{"path":"https://phipsonlab.github.io/SuperCellCyto/CODE_OF_CONDUCT.html","id":"our-pledge","dir":"","previous_headings":"","what":"Our Pledge","title":"Contributor Covenant Code of Conduct","text":"members, contributors, leaders pledge make participation community harassment-free experience everyone, regardless age, body size, visible invisible disability, ethnicity, sex characteristics, gender identity expression, level experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, sexual identity orientation. pledge act interact ways contribute open, welcoming, diverse, inclusive, healthy community.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/CODE_OF_CONDUCT.html","id":"our-standards","dir":"","previous_headings":"","what":"Our Standards","title":"Contributor Covenant Code of Conduct","text":"Examples behavior contributes positive environment community include: Demonstrating empathy kindness toward people respectful differing opinions, viewpoints, experiences Giving gracefully accepting constructive feedback Accepting responsibility apologizing affected mistakes, learning experience Focusing best just us individuals, overall community Examples unacceptable behavior include: use sexualized language imagery, sexual attention advances kind Trolling, insulting derogatory comments, personal political attacks Public private harassment Publishing others’ private information, physical email address, without explicit permission conduct reasonably considered inappropriate professional setting","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/CODE_OF_CONDUCT.html","id":"enforcement-responsibilities","dir":"","previous_headings":"","what":"Enforcement Responsibilities","title":"Contributor Covenant Code of Conduct","text":"Community leaders responsible clarifying enforcing standards acceptable behavior take appropriate fair corrective action response behavior deem inappropriate, threatening, offensive, harmful. Community leaders right responsibility remove, edit, reject comments, commits, code, wiki edits, issues, contributions aligned Code Conduct, communicate reasons moderation decisions appropriate.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/CODE_OF_CONDUCT.html","id":"scope","dir":"","previous_headings":"","what":"Scope","title":"Contributor Covenant Code of Conduct","text":"Code Conduct applies within community spaces, also applies individual officially representing community public spaces. Examples representing community include using official e-mail address, posting via official social media account, acting appointed representative online offline event.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/CODE_OF_CONDUCT.html","id":"enforcement","dir":"","previous_headings":"","what":"Enforcement","title":"Contributor Covenant Code of Conduct","text":"Instances abusive, harassing, otherwise unacceptable behavior may reported community leaders responsible enforcement putri.g@wehi.edu.au. complaints reviewed investigated promptly fairly. community leaders obligated respect privacy security reporter incident.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/CODE_OF_CONDUCT.html","id":"enforcement-guidelines","dir":"","previous_headings":"","what":"Enforcement Guidelines","title":"Contributor Covenant Code of Conduct","text":"Community leaders follow Community Impact Guidelines determining consequences action deem violation Code Conduct:","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/CODE_OF_CONDUCT.html","id":"id_1-correction","dir":"","previous_headings":"Enforcement Guidelines","what":"1. Correction","title":"Contributor Covenant Code of Conduct","text":"Community Impact: Use inappropriate language behavior deemed unprofessional unwelcome community. Consequence: private, written warning community leaders, providing clarity around nature violation explanation behavior inappropriate. public apology may requested.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/CODE_OF_CONDUCT.html","id":"id_2-warning","dir":"","previous_headings":"Enforcement Guidelines","what":"2. Warning","title":"Contributor Covenant Code of Conduct","text":"Community Impact: violation single incident series actions. Consequence: warning consequences continued behavior. interaction people involved, including unsolicited interaction enforcing Code Conduct, specified period time. includes avoiding interactions community spaces well external channels like social media. Violating terms may lead temporary permanent ban.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/CODE_OF_CONDUCT.html","id":"id_3-temporary-ban","dir":"","previous_headings":"Enforcement Guidelines","what":"3. Temporary Ban","title":"Contributor Covenant Code of Conduct","text":"Community Impact: serious violation community standards, including sustained inappropriate behavior. Consequence: temporary ban sort interaction public communication community specified period time. public private interaction people involved, including unsolicited interaction enforcing Code Conduct, allowed period. Violating terms may lead permanent ban.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/CODE_OF_CONDUCT.html","id":"id_4-permanent-ban","dir":"","previous_headings":"Enforcement Guidelines","what":"4. Permanent Ban","title":"Contributor Covenant Code of Conduct","text":"Community Impact: Demonstrating pattern violation community standards, including sustained inappropriate behavior, harassment individual, aggression toward disparagement classes individuals. Consequence: permanent ban sort public interaction within community.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/CODE_OF_CONDUCT.html","id":"attribution","dir":"","previous_headings":"","what":"Attribution","title":"Contributor Covenant Code of Conduct","text":"Code Conduct adapted Contributor Covenant, version 2.1, available https://www.contributor-covenant.org/version/2/1/code_of_conduct.html. Community Impact Guidelines inspired [Mozilla’s code conduct enforcement ladder][https://github.com/mozilla/inclusion]. answers common questions code conduct, see FAQ https://www.contributor-covenant.org/faq. Translations available https://www.contributor-covenant.org/translations.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/CONTRIBUTING.html","id":null,"dir":"","previous_headings":"","what":"Contributing to SuperCellCyto","title":"Contributing to SuperCellCyto","text":"outlines propose change SuperCellCyto.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/CONTRIBUTING.html","id":"making-changes-to-the-package","dir":"","previous_headings":"","what":"Making changes to the package","title":"Contributing to SuperCellCyto","text":"want make change, please first file issue make sure someone team agrees ’s needed. ’ve found bug, please file issue illustrates bug minimal reprex (also help write unit test, needed).","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/CONTRIBUTING.html","id":"pull-request-process","dir":"","previous_headings":"Making changes to the package","what":"Pull request process","title":"Contributing to SuperCellCyto","text":"Fork package clone onto computer. Install development dependencies devtools::install_dev_deps(). Create Git branch pull request (PR). can use usethis::pr_init(\"brief-description--change\"). Make changes, commit git. Make sure unit tests passing. can use devtools::test(). Create PR. Make sure title PR briefly describe change, body PR contain Fixes #issue-number.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/CONTRIBUTING.html","id":"code-of-conduct","dir":"","previous_headings":"","what":"Code of Conduct","title":"Contributing to SuperCellCyto","text":"Please note SuperCellCyto project released Contributor Code Conduct. contributing project agree abide terms.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/how_to_create_supercells.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"How to create supercells","text":"vignette describes steps generate supercells cytometry data using SuperCellCyto R package. Please note ’re still actively updating vignette (fact package ), welcome feedbacks improve . Please reach creating GitHub issues GitHub repository.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/how_to_create_supercells.html","id":"installation","dir":"Articles","previous_headings":"","what":"Installation","title":"How to create supercells","text":"SuperCellCyto can installed using remotes package CRAN: SuperCellCyto requires SuperCell R package installed run properly. use remotes::install_github command install SuperCellCyto, automatically installed. case doesn’t, can manually install using:","code":"# install remotes package first. install.packages(\"remotes\") # then use it to install SuperCellCyto remotes::install_github(\"phipsonlab/SuperCellCyto\") remotes::install_github(\"GfellerLab/SuperCell\")"},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/how_to_create_supercells.html","id":"preparing-your-dataset","dir":"Articles","previous_headings":"","what":"Preparing your dataset","title":"How to create supercells","text":"function creates supercells called runSuperCellCyto, operates data.table object, enhanced version R native data.frame. addition needing data stored data.table object also requires: markers using create supercells appropriately transformed, typically using either arcsinh transformation linear binning (using FlowJo). runSuperCellCyto perform data transformation scaling. object column denoting unique ID cell. likely create column , can simply just numerical value ranging 1 however many cells data. object column denoting biological sample cell comes . column critical ensure cells different samples mixed supercell. sure import CSV FCS files data.table object, /subsequently prepare object ready SuperCellCyto, please consult vignette. vignette, also provide explanation behind need cell ID sample column. vignette, simulate toy data using simCytoData function. Specifically, simulate 15 markers 3 samples, sample containing 10,000 cells. Hence total, toy dataset containing 15 markers 30,000 cells. toy dataset, transform data using arcsinh transformation. use base R asinh function : also create column Cell_id_dummy uniquely identify cell. values Cell_1, Cell_2, way Cell_x x number cells dataset. default, simCytoData function generate cells multiple samples, resulting data.table object already column called Sample denotes sample cells come . Let’s take note sample cell id column later.","code":"n_markers <- 15 n_samples <- 3 dat <- simCytoData(nmarkers = n_markers, ncells = rep(10000, n_samples)) head(dat) #> Marker_1 Marker_2 Marker_3 Marker_4 Marker_5 Marker_6 Marker_7 Marker_8 #> 1: 13.26051 16.93396 4.648167 7.614336 13.16527 14.20685 10.26838 18.69479 #> 2: 12.31247 15.55551 5.845648 7.817869 12.13161 11.19494 11.29331 19.37165 #> 3: 11.53995 18.01155 5.942080 9.169292 13.05679 11.74417 11.04089 17.84166 #> 4: 14.37444 15.63743 5.660410 6.981808 12.29892 12.14983 12.39524 21.86125 #> 5: 13.33747 17.32484 5.236502 6.711492 12.98148 11.70372 11.43519 18.31638 #> 6: 11.42664 19.57554 5.718882 8.022608 13.08475 13.07168 11.13570 19.33357 #> Marker_9 Marker_10 Marker_11 Marker_12 Marker_13 Marker_14 Marker_15 #> 1: 15.09595 12.22340 13.13038 5.465730 6.259695 11.323180 9.723435 #> 2: 17.49136 13.57375 13.03428 4.579316 7.412500 10.282344 10.752968 #> 3: 15.97173 13.56235 13.58457 6.016201 8.553632 10.141480 10.421929 #> 4: 15.87837 14.80048 13.92161 5.487170 6.675427 9.753265 11.417760 #> 5: 17.07165 13.23186 13.36450 4.306789 7.423704 11.166471 8.460497 #> 6: 16.03938 15.14831 13.21584 5.540360 4.816466 11.185558 8.625391 #> Sample Cell_Id #> 1: Sample_1 Cell_1 #> 2: Sample_1 Cell_2 #> 3: Sample_1 Cell_3 #> 4: Sample_1 Cell_4 #> 5: Sample_1 Cell_5 #> 6: Sample_1 Cell_6 # Specify which columns are the markers to transform marker_cols <- paste0(\"Marker_\", seq_len(n_markers)) # The co-factor for arc-sinh cofactor <- 5 # Do the transformation dat_asinh <- asinh(dat[, marker_cols, with = FALSE] / cofactor) # Rename the new columns marker_cols_asinh <- paste0(marker_cols, \"_asinh\") names(dat_asinh) <- marker_cols_asinh # Add them our previously loaded data dat <- cbind(dat, dat_asinh) head(dat[, marker_cols_asinh, with = FALSE]) #> Marker_1_asinh Marker_2_asinh Marker_3_asinh Marker_4_asinh Marker_5_asinh #> 1: 1.702285 1.934145 0.8307316 1.207381 1.695544 #> 2: 1.633211 1.853006 0.9960593 1.229518 1.619515 #> 3: 1.573460 1.993454 1.0085360 1.366767 1.687812 #> 4: 1.778122 1.858008 0.9717564 1.135865 1.632191 #> 5: 1.707702 1.956051 0.9144276 1.103980 1.682413 #> 6: 1.564413 2.073915 0.9794760 1.251377 1.689810 #> Marker_6_asinh Marker_7_asinh Marker_8_asinh Marker_9_asinh Marker_10_asinh #> 1: 1.767052 1.467386 2.029376 1.824497 1.626487 #> 2: 1.545676 1.553670 2.063773 1.965246 1.724163 #> 3: 1.589578 1.533039 1.984325 1.878176 1.723374 #> 4: 1.620903 1.639422 2.181253 1.872582 1.805752 #> 5: 1.586405 1.565098 2.009634 1.941915 1.700262 #> 6: 1.688877 1.540834 2.061869 1.882210 1.827785 #> Marker_11_asinh Marker_12_asinh Marker_13_asinh Marker_14_asinh #> 1: 1.693063 0.9457285 1.0488038 1.556086 #> 2: 1.686202 0.8206116 1.1850166 1.468608 #> 3: 1.724910 1.0180458 1.3062462 1.456219 #> 4: 1.747942 0.9486197 1.0996630 1.421346 #> 5: 1.709598 0.7798671 1.1862691 1.543352 #> 6: 1.699128 0.9557659 0.8551784 1.544911 #> Marker_15_asinh #> 1: 1.418622 #> 2: 1.509024 #> 3: 1.480749 #> 4: 1.563701 #> 5: 1.296808 #> 6: 1.313466 dat$Cell_id_dummy <- paste0(\"Cell_\", seq_len(nrow(dat))) head(dat$Cell_id_dummy, n = 10) #> [1] \"Cell_1\" \"Cell_2\" \"Cell_3\" \"Cell_4\" \"Cell_5\" \"Cell_6\" \"Cell_7\" #> [8] \"Cell_8\" \"Cell_9\" \"Cell_10\" unique(dat$Sample) #> [1] \"Sample_1\" \"Sample_2\" \"Sample_3\" sample_col <- \"Sample\" cell_id_col <- \"Cell_id_dummy\""},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/how_to_create_supercells.html","id":"creating-supercells","dir":"Articles","previous_headings":"","what":"Creating supercells","title":"How to create supercells","text":"Now data, let’s create supercells. , use runSuperCellCyto function pass markers, sample cell ID columns parameters. reason need specify markers function create supercells based expression markers. highly recommend creating supercells using markers data, let cell type cell state markers. However, reason want use subset markers data, make sure specify vector later pass runSuperCellCyto function. tutorial, use arcsinh transformed markers toy data. Let’s dig deeper object created: list containing 3 elements:","code":"supercells <- runSuperCellCyto( dt = dat, markers = marker_cols_asinh, sample_colname = sample_col, cell_id_colname = cell_id_col ) class(supercells) #> [1] \"list\" names(supercells) #> [1] \"supercell_expression_matrix\" \"supercell_cell_map\" #> [3] \"supercell_object\""},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/how_to_create_supercells.html","id":"supercell-object","dir":"Articles","previous_headings":"Creating supercells","what":"Supercell object","title":"How to create supercells","text":"supercell_object contains metadata used create supercells. list, element contains metadata used create supercells sample. come handy need either regenerate supercells using different gamma values (get less supercells) debugging later line. regenerating supercells Controlling supercells granularity section .","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/how_to_create_supercells.html","id":"supercell-expression-matrix","dir":"Articles","previous_headings":"Creating supercells","what":"Supercell expression matrix","title":"How to create supercells","text":"supercell_expression_matrix contains marker expression supercell. calculated taking average marker expression cells contained within supercell. Therein, following columns: markers previously specified markers_col variable. example, arcsinh transformed markers toy data. column (Sample case) denoting sample supercell belongs , (note column name stored sample_col variable). SuperCellId column denoting unique ID supercell.","code":"head(supercells$supercell_expression_matrix) #> Marker_1_asinh Marker_2_asinh Marker_3_asinh Marker_4_asinh Marker_5_asinh #> 1: 1.643158 1.907332 0.8153221 1.169835 1.649817 #> 2: 1.621103 1.892630 0.9636129 1.096485 1.597267 #> 3: 1.661288 1.900047 0.6995604 1.191519 1.667012 #> 4: 1.634313 1.915696 1.0754045 1.247078 1.619922 #> 5: 1.616409 1.890359 0.7616117 1.143792 1.646885 #> 6: 1.703777 1.916678 0.9373116 1.158010 1.577142 #> Marker_6_asinh Marker_7_asinh Marker_8_asinh Marker_9_asinh Marker_10_asinh #> 1: 1.641203 1.504391 2.056454 1.923121 1.773593 #> 2: 1.623322 1.507671 2.062644 1.892218 1.752730 #> 3: 1.593256 1.489894 2.042796 1.898490 1.751634 #> 4: 1.630673 1.458372 2.066243 1.907359 1.760180 #> 5: 1.679005 1.554171 2.055716 1.916725 1.750212 #> 6: 1.671758 1.473018 2.039974 1.904624 1.780050 #> Marker_11_asinh Marker_12_asinh Marker_13_asinh Marker_14_asinh #> 1: 1.710697 1.0844890 1.151371 1.456152 #> 2: 1.706101 1.0261988 1.171544 1.506499 #> 3: 1.677037 0.9669220 1.166216 1.401009 #> 4: 1.708883 0.7747316 1.089448 1.492407 #> 5: 1.694421 0.7652433 1.098150 1.328574 #> 6: 1.715706 0.9424568 1.268092 1.541633 #> Marker_15_asinh Sample SuperCellId #> 1: 1.410715 Sample_1 SuperCell_1_Sample_Sample_1 #> 2: 1.257193 Sample_1 SuperCell_2_Sample_Sample_1 #> 3: 1.261979 Sample_1 SuperCell_3_Sample_Sample_1 #> 4: 1.499962 Sample_1 SuperCell_4_Sample_Sample_1 #> 5: 1.394656 Sample_1 SuperCell_5_Sample_Sample_1 #> 6: 1.202334 Sample_1 SuperCell_6_Sample_Sample_1"},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/how_to_create_supercells.html","id":"supercellid","dir":"Articles","previous_headings":"Creating supercells > Supercell expression matrix","what":"SuperCellId","title":"How to create supercells","text":"Let’s look SuperCellId: Let’s break one , SuperCell_1_Sample_Sample_1. SuperCell_1 numbering (1 however many supercells sample) used uniquely identify supercell sample. Notably, may encounter (SuperCell_1, SuperCell_2) repeated across different samples, e.g., 3 supercells’ id pre-fixed SuperCell_1, make equal one another! SuperCell_1_Sample_Sample_1 contain cells Sample_1 SuperCell_1_Sample_Sample_2 contain cells Sample_2. now, may noticed appended sample name supercell id. aids differentiating supercells different samples.","code":"head(unique(supercells$supercell_expression_matrix$SuperCellId)) #> [1] \"SuperCell_1_Sample_Sample_1\" \"SuperCell_2_Sample_Sample_1\" #> [3] \"SuperCell_3_Sample_Sample_1\" \"SuperCell_4_Sample_Sample_1\" #> [5] \"SuperCell_5_Sample_Sample_1\" \"SuperCell_6_Sample_Sample_1\" supercell_ids <- unique(supercells$supercell_expression_matrix$SuperCellId) supercell_ids[grep(\"SuperCell_1_\", supercell_ids)] #> [1] \"SuperCell_1_Sample_Sample_1\" \"SuperCell_1_Sample_Sample_2\" #> [3] \"SuperCell_1_Sample_Sample_3\""},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/how_to_create_supercells.html","id":"supercell-cell-map","dir":"Articles","previous_headings":"Creating supercells","what":"Supercell cell map","title":"How to create supercells","text":"supercell_cell_map maps cell dataset supercell belongs . map useful later need expand supercells . Additionally, also reason need column dataset uniquely identify cell.","code":"head(supercells$supercell_cell_map) #> SuperCellID CellId Sample #> 1: SuperCell_38_Sample_Sample_1 Cell_1 Sample_1 #> 2: SuperCell_242_Sample_Sample_1 Cell_2 Sample_1 #> 3: SuperCell_99_Sample_Sample_1 Cell_3 Sample_1 #> 4: SuperCell_282_Sample_Sample_1 Cell_4 Sample_1 #> 5: SuperCell_300_Sample_Sample_1 Cell_5 Sample_1 #> 6: SuperCell_426_Sample_Sample_1 Cell_6 Sample_1"},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/how_to_create_supercells.html","id":"running-runsupercellcyto-in-parallel","dir":"Articles","previous_headings":"","what":"Running runSuperCellCyto in parallel","title":"How to create supercells","text":"default, runSuperCellCyto process sample one . sample processed independent one another, strictly speaking, can process parallel. , need : Create BiocParallelParam object BiocParallel package. object can either type MulticoreParamor SnowParam. highly recommend consulting vignette information. Set number tasks BiocParallelParam object number samples dataset. Set load_balancing parameter runSuperCellCyto function TRUE. ensure even distribution supercell creation jobs. sample processed parallel job, don’t want job process large sample also assigned smaller samples possible. want know feature works, please refer manuscript. NOTE: set value workers param BiocParallelParam object total number cores computer, render computer useless anything else. Perhaps importantly, might blow RAM kill Rsession. find total number cores computer, can use parallel’s detectCores function. supply number minus one workers param BiocParallelParam object.","code":"n_cores <- detectCores() supercell_par <- runSuperCellCyto( dt = dat, markers = marker_cols_asinh, sample_colname = sample_col, cell_id_colname = cell_id_col, BPPARAM = MulticoreParam( workers = n_cores - 1, tasks = n_samples ), load_balancing = TRUE )"},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/how_to_create_supercells.html","id":"controlling-supercells-granularity","dir":"Articles","previous_headings":"","what":"Controlling supercells granularity","title":"How to create supercells","text":"described runSuperCellCyto function’s documentation, let’s briefly go . runSuperCellCyto function equipped various parameters can customised alter composition supercells. one likely used gamma parameter, denoted gam function. default, value gam set 20, found work well cases. gamma parameter controls many supercells generate, indirectly, many cells captured within supercell. parameter resolved following formula gamma=n_cells/n_supercells n_cell denotes number cells n_supercells denotes number supercells. general, larger gamma parameter set , less supercells get. Say instance 10,000 cells. gamma set 10, end 1,000 supercells, whereas gamma set 50, end 200 supercells. may noticed, reading sections , runSuperCellCyto ran sample independent , can set 1 value gamma parameter. Indeed, now, gamma value used across samples, depending many cells sample, end different number supercells sample. instance, say 10,000 cells sample 1, 100,000 cells sample 2. gamma set 10, sample 1, get 1,000 supercells (10,000/10) sample 2, get 10,000 supercells (100,000/10). note: whatever gamma value chose, expect supercell contain exactly number cells. behaviour intentional ensure rare cell types intermixed non-rare cell types supercell.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/how_to_create_supercells.html","id":"adjusting-gamma-value-after-one-run-of-runsupercellcyto","dir":"Articles","previous_headings":"Controlling supercells granularity","what":"Adjusting gamma value after one run of runSuperCellCyto","title":"How to create supercells","text":"run runSuperCellCyto discarded SuperCell object generated (serious, please don’t!), can use object quickly regenerate supercells using different gamma values. example, using SuperCell object generated toy dataset, regenerate supercells using gamma 10 50. function recomputeSupercells. store output list, one element per gamma value. end list containing 2 elements. 1st element contains supercells generated using gamma = 10, 2nd contains supercells generated using gamma = 50. output generated recomputeSupercells essentially list: supercell_expression_matrix: data.table object contains marker expression supercell. supercell_cell_map: data.table maps cell corresponding supercell. mentioned , gamma dictates granularity supercells. Compared previous run gamma set 20, get supercells gamma = 10, less gamma = 50. Let’s see ’s case.","code":"addt_gamma_vals <- c(10, 50) supercells_addt_gamma <- lapply(addt_gamma_vals, function(gam) { recomputeSupercells( dt = dat, sc_objects = supercells$supercell_object, markers = marker_cols_asinh, sample_colname = sample_col, cell_id_colname = cell_id_col, gam = gam ) }) supercells_addt_gamma[[1]] #> $supercell_expression_matrix #> Marker_1_asinh Marker_2_asinh Marker_3_asinh Marker_4_asinh #> 1: 1.618907 1.907631 1.0072563 1.252648 #> 2: 1.535807 1.878555 0.8230414 1.249378 #> 3: 1.653043 1.884893 0.8829517 1.025791 #> 4: 1.696478 1.926849 1.1740522 1.082426 #> 5: 1.631592 1.905014 0.9199998 1.163173 #> --- #> 2996: 1.139950 1.900943 1.3575769 1.958551 #> 2997: 1.148204 1.783714 1.5540021 1.898327 #> 2998: 1.138231 1.830399 1.4115217 1.925456 #> 2999: 1.115342 1.819121 1.5356779 1.871019 #> 3000: 1.230601 1.768583 1.3584141 1.912769 #> Marker_5_asinh Marker_6_asinh Marker_7_asinh Marker_8_asinh #> 1: 1.675394 1.594356 1.587978 2.0507386 #> 2: 1.653235 1.626521 1.505604 2.0272368 #> 3: 1.591307 1.662946 1.441340 2.0604707 #> 4: 1.655110 1.573602 1.477954 2.0853431 #> 5: 1.568925 1.653362 1.457803 2.0496127 #> --- #> 2996: 1.795176 2.016813 1.849205 0.9122364 #> 2997: 1.718403 2.021645 1.748029 0.7384978 #> 2998: 1.810082 2.054379 1.652067 1.0630050 #> 2999: 1.695296 2.064753 1.831022 0.8525944 #> 3000: 1.703556 2.021000 1.770719 0.8914033 #> Marker_9_asinh Marker_10_asinh Marker_11_asinh Marker_12_asinh #> 1: 1.894422 1.752005 1.669240 1.0244124 #> 2: 1.895347 1.738378 1.700202 0.8180268 #> 3: 1.901746 1.727937 1.704476 1.0978080 #> 4: 1.907193 1.811203 1.731037 1.0957119 #> 5: 1.917960 1.775126 1.708457 0.8937115 #> --- #> 2996: 1.819999 2.049516 1.896457 1.8650795 #> 2997: 1.779117 2.040142 1.825453 1.8925735 #> 2998: 1.825389 2.105406 1.882257 1.8739584 #> 2999: 1.887215 2.064012 1.872201 1.6840172 #> 3000: 1.847472 2.053358 1.868725 1.7958683 #> Marker_13_asinh Marker_14_asinh Marker_15_asinh Sample #> 1: 1.1931847 1.413249 1.5268084 Sample_1 #> 2: 1.2093831 1.376127 1.4043985 Sample_1 #> 3: 1.0345544 1.543852 1.3807248 Sample_1 #> 4: 0.9364784 1.461238 1.2827517 Sample_1 #> 5: 1.2105299 1.467063 1.2485890 Sample_1 #> --- #> 2996: 1.9040646 1.406372 0.6992414 Sample_3 #> 2997: 1.9379146 1.384341 1.0892370 Sample_3 #> 2998: 2.0041233 1.420623 1.3140576 Sample_3 #> 2999: 1.9097184 1.542547 1.2369247 Sample_3 #> 3000: 1.9039728 1.335958 1.1536828 Sample_3 #> SuperCellId #> 1: SuperCell_1_Sample_Sample_1 #> 2: SuperCell_2_Sample_Sample_1 #> 3: SuperCell_3_Sample_Sample_1 #> 4: SuperCell_4_Sample_Sample_1 #> 5: SuperCell_5_Sample_Sample_1 #> --- #> 2996: SuperCell_996_Sample_Sample_3 #> 2997: SuperCell_997_Sample_Sample_3 #> 2998: SuperCell_998_Sample_Sample_3 #> 2999: SuperCell_999_Sample_Sample_3 #> 3000: SuperCell_1000_Sample_Sample_3 #> #> $supercell_cell_map #> SuperCellID CellId Sample #> 1: SuperCell_297_Sample_Sample_1 Cell_1 Sample_1 #> 2: SuperCell_488_Sample_Sample_1 Cell_2 Sample_1 #> 3: SuperCell_326_Sample_Sample_1 Cell_3 Sample_1 #> 4: SuperCell_756_Sample_Sample_1 Cell_4 Sample_1 #> 5: SuperCell_50_Sample_Sample_1 Cell_5 Sample_1 #> --- #> 29996: SuperCell_750_Sample_Sample_3 Cell_29996 Sample_3 #> 29997: SuperCell_76_Sample_Sample_3 Cell_29997 Sample_3 #> 29998: SuperCell_525_Sample_Sample_3 Cell_29998 Sample_3 #> 29999: SuperCell_390_Sample_Sample_3 Cell_29999 Sample_3 #> 30000: SuperCell_850_Sample_Sample_3 Cell_30000 Sample_3 n_supercells_gamma20 <- nrow(supercells$supercell_expression_matrix) n_supercells_gamma10 <- nrow(supercells_addt_gamma[[1]]$supercell_expression_matrix) n_supercells_gamma50 <- nrow(supercells_addt_gamma[[2]]$supercell_expression_matrix) n_supercells_gamma10 > n_supercells_gamma20 #> [1] TRUE n_supercells_gamma50 < n_supercells_gamma20 #> [1] TRUE"},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/how_to_create_supercells.html","id":"specifying-different-gamma-value-for-different-samples","dir":"Articles","previous_headings":"Controlling supercells granularity","what":"Specifying different gamma value for different samples","title":"How to create supercells","text":"future, may add ability specify different gam value different samples. now, want , need break data multiple data.table objects, containing data 1 sample, run runSuperCellCyto function different gam parameter value. Something like following: Subsequently, extract combine supercell_expression_matrix supercell_cell_map, need use rbind:","code":"n_markers <- 10 dat <- simCytoData(nmarkers = n_markers) markers_col <- paste0(\"Marker_\", seq_len(n_markers)) sample_col <- \"Sample\" cell_id_col <- \"Cell_Id\" samples <- unique(dat[[sample_col]]) gam_values <- c(10, 20, 10) supercells_diff_gam <- lapply(seq_len(length(samples)), function(i) { sample <- samples[i] gam <- gam_values[i] dat_samp <- dat[dat$Sample == sample, ] supercell_samp <- runSuperCellCyto( dt = dat_samp, markers = markers_col, sample_colname = sample_col, cell_id_colname = cell_id_col, gam = gam ) return(supercell_samp) }) supercell_expression_matrix <- do.call( \"rbind\", lapply(supercells_diff_gam, function(x) x[[\"supercell_expression_matrix\"]]) ) supercell_cell_map <- do.call( \"rbind\", lapply(supercells_diff_gam, function(x) x[[\"supercell_cell_map\"]]) ) rbind(head(supercell_expression_matrix, n = 3), tail(supercell_expression_matrix, n = 3)) #> Marker_1 Marker_2 Marker_3 Marker_4 Marker_5 Marker_6 Marker_7 Marker_8 #> 1: 13.528431 20.197100 10.66962 11.43262 10.198854 10.951377 12.45046 14.331914 #> 2: 14.031970 19.657061 10.68137 10.91435 9.265711 10.175718 11.45509 15.841867 #> 3: 11.959244 21.721450 10.49142 12.80011 9.537898 9.331802 11.69437 15.274758 #> 4: 7.421480 8.787201 10.12896 13.78613 4.413287 16.935269 15.66850 8.789575 #> 5: 6.064651 9.652777 10.31984 13.88382 5.851171 17.073543 15.40189 12.185972 #> 6: 6.185106 7.476987 10.27299 13.09735 6.625321 15.175355 16.92339 11.788283 #> Marker_9 Marker_10 Sample SuperCellId #> 1: 11.295812 9.974660 Sample_1 SuperCell_1_Sample_Sample_1 #> 2: 9.674440 10.696429 Sample_1 SuperCell_2_Sample_Sample_1 #> 3: 11.342987 9.905015 Sample_1 SuperCell_3_Sample_Sample_1 #> 4: 4.833940 12.890006 Sample_2 SuperCell_498_Sample_Sample_2 #> 5: 4.876665 13.454078 Sample_2 SuperCell_499_Sample_Sample_2 #> 6: 5.844867 12.651590 Sample_2 SuperCell_500_Sample_Sample_2 rbind(head(supercell_cell_map, n = 3), tail(supercell_cell_map, n = 3)) #> SuperCellID CellId Sample #> 1: SuperCell_101_Sample_Sample_1 Cell_1 Sample_1 #> 2: SuperCell_869_Sample_Sample_1 Cell_2 Sample_1 #> 3: SuperCell_413_Sample_Sample_1 Cell_3 Sample_1 #> 4: SuperCell_115_Sample_Sample_2 Cell_19998 Sample_2 #> 5: SuperCell_99_Sample_Sample_2 Cell_19999 Sample_2 #> 6: SuperCell_273_Sample_Sample_2 Cell_20000 Sample_2"},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/how_to_create_supercells.html","id":"mixing-cells-from-different-samples-in-a-supercell","dir":"Articles","previous_headings":"","what":"Mixing cells from different samples in a supercell","title":"How to create supercells","text":"whatever reason don’t mind (perhaps point want) supercell contain cells different biological samples, still need sample column data.table. However, need essentially set value column exactly one unique value. way, SuperCellCyto treat cells coming one sample. Just note, parallel processing feature SuperCellCyto won’t work essentially 1 sample nothing SuperCellCyto parallelise.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/how_to_create_supercells.html","id":"i-have-more-cells-than-ram-in-my-computer","dir":"Articles","previous_headings":"","what":"I have more cells than RAM in my computer","title":"How to create supercells","text":"dataset huge constantly running RAM generating supercells? thing happens solution . Since supercells generated sample independent others can easily break process. example: Load subset samples (say 1-10). Generate supercells samples. Save output using qs package. Extract supercell_expression_matrix supercell_cell_map, export csv file using data.table’s fwrite function. Load another sets samples (say 11-20), rinse repeat step 2-4. processed samples, can load supercell_expression_matrix supercell_cell_map csv files analyse . want regenerate supercells using different gamma values, load relevant output saved using qs package relevant data (remember note output belongs sets samples!), run recomputeSupercells function.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/how_to_create_supercells.html","id":"session-information","dir":"Articles","previous_headings":"","what":"Session information","title":"How to create supercells","text":"","code":"sessionInfo() #> R version 4.3.2 (2023-10-31) #> Platform: x86_64-pc-linux-gnu (64-bit) #> Running under: Ubuntu 22.04.3 LTS #> #> Matrix products: default #> BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 #> LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so; LAPACK version 3.10.0 #> #> locale: #> [1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8 #> [4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8 #> [7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C #> [10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C #> #> time zone: UTC #> tzcode source: system (glibc) #> #> attached base packages: #> [1] parallel stats graphics grDevices utils datasets methods #> [8] base #> #> other attached packages: #> [1] BiocParallel_1.36.0 SuperCellCyto_0.1.0 #> #> loaded via a namespace (and not attached): #> [1] Matrix_1.6-5 jsonlite_1.8.8 compiler_4.3.2 Rcpp_1.0.12 #> [5] stringr_1.5.1 SuperCell_1.0 jquerylib_0.1.4 systemfonts_1.0.5 #> [9] textshaping_0.3.7 yaml_2.3.8 fastmap_1.1.1 lattice_0.21-9 #> [13] plyr_1.8.9 R6_2.5.1 igraph_1.6.0 knitr_1.45 #> [17] desc_1.4.3 bslib_0.6.1 rlang_1.1.3 cachem_1.0.8 #> [21] stringi_1.8.3 RANN_2.6.1 xfun_0.41 fs_1.6.3 #> [25] sass_0.4.8 memoise_2.0.1 cli_3.6.2 pkgdown_2.0.7 #> [29] magrittr_2.0.3 digest_0.6.34 grid_4.3.2 lifecycle_1.0.4 #> [33] vctrs_0.6.5 evaluate_0.23 glue_1.7.0 data.table_1.14.10 #> [37] codetools_0.2-19 ragg_1.2.7 rmarkdown_2.25 purrr_1.0.2 #> [41] pkgconfig_2.0.3 tools_4.3.2 htmltools_0.5.7"},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/how_to_prepare_data.html","id":"performing-quality-control","dir":"Articles","previous_headings":"","what":"Performing Quality Control","title":"How to Prepare Data for SuperCellCyto","text":"Prior creating supercells, ’s crucial ensure dataset undergone thorough quality control (QC). want retain single, live cells remove debris, doublets, dead cells. Additionally, also important perform compensation correct fluorescence spillover (Flow data) adjust signal overlap spillover different metal isotopse (Cytof data). well-prepared dataset key obtaining reliable supercells SuperCellCyto. Several R packages available performing QC cytometry data. Notable among PeacoQC, CATALYST, CytoExploreR. packages well maintained continuously updated. make sure information provide quickly go date, highly recommend consult packages’ respective vignettes detailed guidance use QC data. prefer using manual gating QC, can also use FlowJo. comprehensive guide using FlowJo prepare data, please read vignette. steps taken vignette QC perfectly adequate SuperCellCyto. manuscript, used CytoExploreR QC Oetjen_bcell flow cytometry data CATALYST QC Trussart_cytofruv Cytof data. specific scripts used can found Github repository: b_cell_identification/gate_flow_data.R Oetjen_bcell data. batch_correction/prepare_data.R Trussart_cytofruv data. scripts adapted used CytofRUV manuscript. Oetjen_bcell data, used following gating strategy post compensation: FSC-H FSC-isolate single events. (Also check SSC-H vs SSC-). FSC-SSC-remove debris. Live/Dead SSC-isolate live cells. following resulting single live cells manually gated Oetjen_bcell data. completing QC process, clean data either CSV FCS file formats. next section guide load files proceed preparing data SuperCellCyto.","code":"knitr::include_graphics(\"figures/oetjen_bcell_single_live_cells.png\", error = FALSE)"},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/how_to_prepare_data.html","id":"preparing-fcscsv-files-for-supercellcyto","dir":"Articles","previous_headings":"","what":"Preparing FCS/CSV files for SuperCellCyto","title":"How to Prepare Data for SuperCellCyto","text":"use SuperCellCyto, input data must formatted data.table object. Briefly, data.table enhanced version R native data.frame object. package offers fast processing large data.frame.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/how_to_prepare_data.html","id":"cell-id-column","dir":"Articles","previous_headings":"Preparing FCS/CSV files for SuperCellCyto","what":"Cell ID column","title":"How to Prepare Data for SuperCellCyto","text":"Additionally, cell data.table must also unique identifier. purpose ID allow SuperCell uniquely identify cell dataset. come super handy later /need work cells belong supercells, .e., need expand supercells . Generally, need create ID . dataset won’t come ID already embedded . tutorial, call column denotes cell ID cell_id. dataset, can name column however like, e.g., id, cell_identity, etc. Just make sure note column name need later create supercells.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/how_to_prepare_data.html","id":"sample-column","dir":"Articles","previous_headings":"Preparing FCS/CSV files for SuperCellCyto","what":"Sample column","title":"How to Prepare Data for SuperCellCyto","text":"Lastly, cell data.table object must also associated sample. information must stored column later pass function creates supercells. Generally, sample typically refers biological sample cell came . create supercells, necessary column dataset. ensure supercell cells exactly one sample. cases, make sense mix cells different biological samples one supercell. Additionally (important), SuperCellCyto can process multiple samples parallel, , needs know sample information. 1 biological sample dataset? matter. still need sample column dataset. difference column 1 unique value. can name column however like, e.g., Samp, Cell_Samp, etc. tutorial, call column sample. Just make sure note column name need later create supercells.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/how_to_prepare_data.html","id":"preparing-csv-files","dir":"Articles","previous_headings":"Preparing FCS/CSV files for SuperCellCyto","what":"Preparing CSV files","title":"How to Prepare Data for SuperCellCyto","text":"Loading CSV files data.table object straightforward. can use fread function data.table package. ’s install : example, let’s load two CSV files containing subsampled data Levine_32dim dataset used SuperCellCyto manuscript. file represents sample (H1 H2), sample name appended file name: Let’s break done: specify location csv files csv_files vector corresponding sample names samples vector. data/Levine_32dim_H1_sub.csv belongs sample H1 data/Levine_32dim_H2_sub.csv belongs sample H2. use lapply simultaneously iterate element csv_files samples vector. csv file corresponding sample, read csv file variable dat_a_sample using fread function. assign sample id new column called sample. result, get list dat containing 2 data.table objects, 1 object per csv file. use rbindlist function data.table package merge list one data.table object. create new column cell_id gives cell unique id Cell_1, Cell_2, etc.","code":"install.packages(\"data.table\") library(data.table) csv_files <- c(\"data/Levine_32dim_H1_sub.csv\", \"data/Levine_32dim_H2_sub.csv\") samples <- c(\"H1\", \"H2\") dat <- lapply(seq(1: length(samples)), function(i) { csv_file <- csv_files[i] sample <- samples[i] dat_a_sample <- fread(csv_file) dat_a_sample$sample <- sample return(dat_a_sample) }) dat <- rbindlist(dat) dat[, cell_id := paste0(\"Cell_\", seq(1: nrow(dat)))] head(dat) #> Time Cell_length DNA1 DNA2 CD45RA CD133 CD19 #> 1: 307428 27 169.91125 262.3192 2.338830 -0.15333985 -0.2056334 #> 2: 80712 13 50.91230 181.1320 2.129232 3.35638666 -0.1013980 #> 3: 111390 16 126.93545 269.4199 1.613719 -0.07193317 0.1116483 #> 4: 14088 31 142.67317 283.4645 4.100985 0.09366111 19.4974289 #> 5: 284190 53 98.28069 187.2090 4.289627 0.56254190 12.2265682 #> 6: 481997 35 112.29634 162.4416 6.089430 0.01665318 -0.1943735 #> CD22 CD11b CD4 CD8 CD34 Flt3 #> 1: -0.19720075 32.13040161 0.78105438 -0.071934469 1.53498471 0.84833205 #> 2: 3.05647945 14.23928833 0.53373063 -0.007943562 -0.09401329 -0.13234507 #> 3: -0.07421356 2.20701027 9.75063324 -0.034266483 0.53720337 -0.05749827 #> 4: 5.07963181 -0.07880223 0.05995781 0.009049721 -0.19206744 3.36803102 #> 5: 10.81768703 1.82670891 1.30010796 -0.187664956 2.05419374 2.72891521 #> 6: 1.43817198 5.79350042 0.64789140 54.004249573 0.28843120 1.01514077 #> CD20 CXCR4 CD235ab CD45 CD123 CD321 CD14 #> 1: -0.08676258 3.488938 0.82301176 313.8038 0.30909532 46.484669 0.05072345 #> 2: -0.04217101 1.364644 -0.13094166 207.2459 1.76594567 22.532978 -0.19256826 #> 3: 0.09777651 3.880993 2.00220966 750.4200 -0.06809702 9.515447 -0.05956535 #> 4: 0.64118648 2.911314 -0.08744399 169.4798 1.25776207 9.218699 1.09861076 #> 5: 15.34162998 9.303430 6.34135485 751.0563 0.05031190 10.463912 1.11993504 #> 6: 3.84020925 3.520693 2.93023992 868.4937 -0.04488884 19.107010 0.62120903 #> CD33 CD47 CD11c CD7 CD15 CD16 #> 1: 2.09802437 20.96871 20.76318550 -0.007966662 0.7279212 -0.03067662 #> 2: 7.35230541 27.49848 15.13398170 -0.087256350 0.7187206 0.41139653 #> 3: -0.16046160 53.51268 -0.19080050 1.044164538 2.1075230 -0.14510959 #> 4: 0.18614264 55.07846 -0.07061907 0.948859751 1.2470639 1.12294865 #> 5: 0.15872155 40.63973 4.64010382 -0.195279136 4.5712810 -0.10192144 #> 6: -0.09832545 29.65497 6.15759659 12.104630470 0.5801706 -0.11606000 #> CD44 CD38 CD13 CD3 CD61 CD117 CD49d #> 1: 95.71002 5.1124768 5.1056433 0.5827813 -0.1684093 -0.02967962 6.557199 #> 2: 185.51929 7.4784145 0.3580886 1.8861074 1.9233229 -0.14122920 1.088500 #> 3: 33.95839 0.6161237 0.3045178 462.1258240 0.7625037 -0.03500306 5.997476 #> 4: 32.46420 249.4612885 1.2526705 0.7302832 3.2274778 -0.18526185 8.533935 #> 5: 98.09428 43.5352974 2.8327518 0.1868679 2.1032026 0.01776284 12.400333 #> 6: 65.91293 2.0126576 1.2817017 390.3737793 2.4605207 0.33154550 5.214703 #> HLA-DR CD64 CD41 Viability file_number event_number #> 1: 112.467545 6.9157209 0.083808646 1.7268630 94 257088 #> 2: 12.206795 30.7242870 7.753727913 3.7120194 94 80655 #> 3: -0.046793 -0.1739236 -0.080375805 0.7011412 94 116394 #> 4: 8.965122 0.3391838 -0.005531122 0.2978864 94 5618 #> 5: 174.952667 0.4361930 1.834125400 13.2743187 94 241699 #> 6: 0.648035 -0.1803290 0.389085352 0.4543665 94 363564 #> sample cell_id #> 1: H1 Cell_1 #> 2: H1 Cell_2 #> 3: H1 Cell_3 #> 4: H1 Cell_4 #> 5: H1 Cell_5 #> 6: H1 Cell_6"},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/how_to_prepare_data.html","id":"preparing-fcs-files","dir":"Articles","previous_headings":"Preparing FCS/CSV files for SuperCellCyto","what":"Preparing FCS files","title":"How to Prepare Data for SuperCellCyto","text":"FCS files, commonly used cytometry, require specific handling. Spectre package contains functions import FCS files data.table object. can install Spectre using remotes package: Let’s load two small FCS files Anti-PD1 data downloadable FlowRepository. Spectre’s read.files reads FCS files list data.table objects, one file. data.table object, also add column FileName denoting name file cell come . list useable SuperCellCyto, need merge one data.table object add sample information cell ID. can use data.table’s rbindlist function merge list one data.table object. FCS files belong two different patients, patient 9 15. shall use sample ID. make sure correctly map filenames patients, first create new data.table object containing mapping FileName sample name, using merge.data.table add data.table object. also create new column cell_id gives cell unique id Cell_1, Cell_2, etc. CSV FCS files loaded data.table objects, next step transform data appropriately SuperCellCyto.","code":"install.packages(\"remotes\") remotes::install_github(\"immunedynamics/Spectre\") library(Spectre) dat_list <- read.files(file.loc = \"data\", file.type = \".fcs\") dat_cytof <- rbindlist(dat_list) sample_info <- data.table( sample = c(\"patient9\", \"patient15\"), filename = c(\"Data23_Panel3_base_NR4_Patient9\", \"Data23_Panel3_base_R5_Patient15\") ) dat_with_sample_info <- merge.data.table( x = dat_cytof, y = sample_info, by.x = \"FileName\", by.y = \"filename\" ) dat_with_sample_info[, cell_id := paste0(\"Cell_\", seq(1: nrow(dat_with_sample_info)))]"},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/how_to_prepare_data.html","id":"data-transformation","dir":"Articles","previous_headings":"","what":"Data Transformation","title":"How to Prepare Data for SuperCellCyto","text":"using SuperCellCyto, ’s essential apply appropriate data transformations. transformations crucial accurate analysis, explained article data transformation. Note: completed QC process outlined CSV files exported FlowJo, can proceed directly next vignette create supercells. details different file types (FCS, CSV scale, CSV channel value), refer guide. common method data transformation cytometry arcsinh transformation, inverse hyperbolic arcsinh transformation. transformation requires specifying cofactor, affects representation low-end data. Typically, cofactor 5 used Cytof data 150 Flow data. vignette focus transformation process rather cofactor selection. -depth information choosing cofactor, read detailed article. ’ll use Levine_32dim dataset loaded earlier CSV files. First, need select markers transformed. Usually, markers transformed SuperCellCyto. However, can choose exclude specific markers needed: transformation, ’ll use cofactor 5 apply arcsinh transformation using Spectre package. Spectre isn’t installed, use: Perform transformation: transformation, new columns “_asinh” appended indicate transformed markers. Alternatively, don’t want use Spectre, can also use inbuilt asinh function R transformation: note, use inbuilt asinh function, need re-attach cell id sample column. data now transformed, ’re ready create supercells using SuperCellCyto. Please refer create supercells vignette detailed instructions.","code":"markers_to_transform <- c(\"CD45RA\",\"CD133\",\"CD19\",\"CD22\",\"CD11b\",\"CD4\", \"CD8\",\"CD34\",\"Flt3\",\"CD20\",\"CXCR4\",\"CD235ab\", \"CD45\",\"CD123\",\"CD321\",\"CD14\",\"CD33\",\"CD47\",\"CD11c\", \"CD7\",\"CD15\",\"CD16\",\"CD44\",\"CD38\",\"CD13\",\"CD3\",\"CD61\", \"CD117\",\"CD49d\",\"HLA-DR\",\"CD64\",\"CD41\") install.packages(\"remotes\") remotes::install_github(\"immunedynamics/Spectre\") dat <- do.asinh(dat, markers_to_transform, cofactor = 5) cofactor <- 5 # Do the transformation dat_asinh <- asinh(dat[, markers_to_transform, with = FALSE] / cofactor) head(dat_asinh) #> CD45RA CD133 CD19 CD22 CD11b CD4 #> 1: 0.4521968 -0.030663164 -0.04111509 -0.03942993 2.55951176 0.15558245 #> 2: 0.4139249 0.628977340 -0.02027821 0.57848688 1.76920432 0.10654443 #> 3: 0.3173883 -0.014386137 0.02232781 -0.01484217 0.42819644 1.42110634 #> 4: 0.7483619 0.018731126 2.07004151 0.89259051 -0.01575979 0.01199128 #> 5: 0.7772642 0.112272365 1.62672741 1.51446768 0.35766705 0.25717724 #> 6: 1.0273733 0.003330631 -0.03886491 0.28380900 0.98926269 0.12921838 #> CD8 CD34 Flt3 CD20 CXCR4 CD235ab #> 1: -0.014386398 0.30236841 0.16886275 -0.017351646 0.6508532 0.16386798 #> 2: -0.001588712 -0.01880155 -0.02646592 -0.008434102 0.2696492 -0.02618534 #> 3: -0.006853243 0.10723503 -0.01149940 0.019554056 0.7139745 0.39044561 #> 4: 0.001809943 -0.03840405 0.63090991 0.127888398 0.5535560 -0.01748791 #> 5: -0.037524184 0.40007994 0.52178220 1.839834412 1.3795382 1.05895614 #> 6: 3.074908161 0.05765429 0.20165859 0.707518206 0.6560537 0.55682438 #> CD45 CD123 CD321 CD14 CD33 CD47 CD11c #> 1: 4.832541 0.061779758 2.925712 0.01014452 0.40817588 2.140661 2.13108274 #> 2: 4.417761 0.346230147 2.210777 -0.03850414 1.17826549 2.406005 1.82688632 #> 3: 5.704353 -0.013618983 1.399436 -0.01191279 -0.03208681 3.065803 -0.03815085 #> 4: 4.216660 0.248972250 1.371487 0.21799154 0.03721993 3.094522 -0.01412334 #> 5: 5.705201 0.010062211 1.484375 0.22215516 0.03173898 2.792218 0.82955004 #> 6: 5.850478 -0.008977647 2.050461 0.12392437 -0.01966382 2.480371 1.03599597 #> CD7 CD15 CD16 CD44 CD38 CD13 CD3 #> 1: -0.001593332 0.1450748 -0.006135286 3.645714 0.8971911 0.89623517 0.11629394 #> 2: -0.017450384 0.1432536 0.082186751 4.307050 1.1923661 0.07155664 0.36880389 #> 3: 0.207344037 0.4099270 -0.029017846 2.614221 0.1229150 0.06086597 5.21957573 #> 4: 0.188650968 0.2468967 0.222743270 2.569725 4.6031134 0.24798459 0.14554227 #> 5: -0.039045905 0.8194260 -0.020382876 3.670287 2.8605627 0.53993131 0.03736488 #> 6: 1.617456647 0.1157753 -0.023209917 3.273479 0.3923848 0.25361287 5.05085497 #> CD61 CD117 CD49d HLA-DR CD64 CD41 #> 1: -0.03367549 -0.005935889 1.0854069 3.806867702 1.12814560 0.016760944 #> 2: 0.37575938 -0.028242085 0.2160160 1.625229446 2.51531881 1.222586140 #> 3: 0.15191575 -0.007000555 1.0156499 -0.009358463 -0.03477772 -0.016074469 #> 4: 0.60744371 -0.037043896 1.3042564 1.347048087 0.06778483 -0.001106224 #> 5: 0.40913068 0.003552560 1.6398025 4.248428862 0.08712833 0.359059949 #> 6: 0.47413843 0.066260604 0.9114135 0.129246858 -0.03605798 0.077738747 dat_asinh$sample <- dat$sample dat_asinh$cell_id <- dat$cell_id head(dat_asinh) #> CD45RA CD133 CD19 CD22 CD11b CD4 #> 1: 0.4521968 -0.030663164 -0.04111509 -0.03942993 2.55951176 0.15558245 #> 2: 0.4139249 0.628977340 -0.02027821 0.57848688 1.76920432 0.10654443 #> 3: 0.3173883 -0.014386137 0.02232781 -0.01484217 0.42819644 1.42110634 #> 4: 0.7483619 0.018731126 2.07004151 0.89259051 -0.01575979 0.01199128 #> 5: 0.7772642 0.112272365 1.62672741 1.51446768 0.35766705 0.25717724 #> 6: 1.0273733 0.003330631 -0.03886491 0.28380900 0.98926269 0.12921838 #> CD8 CD34 Flt3 CD20 CXCR4 CD235ab #> 1: -0.014386398 0.30236841 0.16886275 -0.017351646 0.6508532 0.16386798 #> 2: -0.001588712 -0.01880155 -0.02646592 -0.008434102 0.2696492 -0.02618534 #> 3: -0.006853243 0.10723503 -0.01149940 0.019554056 0.7139745 0.39044561 #> 4: 0.001809943 -0.03840405 0.63090991 0.127888398 0.5535560 -0.01748791 #> 5: -0.037524184 0.40007994 0.52178220 1.839834412 1.3795382 1.05895614 #> 6: 3.074908161 0.05765429 0.20165859 0.707518206 0.6560537 0.55682438 #> CD45 CD123 CD321 CD14 CD33 CD47 CD11c #> 1: 4.832541 0.061779758 2.925712 0.01014452 0.40817588 2.140661 2.13108274 #> 2: 4.417761 0.346230147 2.210777 -0.03850414 1.17826549 2.406005 1.82688632 #> 3: 5.704353 -0.013618983 1.399436 -0.01191279 -0.03208681 3.065803 -0.03815085 #> 4: 4.216660 0.248972250 1.371487 0.21799154 0.03721993 3.094522 -0.01412334 #> 5: 5.705201 0.010062211 1.484375 0.22215516 0.03173898 2.792218 0.82955004 #> 6: 5.850478 -0.008977647 2.050461 0.12392437 -0.01966382 2.480371 1.03599597 #> CD7 CD15 CD16 CD44 CD38 CD13 CD3 #> 1: -0.001593332 0.1450748 -0.006135286 3.645714 0.8971911 0.89623517 0.11629394 #> 2: -0.017450384 0.1432536 0.082186751 4.307050 1.1923661 0.07155664 0.36880389 #> 3: 0.207344037 0.4099270 -0.029017846 2.614221 0.1229150 0.06086597 5.21957573 #> 4: 0.188650968 0.2468967 0.222743270 2.569725 4.6031134 0.24798459 0.14554227 #> 5: -0.039045905 0.8194260 -0.020382876 3.670287 2.8605627 0.53993131 0.03736488 #> 6: 1.617456647 0.1157753 -0.023209917 3.273479 0.3923848 0.25361287 5.05085497 #> CD61 CD117 CD49d HLA-DR CD64 CD41 #> 1: -0.03367549 -0.005935889 1.0854069 3.806867702 1.12814560 0.016760944 #> 2: 0.37575938 -0.028242085 0.2160160 1.625229446 2.51531881 1.222586140 #> 3: 0.15191575 -0.007000555 1.0156499 -0.009358463 -0.03477772 -0.016074469 #> 4: 0.60744371 -0.037043896 1.3042564 1.347048087 0.06778483 -0.001106224 #> 5: 0.40913068 0.003552560 1.6398025 4.248428862 0.08712833 0.359059949 #> 6: 0.47413843 0.066260604 0.9114135 0.129246858 -0.03605798 0.077738747 #> sample cell_id #> 1: H1 Cell_1 #> 2: H1 Cell_2 #> 3: H1 Cell_3 #> 4: H1 Cell_4 #> 5: H1 Cell_5 #> 6: H1 Cell_6"},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/how_to_prepare_data.html","id":"session-information","dir":"Articles","previous_headings":"","what":"Session information","title":"How to Prepare Data for SuperCellCyto","text":"","code":"sessionInfo() #> R version 4.3.2 (2023-10-31) #> Platform: x86_64-pc-linux-gnu (64-bit) #> Running under: Ubuntu 22.04.3 LTS #> #> Matrix products: default #> BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 #> LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so; LAPACK version 3.10.0 #> #> locale: #> [1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8 #> [4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8 #> [7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C #> [10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C #> #> time zone: UTC #> tzcode source: system (glibc) #> #> attached base packages: #> [1] stats graphics grDevices utils datasets methods base #> #> other attached packages: #> [1] data.table_1.14.10 #> #> loaded via a namespace (and not attached): #> [1] vctrs_0.6.5 cli_3.6.2 knitr_1.45 rlang_1.1.3 #> [5] xfun_0.41 highr_0.10 stringi_1.8.3 png_0.1-8 #> [9] purrr_1.0.2 textshaping_0.3.7 jsonlite_1.8.8 glue_1.7.0 #> [13] htmltools_0.5.7 ragg_1.2.7 sass_0.4.8 rmarkdown_2.25 #> [17] evaluate_0.23 jquerylib_0.1.4 fastmap_1.1.1 yaml_2.3.8 #> [21] lifecycle_1.0.4 memoise_2.0.1 stringr_1.5.1 compiler_4.3.2 #> [25] fs_1.6.3 systemfonts_1.0.5 digest_0.6.34 R6_2.5.1 #> [29] magrittr_2.0.3 bslib_0.6.1 tools_4.3.2 pkgdown_2.0.7 #> [33] cachem_1.0.8 desc_1.4.3"},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/interoperability_with_sce.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"Interoperability with SingleCellExperiment","text":"vignette demonstrates integrate SuperCellCyto results cytometry data stored SingleCellExperiment (SCE) objects, analyse SuperCellCyto output using Bioconductor packages take SCE objects input. use subsampled Levine_32dim dataset stored SCE object illustrate create supercells conduct downstream analyses.","code":"library(SuperCellCyto) library(qs) library(scran) library(BiocSingular) library(scater) library(bluster) library(data.table)"},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/interoperability_with_sce.html","id":"preparing-sce-object","dir":"Articles","previous_headings":"","what":"Preparing SCE object","title":"Interoperability with SingleCellExperiment","text":"first load subsampled Levine_32dim data, stored qs using qread function. data stored counts assay. subset include markers need perform downstream analysis, transform using arcsinh transformation, store transformed data logcounts assay.","code":"sce <- qread(\"data/Levine_32dim_sce_sub.qs\") sce #> class: SingleCellExperiment #> dim: 39 1400 #> metadata(0): #> assays(1): counts #> rownames(39): Time Cell_length ... file_number event_number #> rowData names(3): channel_name marker_name marker_class #> colnames(1400): cell_561 cell_321 ... cell_103890 cell_104094 #> colData names(3): population cell_id sample #> reducedDimNames(0): #> mainExpName: NULL #> altExpNames(0): markers <- c( \"CD45RA\", \"CD133\", \"CD19\", \"CD22\", \"CD11b\", \"CD4\", \"CD8\", \"CD34\", \"Flt3\", \"CD20\", \"CXCR4\", \"CD235ab\", \"CD45\", \"CD123\", \"CD321\", \"CD14\", \"CD33\", \"CD47\", \"CD11c\", \"CD7\", \"CD15\", \"CD16\", \"CD44\", \"CD38\", \"CD13\", \"CD3\", \"CD61\", \"CD117\", \"CD49d\", \"HLA-DR\", \"CD64\", \"CD41\" ) # keep only the relevant markers sce <- sce[markers,] # to store arcsinh transformed data exprs(sce) <- asinh(counts(sce) / 5) sce #> class: SingleCellExperiment #> dim: 32 1400 #> metadata(0): #> assays(2): counts logcounts #> rownames(32): CD45RA CD133 ... CD64 CD41 #> rowData names(3): channel_name marker_name marker_class #> colnames(1400): cell_561 cell_321 ... cell_103890 cell_104094 #> colData names(3): population cell_id sample #> reducedDimNames(0): #> mainExpName: NULL #> altExpNames(0):"},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/interoperability_with_sce.html","id":"run-supercellcyto","dir":"Articles","previous_headings":"","what":"Run SuperCellCyto","title":"Interoperability with SingleCellExperiment","text":"SuperCellCyto requires input data data.table format. Therefore, need extract arcsinh-transformed data data.table object, add sample information IDs cells. Note SCE typically stores cells columns features rows. SuperCellCyto, conversely, requires cells rows features columns, format typical cytometry data typically cells features. Hence, transpose extracted data accordingly creating data.table object. can now embed supercell ID colData SCE object.","code":"dt <- data.table(t(exprs(sce))) dt$sample <- colData(sce)$sample dt$cell_id <- colnames(sce) supercells <- runSuperCellCyto( dt = dt, markers = markers, sample_colname = \"sample\", cell_id_colname = \"cell_id\", gam = 5 ) head(supercells$supercell_expression_matrix) #> CD45RA CD133 CD19 CD22 CD11b CD4 #> 1: 0.3527464 0.36965658 0.052225408 0.15136864 0.38488737 0.196023673 #> 2: 0.4041729 0.11507111 -0.006932994 0.14693022 0.31907116 -0.003634473 #> 3: 0.2887375 0.36023125 0.056967849 0.07522713 0.24452473 0.029621008 #> 4: 0.4649379 0.08945479 0.103484348 0.11839183 0.14487231 1.042568045 #> 5: 0.9805149 0.19259931 2.047843479 0.63399673 0.19205448 0.069494473 #> 6: 0.5039989 0.04109535 1.140960742 0.16492283 0.02102912 0.071198534 #> CD8 CD34 Flt3 CD20 CXCR4 CD235ab CD45 #> 1: 0.007764969 3.50239704 0.34908410 0.05885608 0.8318448 0.08275919 4.150848 #> 2: 0.398832012 0.03705595 0.08254384 0.11077190 0.1816196 0.23423737 4.807796 #> 3: 0.141084382 2.86064160 0.15894138 0.09338509 0.5989438 0.28179014 3.957416 #> 4: 0.071286889 0.10101316 0.29710281 0.03730981 1.2497923 0.67063325 5.886074 #> 5: 0.119244014 0.18210858 0.18761215 1.92656431 1.6019596 0.55462384 4.901840 #> 6: 0.004411946 0.11332847 0.18281316 0.16633969 0.5100604 0.28425575 2.570437 #> CD123 CD321 CD14 CD33 CD47 CD11c CD7 #> 1: 0.65958207 3.4777525 0.002602230 0.152636911 3.397630 0.5570696 0.12059033 #> 2: 0.01079346 0.7022473 0.040223896 -0.019154034 2.348988 0.3813772 3.63888594 #> 3: 0.68153776 3.1851073 0.015196514 0.117996726 2.756822 0.3060572 0.07848237 #> 4: 0.11592253 2.1491149 -0.007858091 -0.002039228 3.268248 0.2132838 1.08816761 #> 5: 0.62460814 2.2506667 0.075977004 0.514268184 3.562088 0.2269047 0.01379916 #> 6: 0.06874399 0.8415449 0.068690241 0.240470325 3.154016 0.4181508 0.07325880 #> CD15 CD16 CD44 CD38 CD13 CD3 CD61 #> 1: 0.63687911 0.195011598 4.262887 2.6031938 0.4192431 0.46531929 0.06761204 #> 2: 0.17664753 0.905724996 1.632231 2.8565129 0.2514765 0.27068380 0.25558748 #> 3: 0.44514407 0.026423501 2.874195 1.9066412 0.4908399 0.24716531 0.17950440 #> 4: 0.08441551 0.004227474 3.640311 0.5495787 0.2311405 5.36168058 0.39291676 #> 5: 0.14494562 0.252655577 2.822493 5.0658843 0.5187125 0.33558106 0.19615231 #> 6: 0.30214595 0.281831160 3.819350 5.8639208 1.0289835 0.07946019 0.08158021 #> CD117 CD49d HLA-DR CD64 CD41 sample #> 1: 1.19031991 1.3604618 2.75321307 0.16150006 0.18985821 H1 #> 2: 0.06541793 0.4496903 0.14374144 0.18547915 0.06282481 H1 #> 3: 0.83249351 0.9205626 2.58482319 0.20073796 0.21266848 H1 #> 4: 0.29209802 0.4707183 0.17818566 0.04568237 0.07765066 H1 #> 5: 0.10129956 1.3608945 2.20287695 0.09954007 0.17256851 H1 #> 6: -0.01764885 1.4263210 0.07484084 0.06353135 0.06840618 H1 #> SuperCellId #> 1: SuperCell_1_Sample_H1 #> 2: SuperCell_2_Sample_H1 #> 3: SuperCell_3_Sample_H1 #> 4: SuperCell_4_Sample_H1 #> 5: SuperCell_5_Sample_H1 #> 6: SuperCell_6_Sample_H1 colData(sce)$supercell_id <- factor(supercells$supercell_cell_map$SuperCellID) head(colData(sce)) #> DataFrame with 6 rows and 4 columns #> population cell_id sample supercell_id #> #> cell_561 Basophils cell_561 H1 SuperCell_94_Sample_H1 #> cell_321 Basophils cell_321 H1 SuperCell_51_Sample_H1 #> cell_153 Basophils cell_153 H1 SuperCell_29_Sample_H1 #> cell_74 Basophils cell_74 H1 SuperCell_51_Sample_H1 #> cell_228 Basophils cell_228 H1 SuperCell_51_Sample_H1 #> cell_146 Basophils cell_146 H1 SuperCell_25_Sample_H1"},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/interoperability_with_sce.html","id":"analyse-supercells-as-sce-object","dir":"Articles","previous_headings":"","what":"Analyse Supercells as SCE object","title":"Interoperability with SingleCellExperiment","text":"number supercells less number cells SCE object, store supercell expression matrix separate SCE object. allows us use Bioconductor packages analyse supercells. code essentially transpose supercell expression matrix, making supercells columns markers rows, store logcounts assay new SCE object. also populate colData SuperCellId sample name supercell. supercell expression matrix now SCE format, can perform downstream analyses clustering drawing UMAP plots using Bioconductor packages. functions operate SCE object work. example, can use plotExpression scater package create violin plots markers clusters. Note, y-axis says “logcounts”, data actually arcsinh transformed, log transformed.","code":"supercell_sce <- SingleCellExperiment( list(logcounts=t(supercells$supercell_expression_matrix[, markers, with=FALSE])), colData = DataFrame( SuperCellId=supercells$supercell_expression_matrix$SuperCellId, sample=supercells$supercell_expression_matrix$sample ) ) colnames(supercell_sce) <- colData(supercell_sce)$SuperCellId supercell_sce #> class: SingleCellExperiment #> dim: 32 280 #> metadata(0): #> assays(1): logcounts #> rownames(32): CD45RA CD133 ... CD64 CD41 #> rowData names(0): #> colnames(280): SuperCell_1_Sample_H1 SuperCell_2_Sample_H1 ... #> SuperCell_139_Sample_H2 SuperCell_140_Sample_H2 #> colData names(2): SuperCellId sample #> reducedDimNames(0): #> mainExpName: NULL #> altExpNames(0): set.seed(42) supercell_sce <- fixedPCA(supercell_sce, rank = 10, subset.row = NULL, BSPARAM=RandomParam()) supercell_sce <- runUMAP(supercell_sce, dimred=\"PCA\") clusters <- clusterCells( supercell_sce, use.dimred = \"PCA\", BLUSPARAM = SNNGraphParam(cluster.fun = \"leiden\") ) colLabels(supercell_sce) <- clusters plotReducedDim(supercell_sce, dimred=\"UMAP\", colour_by=\"label\") plotExpression(supercell_sce, c(\"CD4\", \"CD8\", \"CD19\", \"CD34\", \"CD11b\"), x = \"label\", colour_by = \"sample\")"},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/interoperability_with_sce.html","id":"transfer-information-from-supercells-sce-object-to-single-cell-sce-object","dir":"Articles","previous_headings":"","what":"Transfer information from supercells SCE object to single cell SCE object","title":"Interoperability with SingleCellExperiment","text":"transfer analysis results (e.g., clusters) supercell SCE object back single-cell SCE object, need data wrangling. vital ensure order analysis results (e.g., clusters) aligns cell order SCE object. Using cluster information example, need first extract colData SCE objects two separate data.table objects. use merge.data.table match merge using supercell ID common identifiers. Make sure set sort parameter FALSE set x colData single cell SCE object. ensures order resulting data.table aligns order colData single-cell SCE object. Finally, can add cluster assignment column colData single-cell SCE object. Visualise UMAP plot. violin plot see distribution marker expressions. Note, y-axis says “logcounts”, data actually arcsinh transformed, log transformed.","code":"cell_id_sce <- data.table(as.data.frame(colData(sce))) supercell_cluster <- data.table(as.data.frame(colData(supercell_sce))) cell_id_sce_with_clusters <- merge.data.table( x = cell_id_sce, y = supercell_cluster, by.x = \"supercell_id\", by.y = \"SuperCellId\", sort = FALSE ) colData(sce)$cluster <- cell_id_sce_with_clusters$label sce <- fixedPCA(sce, rank = 10, subset.row = NULL, BSPARAM=RandomParam()) sce <- runUMAP(sce, dimred=\"PCA\") plotReducedDim(sce, dimred=\"UMAP\", colour_by=\"cluster\") plotExpression(sce, c(\"CD4\", \"CD8\", \"CD19\", \"CD34\", \"CD11b\"), x = \"cluster\", colour_by = \"sample\")"},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/interoperability_with_sce.html","id":"session-information","dir":"Articles","previous_headings":"","what":"Session information","title":"Interoperability with SingleCellExperiment","text":"","code":"sessionInfo() #> R version 4.3.2 (2023-10-31) #> Platform: x86_64-pc-linux-gnu (64-bit) #> Running under: Ubuntu 22.04.3 LTS #> #> Matrix products: default #> BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 #> LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so; LAPACK version 3.10.0 #> #> locale: #> [1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8 #> [4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8 #> [7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C #> [10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C #> #> time zone: UTC #> tzcode source: system (glibc) #> #> attached base packages: #> [1] stats4 stats graphics grDevices utils datasets methods #> [8] base #> #> other attached packages: #> [1] data.table_1.14.10 bluster_1.12.0 #> [3] scater_1.30.1 ggplot2_3.4.4 #> [5] BiocSingular_1.18.0 scran_1.30.2 #> [7] scuttle_1.12.0 SingleCellExperiment_1.24.0 #> [9] SummarizedExperiment_1.32.0 Biobase_2.62.0 #> [11] GenomicRanges_1.54.1 GenomeInfoDb_1.38.5 #> [13] IRanges_2.36.0 S4Vectors_0.40.2 #> [15] BiocGenerics_0.48.1 MatrixGenerics_1.14.0 #> [17] matrixStats_1.2.0 qs_0.25.7 #> [19] SuperCellCyto_0.1.0 #> #> loaded via a namespace (and not attached): #> [1] bitops_1.0-7 gridExtra_2.3 #> [3] rlang_1.1.3 magrittr_2.0.3 #> [5] compiler_4.3.2 DelayedMatrixStats_1.24.0 #> [7] systemfonts_1.0.5 vctrs_0.6.5 #> [9] stringr_1.5.1 pkgconfig_2.0.3 #> [11] crayon_1.5.2 fastmap_1.1.1 #> [13] XVector_0.42.0 labeling_0.4.3 #> [15] SuperCell_1.0 utf8_1.2.4 #> [17] rmarkdown_2.25 ggbeeswarm_0.7.2 #> [19] ragg_1.2.7 purrr_1.0.2 #> [21] xfun_0.41 zlibbioc_1.48.0 #> [23] cachem_1.0.8 beachmat_2.18.0 #> [25] jsonlite_1.8.8 highr_0.10 #> [27] DelayedArray_0.28.0 BiocParallel_1.36.0 #> [29] irlba_2.3.5.1 parallel_4.3.2 #> [31] cluster_2.1.4 R6_2.5.1 #> [33] bslib_0.6.1 stringi_1.8.3 #> [35] limma_3.58.1 jquerylib_0.1.4 #> [37] Rcpp_1.0.12 knitr_1.45 #> [39] FNN_1.1.4 Matrix_1.6-5 #> [41] igraph_1.6.0 tidyselect_1.2.0 #> [43] abind_1.4-5 yaml_2.3.8 #> [45] viridis_0.6.4 stringfish_0.16.0 #> [47] codetools_0.2-19 plyr_1.8.9 #> [49] lattice_0.21-9 tibble_3.2.1 #> [51] withr_3.0.0 evaluate_0.23 #> [53] desc_1.4.3 RcppParallel_5.1.7 #> [55] pillar_1.9.0 generics_0.1.3 #> [57] RCurl_1.98-1.14 sparseMatrixStats_1.14.0 #> [59] munsell_0.5.0 scales_1.3.0 #> [61] RApiSerialize_0.1.2 glue_1.7.0 #> [63] metapod_1.10.1 tools_4.3.2 #> [65] BiocNeighbors_1.20.2 ScaledMatrix_1.10.0 #> [67] locfit_1.5-9.8 RANN_2.6.1 #> [69] fs_1.6.3 cowplot_1.1.3 #> [71] grid_4.3.2 edgeR_4.0.12 #> [73] colorspace_2.1-0 GenomeInfoDbData_1.2.11 #> [75] beeswarm_0.4.0 vipor_0.4.7 #> [77] cli_3.6.2 rsvd_1.0.5 #> [79] textshaping_0.3.7 fansi_1.0.6 #> [81] viridisLite_0.4.2 S4Arrays_1.2.0 #> [83] dplyr_1.1.4 uwot_0.1.16 #> [85] gtable_0.3.4 sass_0.4.8 #> [87] digest_0.6.34 SparseArray_1.2.3 #> [89] ggrepel_0.9.5 dqrng_0.3.2 #> [91] farver_2.1.1 memoise_2.0.1 #> [93] htmltools_0.5.7 pkgdown_2.0.7 #> [95] lifecycle_1.0.4 statmod_1.5.0"},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/interoperability_with_seurat.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"Interoperability with Seurat","text":"can integrate SuperCellCyto’s output cytometry data stored Seurat objects? possible store results SuperCellCyto Seurat objects subsequent analysis using Seurat? answer yes. vignette, demonstrate process using subsampled Levine_32dim dataset used manuscript stored Seurat object. show create supercells data analyze using Seurat.","code":"library(qs) library(Seurat) library(data.table) library(SuperCellCyto) set.seed(42)"},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/interoperability_with_seurat.html","id":"preparing-seurat-object","dir":"Articles","previous_headings":"","what":"Preparing Seurat object","title":"Interoperability with Seurat","text":"subsampled Levine_32dim data stored qs object. begin loading data using qread function qs package. data stored originalexp assay, counts data slots containing raw data. running SuperCellCyto, first: Subset data retain markers need perform downstream analysis. Perform arcsinh transformation, store transformed data data slot originalexp assay.","code":"seurat_obj <- qread(\"data/Levine_32dim_seurat_sub.qs\") seurat_obj #> An object of class Seurat #> 39 features across 1400 samples within 1 assay #> Active assay: originalexp (39 features, 0 variable features) #> 2 layers present: counts, data markers <- c( \"CD45RA\", \"CD133\", \"CD19\", \"CD22\", \"CD11b\", \"CD4\", \"CD8\", \"CD34\", \"Flt3\", \"CD20\", \"CXCR4\", \"CD235ab\", \"CD45\", \"CD123\", \"CD321\", \"CD14\", \"CD33\", \"CD47\", \"CD11c\", \"CD7\", \"CD15\", \"CD16\", \"CD44\", \"CD38\", \"CD13\", \"CD3\", \"CD61\", \"CD117\", \"CD49d\", \"HLA-DR\", \"CD64\", \"CD41\" ) # keep only the relevant markers seurat_obj <- seurat_obj[markers, ] # to store arcsinh transformed data seurat_obj[['originalexp']]$data <- asinh(seurat_obj[['originalexp']]$counts / 5) seurat_obj #> An object of class Seurat #> 32 features across 1400 samples within 1 assay #> Active assay: originalexp (32 features, 0 variable features) #> 2 layers present: counts, data"},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/interoperability_with_seurat.html","id":"run-supercellcyto","dir":"Articles","previous_headings":"","what":"Run SuperCellCyto","title":"Interoperability with Seurat","text":"SuperCellCyto requires input data data.table format. Hence, extract arcsinh-transformed data Seurat object, format data.table, include sample information cell IDs. ’s important note Seurat objects typically store cells columns features (markers genes) rows. Since SuperCellCyto expects cells rows features columns, also transpose data. transposing preparing data table, run runSuperCellCyto function, passing required parameters including markers, sample column name, cell ID column name, gamma value. can now embed supercell ID metadata Seurat object.","code":"# check.names set to FALSE so HLA-DR is not replaced with HLA.DR dt <- data.table(t(data.frame(seurat_obj[['originalexp']]$data, check.names = FALSE))) # add the cell_id and sample metadata dt <- cbind(dt, seurat_obj[[c(\"cell_id\", \"sample\")]]) supercells <- runSuperCellCyto( dt = dt, markers = markers, sample_colname = \"sample\", cell_id_colname = \"cell_id\", gam = 5 ) head(supercells$supercell_expression_matrix) #> CD45RA CD133 CD19 CD22 CD11b CD4 #> 1: 0.3527464 0.36965658 0.052225408 0.15136864 0.38488737 0.196023673 #> 2: 0.4041729 0.11507111 -0.006932994 0.14693022 0.31907116 -0.003634473 #> 3: 0.2887375 0.36023125 0.056967849 0.07522713 0.24452473 0.029621008 #> 4: 0.4649379 0.08945479 0.103484348 0.11839183 0.14487231 1.042568045 #> 5: 0.9805149 0.19259931 2.047843479 0.63399673 0.19205448 0.069494473 #> 6: 0.5039989 0.04109535 1.140960742 0.16492283 0.02102912 0.071198534 #> CD8 CD34 Flt3 CD20 CXCR4 CD235ab CD45 #> 1: 0.007764969 3.50239704 0.34908410 0.05885608 0.8318448 0.08275919 4.150848 #> 2: 0.398832012 0.03705595 0.08254384 0.11077190 0.1816196 0.23423737 4.807796 #> 3: 0.141084382 2.86064160 0.15894138 0.09338509 0.5989438 0.28179014 3.957416 #> 4: 0.071286889 0.10101316 0.29710281 0.03730981 1.2497923 0.67063325 5.886074 #> 5: 0.119244014 0.18210858 0.18761215 1.92656431 1.6019596 0.55462384 4.901840 #> 6: 0.004411946 0.11332847 0.18281316 0.16633969 0.5100604 0.28425575 2.570437 #> CD123 CD321 CD14 CD33 CD47 CD11c CD7 #> 1: 0.65958207 3.4777525 0.002602230 0.152636911 3.397630 0.5570696 0.12059033 #> 2: 0.01079346 0.7022473 0.040223896 -0.019154034 2.348988 0.3813772 3.63888594 #> 3: 0.68153776 3.1851073 0.015196514 0.117996726 2.756822 0.3060572 0.07848237 #> 4: 0.11592253 2.1491149 -0.007858091 -0.002039228 3.268248 0.2132838 1.08816761 #> 5: 0.62460814 2.2506667 0.075977004 0.514268184 3.562088 0.2269047 0.01379916 #> 6: 0.06874399 0.8415449 0.068690241 0.240470325 3.154016 0.4181508 0.07325880 #> CD15 CD16 CD44 CD38 CD13 CD3 CD61 #> 1: 0.63687911 0.195011598 4.262887 2.6031938 0.4192431 0.46531929 0.06761204 #> 2: 0.17664753 0.905724996 1.632231 2.8565129 0.2514765 0.27068380 0.25558748 #> 3: 0.44514407 0.026423501 2.874195 1.9066412 0.4908399 0.24716531 0.17950440 #> 4: 0.08441551 0.004227474 3.640311 0.5495787 0.2311405 5.36168058 0.39291676 #> 5: 0.14494562 0.252655577 2.822493 5.0658843 0.5187125 0.33558106 0.19615231 #> 6: 0.30214595 0.281831160 3.819350 5.8639208 1.0289835 0.07946019 0.08158021 #> CD117 CD49d HLA-DR CD64 CD41 sample #> 1: 1.19031991 1.3604618 2.75321307 0.16150006 0.18985821 H1 #> 2: 0.06541793 0.4496903 0.14374144 0.18547915 0.06282481 H1 #> 3: 0.83249351 0.9205626 2.58482319 0.20073796 0.21266848 H1 #> 4: 0.29209802 0.4707183 0.17818566 0.04568237 0.07765066 H1 #> 5: 0.10129956 1.3608945 2.20287695 0.09954007 0.17256851 H1 #> 6: -0.01764885 1.4263210 0.07484084 0.06353135 0.06840618 H1 #> SuperCellId #> 1: SuperCell_1_Sample_H1 #> 2: SuperCell_2_Sample_H1 #> 3: SuperCell_3_Sample_H1 #> 4: SuperCell_4_Sample_H1 #> 5: SuperCell_5_Sample_H1 #> 6: SuperCell_6_Sample_H1 seurat_obj$supercell_id <- factor(supercells$supercell_cell_map$SuperCellID) head(seurat_obj[[]]) #> orig.ident nCount_originalexp nFeature_originalexp population cell_id #> cell_561 cell 782.3311 23 Basophils cell_561 #> cell_321 cell 849.1107 28 Basophils cell_321 #> cell_153 cell 1349.6991 21 Basophils cell_153 #> cell_74 cell 908.6923 23 Basophils cell_74 #> cell_228 cell 723.2195 27 Basophils cell_228 #> cell_146 cell 444.4285 22 Basophils cell_146 #> sample supercell_id #> cell_561 H1 SuperCell_94_Sample_H1 #> cell_321 H1 SuperCell_51_Sample_H1 #> cell_153 H1 SuperCell_29_Sample_H1 #> cell_74 H1 SuperCell_51_Sample_H1 #> cell_228 H1 SuperCell_51_Sample_H1 #> cell_146 H1 SuperCell_25_Sample_H1"},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/interoperability_with_seurat.html","id":"analyse-supercells-as-seurat-object","dir":"Articles","previous_headings":"","what":"Analyse Supercells as Seurat object","title":"Interoperability with Seurat","text":"supercell expression matrix, fewer supercells number cells Seurat object, best stored separate Seurat object. allows us use Seurat’s functions analysis. , first transpose expression matrix, ensuring cells columns markers rows, create new Seurat object default RNA assay. data counts slots RNA assay set contain marker expression. supercell marker expression stored Seurat object, can proceed performing downstream analysis clustering creating UMAP plots.","code":"supercell_exp_mat <- t(supercells$supercell_expression_matrix[, markers, with=FALSE]) colnames(supercell_exp_mat) <- supercells$supercell_expression_matrix$SuperCellId supercell_seurat_obj <- CreateSeuratObject(counts = supercell_exp_mat) #> Warning: Data is of class matrix. Coercing to dgCMatrix. supercell_seurat_obj[['RNA']]$data <- supercell_seurat_obj[['RNA']]$counts supercell_seurat_obj #> An object of class Seurat #> 32 features across 280 samples within 1 assay #> Active assay: RNA (32 features, 0 variable features) #> 2 layers present: counts, data # Have to do this, otherwise Seurat will complain supercell_seurat_obj <- ScaleData(supercell_seurat_obj) supercell_seurat_obj <- RunPCA( object = supercell_seurat_obj, npcs = 10, nfeatures.print = 1, approx = FALSE, seed.use = 42, features = markers ) supercell_seurat_obj <- FindNeighbors(supercell_seurat_obj, dims = 1:10) supercell_seurat_obj <- FindClusters(supercell_seurat_obj, resolution = 0.5) #> Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck #> #> Number of nodes: 280 #> Number of edges: 6252 #> #> Running Louvain algorithm... #> Maximum modularity in 10 random starts: 0.8590 #> Number of communities: 7 #> Elapsed time: 0 seconds supercell_seurat_obj <- RunUMAP(supercell_seurat_obj, dims = 1:10) #> Warning: The default method for RunUMAP has changed from calling Python UMAP via reticulate to the R-native UWOT using the cosine metric #> To use Python UMAP via reticulate, set umap.method to 'umap-learn' and metric to 'correlation' #> This message will be shown once per session DimPlot(supercell_seurat_obj, reduction = \"umap\") FeaturePlot(supercell_seurat_obj, features = c(\"CD4\", \"CD8\", \"CD19\", \"CD34\", \"CD11b\"), ncol = 3)"},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/interoperability_with_seurat.html","id":"transfer-information-from-supercells-seurat-object-to-single-cell-seurat-object","dir":"Articles","previous_headings":"","what":"Transfer information from supercells Seurat object to single cell Seurat object","title":"Interoperability with Seurat","text":"transfer information (e.g., clusters) obtained analyzing supercells back single cells, need data wrangling. key ensuring order new information aligns order cells Seurat object. demonstrate using cluster information example. first extract metadata single-cell Seurat object clustering information supercells Seurat object two different data.table objects, merge using merge.data.table, setting sort parameter FALSE x parameter data.table containing metadata single-cell Seurat object ensure result order metadata single-cell Seurat object. merging, can add cluster assignment metadata single-cell Seurat object. visualise cluster assignments marker expressions clustered single cell data.","code":"clusters <- data.table( supercell_id = colnames(supercell_seurat_obj), cluster = as.vector(Idents(supercell_seurat_obj)) ) cell_metadata <- seurat_obj[[]] cell_metadata <- merge.data.table( x = cell_metadata, y = clusters, by = \"supercell_id\", sort = FALSE ) seurat_obj$cluster <- cell_metadata$cluster Idents(seurat_obj) <- \"cluster\" seurat_obj <- ScaleData(seurat_obj) seurat_obj <- RunPCA( object = seurat_obj, npcs = 10, nfeatures.print = 1, approx = FALSE, seed.use = 42, features = markers ) seurat_obj <- FindNeighbors(seurat_obj, dims = 1:10) seurat_obj <- FindClusters(seurat_obj, resolution = 0.5) #> Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck #> #> Number of nodes: 1400 #> Number of edges: 45134 #> #> Running Louvain algorithm... #> Maximum modularity in 10 random starts: 0.9088 #> Number of communities: 9 #> Elapsed time: 0 seconds seurat_obj <- RunUMAP(seurat_obj, dims = 1:10) DimPlot(seurat_obj, reduction = \"umap\") FeaturePlot(seurat_obj, features = c(\"CD4\", \"CD8\", \"CD19\", \"CD34\", \"CD11b\"), ncol = 3)"},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/interoperability_with_seurat.html","id":"session-information","dir":"Articles","previous_headings":"","what":"Session information","title":"Interoperability with Seurat","text":"","code":"sessionInfo() #> R version 4.3.2 (2023-10-31) #> Platform: x86_64-pc-linux-gnu (64-bit) #> Running under: Ubuntu 22.04.3 LTS #> #> Matrix products: default #> BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 #> LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so; LAPACK version 3.10.0 #> #> locale: #> [1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8 #> [4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8 #> [7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C #> [10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C #> #> time zone: UTC #> tzcode source: system (glibc) #> #> attached base packages: #> [1] stats graphics grDevices utils datasets methods base #> #> other attached packages: #> [1] SuperCellCyto_0.1.0 data.table_1.14.10 Seurat_5.0.1 #> [4] SeuratObject_5.0.1 sp_2.1-2 qs_0.25.7 #> #> loaded via a namespace (and not attached): #> [1] RColorBrewer_1.1-3 jsonlite_1.8.8 magrittr_2.0.3 #> [4] spatstat.utils_3.0-4 farver_2.1.1 rmarkdown_2.25 #> [7] fs_1.6.3 ragg_1.2.7 vctrs_0.6.5 #> [10] ROCR_1.0-11 memoise_2.0.1 spatstat.explore_3.2-5 #> [13] htmltools_0.5.7 sass_0.4.8 sctransform_0.4.1 #> [16] parallelly_1.36.0 KernSmooth_2.23-22 bslib_0.6.1 #> [19] htmlwidgets_1.6.4 desc_1.4.3 ica_1.0-3 #> [22] plyr_1.8.9 plotly_4.10.4 zoo_1.8-12 #> [25] cachem_1.0.8 igraph_1.6.0 mime_0.12 #> [28] lifecycle_1.0.4 pkgconfig_2.0.3 Matrix_1.6-5 #> [31] R6_2.5.1 fastmap_1.1.1 fitdistrplus_1.1-11 #> [34] future_1.33.1 shiny_1.8.0 digest_0.6.34 #> [37] colorspace_2.1-0 patchwork_1.2.0 tensor_1.5 #> [40] RSpectra_0.16-1 irlba_2.3.5.1 textshaping_0.3.7 #> [43] labeling_0.4.3 progressr_0.14.0 fansi_1.0.6 #> [46] spatstat.sparse_3.0-3 httr_1.4.7 polyclip_1.10-6 #> [49] abind_1.4-5 compiler_4.3.2 withr_3.0.0 #> [52] BiocParallel_1.36.0 fastDummies_1.7.3 highr_0.10 #> [55] MASS_7.3-60 tools_4.3.2 lmtest_0.9-40 #> [58] httpuv_1.6.13 future.apply_1.11.1 goftest_1.2-3 #> [61] glue_1.7.0 nlme_3.1-163 promises_1.2.1 #> [64] grid_4.3.2 Rtsne_0.17 cluster_2.1.4 #> [67] reshape2_1.4.4 generics_0.1.3 gtable_0.3.4 #> [70] spatstat.data_3.0-4 tidyr_1.3.0 RApiSerialize_0.1.2 #> [73] stringfish_0.16.0 utf8_1.2.4 spatstat.geom_3.2-7 #> [76] RcppAnnoy_0.0.21 ggrepel_0.9.5 RANN_2.6.1 #> [79] pillar_1.9.0 stringr_1.5.1 spam_2.10-0 #> [82] RcppHNSW_0.5.0 later_1.3.2 splines_4.3.2 #> [85] dplyr_1.1.4 lattice_0.21-9 survival_3.5-7 #> [88] deldir_2.0-2 tidyselect_1.2.0 miniUI_0.1.1.1 #> [91] pbapply_1.7-2 knitr_1.45 gridExtra_2.3 #> [94] scattermore_1.2 xfun_0.41 matrixStats_1.2.0 #> [97] stringi_1.8.3 lazyeval_0.2.2 yaml_2.3.8 #> [100] evaluate_0.23 codetools_0.2-19 SuperCell_1.0 #> [103] tibble_3.2.1 cli_3.6.2 uwot_0.1.16 #> [106] RcppParallel_5.1.7 xtable_1.8-4 reticulate_1.34.0 #> [109] systemfonts_1.0.5 munsell_0.5.0 jquerylib_0.1.4 #> [112] Rcpp_1.0.12 globals_0.16.2 spatstat.random_3.2-2 #> [115] png_0.1-8 parallel_4.3.2 ellipsis_0.3.2 #> [118] pkgdown_2.0.7 ggplot2_3.4.4 dotCall64_1.1-1 #> [121] listenv_0.9.0 viridisLite_0.4.2 scales_1.3.0 #> [124] ggridges_0.5.5 leiden_0.4.3.1 purrr_1.0.2 #> [127] rlang_1.1.3 cowplot_1.1.3"},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/using_supercellcyto_for_stratified_summarising.html","id":"session-information","dir":"Articles","previous_headings":"","what":"Session information","title":"Using SuperCellCyto for Stratified Summarising","text":"","code":"sessionInfo() #> R version 4.3.2 (2023-10-31) #> Platform: x86_64-pc-linux-gnu (64-bit) #> Running under: Ubuntu 22.04.3 LTS #> #> Matrix products: default #> BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 #> LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so; LAPACK version 3.10.0 #> #> locale: #> [1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8 #> [4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8 #> [7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C #> [10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C #> #> time zone: UTC #> tzcode source: system (glibc) #> #> attached base packages: #> [1] stats graphics grDevices utils datasets methods base #> #> other attached packages: #> [1] SuperCellCyto_0.1.0 #> #> loaded via a namespace (and not attached): #> [1] Matrix_1.6-5 jsonlite_1.8.8 compiler_4.3.2 #> [4] Rcpp_1.0.12 stringr_1.5.1 parallel_4.3.2 #> [7] SuperCell_1.0 jquerylib_0.1.4 systemfonts_1.0.5 #> [10] textshaping_0.3.7 BiocParallel_1.36.0 yaml_2.3.8 #> [13] fastmap_1.1.1 lattice_0.21-9 plyr_1.8.9 #> [16] R6_2.5.1 igraph_1.6.0 knitr_1.45 #> [19] desc_1.4.3 bslib_0.6.1 rlang_1.1.3 #> [22] cachem_1.0.8 stringi_1.8.3 RANN_2.6.1 #> [25] xfun_0.41 fs_1.6.3 sass_0.4.8 #> [28] memoise_2.0.1 cli_3.6.2 pkgdown_2.0.7 #> [31] magrittr_2.0.3 digest_0.6.34 grid_4.3.2 #> [34] lifecycle_1.0.4 vctrs_0.6.5 evaluate_0.23 #> [37] glue_1.7.0 data.table_1.14.10 codetools_0.2-19 #> [40] ragg_1.2.7 rmarkdown_2.25 purrr_1.0.2 #> [43] pkgconfig_2.0.3 tools_4.3.2 htmltools_0.5.7"},{"path":"https://phipsonlab.github.io/SuperCellCyto/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Givanna Putri. Author, maintainer. George Howitt. Author. Felix Marsh-Wakefield. Author. Thomas Ashhurst. Author. Belinda Phipson. Author.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Putri, H G, Howitt, George, Marsh-Wakefield, Felix, Ashhurst, Myles T, Phipson, Belinda (2023). “SuperCellCyto: enabling efficient analysis large scale cytometry datasets.” bioRxiv. doi:10.1101/2023.08.14.553168.","code":"@Article{, title = {SuperCellCyto: enabling efficient analysis of large scale cytometry datasets}, author = {{Putri} and Givanna H and {Howitt} and {George} and {Marsh-Wakefield} and {Felix} and {Ashhurst} and Thomas Myles and {Phipson} and {Belinda}}, journal = {bioRxiv}, year = {2023}, doi = {https://doi.org/10.1101/2023.08.14.553168}, }"},{"path":"https://phipsonlab.github.io/SuperCellCyto/index.html","id":"supercellcyto","dir":"","previous_headings":"","what":"SuperCell For Cytometry Data","title":"SuperCell For Cytometry Data","text":"SuperCellCyto extension SuperCell R package. Initially developed scRNAseq data, SuperCell aggregates cells similar transcriptomic profiles “supercells” (also known “metacells” scRNAseq literature). SuperCellCyto, ’ve tailored SuperCell package specifically cater cytometry data: Supercells now aggregating cells similar marker expressions. Supercells now created individual sample. adaptation ensures supercell encompasses cells exclusively one sample. processing sample independently, prevent intermixing cells different samples within supercells. Multiple samples can now processed parallel custom load balancing strategy. enhancement enables simultaneous generation supercells multiple samples, significantly reducing computational time required processing large datasets.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/index.html","id":"vignettes-and-function-documentation","dir":"","previous_headings":"","what":"Vignettes and Function Documentation","title":"SuperCell For Cytometry Data","text":"understand SuperCellCyto can integrated workflow, head Articles page. Click dropdown arrow Articles link navbar top website. vignettes provide step--step guides, practical examples, use-case scenarios demonstrate package’s application various research contexts. Documentation usage function SuperCellCyto package available Reference page. Click Reference link navbar top website.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/index.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"SuperCell For Cytometry Data","text":"use SuperCellCyto study, please kindly cite preprint bioRxiv: Putri, G. H., Howitt, G., Marsh-Wakefield, F., Ashhurst, T. M., & Phipson, B. (2023). SuperCellCyto: enabling efficient analysis large scale cytometry datasets. bioRxiv; DOI: https://doi.org/10.1101/2023.08.14.553168","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"SuperCell For Cytometry Data","text":"package can installed using remotes: SuperCellCyto requires SuperCell R package installed run properly. use installation command , , theory, automatically installed. case doesn’t, please manually install running following command beforehand:","code":"# Install remotes install.packages(\"remotes\") # Install SuperCellCyto from this repository remotes::install_github(\"phipsonlab/SuperCellCyto\") # Install SuperCell from their github repository remotes::install_github(\"GfellerLab/SuperCell\")"},{"path":"https://phipsonlab.github.io/SuperCellCyto/index.html","id":"code-of-conduct","dir":"","previous_headings":"","what":"Code of Conduct","title":"SuperCell For Cytometry Data","text":"Please note SuperCellCyto project released Contributor Code Conduct. contributing project, agree abide terms.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/index.html","id":"contribution-guide","dir":"","previous_headings":"","what":"Contribution guide","title":"SuperCell For Cytometry Data","text":"Please visit Contributing Guide","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/reference/recomputeSupercells.html","id":null,"dir":"Reference","previous_headings":"","what":"Recompute supercells — recomputeSupercells","title":"Recompute supercells — recomputeSupercells","text":"Given supercell object, recreate supercells using different gamma value. Gamma value controls number supercells generated. smaller value, supercells get, vice versa. function run, need least run runSuperCellCyto function !","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/reference/recomputeSupercells.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Recompute supercells — recomputeSupercells","text":"","code":"recomputeSupercells( dt, sc_objects, markers, sample_colname, cell_id_colname, gam = 20 )"},{"path":"https://phipsonlab.github.io/SuperCellCyto/reference/recomputeSupercells.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Recompute supercells — recomputeSupercells","text":"dt data.table object containing cytometry data rows represent cells columns represent markers. sc_objects supercell_object returned runSuperCellCyto function. markers character vector identifying markers create supercells . sample_colname character string identifying column dt denotes sample cell. cell_id_colname character string identifying column dt representing cell's unique ID. gam numeric value specifying gamma value regulates number supercells generated. Defaults 20.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/reference/recomputeSupercells.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Recompute supercells — recomputeSupercells","text":"list following components: supercell_expression_matrix: data.table object contains marker expression supercell. marker expressions computed calculating mean marker expressions across cells within individual supercell. supercell_cell_map: data.table maps cell corresponding supercell. table essential identifying specific supercell cell allocated . proves particularly useful analyses require one expand supercells individual cell level.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/reference/recomputeSupercells.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Recompute supercells — recomputeSupercells","text":"Givanna Putri","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/reference/recomputeSupercells.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Recompute supercells — recomputeSupercells","text":"","code":"set.seed(42) cyto_dat <- simCytoData(10, rep(1000, 3)) markers <- paste0(\"Marker_\", seq_len(10)) out_gam20 <- runSuperCellCyto( dt = cyto_dat, markers = markers, sample_colname = \"Sample\", cell_id_colname = \"Cell_Id\", gam = 20 ) recomputed_sc <- recomputeSupercells( dt = cyto_dat, sc_objects = out_gam20$supercell_object, markers = markers, sample_colname = \"Sample\", cell_id_colname = \"Cell_Id\", gam = 50 )"},{"path":"https://phipsonlab.github.io/SuperCellCyto/reference/runSuperCellCyto.html","id":null,"dir":"Reference","previous_headings":"","what":"Run SuperCellCyto on Cytometry Data — runSuperCellCyto","title":"Run SuperCellCyto on Cytometry Data — runSuperCellCyto","text":"function creates supercells cytometry data formatted data.table object using SuperCellCyto algorithm. Please make sure read additional details better understand function works.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/reference/runSuperCellCyto.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Run SuperCellCyto on Cytometry Data — runSuperCellCyto","text":"","code":"runSuperCellCyto( dt, markers, sample_colname, cell_id_colname, gam = 20, k_knn = 5, BPPARAM = SerialParam(), load_balancing = FALSE )"},{"path":"https://phipsonlab.github.io/SuperCellCyto/reference/runSuperCellCyto.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Run SuperCellCyto on Cytometry Data — runSuperCellCyto","text":"dt data.table object containing cytometry data rows represent cells columns represent markers. data.frame object, function try convert data.table object. warning message displayed happens. Otherwise, terminate. markers character vector identifying markers create supercells . sample_colname character string identifying column dt denotes sample cell. cell_id_colname character string identifying column dt representing cell's unique ID. gam numeric value specifying gamma value regulates number supercells generated. Defaults 20. k_knn numeric value specifying k value (number neighbours) used build kNN network. Defaults 5. BPPARAM BiocParallelParam object specifying parallel processing settings. Defaults SerialParam, meaning samples processed sequentially one . Refer additional details section parallel processing details. load_balancing logical value indicating whether use custom load balancing scheme processing multiple samples parallel. Defaults FALSE. Refer additional details section parallel processing details.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/reference/runSuperCellCyto.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Run SuperCellCyto on Cytometry Data — runSuperCellCyto","text":"list following components: supercell_object: list containing object returned SCimplify function. One object per sample. object critical recomputing supercells future. Hence discard . supercell_expression_matrix: data.table object contains marker expression supercell. marker expressions computed calculating mean marker expressions across cells within individual supercell. supercell_cell_map: data.table maps cell corresponding supercell. table essential identifying specific supercell cell allocated . proves particularly useful analyses require one expand supercells individual cell level.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/reference/runSuperCellCyto.html","id":"parallel-processing","dir":"Reference","previous_headings":"","what":"Parallel Processing","title":"Run SuperCellCyto on Cytometry Data — runSuperCellCyto","text":"SuperCellCyto can process multiple samples simultaneously parallel. can drastically bring processing time dataset large number samples. enable feature, set BPPARAM parameter either MulticoreParam object SnowParam object. Importantly, also recommended set number tasks (.e., task parameter either MulticoreParam SnowParam object) number samples dataset. Furthermore, also recommend setting load_balancing parameter TRUE. ensures optimal distribution samples across multiple cores, particularly important samples varying sizes (number cells).","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/reference/runSuperCellCyto.html","id":"cell-id-and-sample-definitions","dir":"Reference","previous_headings":"","what":"Cell ID and Sample Definitions","title":"Run SuperCellCyto on Cytometry Data — runSuperCellCyto","text":"cell_id_colname parameter specifies column dt denotes unique identifier cell. perfectly normal column dataset default. good news trivial create one. can create new vector containing sequence numbers 1 however many cells , append vector new column dataset. Refer vignette . sample_colname parameter specifies column dt denotes sample cell came . default, SuperCellCyto creates supercells sample independent samples. ensures supercell contain cells exactly one sample. constitute sample? purposes, sample represents biological sample experiment. may thinking, possible use different context, say creating supercells population cluster rather biological sample? short answer yes, address vignette.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/reference/runSuperCellCyto.html","id":"computing-pca","dir":"Reference","previous_headings":"","what":"Computing PCA","title":"Run SuperCellCyto on Cytometry Data — runSuperCellCyto","text":"function start computing PCA markers specified markers parameter. default, number PCs calculated set 10. less 10 markers markers parameter, number PCs set however many markers markers parameter. Notably, scaling transformation done markers' expressions prior computing PCs. function use irlba calculate PCA. little gain use cytometry data relatively tiny number features (markers) data.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/reference/runSuperCellCyto.html","id":"setting-supercell-s-resolution","dir":"Reference","previous_headings":"","what":"Setting Supercell's Resolution","title":"Run SuperCellCyto on Cytometry Data — runSuperCellCyto","text":"gam parameter influences number supercells created per sample. lower gam value results , thus generally smaller supercells, vice versa. estimate many supercells get dataset, important understand gam value interpreted context number cells sample. gam=n_cells/n_supercells n_cells denotes number cells n_supercells denotes number supercells created. resolving formula , can roughly estimate many supercells get per sample. example, say 2 samples, sample B. Sample 10,000 cells, sample B 5,000 cells: gam set 10, end 1,000 supercells sample 500 supercells sample B, total 1,500 supercells. gam set 50, end 200 supercells sample 100 supercells sample B, total 300 supercells. Importantly, one expect supercells size. capture /less cells others. trivial estimate many cells captured supercell beforehand.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/reference/runSuperCellCyto.html","id":"computing-knn-network","dir":"Reference","previous_headings":"","what":"Computing kNN network","title":"Run SuperCellCyto on Cytometry Data — runSuperCellCyto","text":"create supercells, kNN (k-Nearest Neighbors) network constructed based k_knn parameter dictates number neighbours (cell) used create network. actual (approximate) kNN network created. walktrap algorithm uses network group cells supercells.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/reference/runSuperCellCyto.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Run SuperCellCyto on Cytometry Data — runSuperCellCyto","text":"Givanna Putri","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/reference/runSuperCellCyto.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Run SuperCellCyto on Cytometry Data — runSuperCellCyto","text":"","code":"# Simulate some data set.seed(42) cyto_dat <- simCytoData(nmarkers = 10, ncells = rep(2000,2)) # Setup the columns designating the markers, samples, and cell IDs marker_col <- paste0(\"Marker_\", seq_len(10)) sample_col <- \"Sample\" cell_id_col <- \"Cell_Id\" supercell_dat <- runSuperCellCyto( cyto_dat, marker_col, sample_col, cell_id_col )"},{"path":"https://phipsonlab.github.io/SuperCellCyto/reference/simCytoData.html","id":null,"dir":"Reference","previous_headings":"","what":"Simulate cytometry data — simCytoData","title":"Simulate cytometry data — simCytoData","text":"Simulate cytometry data use testing documenting functions require cytometry data. Please run set.seed running function want ensure reproducibility.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/reference/simCytoData.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Simulate cytometry data — simCytoData","text":"","code":"simCytoData(nmarkers = 10, ncells = rep(10000, 2))"},{"path":"https://phipsonlab.github.io/SuperCellCyto/reference/simCytoData.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Simulate cytometry data — simCytoData","text":"nmarkers numeric value specifying number markers simulate. ncells numeric vector specifying number cells simulate per sample. 1 vector element per sample.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/reference/simCytoData.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Simulate cytometry data — simCytoData","text":"data.table object containing simulated cytometry data rows represent cells columns represent markers.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/reference/simCytoData.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Simulate cytometry data — simCytoData","text":"Givanna Putri","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/reference/simCytoData.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Simulate cytometry data — simCytoData","text":"","code":"set.seed(42) cyto_dat <- simCytoData() head(cyto_dat) #> Marker_1 Marker_2 Marker_3 Marker_4 Marker_5 Marker_6 Marker_7 Marker_8 #> 1: 18.61597 17.43348 9.213419 18.40881 13.68860 12.77402 15.24751 7.140615 #> 2: 20.23361 19.82792 9.740510 18.16383 13.97108 14.25898 16.05032 5.863752 #> 3: 18.62743 17.76816 11.175358 18.59606 16.08534 13.69734 16.71550 4.750240 #> 4: 20.74051 19.94771 9.797939 18.43590 13.92092 12.64266 15.55953 8.173464 #> 5: 18.65938 18.87830 8.916928 17.83295 15.62066 11.37118 16.08417 6.664707 #> 6: 20.02696 20.76054 9.262685 16.89373 15.92339 13.40002 16.13880 6.862717 #> Marker_9 Marker_10 Sample Cell_Id #> 1: 14.37555 14.18484 Sample_1 Cell_1 #> 2: 15.58007 15.56981 Sample_1 Cell_2 #> 3: 14.16156 14.92222 Sample_1 Cell_3 #> 4: 14.26637 15.10761 Sample_1 Cell_4 #> 5: 15.12219 15.64231 Sample_1 Cell_5 #> 6: 15.85313 15.52535 Sample_1 Cell_6 dim(cyto_dat) #> [1] 20000 12"},{"path":"https://phipsonlab.github.io/SuperCellCyto/news/index.html","id":"supercellcyto-010","dir":"Changelog","previous_headings":"","what":"SuperCellCyto 0.1.0","title":"SuperCellCyto 0.1.0","text":"first release SuperCellCyto. also version SuperCellCyto used preprint:","code":"@article{ putri2023supercellcyto, title={SuperCellCyto: enabling efficient analysis of large scale cytometry datasets}, author={Putri, Givanna H and Howitt, George and Marsh-Wakefield, Felix and Ashhurst, Thomas Myles and Phipson, Belinda}, journal={bioRxiv}, pages={2023--08}, year={2023}, publisher={Cold Spring Harbor Laboratory} }"}] +[{"path":[]},{"path":"https://phipsonlab.github.io/SuperCellCyto/CODE_OF_CONDUCT.html","id":"our-pledge","dir":"","previous_headings":"","what":"Our Pledge","title":"Contributor Covenant Code of Conduct","text":"members, contributors, leaders pledge make participation community harassment-free experience everyone, regardless age, body size, visible invisible disability, ethnicity, sex characteristics, gender identity expression, level experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, sexual identity orientation. pledge act interact ways contribute open, welcoming, diverse, inclusive, healthy community.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/CODE_OF_CONDUCT.html","id":"our-standards","dir":"","previous_headings":"","what":"Our Standards","title":"Contributor Covenant Code of Conduct","text":"Examples behavior contributes positive environment community include: Demonstrating empathy kindness toward people respectful differing opinions, viewpoints, experiences Giving gracefully accepting constructive feedback Accepting responsibility apologizing affected mistakes, learning experience Focusing best just us individuals, overall community Examples unacceptable behavior include: use sexualized language imagery, sexual attention advances kind Trolling, insulting derogatory comments, personal political attacks Public private harassment Publishing others’ private information, physical email address, without explicit permission conduct reasonably considered inappropriate professional setting","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/CODE_OF_CONDUCT.html","id":"enforcement-responsibilities","dir":"","previous_headings":"","what":"Enforcement Responsibilities","title":"Contributor Covenant Code of Conduct","text":"Community leaders responsible clarifying enforcing standards acceptable behavior take appropriate fair corrective action response behavior deem inappropriate, threatening, offensive, harmful. Community leaders right responsibility remove, edit, reject comments, commits, code, wiki edits, issues, contributions aligned Code Conduct, communicate reasons moderation decisions appropriate.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/CODE_OF_CONDUCT.html","id":"scope","dir":"","previous_headings":"","what":"Scope","title":"Contributor Covenant Code of Conduct","text":"Code Conduct applies within community spaces, also applies individual officially representing community public spaces. Examples representing community include using official e-mail address, posting via official social media account, acting appointed representative online offline event.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/CODE_OF_CONDUCT.html","id":"enforcement","dir":"","previous_headings":"","what":"Enforcement","title":"Contributor Covenant Code of Conduct","text":"Instances abusive, harassing, otherwise unacceptable behavior may reported community leaders responsible enforcement putri.g@wehi.edu.au. complaints reviewed investigated promptly fairly. community leaders obligated respect privacy security reporter incident.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/CODE_OF_CONDUCT.html","id":"enforcement-guidelines","dir":"","previous_headings":"","what":"Enforcement Guidelines","title":"Contributor Covenant Code of Conduct","text":"Community leaders follow Community Impact Guidelines determining consequences action deem violation Code Conduct:","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/CODE_OF_CONDUCT.html","id":"id_1-correction","dir":"","previous_headings":"Enforcement Guidelines","what":"1. Correction","title":"Contributor Covenant Code of Conduct","text":"Community Impact: Use inappropriate language behavior deemed unprofessional unwelcome community. Consequence: private, written warning community leaders, providing clarity around nature violation explanation behavior inappropriate. public apology may requested.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/CODE_OF_CONDUCT.html","id":"id_2-warning","dir":"","previous_headings":"Enforcement Guidelines","what":"2. Warning","title":"Contributor Covenant Code of Conduct","text":"Community Impact: violation single incident series actions. Consequence: warning consequences continued behavior. interaction people involved, including unsolicited interaction enforcing Code Conduct, specified period time. includes avoiding interactions community spaces well external channels like social media. Violating terms may lead temporary permanent ban.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/CODE_OF_CONDUCT.html","id":"id_3-temporary-ban","dir":"","previous_headings":"Enforcement Guidelines","what":"3. Temporary Ban","title":"Contributor Covenant Code of Conduct","text":"Community Impact: serious violation community standards, including sustained inappropriate behavior. Consequence: temporary ban sort interaction public communication community specified period time. public private interaction people involved, including unsolicited interaction enforcing Code Conduct, allowed period. Violating terms may lead permanent ban.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/CODE_OF_CONDUCT.html","id":"id_4-permanent-ban","dir":"","previous_headings":"Enforcement Guidelines","what":"4. Permanent Ban","title":"Contributor Covenant Code of Conduct","text":"Community Impact: Demonstrating pattern violation community standards, including sustained inappropriate behavior, harassment individual, aggression toward disparagement classes individuals. Consequence: permanent ban sort public interaction within community.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/CODE_OF_CONDUCT.html","id":"attribution","dir":"","previous_headings":"","what":"Attribution","title":"Contributor Covenant Code of Conduct","text":"Code Conduct adapted Contributor Covenant, version 2.1, available https://www.contributor-covenant.org/version/2/1/code_of_conduct.html. Community Impact Guidelines inspired [Mozilla’s code conduct enforcement ladder][https://github.com/mozilla/inclusion]. answers common questions code conduct, see FAQ https://www.contributor-covenant.org/faq. Translations available https://www.contributor-covenant.org/translations.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/CONTRIBUTING.html","id":null,"dir":"","previous_headings":"","what":"Contributing to SuperCellCyto","title":"Contributing to SuperCellCyto","text":"outlines propose change SuperCellCyto.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/CONTRIBUTING.html","id":"making-changes-to-the-package","dir":"","previous_headings":"","what":"Making changes to the package","title":"Contributing to SuperCellCyto","text":"want make change, please first file issue make sure someone team agrees ’s needed. ’ve found bug, please file issue illustrates bug minimal reprex (also help write unit test, needed).","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/CONTRIBUTING.html","id":"pull-request-process","dir":"","previous_headings":"Making changes to the package","what":"Pull request process","title":"Contributing to SuperCellCyto","text":"Fork package clone onto computer. Install development dependencies devtools::install_dev_deps(). Create Git branch pull request (PR). can use usethis::pr_init(\"brief-description--change\"). Make changes, commit git. Make sure unit tests passing. can use devtools::test(). Create PR. Make sure title PR briefly describe change, body PR contain Fixes #issue-number.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/CONTRIBUTING.html","id":"code-of-conduct","dir":"","previous_headings":"","what":"Code of Conduct","title":"Contributing to SuperCellCyto","text":"Please note SuperCellCyto project released Contributor Code Conduct. contributing project agree abide terms.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/how_to_create_supercells.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"How to create supercells","text":"vignette describes steps generate supercells cytometry data using SuperCellCyto R package. Please note ’re still actively updating vignette (fact package ), welcome feedbacks improve . Please reach creating GitHub issues GitHub repository.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/how_to_create_supercells.html","id":"installation","dir":"Articles","previous_headings":"","what":"Installation","title":"How to create supercells","text":"SuperCellCyto can installed using remotes package CRAN: SuperCellCyto requires SuperCell R package installed run properly. use remotes::install_github command install SuperCellCyto, automatically installed. case doesn’t, can manually install using:","code":"# install remotes package first. install.packages(\"remotes\") # then use it to install SuperCellCyto remotes::install_github(\"phipsonlab/SuperCellCyto\") remotes::install_github(\"GfellerLab/SuperCell\")"},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/how_to_create_supercells.html","id":"preparing-your-dataset","dir":"Articles","previous_headings":"","what":"Preparing your dataset","title":"How to create supercells","text":"function creates supercells called runSuperCellCyto, operates data.table object, enhanced version R native data.frame. addition needing data stored data.table object also requires: markers using create supercells appropriately transformed, typically using either arcsinh transformation linear binning (using FlowJo). runSuperCellCyto perform data transformation scaling. object column denoting unique ID cell. likely create column , can simply just numerical value ranging 1 however many cells data. object column denoting biological sample cell comes . column critical ensure cells different samples mixed supercell. sure import CSV FCS files data.table object, /subsequently prepare object ready SuperCellCyto, please consult vignette. vignette, also provide explanation behind need cell ID sample column. vignette, simulate toy data using simCytoData function. Specifically, simulate 15 markers 3 samples, sample containing 10,000 cells. Hence total, toy dataset containing 15 markers 30,000 cells. toy dataset, transform data using arcsinh transformation. use base R asinh function : also create column Cell_id_dummy uniquely identify cell. values Cell_1, Cell_2, way Cell_x x number cells dataset. default, simCytoData function generate cells multiple samples, resulting data.table object already column called Sample denotes sample cells come . Let’s take note sample cell id column later.","code":"n_markers <- 15 n_samples <- 3 dat <- simCytoData(nmarkers = n_markers, ncells = rep(10000, n_samples)) head(dat) #> Marker_1 Marker_2 Marker_3 Marker_4 Marker_5 Marker_6 Marker_7 Marker_8 #> 1: 3.911267 14.83726 12.51689 12.62375 8.223708 5.362362 10.63506 13.02567 #> 2: 6.200052 13.92824 13.61499 11.72022 8.738842 5.649981 11.36196 16.58609 #> 3: 3.440594 14.40114 14.14425 11.37746 9.476859 4.804920 10.56520 13.92912 #> 4: 4.885428 14.98846 14.01897 13.10771 8.504240 5.036536 13.29726 12.90628 #> 5: 4.136757 15.66933 14.83591 11.48224 9.315948 5.070950 12.82232 14.35390 #> 6: 6.410793 12.30549 15.27480 11.32005 7.359705 3.812325 10.87147 14.51132 #> Marker_9 Marker_10 Marker_11 Marker_12 Marker_13 Marker_14 Marker_15 #> 1: 10.154119 15.92435 10.523631 20.31748 11.505223 9.992914 11.14838 #> 2: 9.423623 16.85166 12.061645 16.93791 10.458019 10.240393 13.23612 #> 3: 11.599579 15.03120 10.417631 19.40872 10.181382 9.272730 11.52143 #> 4: 11.757270 17.60875 11.159880 19.17082 9.333655 10.400236 10.80259 #> 5: 12.839921 16.06602 9.659734 17.40636 10.951341 9.470453 11.68651 #> 6: 13.366770 15.09505 8.911489 19.76572 9.150376 10.223870 11.96007 #> Sample Cell_Id #> 1: Sample_1 Cell_1 #> 2: Sample_1 Cell_2 #> 3: Sample_1 Cell_3 #> 4: Sample_1 Cell_4 #> 5: Sample_1 Cell_5 #> 6: Sample_1 Cell_6 # Specify which columns are the markers to transform marker_cols <- paste0(\"Marker_\", seq_len(n_markers)) # The co-factor for arc-sinh cofactor <- 5 # Do the transformation dat_asinh <- asinh(dat[, marker_cols, with = FALSE] / cofactor) # Rename the new columns marker_cols_asinh <- paste0(marker_cols, \"_asinh\") names(dat_asinh) <- marker_cols_asinh # Add them our previously loaded data dat <- cbind(dat, dat_asinh) head(dat[, marker_cols_asinh, with = FALSE]) #> Marker_1_asinh Marker_2_asinh Marker_3_asinh Marker_4_asinh Marker_5_asinh #> 1: 0.7187504 1.808103 1.648485 1.656384 1.272460 #> 2: 1.0413374 1.748391 1.727010 1.587700 1.324790 #> 3: 0.6429059 1.779875 1.762888 1.560462 1.395841 #> 4: 0.8650775 1.817716 1.754504 1.691449 1.301250 #> 5: 0.7538839 1.859950 1.808017 1.568861 1.380723 #> 6: 1.0675259 1.632686 1.835685 1.555833 1.179097 #> Marker_6_asinh Marker_7_asinh Marker_8_asinh Marker_9_asinh Marker_10_asinh #> 1: 0.9317023 1.499036 1.685584 1.457336 1.875341 #> 2: 0.9703748 1.559215 1.914255 1.390861 1.929474 #> 3: 0.8535143 1.493075 1.748450 1.578191 1.820418 #> 4: 0.8865311 1.704875 1.676993 1.590604 1.971679 #> 5: 0.8913720 1.670910 1.776772 1.672188 1.883794 #> 6: 0.7030894 1.518971 1.787078 1.709757 1.824441 #> Marker_11_asinh Marker_12_asinh Marker_13_asinh Marker_14_asinh #> 1: 1.489513 2.109999 1.570695 1.443001 #> 2: 1.614170 1.934369 1.483867 1.464932 #> 3: 1.480377 2.065625 1.459742 1.376628 #> 4: 1.542813 2.053686 1.382396 1.478871 #> 5: 1.412780 1.960563 1.525626 1.395243 #> 6: 1.341811 2.083285 1.364954 1.463482 #> Marker_15_asinh #> 1: 1.541872 #> 2: 1.700563 #> 3: 1.571986 #> 4: 1.513200 #> 5: 1.585051 #> 6: 1.606362 dat$Cell_id_dummy <- paste0(\"Cell_\", seq_len(nrow(dat))) head(dat$Cell_id_dummy, n = 10) #> [1] \"Cell_1\" \"Cell_2\" \"Cell_3\" \"Cell_4\" \"Cell_5\" \"Cell_6\" \"Cell_7\" #> [8] \"Cell_8\" \"Cell_9\" \"Cell_10\" unique(dat$Sample) #> [1] \"Sample_1\" \"Sample_2\" \"Sample_3\" sample_col <- \"Sample\" cell_id_col <- \"Cell_id_dummy\""},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/how_to_create_supercells.html","id":"creating-supercells","dir":"Articles","previous_headings":"","what":"Creating supercells","title":"How to create supercells","text":"Now data, let’s create supercells. , use runSuperCellCyto function pass markers, sample cell ID columns parameters. reason need specify markers function create supercells based expression markers. highly recommend creating supercells using markers data, let cell type cell state markers. However, reason want use subset markers data, make sure specify vector later pass runSuperCellCyto function. tutorial, use arcsinh transformed markers toy data. Let’s dig deeper object created: list containing 3 elements:","code":"supercells <- runSuperCellCyto( dt = dat, markers = marker_cols_asinh, sample_colname = sample_col, cell_id_colname = cell_id_col ) class(supercells) #> [1] \"list\" names(supercells) #> [1] \"supercell_expression_matrix\" \"supercell_cell_map\" #> [3] \"supercell_object\""},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/how_to_create_supercells.html","id":"supercell-object","dir":"Articles","previous_headings":"Creating supercells","what":"Supercell object","title":"How to create supercells","text":"supercell_object contains metadata used create supercells. list, element contains metadata used create supercells sample. come handy need either regenerate supercells using different gamma values (get less supercells) debugging later line. regenerating supercells Controlling supercells granularity section .","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/how_to_create_supercells.html","id":"supercell-expression-matrix","dir":"Articles","previous_headings":"Creating supercells","what":"Supercell expression matrix","title":"How to create supercells","text":"supercell_expression_matrix contains marker expression supercell. calculated taking average marker expression cells contained within supercell. Therein, following columns: markers previously specified markers_col variable. example, arcsinh transformed markers toy data. column (Sample case) denoting sample supercell belongs , (note column name stored sample_col variable). SuperCellId column denoting unique ID supercell.","code":"head(supercells$supercell_expression_matrix) #> Marker_1_asinh Marker_2_asinh Marker_3_asinh Marker_4_asinh Marker_5_asinh #> 1: 0.7887688 1.785356 1.754431 1.588763 1.263602 #> 2: 1.0797385 1.803940 1.720184 1.534222 1.250625 #> 3: 0.9234995 1.817283 1.755081 1.546211 1.280063 #> 4: 1.0205243 1.796828 1.736790 1.487011 1.202033 #> 5: 0.9996782 1.800857 1.736689 1.618613 1.274462 #> 6: 1.0275357 1.799934 1.729462 1.568709 1.274037 #> Marker_6_asinh Marker_7_asinh Marker_8_asinh Marker_9_asinh Marker_10_asinh #> 1: 1.0568480 1.471808 1.742531 1.536523 1.895745 #> 2: 0.8973970 1.548641 1.778694 1.584895 1.914465 #> 3: 1.0854014 1.638187 1.796407 1.566501 1.913043 #> 4: 1.0318368 1.555554 1.750030 1.557390 1.908506 #> 5: 0.7619424 1.606388 1.761063 1.400137 1.906447 #> 6: 1.0985402 1.537728 1.747352 1.440771 1.913271 #> Marker_11_asinh Marker_12_asinh Marker_13_asinh Marker_14_asinh #> 1: 1.336033 2.028860 1.298781 1.440736 #> 2: 1.308154 2.013720 1.423327 1.240937 #> 3: 1.324362 2.023927 1.432922 1.274848 #> 4: 1.246893 2.011844 1.508924 1.328908 #> 5: 1.474889 2.011993 1.415524 1.386133 #> 6: 1.424232 2.024207 1.453296 1.243065 #> Marker_15_asinh Sample SuperCellId #> 1: 1.625278 Sample_1 SuperCell_1_Sample_Sample_1 #> 2: 1.579759 Sample_1 SuperCell_2_Sample_Sample_1 #> 3: 1.605998 Sample_1 SuperCell_3_Sample_Sample_1 #> 4: 1.533573 Sample_1 SuperCell_4_Sample_Sample_1 #> 5: 1.537838 Sample_1 SuperCell_5_Sample_Sample_1 #> 6: 1.625689 Sample_1 SuperCell_6_Sample_Sample_1"},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/how_to_create_supercells.html","id":"supercellid","dir":"Articles","previous_headings":"Creating supercells > Supercell expression matrix","what":"SuperCellId","title":"How to create supercells","text":"Let’s look SuperCellId: Let’s break one , SuperCell_1_Sample_Sample_1. SuperCell_1 numbering (1 however many supercells sample) used uniquely identify supercell sample. Notably, may encounter (SuperCell_1, SuperCell_2) repeated across different samples, e.g., 3 supercells’ id pre-fixed SuperCell_1, make equal one another! SuperCell_1_Sample_Sample_1 contain cells Sample_1 SuperCell_1_Sample_Sample_2 contain cells Sample_2. now, may noticed appended sample name supercell id. aids differentiating supercells different samples.","code":"head(unique(supercells$supercell_expression_matrix$SuperCellId)) #> [1] \"SuperCell_1_Sample_Sample_1\" \"SuperCell_2_Sample_Sample_1\" #> [3] \"SuperCell_3_Sample_Sample_1\" \"SuperCell_4_Sample_Sample_1\" #> [5] \"SuperCell_5_Sample_Sample_1\" \"SuperCell_6_Sample_Sample_1\" supercell_ids <- unique(supercells$supercell_expression_matrix$SuperCellId) supercell_ids[grep(\"SuperCell_1_\", supercell_ids)] #> [1] \"SuperCell_1_Sample_Sample_1\" \"SuperCell_1_Sample_Sample_2\" #> [3] \"SuperCell_1_Sample_Sample_3\""},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/how_to_create_supercells.html","id":"supercell-cell-map","dir":"Articles","previous_headings":"Creating supercells","what":"Supercell cell map","title":"How to create supercells","text":"supercell_cell_map maps cell dataset supercell belongs . map useful later need expand supercells . Additionally, also reason need column dataset uniquely identify cell.","code":"head(supercells$supercell_cell_map) #> SuperCellID CellId Sample #> 1: SuperCell_59_Sample_Sample_1 Cell_1 Sample_1 #> 2: SuperCell_249_Sample_Sample_1 Cell_2 Sample_1 #> 3: SuperCell_427_Sample_Sample_1 Cell_3 Sample_1 #> 4: SuperCell_107_Sample_Sample_1 Cell_4 Sample_1 #> 5: SuperCell_164_Sample_Sample_1 Cell_5 Sample_1 #> 6: SuperCell_227_Sample_Sample_1 Cell_6 Sample_1"},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/how_to_create_supercells.html","id":"running-runsupercellcyto-in-parallel","dir":"Articles","previous_headings":"","what":"Running runSuperCellCyto in parallel","title":"How to create supercells","text":"default, runSuperCellCyto process sample one . sample processed independent one another, strictly speaking, can process parallel. , need : Create BiocParallelParam object BiocParallel package. object can either type MulticoreParamor SnowParam. highly recommend consulting vignette information. Set number tasks BiocParallelParam object number samples dataset. Set load_balancing parameter runSuperCellCyto function TRUE. ensure even distribution supercell creation jobs. sample processed parallel job, don’t want job process large sample also assigned smaller samples possible. want know feature works, please refer manuscript. NOTE: set value workers param BiocParallelParam object total number cores computer, render computer useless anything else. Perhaps importantly, might blow RAM kill Rsession. find total number cores computer, can use parallel’s detectCores function. supply number minus one workers param BiocParallelParam object.","code":"n_cores <- detectCores() supercell_par <- runSuperCellCyto( dt = dat, markers = marker_cols_asinh, sample_colname = sample_col, cell_id_colname = cell_id_col, BPPARAM = MulticoreParam( workers = n_cores - 1, tasks = n_samples ), load_balancing = TRUE )"},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/how_to_create_supercells.html","id":"controlling-supercells-granularity","dir":"Articles","previous_headings":"","what":"Controlling supercells granularity","title":"How to create supercells","text":"described runSuperCellCyto function’s documentation, let’s briefly go . runSuperCellCyto function equipped various parameters can customised alter composition supercells. one likely used gamma parameter, denoted gam function. default, value gam set 20, found work well cases. gamma parameter controls many supercells generate, indirectly, many cells captured within supercell. parameter resolved following formula gamma=n_cells/n_supercells n_cell denotes number cells n_supercells denotes number supercells. general, larger gamma parameter set , less supercells get. Say instance 10,000 cells. gamma set 10, end 1,000 supercells, whereas gamma set 50, end 200 supercells. may noticed, reading sections , runSuperCellCyto ran sample independent , can set 1 value gamma parameter. Indeed, now, gamma value used across samples, depending many cells sample, end different number supercells sample. instance, say 10,000 cells sample 1, 100,000 cells sample 2. gamma set 10, sample 1, get 1,000 supercells (10,000/10) sample 2, get 10,000 supercells (100,000/10). note: whatever gamma value chose, expect supercell contain exactly number cells. behaviour intentional ensure rare cell types intermixed non-rare cell types supercell.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/how_to_create_supercells.html","id":"adjusting-gamma-value-after-one-run-of-runsupercellcyto","dir":"Articles","previous_headings":"Controlling supercells granularity","what":"Adjusting gamma value after one run of runSuperCellCyto","title":"How to create supercells","text":"run runSuperCellCyto discarded SuperCell object generated (serious, please don’t!), can use object quickly regenerate supercells using different gamma values. example, using SuperCell object generated toy dataset, regenerate supercells using gamma 10 50. function recomputeSupercells. store output list, one element per gamma value. end list containing 2 elements. 1st element contains supercells generated using gamma = 10, 2nd contains supercells generated using gamma = 50. output generated recomputeSupercells essentially list: supercell_expression_matrix: data.table object contains marker expression supercell. supercell_cell_map: data.table maps cell corresponding supercell. mentioned , gamma dictates granularity supercells. Compared previous run gamma set 20, get supercells gamma = 10, less gamma = 50. Let’s see ’s case.","code":"addt_gamma_vals <- c(10, 50) supercells_addt_gamma <- lapply(addt_gamma_vals, function(gam) { recomputeSupercells( dt = dat, sc_objects = supercells$supercell_object, markers = marker_cols_asinh, sample_colname = sample_col, cell_id_colname = cell_id_col, gam = gam ) }) supercells_addt_gamma[[1]] #> $supercell_expression_matrix #> Marker_1_asinh Marker_2_asinh Marker_3_asinh Marker_4_asinh #> 1: 0.9320018 1.789335 1.731283 1.551380 #> 2: 0.9060277 1.803178 1.741394 1.563690 #> 3: 0.8033353 1.787410 1.700738 1.607098 #> 4: 0.9489170 1.790874 1.734983 1.607087 #> 5: 1.0178860 1.785430 1.733907 1.568372 #> --- #> 2996: 0.9427250 2.009554 1.279477 1.978510 #> 2997: 1.0374571 1.996219 1.213171 1.923864 #> 2998: 1.1224420 1.963518 1.317463 1.878919 #> 2999: 0.9671641 2.008227 1.209016 1.829963 #> 3000: 1.0507669 2.033083 1.252428 1.944653 #> Marker_5_asinh Marker_6_asinh Marker_7_asinh Marker_8_asinh #> 1: 1.242994 0.9710434 1.5448413 1.7654222 #> 2: 1.209378 0.7442933 1.6038634 1.7762536 #> 3: 1.258348 0.9915318 1.5835597 1.7227574 #> 4: 1.201311 1.0286385 1.4992039 1.7676266 #> 5: 1.109505 0.6948621 1.5383390 1.7583671 #> --- #> 2996: 1.994188 1.9802987 1.0635962 1.0653876 #> 2997: 2.000958 2.0201239 1.0456459 1.1448839 #> 2998: 1.930298 1.9384819 0.7539548 1.2508786 #> 2999: 1.983897 2.0046537 1.3703910 0.9789633 #> 3000: 1.956602 2.0301099 1.3507904 1.1403825 #> Marker_9_asinh Marker_10_asinh Marker_11_asinh Marker_12_asinh #> 1: 1.518542 1.907634 1.3911387 2.024894 #> 2: 1.474904 1.898395 1.3712703 2.038662 #> 3: 1.538333 1.858689 1.3449131 2.015894 #> 4: 1.562792 1.911530 1.3972428 2.023205 #> 5: 1.558192 1.917227 1.4352655 2.023435 #> --- #> 2996: 1.884170 1.265114 0.9446541 1.644660 #> 2997: 1.893034 1.295976 0.9170071 1.513924 #> 2998: 1.884689 1.223292 1.0582967 1.720190 #> 2999: 1.862444 1.305982 1.0628570 1.653478 #> 3000: 1.818277 1.170495 1.0605986 1.706870 #> Marker_13_asinh Marker_14_asinh Marker_15_asinh Sample #> 1: 1.431277 1.357182 1.592556 Sample_1 #> 2: 1.420618 1.234898 1.567322 Sample_1 #> 3: 1.373082 1.419728 1.495968 Sample_1 #> 4: 1.424757 1.195623 1.597984 Sample_1 #> 5: 1.448395 1.314179 1.545810 Sample_1 #> --- #> 2996: 1.586902 1.929914 1.742345 Sample_3 #> 2997: 1.368702 1.904601 1.687283 Sample_3 #> 2998: 1.400606 1.827703 1.639502 Sample_3 #> 2999: 1.499801 1.876100 1.678882 Sample_3 #> 3000: 1.540135 1.895232 1.587085 Sample_3 #> SuperCellId #> 1: SuperCell_1_Sample_Sample_1 #> 2: SuperCell_2_Sample_Sample_1 #> 3: SuperCell_3_Sample_Sample_1 #> 4: SuperCell_4_Sample_Sample_1 #> 5: SuperCell_5_Sample_Sample_1 #> --- #> 2996: SuperCell_996_Sample_Sample_3 #> 2997: SuperCell_997_Sample_Sample_3 #> 2998: SuperCell_998_Sample_Sample_3 #> 2999: SuperCell_999_Sample_Sample_3 #> 3000: SuperCell_1000_Sample_Sample_3 #> #> $supercell_cell_map #> SuperCellID CellId Sample #> 1: SuperCell_143_Sample_Sample_1 Cell_1 Sample_1 #> 2: SuperCell_316_Sample_Sample_1 Cell_2 Sample_1 #> 3: SuperCell_641_Sample_Sample_1 Cell_3 Sample_1 #> 4: SuperCell_60_Sample_Sample_1 Cell_4 Sample_1 #> 5: SuperCell_202_Sample_Sample_1 Cell_5 Sample_1 #> --- #> 29996: SuperCell_619_Sample_Sample_3 Cell_29996 Sample_3 #> 29997: SuperCell_352_Sample_Sample_3 Cell_29997 Sample_3 #> 29998: SuperCell_258_Sample_Sample_3 Cell_29998 Sample_3 #> 29999: SuperCell_727_Sample_Sample_3 Cell_29999 Sample_3 #> 30000: SuperCell_685_Sample_Sample_3 Cell_30000 Sample_3 n_supercells_gamma20 <- nrow(supercells$supercell_expression_matrix) n_supercells_gamma10 <- nrow(supercells_addt_gamma[[1]]$supercell_expression_matrix) n_supercells_gamma50 <- nrow(supercells_addt_gamma[[2]]$supercell_expression_matrix) n_supercells_gamma10 > n_supercells_gamma20 #> [1] TRUE n_supercells_gamma50 < n_supercells_gamma20 #> [1] TRUE"},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/how_to_create_supercells.html","id":"specifying-different-gamma-value-for-different-samples","dir":"Articles","previous_headings":"Controlling supercells granularity","what":"Specifying different gamma value for different samples","title":"How to create supercells","text":"future, may add ability specify different gam value different samples. now, want , need break data multiple data.table objects, containing data 1 sample, run runSuperCellCyto function different gam parameter value. Something like following: Subsequently, extract combine supercell_expression_matrix supercell_cell_map, need use rbind:","code":"n_markers <- 10 dat <- simCytoData(nmarkers = n_markers) markers_col <- paste0(\"Marker_\", seq_len(n_markers)) sample_col <- \"Sample\" cell_id_col <- \"Cell_Id\" samples <- unique(dat[[sample_col]]) gam_values <- c(10, 20, 10) supercells_diff_gam <- lapply(seq_len(length(samples)), function(i) { sample <- samples[i] gam <- gam_values[i] dat_samp <- dat[dat$Sample == sample, ] supercell_samp <- runSuperCellCyto( dt = dat_samp, markers = markers_col, sample_colname = sample_col, cell_id_colname = cell_id_col, gam = gam ) return(supercell_samp) }) supercell_expression_matrix <- do.call( \"rbind\", lapply(supercells_diff_gam, function(x) x[[\"supercell_expression_matrix\"]]) ) supercell_cell_map <- do.call( \"rbind\", lapply(supercells_diff_gam, function(x) x[[\"supercell_cell_map\"]]) ) rbind(head(supercell_expression_matrix, n = 3), tail(supercell_expression_matrix, n = 3)) #> Marker_1 Marker_2 Marker_3 Marker_4 Marker_5 Marker_6 Marker_7 #> 1: 7.870171 7.669862 9.460745 10.02700 8.646107 18.42406 15.146836 #> 2: 9.006217 7.107131 8.475524 10.57840 10.408356 20.23030 14.908706 #> 3: 8.590865 7.512493 8.732528 10.86877 8.094644 20.79423 14.747559 #> 4: 9.525966 11.244675 12.196923 13.84914 16.215898 17.48151 4.877098 #> 5: 12.627982 9.954570 9.915641 16.24578 15.424371 17.09875 7.492686 #> 6: 11.682684 10.393288 10.688327 17.24582 17.115084 19.99054 6.360460 #> Marker_8 Marker_9 Marker_10 Sample SuperCellId #> 1: 11.543838 6.714235 11.67504 Sample_1 SuperCell_1_Sample_Sample_1 #> 2: 10.779079 6.117674 10.66601 Sample_1 SuperCell_2_Sample_Sample_1 #> 3: 12.833208 6.660056 12.10731 Sample_1 SuperCell_3_Sample_Sample_1 #> 4: 7.538974 9.070998 18.20164 Sample_2 SuperCell_498_Sample_Sample_2 #> 5: 7.860059 8.863589 19.69940 Sample_2 SuperCell_499_Sample_Sample_2 #> 6: 6.384969 8.443979 19.44794 Sample_2 SuperCell_500_Sample_Sample_2 rbind(head(supercell_cell_map, n = 3), tail(supercell_cell_map, n = 3)) #> SuperCellID CellId Sample #> 1: SuperCell_176_Sample_Sample_1 Cell_1 Sample_1 #> 2: SuperCell_710_Sample_Sample_1 Cell_2 Sample_1 #> 3: SuperCell_295_Sample_Sample_1 Cell_3 Sample_1 #> 4: SuperCell_217_Sample_Sample_2 Cell_19998 Sample_2 #> 5: SuperCell_51_Sample_Sample_2 Cell_19999 Sample_2 #> 6: SuperCell_175_Sample_Sample_2 Cell_20000 Sample_2"},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/how_to_create_supercells.html","id":"mixing-cells-from-different-samples-in-a-supercell","dir":"Articles","previous_headings":"","what":"Mixing cells from different samples in a supercell","title":"How to create supercells","text":"whatever reason don’t mind (perhaps point want) supercell contain cells different biological samples, still need sample column data.table. However, need essentially set value column exactly one unique value. way, SuperCellCyto treat cells coming one sample. Just note, parallel processing feature SuperCellCyto won’t work essentially 1 sample nothing SuperCellCyto parallelise.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/how_to_create_supercells.html","id":"i-have-more-cells-than-ram-in-my-computer","dir":"Articles","previous_headings":"","what":"I have more cells than RAM in my computer","title":"How to create supercells","text":"dataset huge constantly running RAM generating supercells? thing happens solution . Since supercells generated sample independent others can easily break process. example: Load subset samples (say 1-10). Generate supercells samples. Save output using qs package. Extract supercell_expression_matrix supercell_cell_map, export csv file using data.table’s fwrite function. Load another sets samples (say 11-20), rinse repeat step 2-4. processed samples, can load supercell_expression_matrix supercell_cell_map csv files analyse . want regenerate supercells using different gamma values, load relevant output saved using qs package relevant data (remember note output belongs sets samples!), run recomputeSupercells function.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/how_to_create_supercells.html","id":"session-information","dir":"Articles","previous_headings":"","what":"Session information","title":"How to create supercells","text":"","code":"sessionInfo() #> R version 4.3.2 (2023-10-31) #> Platform: x86_64-pc-linux-gnu (64-bit) #> Running under: Ubuntu 22.04.3 LTS #> #> Matrix products: default #> BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 #> LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so; LAPACK version 3.10.0 #> #> locale: #> [1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8 #> [4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8 #> [7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C #> [10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C #> #> time zone: UTC #> tzcode source: system (glibc) #> #> attached base packages: #> [1] parallel stats graphics grDevices utils datasets methods #> [8] base #> #> other attached packages: #> [1] BiocParallel_1.36.0 SuperCellCyto_0.1.0 #> #> loaded via a namespace (and not attached): #> [1] Matrix_1.6-5 jsonlite_1.8.8 compiler_4.3.2 Rcpp_1.0.12 #> [5] stringr_1.5.1 SuperCell_1.0 jquerylib_0.1.4 systemfonts_1.0.5 #> [9] textshaping_0.3.7 yaml_2.3.8 fastmap_1.1.1 lattice_0.21-9 #> [13] plyr_1.8.9 R6_2.5.1 igraph_1.6.0 knitr_1.45 #> [17] desc_1.4.3 bslib_0.6.1 rlang_1.1.3 cachem_1.0.8 #> [21] stringi_1.8.3 RANN_2.6.1 xfun_0.41 fs_1.6.3 #> [25] sass_0.4.8 memoise_2.0.1 cli_3.6.2 pkgdown_2.0.7 #> [29] magrittr_2.0.3 digest_0.6.34 grid_4.3.2 lifecycle_1.0.4 #> [33] vctrs_0.6.5 evaluate_0.23 glue_1.7.0 data.table_1.14.10 #> [37] codetools_0.2-19 ragg_1.2.7 rmarkdown_2.25 purrr_1.0.2 #> [41] pkgconfig_2.0.3 tools_4.3.2 htmltools_0.5.7"},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/how_to_prepare_data.html","id":"performing-quality-control","dir":"Articles","previous_headings":"","what":"Performing Quality Control","title":"How to Prepare Data for SuperCellCyto","text":"Prior creating supercells, ’s crucial ensure dataset undergone thorough quality control (QC). want retain single, live cells remove debris, doublets, dead cells. Additionally, also important perform compensation correct fluorescence spillover (Flow data) adjust signal overlap spillover different metal isotopse (Cytof data). well-prepared dataset key obtaining reliable supercells SuperCellCyto. Several R packages available performing QC cytometry data. Notable among PeacoQC, CATALYST, CytoExploreR. packages well maintained continuously updated. make sure information provide quickly go date, highly recommend consult packages’ respective vignettes detailed guidance use QC data. prefer using manual gating QC, can also use FlowJo. comprehensive guide using FlowJo prepare data, please read vignette. steps taken vignette QC perfectly adequate SuperCellCyto. manuscript, used CytoExploreR QC Oetjen_bcell flow cytometry data CATALYST QC Trussart_cytofruv Cytof data. specific scripts used can found Github repository: b_cell_identification/gate_flow_data.R Oetjen_bcell data. batch_correction/prepare_data.R Trussart_cytofruv data. scripts adapted used CytofRUV manuscript. Oetjen_bcell data, used following gating strategy post compensation: FSC-H FSC-isolate single events. (Also check SSC-H vs SSC-). FSC-SSC-remove debris. Live/Dead SSC-isolate live cells. following resulting single live cells manually gated Oetjen_bcell data. completing QC process, clean data either CSV FCS file formats. next section guide load files proceed preparing data SuperCellCyto.","code":"knitr::include_graphics(\"figures/oetjen_bcell_single_live_cells.png\", error = FALSE)"},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/how_to_prepare_data.html","id":"preparing-fcscsv-files-for-supercellcyto","dir":"Articles","previous_headings":"","what":"Preparing FCS/CSV files for SuperCellCyto","title":"How to Prepare Data for SuperCellCyto","text":"use SuperCellCyto, input data must formatted data.table object. Briefly, data.table enhanced version R native data.frame object. package offers fast processing large data.frame.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/how_to_prepare_data.html","id":"cell-id-column","dir":"Articles","previous_headings":"Preparing FCS/CSV files for SuperCellCyto","what":"Cell ID column","title":"How to Prepare Data for SuperCellCyto","text":"Additionally, cell data.table must also unique identifier. purpose ID allow SuperCell uniquely identify cell dataset. come super handy later /need work cells belong supercells, .e., need expand supercells . Generally, need create ID . dataset won’t come ID already embedded . tutorial, call column denotes cell ID cell_id. dataset, can name column however like, e.g., id, cell_identity, etc. Just make sure note column name need later create supercells.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/how_to_prepare_data.html","id":"sample-column","dir":"Articles","previous_headings":"Preparing FCS/CSV files for SuperCellCyto","what":"Sample column","title":"How to Prepare Data for SuperCellCyto","text":"Lastly, cell data.table object must also associated sample. information must stored column later pass function creates supercells. Generally, sample typically refers biological sample cell came . create supercells, necessary column dataset. ensure supercell cells exactly one sample. cases, make sense mix cells different biological samples one supercell. Additionally (important), SuperCellCyto can process multiple samples parallel, , needs know sample information. 1 biological sample dataset? matter. still need sample column dataset. difference column 1 unique value. can name column however like, e.g., Samp, Cell_Samp, etc. tutorial, call column sample. Just make sure note column name need later create supercells.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/how_to_prepare_data.html","id":"preparing-csv-files","dir":"Articles","previous_headings":"Preparing FCS/CSV files for SuperCellCyto","what":"Preparing CSV files","title":"How to Prepare Data for SuperCellCyto","text":"Loading CSV files data.table object straightforward. can use fread function data.table package. ’s install : example, let’s load two CSV files containing subsampled data Levine_32dim dataset used SuperCellCyto manuscript. file represents sample (H1 H2), sample name appended file name: Let’s break done: specify location csv files csv_files vector corresponding sample names samples vector. data/Levine_32dim_H1_sub.csv belongs sample H1 data/Levine_32dim_H2_sub.csv belongs sample H2. use lapply simultaneously iterate element csv_files samples vector. csv file corresponding sample, read csv file variable dat_a_sample using fread function. assign sample id new column called sample. result, get list dat containing 2 data.table objects, 1 object per csv file. use rbindlist function data.table package merge list one data.table object. create new column cell_id gives cell unique id Cell_1, Cell_2, etc.","code":"install.packages(\"data.table\") library(data.table) csv_files <- c(\"data/Levine_32dim_H1_sub.csv\", \"data/Levine_32dim_H2_sub.csv\") samples <- c(\"H1\", \"H2\") dat <- lapply(seq(1: length(samples)), function(i) { csv_file <- csv_files[i] sample <- samples[i] dat_a_sample <- fread(csv_file) dat_a_sample$sample <- sample return(dat_a_sample) }) dat <- rbindlist(dat) dat[, cell_id := paste0(\"Cell_\", seq(1: nrow(dat)))] head(dat) #> Time Cell_length DNA1 DNA2 CD45RA CD133 CD19 #> 1: 307428 27 169.91125 262.3192 2.338830 -0.15333985 -0.2056334 #> 2: 80712 13 50.91230 181.1320 2.129232 3.35638666 -0.1013980 #> 3: 111390 16 126.93545 269.4199 1.613719 -0.07193317 0.1116483 #> 4: 14088 31 142.67317 283.4645 4.100985 0.09366111 19.4974289 #> 5: 284190 53 98.28069 187.2090 4.289627 0.56254190 12.2265682 #> 6: 481997 35 112.29634 162.4416 6.089430 0.01665318 -0.1943735 #> CD22 CD11b CD4 CD8 CD34 Flt3 #> 1: -0.19720075 32.13040161 0.78105438 -0.071934469 1.53498471 0.84833205 #> 2: 3.05647945 14.23928833 0.53373063 -0.007943562 -0.09401329 -0.13234507 #> 3: -0.07421356 2.20701027 9.75063324 -0.034266483 0.53720337 -0.05749827 #> 4: 5.07963181 -0.07880223 0.05995781 0.009049721 -0.19206744 3.36803102 #> 5: 10.81768703 1.82670891 1.30010796 -0.187664956 2.05419374 2.72891521 #> 6: 1.43817198 5.79350042 0.64789140 54.004249573 0.28843120 1.01514077 #> CD20 CXCR4 CD235ab CD45 CD123 CD321 CD14 #> 1: -0.08676258 3.488938 0.82301176 313.8038 0.30909532 46.484669 0.05072345 #> 2: -0.04217101 1.364644 -0.13094166 207.2459 1.76594567 22.532978 -0.19256826 #> 3: 0.09777651 3.880993 2.00220966 750.4200 -0.06809702 9.515447 -0.05956535 #> 4: 0.64118648 2.911314 -0.08744399 169.4798 1.25776207 9.218699 1.09861076 #> 5: 15.34162998 9.303430 6.34135485 751.0563 0.05031190 10.463912 1.11993504 #> 6: 3.84020925 3.520693 2.93023992 868.4937 -0.04488884 19.107010 0.62120903 #> CD33 CD47 CD11c CD7 CD15 CD16 #> 1: 2.09802437 20.96871 20.76318550 -0.007966662 0.7279212 -0.03067662 #> 2: 7.35230541 27.49848 15.13398170 -0.087256350 0.7187206 0.41139653 #> 3: -0.16046160 53.51268 -0.19080050 1.044164538 2.1075230 -0.14510959 #> 4: 0.18614264 55.07846 -0.07061907 0.948859751 1.2470639 1.12294865 #> 5: 0.15872155 40.63973 4.64010382 -0.195279136 4.5712810 -0.10192144 #> 6: -0.09832545 29.65497 6.15759659 12.104630470 0.5801706 -0.11606000 #> CD44 CD38 CD13 CD3 CD61 CD117 CD49d #> 1: 95.71002 5.1124768 5.1056433 0.5827813 -0.1684093 -0.02967962 6.557199 #> 2: 185.51929 7.4784145 0.3580886 1.8861074 1.9233229 -0.14122920 1.088500 #> 3: 33.95839 0.6161237 0.3045178 462.1258240 0.7625037 -0.03500306 5.997476 #> 4: 32.46420 249.4612885 1.2526705 0.7302832 3.2274778 -0.18526185 8.533935 #> 5: 98.09428 43.5352974 2.8327518 0.1868679 2.1032026 0.01776284 12.400333 #> 6: 65.91293 2.0126576 1.2817017 390.3737793 2.4605207 0.33154550 5.214703 #> HLA-DR CD64 CD41 Viability file_number event_number #> 1: 112.467545 6.9157209 0.083808646 1.7268630 94 257088 #> 2: 12.206795 30.7242870 7.753727913 3.7120194 94 80655 #> 3: -0.046793 -0.1739236 -0.080375805 0.7011412 94 116394 #> 4: 8.965122 0.3391838 -0.005531122 0.2978864 94 5618 #> 5: 174.952667 0.4361930 1.834125400 13.2743187 94 241699 #> 6: 0.648035 -0.1803290 0.389085352 0.4543665 94 363564 #> sample cell_id #> 1: H1 Cell_1 #> 2: H1 Cell_2 #> 3: H1 Cell_3 #> 4: H1 Cell_4 #> 5: H1 Cell_5 #> 6: H1 Cell_6"},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/how_to_prepare_data.html","id":"preparing-fcs-files","dir":"Articles","previous_headings":"Preparing FCS/CSV files for SuperCellCyto","what":"Preparing FCS files","title":"How to Prepare Data for SuperCellCyto","text":"FCS files, commonly used cytometry, require specific handling. Spectre package contains functions import FCS files data.table object. can install Spectre using remotes package: Let’s load two small FCS files Anti-PD1 data downloadable FlowRepository. Spectre’s read.files reads FCS files list data.table objects, one file. data.table object, also add column FileName denoting name file cell come . list useable SuperCellCyto, need merge one data.table object add sample information cell ID. can use data.table’s rbindlist function merge list one data.table object. FCS files belong two different patients, patient 9 15. shall use sample ID. make sure correctly map filenames patients, first create new data.table object containing mapping FileName sample name, using merge.data.table add data.table object. also create new column cell_id gives cell unique id Cell_1, Cell_2, etc. CSV FCS files loaded data.table objects, next step transform data appropriately SuperCellCyto.","code":"install.packages(\"remotes\") remotes::install_github(\"immunedynamics/Spectre\") library(Spectre) dat_list <- read.files(file.loc = \"data\", file.type = \".fcs\") dat_cytof <- rbindlist(dat_list) sample_info <- data.table( sample = c(\"patient9\", \"patient15\"), filename = c(\"Data23_Panel3_base_NR4_Patient9\", \"Data23_Panel3_base_R5_Patient15\") ) dat_with_sample_info <- merge.data.table( x = dat_cytof, y = sample_info, by.x = \"FileName\", by.y = \"filename\" ) dat_with_sample_info[, cell_id := paste0(\"Cell_\", seq(1: nrow(dat_with_sample_info)))]"},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/how_to_prepare_data.html","id":"data-transformation","dir":"Articles","previous_headings":"","what":"Data Transformation","title":"How to Prepare Data for SuperCellCyto","text":"using SuperCellCyto, ’s essential apply appropriate data transformations. transformations crucial accurate analysis, explained article data transformation. Note: completed QC process outlined CSV files exported FlowJo, can proceed directly next vignette create supercells. details different file types (FCS, CSV scale, CSV channel value), refer guide. common method data transformation cytometry arcsinh transformation, inverse hyperbolic arcsinh transformation. transformation requires specifying cofactor, affects representation low-end data. Typically, cofactor 5 used Cytof data 150 Flow data. vignette focus transformation process rather cofactor selection. -depth information choosing cofactor, read detailed article. ’ll use Levine_32dim dataset loaded earlier CSV files. First, need select markers transformed. Usually, markers transformed SuperCellCyto. However, can choose exclude specific markers needed: transformation, ’ll use cofactor 5 apply arcsinh transformation using Spectre package. Spectre isn’t installed, use: Perform transformation: transformation, new columns “_asinh” appended indicate transformed markers. Alternatively, don’t want use Spectre, can also use inbuilt asinh function R transformation: note, use inbuilt asinh function, need re-attach cell id sample column. data now transformed, ’re ready create supercells using SuperCellCyto. Please refer create supercells vignette detailed instructions.","code":"markers_to_transform <- c(\"CD45RA\",\"CD133\",\"CD19\",\"CD22\",\"CD11b\",\"CD4\", \"CD8\",\"CD34\",\"Flt3\",\"CD20\",\"CXCR4\",\"CD235ab\", \"CD45\",\"CD123\",\"CD321\",\"CD14\",\"CD33\",\"CD47\",\"CD11c\", \"CD7\",\"CD15\",\"CD16\",\"CD44\",\"CD38\",\"CD13\",\"CD3\",\"CD61\", \"CD117\",\"CD49d\",\"HLA-DR\",\"CD64\",\"CD41\") install.packages(\"remotes\") remotes::install_github(\"immunedynamics/Spectre\") dat <- do.asinh(dat, markers_to_transform, cofactor = 5) cofactor <- 5 # Do the transformation dat_asinh <- asinh(dat[, markers_to_transform, with = FALSE] / cofactor) head(dat_asinh) #> CD45RA CD133 CD19 CD22 CD11b CD4 #> 1: 0.4521968 -0.030663164 -0.04111509 -0.03942993 2.55951176 0.15558245 #> 2: 0.4139249 0.628977340 -0.02027821 0.57848688 1.76920432 0.10654443 #> 3: 0.3173883 -0.014386137 0.02232781 -0.01484217 0.42819644 1.42110634 #> 4: 0.7483619 0.018731126 2.07004151 0.89259051 -0.01575979 0.01199128 #> 5: 0.7772642 0.112272365 1.62672741 1.51446768 0.35766705 0.25717724 #> 6: 1.0273733 0.003330631 -0.03886491 0.28380900 0.98926269 0.12921838 #> CD8 CD34 Flt3 CD20 CXCR4 CD235ab #> 1: -0.014386398 0.30236841 0.16886275 -0.017351646 0.6508532 0.16386798 #> 2: -0.001588712 -0.01880155 -0.02646592 -0.008434102 0.2696492 -0.02618534 #> 3: -0.006853243 0.10723503 -0.01149940 0.019554056 0.7139745 0.39044561 #> 4: 0.001809943 -0.03840405 0.63090991 0.127888398 0.5535560 -0.01748791 #> 5: -0.037524184 0.40007994 0.52178220 1.839834412 1.3795382 1.05895614 #> 6: 3.074908161 0.05765429 0.20165859 0.707518206 0.6560537 0.55682438 #> CD45 CD123 CD321 CD14 CD33 CD47 CD11c #> 1: 4.832541 0.061779758 2.925712 0.01014452 0.40817588 2.140661 2.13108274 #> 2: 4.417761 0.346230147 2.210777 -0.03850414 1.17826549 2.406005 1.82688632 #> 3: 5.704353 -0.013618983 1.399436 -0.01191279 -0.03208681 3.065803 -0.03815085 #> 4: 4.216660 0.248972250 1.371487 0.21799154 0.03721993 3.094522 -0.01412334 #> 5: 5.705201 0.010062211 1.484375 0.22215516 0.03173898 2.792218 0.82955004 #> 6: 5.850478 -0.008977647 2.050461 0.12392437 -0.01966382 2.480371 1.03599597 #> CD7 CD15 CD16 CD44 CD38 CD13 CD3 #> 1: -0.001593332 0.1450748 -0.006135286 3.645714 0.8971911 0.89623517 0.11629394 #> 2: -0.017450384 0.1432536 0.082186751 4.307050 1.1923661 0.07155664 0.36880389 #> 3: 0.207344037 0.4099270 -0.029017846 2.614221 0.1229150 0.06086597 5.21957573 #> 4: 0.188650968 0.2468967 0.222743270 2.569725 4.6031134 0.24798459 0.14554227 #> 5: -0.039045905 0.8194260 -0.020382876 3.670287 2.8605627 0.53993131 0.03736488 #> 6: 1.617456647 0.1157753 -0.023209917 3.273479 0.3923848 0.25361287 5.05085497 #> CD61 CD117 CD49d HLA-DR CD64 CD41 #> 1: -0.03367549 -0.005935889 1.0854069 3.806867702 1.12814560 0.016760944 #> 2: 0.37575938 -0.028242085 0.2160160 1.625229446 2.51531881 1.222586140 #> 3: 0.15191575 -0.007000555 1.0156499 -0.009358463 -0.03477772 -0.016074469 #> 4: 0.60744371 -0.037043896 1.3042564 1.347048087 0.06778483 -0.001106224 #> 5: 0.40913068 0.003552560 1.6398025 4.248428862 0.08712833 0.359059949 #> 6: 0.47413843 0.066260604 0.9114135 0.129246858 -0.03605798 0.077738747 dat_asinh$sample <- dat$sample dat_asinh$cell_id <- dat$cell_id head(dat_asinh) #> CD45RA CD133 CD19 CD22 CD11b CD4 #> 1: 0.4521968 -0.030663164 -0.04111509 -0.03942993 2.55951176 0.15558245 #> 2: 0.4139249 0.628977340 -0.02027821 0.57848688 1.76920432 0.10654443 #> 3: 0.3173883 -0.014386137 0.02232781 -0.01484217 0.42819644 1.42110634 #> 4: 0.7483619 0.018731126 2.07004151 0.89259051 -0.01575979 0.01199128 #> 5: 0.7772642 0.112272365 1.62672741 1.51446768 0.35766705 0.25717724 #> 6: 1.0273733 0.003330631 -0.03886491 0.28380900 0.98926269 0.12921838 #> CD8 CD34 Flt3 CD20 CXCR4 CD235ab #> 1: -0.014386398 0.30236841 0.16886275 -0.017351646 0.6508532 0.16386798 #> 2: -0.001588712 -0.01880155 -0.02646592 -0.008434102 0.2696492 -0.02618534 #> 3: -0.006853243 0.10723503 -0.01149940 0.019554056 0.7139745 0.39044561 #> 4: 0.001809943 -0.03840405 0.63090991 0.127888398 0.5535560 -0.01748791 #> 5: -0.037524184 0.40007994 0.52178220 1.839834412 1.3795382 1.05895614 #> 6: 3.074908161 0.05765429 0.20165859 0.707518206 0.6560537 0.55682438 #> CD45 CD123 CD321 CD14 CD33 CD47 CD11c #> 1: 4.832541 0.061779758 2.925712 0.01014452 0.40817588 2.140661 2.13108274 #> 2: 4.417761 0.346230147 2.210777 -0.03850414 1.17826549 2.406005 1.82688632 #> 3: 5.704353 -0.013618983 1.399436 -0.01191279 -0.03208681 3.065803 -0.03815085 #> 4: 4.216660 0.248972250 1.371487 0.21799154 0.03721993 3.094522 -0.01412334 #> 5: 5.705201 0.010062211 1.484375 0.22215516 0.03173898 2.792218 0.82955004 #> 6: 5.850478 -0.008977647 2.050461 0.12392437 -0.01966382 2.480371 1.03599597 #> CD7 CD15 CD16 CD44 CD38 CD13 CD3 #> 1: -0.001593332 0.1450748 -0.006135286 3.645714 0.8971911 0.89623517 0.11629394 #> 2: -0.017450384 0.1432536 0.082186751 4.307050 1.1923661 0.07155664 0.36880389 #> 3: 0.207344037 0.4099270 -0.029017846 2.614221 0.1229150 0.06086597 5.21957573 #> 4: 0.188650968 0.2468967 0.222743270 2.569725 4.6031134 0.24798459 0.14554227 #> 5: -0.039045905 0.8194260 -0.020382876 3.670287 2.8605627 0.53993131 0.03736488 #> 6: 1.617456647 0.1157753 -0.023209917 3.273479 0.3923848 0.25361287 5.05085497 #> CD61 CD117 CD49d HLA-DR CD64 CD41 #> 1: -0.03367549 -0.005935889 1.0854069 3.806867702 1.12814560 0.016760944 #> 2: 0.37575938 -0.028242085 0.2160160 1.625229446 2.51531881 1.222586140 #> 3: 0.15191575 -0.007000555 1.0156499 -0.009358463 -0.03477772 -0.016074469 #> 4: 0.60744371 -0.037043896 1.3042564 1.347048087 0.06778483 -0.001106224 #> 5: 0.40913068 0.003552560 1.6398025 4.248428862 0.08712833 0.359059949 #> 6: 0.47413843 0.066260604 0.9114135 0.129246858 -0.03605798 0.077738747 #> sample cell_id #> 1: H1 Cell_1 #> 2: H1 Cell_2 #> 3: H1 Cell_3 #> 4: H1 Cell_4 #> 5: H1 Cell_5 #> 6: H1 Cell_6"},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/how_to_prepare_data.html","id":"session-information","dir":"Articles","previous_headings":"","what":"Session information","title":"How to Prepare Data for SuperCellCyto","text":"","code":"sessionInfo() #> R version 4.3.2 (2023-10-31) #> Platform: x86_64-pc-linux-gnu (64-bit) #> Running under: Ubuntu 22.04.3 LTS #> #> Matrix products: default #> BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 #> LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so; LAPACK version 3.10.0 #> #> locale: #> [1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8 #> [4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8 #> [7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C #> [10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C #> #> time zone: UTC #> tzcode source: system (glibc) #> #> attached base packages: #> [1] stats graphics grDevices utils datasets methods base #> #> other attached packages: #> [1] data.table_1.14.10 #> #> loaded via a namespace (and not attached): #> [1] vctrs_0.6.5 cli_3.6.2 knitr_1.45 rlang_1.1.3 #> [5] xfun_0.41 highr_0.10 stringi_1.8.3 png_0.1-8 #> [9] purrr_1.0.2 textshaping_0.3.7 jsonlite_1.8.8 glue_1.7.0 #> [13] htmltools_0.5.7 ragg_1.2.7 sass_0.4.8 rmarkdown_2.25 #> [17] evaluate_0.23 jquerylib_0.1.4 fastmap_1.1.1 yaml_2.3.8 #> [21] lifecycle_1.0.4 memoise_2.0.1 stringr_1.5.1 compiler_4.3.2 #> [25] fs_1.6.3 systemfonts_1.0.5 digest_0.6.34 R6_2.5.1 #> [29] magrittr_2.0.3 bslib_0.6.1 tools_4.3.2 pkgdown_2.0.7 #> [33] cachem_1.0.8 desc_1.4.3"},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/interoperability_with_sce.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"Interoperability with SingleCellExperiment","text":"vignette demonstrates integrate SuperCellCyto results cytometry data stored SingleCellExperiment (SCE) objects, analyse SuperCellCyto output using Bioconductor packages take SCE objects input. use subsampled Levine_32dim dataset stored SCE object illustrate create supercells conduct downstream analyses.","code":"library(SuperCellCyto) library(qs) library(scran) library(BiocSingular) library(scater) library(bluster) library(data.table)"},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/interoperability_with_sce.html","id":"preparing-sce-object","dir":"Articles","previous_headings":"","what":"Preparing SCE object","title":"Interoperability with SingleCellExperiment","text":"first load subsampled Levine_32dim data, stored qs using qread function. data stored counts assay. subset include markers need perform downstream analysis, transform using arcsinh transformation, store transformed data logcounts assay.","code":"sce <- qread(\"data/Levine_32dim_sce_sub.qs\") sce #> class: SingleCellExperiment #> dim: 39 1400 #> metadata(0): #> assays(1): counts #> rownames(39): Time Cell_length ... file_number event_number #> rowData names(3): channel_name marker_name marker_class #> colnames(1400): cell_561 cell_321 ... cell_103890 cell_104094 #> colData names(3): population cell_id sample #> reducedDimNames(0): #> mainExpName: NULL #> altExpNames(0): markers <- c( \"CD45RA\", \"CD133\", \"CD19\", \"CD22\", \"CD11b\", \"CD4\", \"CD8\", \"CD34\", \"Flt3\", \"CD20\", \"CXCR4\", \"CD235ab\", \"CD45\", \"CD123\", \"CD321\", \"CD14\", \"CD33\", \"CD47\", \"CD11c\", \"CD7\", \"CD15\", \"CD16\", \"CD44\", \"CD38\", \"CD13\", \"CD3\", \"CD61\", \"CD117\", \"CD49d\", \"HLA-DR\", \"CD64\", \"CD41\" ) # keep only the relevant markers sce <- sce[markers,] # to store arcsinh transformed data exprs(sce) <- asinh(counts(sce) / 5) sce #> class: SingleCellExperiment #> dim: 32 1400 #> metadata(0): #> assays(2): counts logcounts #> rownames(32): CD45RA CD133 ... CD64 CD41 #> rowData names(3): channel_name marker_name marker_class #> colnames(1400): cell_561 cell_321 ... cell_103890 cell_104094 #> colData names(3): population cell_id sample #> reducedDimNames(0): #> mainExpName: NULL #> altExpNames(0):"},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/interoperability_with_sce.html","id":"run-supercellcyto","dir":"Articles","previous_headings":"","what":"Run SuperCellCyto","title":"Interoperability with SingleCellExperiment","text":"SuperCellCyto requires input data data.table format. Therefore, need extract arcsinh-transformed data data.table object, add sample information IDs cells. Note SCE typically stores cells columns features rows. SuperCellCyto, conversely, requires cells rows features columns, format typical cytometry data typically cells features. Hence, transpose extracted data accordingly creating data.table object. can now embed supercell ID colData SCE object.","code":"dt <- data.table(t(exprs(sce))) dt$sample <- colData(sce)$sample dt$cell_id <- colnames(sce) supercells <- runSuperCellCyto( dt = dt, markers = markers, sample_colname = \"sample\", cell_id_colname = \"cell_id\", gam = 5 ) head(supercells$supercell_expression_matrix) #> CD45RA CD133 CD19 CD22 CD11b CD4 #> 1: 0.3527464 0.36965658 0.052225408 0.15136864 0.38488737 0.196023673 #> 2: 0.4041729 0.11507111 -0.006932994 0.14693022 0.31907116 -0.003634473 #> 3: 0.2887375 0.36023125 0.056967849 0.07522713 0.24452473 0.029621008 #> 4: 0.4649379 0.08945479 0.103484348 0.11839183 0.14487231 1.042568045 #> 5: 0.9805149 0.19259931 2.047843479 0.63399673 0.19205448 0.069494473 #> 6: 0.5039989 0.04109535 1.140960742 0.16492283 0.02102912 0.071198534 #> CD8 CD34 Flt3 CD20 CXCR4 CD235ab CD45 #> 1: 0.007764969 3.50239704 0.34908410 0.05885608 0.8318448 0.08275919 4.150848 #> 2: 0.398832012 0.03705595 0.08254384 0.11077190 0.1816196 0.23423737 4.807796 #> 3: 0.141084382 2.86064160 0.15894138 0.09338509 0.5989438 0.28179014 3.957416 #> 4: 0.071286889 0.10101316 0.29710281 0.03730981 1.2497923 0.67063325 5.886074 #> 5: 0.119244014 0.18210858 0.18761215 1.92656431 1.6019596 0.55462384 4.901840 #> 6: 0.004411946 0.11332847 0.18281316 0.16633969 0.5100604 0.28425575 2.570437 #> CD123 CD321 CD14 CD33 CD47 CD11c CD7 #> 1: 0.65958207 3.4777525 0.002602230 0.152636911 3.397630 0.5570696 0.12059033 #> 2: 0.01079346 0.7022473 0.040223896 -0.019154034 2.348988 0.3813772 3.63888594 #> 3: 0.68153776 3.1851073 0.015196514 0.117996726 2.756822 0.3060572 0.07848237 #> 4: 0.11592253 2.1491149 -0.007858091 -0.002039228 3.268248 0.2132838 1.08816761 #> 5: 0.62460814 2.2506667 0.075977004 0.514268184 3.562088 0.2269047 0.01379916 #> 6: 0.06874399 0.8415449 0.068690241 0.240470325 3.154016 0.4181508 0.07325880 #> CD15 CD16 CD44 CD38 CD13 CD3 CD61 #> 1: 0.63687911 0.195011598 4.262887 2.6031938 0.4192431 0.46531929 0.06761204 #> 2: 0.17664753 0.905724996 1.632231 2.8565129 0.2514765 0.27068380 0.25558748 #> 3: 0.44514407 0.026423501 2.874195 1.9066412 0.4908399 0.24716531 0.17950440 #> 4: 0.08441551 0.004227474 3.640311 0.5495787 0.2311405 5.36168058 0.39291676 #> 5: 0.14494562 0.252655577 2.822493 5.0658843 0.5187125 0.33558106 0.19615231 #> 6: 0.30214595 0.281831160 3.819350 5.8639208 1.0289835 0.07946019 0.08158021 #> CD117 CD49d HLA-DR CD64 CD41 sample #> 1: 1.19031991 1.3604618 2.75321307 0.16150006 0.18985821 H1 #> 2: 0.06541793 0.4496903 0.14374144 0.18547915 0.06282481 H1 #> 3: 0.83249351 0.9205626 2.58482319 0.20073796 0.21266848 H1 #> 4: 0.29209802 0.4707183 0.17818566 0.04568237 0.07765066 H1 #> 5: 0.10129956 1.3608945 2.20287695 0.09954007 0.17256851 H1 #> 6: -0.01764885 1.4263210 0.07484084 0.06353135 0.06840618 H1 #> SuperCellId #> 1: SuperCell_1_Sample_H1 #> 2: SuperCell_2_Sample_H1 #> 3: SuperCell_3_Sample_H1 #> 4: SuperCell_4_Sample_H1 #> 5: SuperCell_5_Sample_H1 #> 6: SuperCell_6_Sample_H1 colData(sce)$supercell_id <- factor(supercells$supercell_cell_map$SuperCellID) head(colData(sce)) #> DataFrame with 6 rows and 4 columns #> population cell_id sample supercell_id #> #> cell_561 Basophils cell_561 H1 SuperCell_94_Sample_H1 #> cell_321 Basophils cell_321 H1 SuperCell_51_Sample_H1 #> cell_153 Basophils cell_153 H1 SuperCell_29_Sample_H1 #> cell_74 Basophils cell_74 H1 SuperCell_51_Sample_H1 #> cell_228 Basophils cell_228 H1 SuperCell_51_Sample_H1 #> cell_146 Basophils cell_146 H1 SuperCell_25_Sample_H1"},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/interoperability_with_sce.html","id":"analyse-supercells-as-sce-object","dir":"Articles","previous_headings":"","what":"Analyse Supercells as SCE object","title":"Interoperability with SingleCellExperiment","text":"number supercells less number cells SCE object, store supercell expression matrix separate SCE object. allows us use Bioconductor packages analyse supercells. code essentially transpose supercell expression matrix, making supercells columns markers rows, store logcounts assay new SCE object. also populate colData SuperCellId sample name supercell. supercell expression matrix now SCE format, can perform downstream analyses clustering drawing UMAP plots using Bioconductor packages. functions operate SCE object work. example, can use plotExpression scater package create violin plots markers clusters. Note, y-axis says “logcounts”, data actually arcsinh transformed, log transformed.","code":"supercell_sce <- SingleCellExperiment( list(logcounts=t(supercells$supercell_expression_matrix[, markers, with=FALSE])), colData = DataFrame( SuperCellId=supercells$supercell_expression_matrix$SuperCellId, sample=supercells$supercell_expression_matrix$sample ) ) colnames(supercell_sce) <- colData(supercell_sce)$SuperCellId supercell_sce #> class: SingleCellExperiment #> dim: 32 280 #> metadata(0): #> assays(1): logcounts #> rownames(32): CD45RA CD133 ... CD64 CD41 #> rowData names(0): #> colnames(280): SuperCell_1_Sample_H1 SuperCell_2_Sample_H1 ... #> SuperCell_139_Sample_H2 SuperCell_140_Sample_H2 #> colData names(2): SuperCellId sample #> reducedDimNames(0): #> mainExpName: NULL #> altExpNames(0): set.seed(42) supercell_sce <- fixedPCA(supercell_sce, rank = 10, subset.row = NULL, BSPARAM=RandomParam()) supercell_sce <- runUMAP(supercell_sce, dimred=\"PCA\") clusters <- clusterCells( supercell_sce, use.dimred = \"PCA\", BLUSPARAM = SNNGraphParam(cluster.fun = \"leiden\") ) colLabels(supercell_sce) <- clusters plotReducedDim(supercell_sce, dimred=\"UMAP\", colour_by=\"label\") plotExpression(supercell_sce, c(\"CD4\", \"CD8\", \"CD19\", \"CD34\", \"CD11b\"), x = \"label\", colour_by = \"sample\")"},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/interoperability_with_sce.html","id":"transfer-information-from-supercells-sce-object-to-single-cell-sce-object","dir":"Articles","previous_headings":"","what":"Transfer information from supercells SCE object to single cell SCE object","title":"Interoperability with SingleCellExperiment","text":"transfer analysis results (e.g., clusters) supercell SCE object back single-cell SCE object, need data wrangling. vital ensure order analysis results (e.g., clusters) aligns cell order SCE object. Using cluster information example, need first extract colData SCE objects two separate data.table objects. use merge.data.table match merge using supercell ID common identifiers. Make sure set sort parameter FALSE set x colData single cell SCE object. ensures order resulting data.table aligns order colData single-cell SCE object. Finally, can add cluster assignment column colData single-cell SCE object. Visualise UMAP plot. violin plot see distribution marker expressions. Note, y-axis says “logcounts”, data actually arcsinh transformed, log transformed.","code":"cell_id_sce <- data.table(as.data.frame(colData(sce))) supercell_cluster <- data.table(as.data.frame(colData(supercell_sce))) cell_id_sce_with_clusters <- merge.data.table( x = cell_id_sce, y = supercell_cluster, by.x = \"supercell_id\", by.y = \"SuperCellId\", sort = FALSE ) colData(sce)$cluster <- cell_id_sce_with_clusters$label sce <- fixedPCA(sce, rank = 10, subset.row = NULL, BSPARAM=RandomParam()) sce <- runUMAP(sce, dimred=\"PCA\") plotReducedDim(sce, dimred=\"UMAP\", colour_by=\"cluster\") plotExpression(sce, c(\"CD4\", \"CD8\", \"CD19\", \"CD34\", \"CD11b\"), x = \"cluster\", colour_by = \"sample\")"},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/interoperability_with_sce.html","id":"session-information","dir":"Articles","previous_headings":"","what":"Session information","title":"Interoperability with SingleCellExperiment","text":"","code":"sessionInfo() #> R version 4.3.2 (2023-10-31) #> Platform: x86_64-pc-linux-gnu (64-bit) #> Running under: Ubuntu 22.04.3 LTS #> #> Matrix products: default #> BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 #> LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so; LAPACK version 3.10.0 #> #> locale: #> [1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8 #> [4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8 #> [7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C #> [10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C #> #> time zone: UTC #> tzcode source: system (glibc) #> #> attached base packages: #> [1] stats4 stats graphics grDevices utils datasets methods #> [8] base #> #> other attached packages: #> [1] data.table_1.14.10 bluster_1.12.0 #> [3] scater_1.30.1 ggplot2_3.4.4 #> [5] BiocSingular_1.18.0 scran_1.30.2 #> [7] scuttle_1.12.0 SingleCellExperiment_1.24.0 #> [9] SummarizedExperiment_1.32.0 Biobase_2.62.0 #> [11] GenomicRanges_1.54.1 GenomeInfoDb_1.38.5 #> [13] IRanges_2.36.0 S4Vectors_0.40.2 #> [15] BiocGenerics_0.48.1 MatrixGenerics_1.14.0 #> [17] matrixStats_1.2.0 qs_0.25.7 #> [19] SuperCellCyto_0.1.0 #> #> loaded via a namespace (and not attached): #> [1] bitops_1.0-7 gridExtra_2.3 #> [3] rlang_1.1.3 magrittr_2.0.3 #> [5] compiler_4.3.2 DelayedMatrixStats_1.24.0 #> [7] systemfonts_1.0.5 vctrs_0.6.5 #> [9] stringr_1.5.1 pkgconfig_2.0.3 #> [11] crayon_1.5.2 fastmap_1.1.1 #> [13] XVector_0.42.0 labeling_0.4.3 #> [15] SuperCell_1.0 utf8_1.2.4 #> [17] rmarkdown_2.25 ggbeeswarm_0.7.2 #> [19] ragg_1.2.7 purrr_1.0.2 #> [21] xfun_0.41 zlibbioc_1.48.0 #> [23] cachem_1.0.8 beachmat_2.18.0 #> [25] jsonlite_1.8.8 highr_0.10 #> [27] DelayedArray_0.28.0 BiocParallel_1.36.0 #> [29] irlba_2.3.5.1 parallel_4.3.2 #> [31] cluster_2.1.4 R6_2.5.1 #> [33] bslib_0.6.1 stringi_1.8.3 #> [35] limma_3.58.1 jquerylib_0.1.4 #> [37] Rcpp_1.0.12 knitr_1.45 #> [39] FNN_1.1.4 Matrix_1.6-5 #> [41] igraph_1.6.0 tidyselect_1.2.0 #> [43] abind_1.4-5 yaml_2.3.8 #> [45] viridis_0.6.4 stringfish_0.16.0 #> [47] codetools_0.2-19 plyr_1.8.9 #> [49] lattice_0.21-9 tibble_3.2.1 #> [51] withr_3.0.0 evaluate_0.23 #> [53] desc_1.4.3 RcppParallel_5.1.7 #> [55] pillar_1.9.0 generics_0.1.3 #> [57] RCurl_1.98-1.14 sparseMatrixStats_1.14.0 #> [59] munsell_0.5.0 scales_1.3.0 #> [61] RApiSerialize_0.1.2 glue_1.7.0 #> [63] metapod_1.10.1 tools_4.3.2 #> [65] BiocNeighbors_1.20.2 ScaledMatrix_1.10.0 #> [67] locfit_1.5-9.8 RANN_2.6.1 #> [69] fs_1.6.3 cowplot_1.1.3 #> [71] grid_4.3.2 edgeR_4.0.12 #> [73] colorspace_2.1-0 GenomeInfoDbData_1.2.11 #> [75] beeswarm_0.4.0 vipor_0.4.7 #> [77] cli_3.6.2 rsvd_1.0.5 #> [79] textshaping_0.3.7 fansi_1.0.6 #> [81] viridisLite_0.4.2 S4Arrays_1.2.0 #> [83] dplyr_1.1.4 uwot_0.1.16 #> [85] gtable_0.3.4 sass_0.4.8 #> [87] digest_0.6.34 SparseArray_1.2.3 #> [89] ggrepel_0.9.5 dqrng_0.3.2 #> [91] farver_2.1.1 memoise_2.0.1 #> [93] htmltools_0.5.7 pkgdown_2.0.7 #> [95] lifecycle_1.0.4 statmod_1.5.0"},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/interoperability_with_seurat.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"Interoperability with Seurat","text":"can integrate SuperCellCyto’s output cytometry data stored Seurat objects? possible store results SuperCellCyto Seurat objects subsequent analysis using Seurat? answer yes. vignette, demonstrate process using subsampled Levine_32dim dataset used manuscript stored Seurat object. show create supercells data analyze using Seurat.","code":"library(qs) library(Seurat) library(data.table) library(SuperCellCyto) set.seed(42)"},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/interoperability_with_seurat.html","id":"preparing-seurat-object","dir":"Articles","previous_headings":"","what":"Preparing Seurat object","title":"Interoperability with Seurat","text":"subsampled Levine_32dim data stored qs object. begin loading data using qread function qs package. data stored originalexp assay, counts data slots containing raw data. running SuperCellCyto, first: Subset data retain markers need perform downstream analysis. Perform arcsinh transformation, store transformed data data slot originalexp assay.","code":"seurat_obj <- qread(\"data/Levine_32dim_seurat_sub.qs\") seurat_obj #> An object of class Seurat #> 39 features across 1400 samples within 1 assay #> Active assay: originalexp (39 features, 0 variable features) #> 2 layers present: counts, data markers <- c( \"CD45RA\", \"CD133\", \"CD19\", \"CD22\", \"CD11b\", \"CD4\", \"CD8\", \"CD34\", \"Flt3\", \"CD20\", \"CXCR4\", \"CD235ab\", \"CD45\", \"CD123\", \"CD321\", \"CD14\", \"CD33\", \"CD47\", \"CD11c\", \"CD7\", \"CD15\", \"CD16\", \"CD44\", \"CD38\", \"CD13\", \"CD3\", \"CD61\", \"CD117\", \"CD49d\", \"HLA-DR\", \"CD64\", \"CD41\" ) # keep only the relevant markers seurat_obj <- seurat_obj[markers, ] # to store arcsinh transformed data seurat_obj[['originalexp']]$data <- asinh(seurat_obj[['originalexp']]$counts / 5) seurat_obj #> An object of class Seurat #> 32 features across 1400 samples within 1 assay #> Active assay: originalexp (32 features, 0 variable features) #> 2 layers present: counts, data"},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/interoperability_with_seurat.html","id":"run-supercellcyto","dir":"Articles","previous_headings":"","what":"Run SuperCellCyto","title":"Interoperability with Seurat","text":"SuperCellCyto requires input data data.table format. Hence, extract arcsinh-transformed data Seurat object, format data.table, include sample information cell IDs. ’s important note Seurat objects typically store cells columns features (markers genes) rows. Since SuperCellCyto expects cells rows features columns, also transpose data. transposing preparing data table, run runSuperCellCyto function, passing required parameters including markers, sample column name, cell ID column name, gamma value. can now embed supercell ID metadata Seurat object.","code":"# check.names set to FALSE so HLA-DR is not replaced with HLA.DR dt <- data.table(t(data.frame(seurat_obj[['originalexp']]$data, check.names = FALSE))) # add the cell_id and sample metadata dt <- cbind(dt, seurat_obj[[c(\"cell_id\", \"sample\")]]) supercells <- runSuperCellCyto( dt = dt, markers = markers, sample_colname = \"sample\", cell_id_colname = \"cell_id\", gam = 5 ) head(supercells$supercell_expression_matrix) #> CD45RA CD133 CD19 CD22 CD11b CD4 #> 1: 0.3527464 0.36965658 0.052225408 0.15136864 0.38488737 0.196023673 #> 2: 0.4041729 0.11507111 -0.006932994 0.14693022 0.31907116 -0.003634473 #> 3: 0.2887375 0.36023125 0.056967849 0.07522713 0.24452473 0.029621008 #> 4: 0.4649379 0.08945479 0.103484348 0.11839183 0.14487231 1.042568045 #> 5: 0.9805149 0.19259931 2.047843479 0.63399673 0.19205448 0.069494473 #> 6: 0.5039989 0.04109535 1.140960742 0.16492283 0.02102912 0.071198534 #> CD8 CD34 Flt3 CD20 CXCR4 CD235ab CD45 #> 1: 0.007764969 3.50239704 0.34908410 0.05885608 0.8318448 0.08275919 4.150848 #> 2: 0.398832012 0.03705595 0.08254384 0.11077190 0.1816196 0.23423737 4.807796 #> 3: 0.141084382 2.86064160 0.15894138 0.09338509 0.5989438 0.28179014 3.957416 #> 4: 0.071286889 0.10101316 0.29710281 0.03730981 1.2497923 0.67063325 5.886074 #> 5: 0.119244014 0.18210858 0.18761215 1.92656431 1.6019596 0.55462384 4.901840 #> 6: 0.004411946 0.11332847 0.18281316 0.16633969 0.5100604 0.28425575 2.570437 #> CD123 CD321 CD14 CD33 CD47 CD11c CD7 #> 1: 0.65958207 3.4777525 0.002602230 0.152636911 3.397630 0.5570696 0.12059033 #> 2: 0.01079346 0.7022473 0.040223896 -0.019154034 2.348988 0.3813772 3.63888594 #> 3: 0.68153776 3.1851073 0.015196514 0.117996726 2.756822 0.3060572 0.07848237 #> 4: 0.11592253 2.1491149 -0.007858091 -0.002039228 3.268248 0.2132838 1.08816761 #> 5: 0.62460814 2.2506667 0.075977004 0.514268184 3.562088 0.2269047 0.01379916 #> 6: 0.06874399 0.8415449 0.068690241 0.240470325 3.154016 0.4181508 0.07325880 #> CD15 CD16 CD44 CD38 CD13 CD3 CD61 #> 1: 0.63687911 0.195011598 4.262887 2.6031938 0.4192431 0.46531929 0.06761204 #> 2: 0.17664753 0.905724996 1.632231 2.8565129 0.2514765 0.27068380 0.25558748 #> 3: 0.44514407 0.026423501 2.874195 1.9066412 0.4908399 0.24716531 0.17950440 #> 4: 0.08441551 0.004227474 3.640311 0.5495787 0.2311405 5.36168058 0.39291676 #> 5: 0.14494562 0.252655577 2.822493 5.0658843 0.5187125 0.33558106 0.19615231 #> 6: 0.30214595 0.281831160 3.819350 5.8639208 1.0289835 0.07946019 0.08158021 #> CD117 CD49d HLA-DR CD64 CD41 sample #> 1: 1.19031991 1.3604618 2.75321307 0.16150006 0.18985821 H1 #> 2: 0.06541793 0.4496903 0.14374144 0.18547915 0.06282481 H1 #> 3: 0.83249351 0.9205626 2.58482319 0.20073796 0.21266848 H1 #> 4: 0.29209802 0.4707183 0.17818566 0.04568237 0.07765066 H1 #> 5: 0.10129956 1.3608945 2.20287695 0.09954007 0.17256851 H1 #> 6: -0.01764885 1.4263210 0.07484084 0.06353135 0.06840618 H1 #> SuperCellId #> 1: SuperCell_1_Sample_H1 #> 2: SuperCell_2_Sample_H1 #> 3: SuperCell_3_Sample_H1 #> 4: SuperCell_4_Sample_H1 #> 5: SuperCell_5_Sample_H1 #> 6: SuperCell_6_Sample_H1 seurat_obj$supercell_id <- factor(supercells$supercell_cell_map$SuperCellID) head(seurat_obj[[]]) #> orig.ident nCount_originalexp nFeature_originalexp population cell_id #> cell_561 cell 782.3311 23 Basophils cell_561 #> cell_321 cell 849.1107 28 Basophils cell_321 #> cell_153 cell 1349.6991 21 Basophils cell_153 #> cell_74 cell 908.6923 23 Basophils cell_74 #> cell_228 cell 723.2195 27 Basophils cell_228 #> cell_146 cell 444.4285 22 Basophils cell_146 #> sample supercell_id #> cell_561 H1 SuperCell_94_Sample_H1 #> cell_321 H1 SuperCell_51_Sample_H1 #> cell_153 H1 SuperCell_29_Sample_H1 #> cell_74 H1 SuperCell_51_Sample_H1 #> cell_228 H1 SuperCell_51_Sample_H1 #> cell_146 H1 SuperCell_25_Sample_H1"},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/interoperability_with_seurat.html","id":"analyse-supercells-as-seurat-object","dir":"Articles","previous_headings":"","what":"Analyse Supercells as Seurat object","title":"Interoperability with Seurat","text":"supercell expression matrix, fewer supercells number cells Seurat object, best stored separate Seurat object. allows us use Seurat’s functions analysis. , first transpose expression matrix, ensuring cells columns markers rows, create new Seurat object default RNA assay. data counts slots RNA assay set contain marker expression. supercell marker expression stored Seurat object, can proceed performing downstream analysis clustering creating UMAP plots.","code":"supercell_exp_mat <- t(supercells$supercell_expression_matrix[, markers, with=FALSE]) colnames(supercell_exp_mat) <- supercells$supercell_expression_matrix$SuperCellId supercell_seurat_obj <- CreateSeuratObject(counts = supercell_exp_mat) #> Warning: Data is of class matrix. Coercing to dgCMatrix. supercell_seurat_obj[['RNA']]$data <- supercell_seurat_obj[['RNA']]$counts supercell_seurat_obj #> An object of class Seurat #> 32 features across 280 samples within 1 assay #> Active assay: RNA (32 features, 0 variable features) #> 2 layers present: counts, data # Have to do this, otherwise Seurat will complain supercell_seurat_obj <- ScaleData(supercell_seurat_obj) supercell_seurat_obj <- RunPCA( object = supercell_seurat_obj, npcs = 10, nfeatures.print = 1, approx = FALSE, seed.use = 42, features = markers ) supercell_seurat_obj <- FindNeighbors(supercell_seurat_obj, dims = 1:10) supercell_seurat_obj <- FindClusters(supercell_seurat_obj, resolution = 0.5) #> Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck #> #> Number of nodes: 280 #> Number of edges: 6252 #> #> Running Louvain algorithm... #> Maximum modularity in 10 random starts: 0.8590 #> Number of communities: 7 #> Elapsed time: 0 seconds supercell_seurat_obj <- RunUMAP(supercell_seurat_obj, dims = 1:10) #> Warning: The default method for RunUMAP has changed from calling Python UMAP via reticulate to the R-native UWOT using the cosine metric #> To use Python UMAP via reticulate, set umap.method to 'umap-learn' and metric to 'correlation' #> This message will be shown once per session DimPlot(supercell_seurat_obj, reduction = \"umap\") FeaturePlot(supercell_seurat_obj, features = c(\"CD4\", \"CD8\", \"CD19\", \"CD34\", \"CD11b\"), ncol = 3)"},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/interoperability_with_seurat.html","id":"transfer-information-from-supercells-seurat-object-to-single-cell-seurat-object","dir":"Articles","previous_headings":"","what":"Transfer information from supercells Seurat object to single cell Seurat object","title":"Interoperability with Seurat","text":"transfer information (e.g., clusters) obtained analyzing supercells back single cells, need data wrangling. key ensuring order new information aligns order cells Seurat object. demonstrate using cluster information example. first extract metadata single-cell Seurat object clustering information supercells Seurat object two different data.table objects, merge using merge.data.table, setting sort parameter FALSE x parameter data.table containing metadata single-cell Seurat object ensure result order metadata single-cell Seurat object. merging, can add cluster assignment metadata single-cell Seurat object. visualise cluster assignments marker expressions clustered single cell data.","code":"clusters <- data.table( supercell_id = colnames(supercell_seurat_obj), cluster = as.vector(Idents(supercell_seurat_obj)) ) cell_metadata <- seurat_obj[[]] cell_metadata <- merge.data.table( x = cell_metadata, y = clusters, by = \"supercell_id\", sort = FALSE ) seurat_obj$cluster <- cell_metadata$cluster Idents(seurat_obj) <- \"cluster\" seurat_obj <- ScaleData(seurat_obj) seurat_obj <- RunPCA( object = seurat_obj, npcs = 10, nfeatures.print = 1, approx = FALSE, seed.use = 42, features = markers ) seurat_obj <- FindNeighbors(seurat_obj, dims = 1:10) seurat_obj <- FindClusters(seurat_obj, resolution = 0.5) #> Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck #> #> Number of nodes: 1400 #> Number of edges: 45134 #> #> Running Louvain algorithm... #> Maximum modularity in 10 random starts: 0.9088 #> Number of communities: 9 #> Elapsed time: 0 seconds seurat_obj <- RunUMAP(seurat_obj, dims = 1:10) DimPlot(seurat_obj, reduction = \"umap\") FeaturePlot(seurat_obj, features = c(\"CD4\", \"CD8\", \"CD19\", \"CD34\", \"CD11b\"), ncol = 3)"},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/interoperability_with_seurat.html","id":"session-information","dir":"Articles","previous_headings":"","what":"Session information","title":"Interoperability with Seurat","text":"","code":"sessionInfo() #> R version 4.3.2 (2023-10-31) #> Platform: x86_64-pc-linux-gnu (64-bit) #> Running under: Ubuntu 22.04.3 LTS #> #> Matrix products: default #> BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 #> LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so; LAPACK version 3.10.0 #> #> locale: #> [1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8 #> [4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8 #> [7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C #> [10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C #> #> time zone: UTC #> tzcode source: system (glibc) #> #> attached base packages: #> [1] stats graphics grDevices utils datasets methods base #> #> other attached packages: #> [1] SuperCellCyto_0.1.0 data.table_1.14.10 Seurat_5.0.1 #> [4] SeuratObject_5.0.1 sp_2.1-2 qs_0.25.7 #> #> loaded via a namespace (and not attached): #> [1] RColorBrewer_1.1-3 jsonlite_1.8.8 magrittr_2.0.3 #> [4] spatstat.utils_3.0-4 farver_2.1.1 rmarkdown_2.25 #> [7] fs_1.6.3 ragg_1.2.7 vctrs_0.6.5 #> [10] ROCR_1.0-11 memoise_2.0.1 spatstat.explore_3.2-5 #> [13] htmltools_0.5.7 sass_0.4.8 sctransform_0.4.1 #> [16] parallelly_1.36.0 KernSmooth_2.23-22 bslib_0.6.1 #> [19] htmlwidgets_1.6.4 desc_1.4.3 ica_1.0-3 #> [22] plyr_1.8.9 plotly_4.10.4 zoo_1.8-12 #> [25] cachem_1.0.8 igraph_1.6.0 mime_0.12 #> [28] lifecycle_1.0.4 pkgconfig_2.0.3 Matrix_1.6-5 #> [31] R6_2.5.1 fastmap_1.1.1 fitdistrplus_1.1-11 #> [34] future_1.33.1 shiny_1.8.0 digest_0.6.34 #> [37] colorspace_2.1-0 patchwork_1.2.0 tensor_1.5 #> [40] RSpectra_0.16-1 irlba_2.3.5.1 textshaping_0.3.7 #> [43] labeling_0.4.3 progressr_0.14.0 fansi_1.0.6 #> [46] spatstat.sparse_3.0-3 httr_1.4.7 polyclip_1.10-6 #> [49] abind_1.4-5 compiler_4.3.2 withr_3.0.0 #> [52] BiocParallel_1.36.0 fastDummies_1.7.3 highr_0.10 #> [55] MASS_7.3-60 tools_4.3.2 lmtest_0.9-40 #> [58] httpuv_1.6.13 future.apply_1.11.1 goftest_1.2-3 #> [61] glue_1.7.0 nlme_3.1-163 promises_1.2.1 #> [64] grid_4.3.2 Rtsne_0.17 cluster_2.1.4 #> [67] reshape2_1.4.4 generics_0.1.3 gtable_0.3.4 #> [70] spatstat.data_3.0-4 tidyr_1.3.0 RApiSerialize_0.1.2 #> [73] stringfish_0.16.0 utf8_1.2.4 spatstat.geom_3.2-7 #> [76] RcppAnnoy_0.0.21 ggrepel_0.9.5 RANN_2.6.1 #> [79] pillar_1.9.0 stringr_1.5.1 spam_2.10-0 #> [82] RcppHNSW_0.5.0 later_1.3.2 splines_4.3.2 #> [85] dplyr_1.1.4 lattice_0.21-9 survival_3.5-7 #> [88] deldir_2.0-2 tidyselect_1.2.0 miniUI_0.1.1.1 #> [91] pbapply_1.7-2 knitr_1.45 gridExtra_2.3 #> [94] scattermore_1.2 xfun_0.41 matrixStats_1.2.0 #> [97] stringi_1.8.3 lazyeval_0.2.2 yaml_2.3.8 #> [100] evaluate_0.23 codetools_0.2-19 SuperCell_1.0 #> [103] tibble_3.2.1 cli_3.6.2 uwot_0.1.16 #> [106] RcppParallel_5.1.7 xtable_1.8-4 reticulate_1.34.0 #> [109] systemfonts_1.0.5 munsell_0.5.0 jquerylib_0.1.4 #> [112] Rcpp_1.0.12 globals_0.16.2 spatstat.random_3.2-2 #> [115] png_0.1-8 parallel_4.3.2 ellipsis_0.3.2 #> [118] pkgdown_2.0.7 ggplot2_3.4.4 dotCall64_1.1-1 #> [121] listenv_0.9.0 viridisLite_0.4.2 scales_1.3.0 #> [124] ggridges_0.5.5 leiden_0.4.3.1 purrr_1.0.2 #> [127] rlang_1.1.3 cowplot_1.1.3"},{"path":"https://phipsonlab.github.io/SuperCellCyto/articles/using_supercellcyto_for_stratified_summarising.html","id":"session-information","dir":"Articles","previous_headings":"","what":"Session information","title":"Using SuperCellCyto for Stratified Summarising","text":"","code":"sessionInfo() #> R version 4.3.2 (2023-10-31) #> Platform: x86_64-pc-linux-gnu (64-bit) #> Running under: Ubuntu 22.04.3 LTS #> #> Matrix products: default #> BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 #> LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so; LAPACK version 3.10.0 #> #> locale: #> [1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8 #> [4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8 #> [7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C #> [10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C #> #> time zone: UTC #> tzcode source: system (glibc) #> #> attached base packages: #> [1] stats graphics grDevices utils datasets methods base #> #> other attached packages: #> [1] SuperCellCyto_0.1.0 #> #> loaded via a namespace (and not attached): #> [1] Matrix_1.6-5 jsonlite_1.8.8 compiler_4.3.2 #> [4] Rcpp_1.0.12 stringr_1.5.1 parallel_4.3.2 #> [7] SuperCell_1.0 jquerylib_0.1.4 systemfonts_1.0.5 #> [10] textshaping_0.3.7 BiocParallel_1.36.0 yaml_2.3.8 #> [13] fastmap_1.1.1 lattice_0.21-9 plyr_1.8.9 #> [16] R6_2.5.1 igraph_1.6.0 knitr_1.45 #> [19] desc_1.4.3 bslib_0.6.1 rlang_1.1.3 #> [22] cachem_1.0.8 stringi_1.8.3 RANN_2.6.1 #> [25] xfun_0.41 fs_1.6.3 sass_0.4.8 #> [28] memoise_2.0.1 cli_3.6.2 pkgdown_2.0.7 #> [31] magrittr_2.0.3 digest_0.6.34 grid_4.3.2 #> [34] lifecycle_1.0.4 vctrs_0.6.5 evaluate_0.23 #> [37] glue_1.7.0 data.table_1.14.10 codetools_0.2-19 #> [40] ragg_1.2.7 rmarkdown_2.25 purrr_1.0.2 #> [43] pkgconfig_2.0.3 tools_4.3.2 htmltools_0.5.7"},{"path":"https://phipsonlab.github.io/SuperCellCyto/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Givanna Putri. Author, maintainer. George Howitt. Author. Felix Marsh-Wakefield. Author. Thomas Ashhurst. Author. Belinda Phipson. Author.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Putri, H G, Howitt, George, Marsh-Wakefield, Felix, Ashhurst, Myles T, Phipson, Belinda (2023). “SuperCellCyto: enabling efficient analysis large scale cytometry datasets.” bioRxiv. doi:10.1101/2023.08.14.553168.","code":"@Article{, title = {SuperCellCyto: enabling efficient analysis of large scale cytometry datasets}, author = {{Putri} and Givanna H and {Howitt} and {George} and {Marsh-Wakefield} and {Felix} and {Ashhurst} and Thomas Myles and {Phipson} and {Belinda}}, journal = {bioRxiv}, year = {2023}, doi = {https://doi.org/10.1101/2023.08.14.553168}, }"},{"path":"https://phipsonlab.github.io/SuperCellCyto/index.html","id":"supercellcyto","dir":"","previous_headings":"","what":"SuperCell For Cytometry Data","title":"SuperCell For Cytometry Data","text":"SuperCellCyto extension SuperCell R package. Initially developed scRNAseq data, SuperCell aggregates cells similar transcriptomic profiles “supercells” (also known “metacells” scRNAseq literature). SuperCellCyto, ’ve tailored SuperCell package specifically cater cytometry data: Supercells now aggregating cells similar marker expressions. Supercells now created individual sample. adaptation ensures supercell encompasses cells exclusively one sample. processing sample independently, prevent intermixing cells different samples within supercells. Multiple samples can now processed parallel custom load balancing strategy. enhancement enables simultaneous generation supercells multiple samples, significantly reducing computational time required processing large datasets.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/index.html","id":"vignettes-and-function-documentation","dir":"","previous_headings":"","what":"Vignettes and Function Documentation","title":"SuperCell For Cytometry Data","text":"understand SuperCellCyto can integrated workflow, head Articles page. Click dropdown arrow Articles link navbar top website. vignettes provide step--step guides, practical examples, use-case scenarios demonstrate package’s application various research contexts. Documentation usage function SuperCellCyto package available Reference page. Click Reference link navbar top website.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/index.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"SuperCell For Cytometry Data","text":"use SuperCellCyto study, please kindly cite preprint bioRxiv: Putri, G. H., Howitt, G., Marsh-Wakefield, F., Ashhurst, T. M., & Phipson, B. (2023). SuperCellCyto: enabling efficient analysis large scale cytometry datasets. bioRxiv; DOI: https://doi.org/10.1101/2023.08.14.553168","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"SuperCell For Cytometry Data","text":"package can installed using remotes: SuperCellCyto requires SuperCell R package installed run properly. use installation command , , theory, automatically installed. case doesn’t, please manually install running following command beforehand:","code":"# Install remotes install.packages(\"remotes\") # Install SuperCellCyto from this repository remotes::install_github(\"phipsonlab/SuperCellCyto\") # Install SuperCell from their github repository remotes::install_github(\"GfellerLab/SuperCell\")"},{"path":"https://phipsonlab.github.io/SuperCellCyto/index.html","id":"code-of-conduct","dir":"","previous_headings":"","what":"Code of Conduct","title":"SuperCell For Cytometry Data","text":"Please note SuperCellCyto project released Contributor Code Conduct. contributing project, agree abide terms.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/index.html","id":"contribution-guide","dir":"","previous_headings":"","what":"Contribution guide","title":"SuperCell For Cytometry Data","text":"Please visit Contributing Guide","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/reference/recomputeSupercells.html","id":null,"dir":"Reference","previous_headings":"","what":"Recompute supercells — recomputeSupercells","title":"Recompute supercells — recomputeSupercells","text":"Given supercell object, recreate supercells using different gamma value. Gamma value controls number supercells generated. smaller value, supercells get, vice versa. function run, need least run runSuperCellCyto function !","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/reference/recomputeSupercells.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Recompute supercells — recomputeSupercells","text":"","code":"recomputeSupercells( dt, sc_objects, markers, sample_colname, cell_id_colname, gam = 20 )"},{"path":"https://phipsonlab.github.io/SuperCellCyto/reference/recomputeSupercells.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Recompute supercells — recomputeSupercells","text":"dt data.table object containing cytometry data rows represent cells columns represent markers. sc_objects supercell_object returned runSuperCellCyto function. markers character vector identifying markers create supercells . sample_colname character string identifying column dt denotes sample cell. cell_id_colname character string identifying column dt representing cell's unique ID. gam numeric value specifying gamma value regulates number supercells generated. Defaults 20.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/reference/recomputeSupercells.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Recompute supercells — recomputeSupercells","text":"list following components: supercell_expression_matrix: data.table object contains marker expression supercell. marker expressions computed calculating mean marker expressions across cells within individual supercell. supercell_cell_map: data.table maps cell corresponding supercell. table essential identifying specific supercell cell allocated . proves particularly useful analyses require one expand supercells individual cell level.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/reference/recomputeSupercells.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Recompute supercells — recomputeSupercells","text":"Givanna Putri","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/reference/recomputeSupercells.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Recompute supercells — recomputeSupercells","text":"","code":"set.seed(42) cyto_dat <- simCytoData(10, rep(1000, 3)) markers <- paste0(\"Marker_\", seq_len(10)) out_gam20 <- runSuperCellCyto( dt = cyto_dat, markers = markers, sample_colname = \"Sample\", cell_id_colname = \"Cell_Id\", gam = 20 ) recomputed_sc <- recomputeSupercells( dt = cyto_dat, sc_objects = out_gam20$supercell_object, markers = markers, sample_colname = \"Sample\", cell_id_colname = \"Cell_Id\", gam = 50 )"},{"path":"https://phipsonlab.github.io/SuperCellCyto/reference/runSuperCellCyto.html","id":null,"dir":"Reference","previous_headings":"","what":"Run SuperCellCyto on Cytometry Data — runSuperCellCyto","title":"Run SuperCellCyto on Cytometry Data — runSuperCellCyto","text":"function creates supercells cytometry data formatted data.table object using SuperCellCyto algorithm. Please make sure read additional details better understand function works.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/reference/runSuperCellCyto.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Run SuperCellCyto on Cytometry Data — runSuperCellCyto","text":"","code":"runSuperCellCyto( dt, markers, sample_colname, cell_id_colname, gam = 20, k_knn = 5, BPPARAM = SerialParam(), load_balancing = FALSE )"},{"path":"https://phipsonlab.github.io/SuperCellCyto/reference/runSuperCellCyto.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Run SuperCellCyto on Cytometry Data — runSuperCellCyto","text":"dt data.table object containing cytometry data rows represent cells columns represent markers. data.frame object, function try convert data.table object. warning message displayed happens. Otherwise, terminate. markers character vector identifying markers create supercells . sample_colname character string identifying column dt denotes sample cell. cell_id_colname character string identifying column dt representing cell's unique ID. gam numeric value specifying gamma value regulates number supercells generated. Defaults 20. k_knn numeric value specifying k value (number neighbours) used build kNN network. Defaults 5. BPPARAM BiocParallelParam object specifying parallel processing settings. Defaults SerialParam, meaning samples processed sequentially one . Refer additional details section parallel processing details. load_balancing logical value indicating whether use custom load balancing scheme processing multiple samples parallel. Defaults FALSE. Refer additional details section parallel processing details.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/reference/runSuperCellCyto.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Run SuperCellCyto on Cytometry Data — runSuperCellCyto","text":"list following components: supercell_object: list containing object returned SCimplify function. One object per sample. object critical recomputing supercells future. Hence discard . supercell_expression_matrix: data.table object contains marker expression supercell. marker expressions computed calculating mean marker expressions across cells within individual supercell. supercell_cell_map: data.table maps cell corresponding supercell. table essential identifying specific supercell cell allocated . proves particularly useful analyses require one expand supercells individual cell level.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/reference/runSuperCellCyto.html","id":"parallel-processing","dir":"Reference","previous_headings":"","what":"Parallel Processing","title":"Run SuperCellCyto on Cytometry Data — runSuperCellCyto","text":"SuperCellCyto can process multiple samples simultaneously parallel. can drastically bring processing time dataset large number samples. enable feature, set BPPARAM parameter either MulticoreParam object SnowParam object. Importantly, also recommended set number tasks (.e., task parameter either MulticoreParam SnowParam object) number samples dataset. Furthermore, also recommend setting load_balancing parameter TRUE. ensures optimal distribution samples across multiple cores, particularly important samples varying sizes (number cells).","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/reference/runSuperCellCyto.html","id":"cell-id-and-sample-definitions","dir":"Reference","previous_headings":"","what":"Cell ID and Sample Definitions","title":"Run SuperCellCyto on Cytometry Data — runSuperCellCyto","text":"cell_id_colname parameter specifies column dt denotes unique identifier cell. perfectly normal column dataset default. good news trivial create one. can create new vector containing sequence numbers 1 however many cells , append vector new column dataset. Refer vignette . sample_colname parameter specifies column dt denotes sample cell came . default, SuperCellCyto creates supercells sample independent samples. ensures supercell contain cells exactly one sample. constitute sample? purposes, sample represents biological sample experiment. may thinking, possible use different context, say creating supercells population cluster rather biological sample? short answer yes, address vignette.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/reference/runSuperCellCyto.html","id":"computing-pca","dir":"Reference","previous_headings":"","what":"Computing PCA","title":"Run SuperCellCyto on Cytometry Data — runSuperCellCyto","text":"function start computing PCA markers specified markers parameter. default, number PCs calculated set 10. less 10 markers markers parameter, number PCs set however many markers markers parameter. Notably, scaling transformation done markers' expressions prior computing PCs. function use irlba calculate PCA. little gain use cytometry data relatively tiny number features (markers) data.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/reference/runSuperCellCyto.html","id":"setting-supercell-s-resolution","dir":"Reference","previous_headings":"","what":"Setting Supercell's Resolution","title":"Run SuperCellCyto on Cytometry Data — runSuperCellCyto","text":"gam parameter influences number supercells created per sample. lower gam value results , thus generally smaller supercells, vice versa. estimate many supercells get dataset, important understand gam value interpreted context number cells sample. gam=n_cells/n_supercells n_cells denotes number cells n_supercells denotes number supercells created. resolving formula , can roughly estimate many supercells get per sample. example, say 2 samples, sample B. Sample 10,000 cells, sample B 5,000 cells: gam set 10, end 1,000 supercells sample 500 supercells sample B, total 1,500 supercells. gam set 50, end 200 supercells sample 100 supercells sample B, total 300 supercells. Importantly, one expect supercells size. capture /less cells others. trivial estimate many cells captured supercell beforehand.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/reference/runSuperCellCyto.html","id":"computing-knn-network","dir":"Reference","previous_headings":"","what":"Computing kNN network","title":"Run SuperCellCyto on Cytometry Data — runSuperCellCyto","text":"create supercells, kNN (k-Nearest Neighbors) network constructed based k_knn parameter dictates number neighbours (cell) used create network. actual (approximate) kNN network created. walktrap algorithm uses network group cells supercells.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/reference/runSuperCellCyto.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Run SuperCellCyto on Cytometry Data — runSuperCellCyto","text":"Givanna Putri","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/reference/runSuperCellCyto.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Run SuperCellCyto on Cytometry Data — runSuperCellCyto","text":"","code":"# Simulate some data set.seed(42) cyto_dat <- simCytoData(nmarkers = 10, ncells = rep(2000,2)) # Setup the columns designating the markers, samples, and cell IDs marker_col <- paste0(\"Marker_\", seq_len(10)) sample_col <- \"Sample\" cell_id_col <- \"Cell_Id\" supercell_dat <- runSuperCellCyto( cyto_dat, marker_col, sample_col, cell_id_col )"},{"path":"https://phipsonlab.github.io/SuperCellCyto/reference/simCytoData.html","id":null,"dir":"Reference","previous_headings":"","what":"Simulate cytometry data — simCytoData","title":"Simulate cytometry data — simCytoData","text":"Simulate cytometry data use testing documenting functions require cytometry data. Please run set.seed running function want ensure reproducibility.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/reference/simCytoData.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Simulate cytometry data — simCytoData","text":"","code":"simCytoData(nmarkers = 10, ncells = rep(10000, 2))"},{"path":"https://phipsonlab.github.io/SuperCellCyto/reference/simCytoData.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Simulate cytometry data — simCytoData","text":"nmarkers numeric value specifying number markers simulate. ncells numeric vector specifying number cells simulate per sample. 1 vector element per sample.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/reference/simCytoData.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Simulate cytometry data — simCytoData","text":"data.table object containing simulated cytometry data rows represent cells columns represent markers.","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/reference/simCytoData.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Simulate cytometry data — simCytoData","text":"Givanna Putri","code":""},{"path":"https://phipsonlab.github.io/SuperCellCyto/reference/simCytoData.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Simulate cytometry data — simCytoData","text":"","code":"set.seed(42) cyto_dat <- simCytoData() head(cyto_dat) #> Marker_1 Marker_2 Marker_3 Marker_4 Marker_5 Marker_6 Marker_7 Marker_8 #> 1: 18.61597 17.43348 9.213419 18.40881 13.68860 12.77402 15.24751 7.140615 #> 2: 20.23361 19.82792 9.740510 18.16383 13.97108 14.25898 16.05032 5.863752 #> 3: 18.62743 17.76816 11.175358 18.59606 16.08534 13.69734 16.71550 4.750240 #> 4: 20.74051 19.94771 9.797939 18.43590 13.92092 12.64266 15.55953 8.173464 #> 5: 18.65938 18.87830 8.916928 17.83295 15.62066 11.37118 16.08417 6.664707 #> 6: 20.02696 20.76054 9.262685 16.89373 15.92339 13.40002 16.13880 6.862717 #> Marker_9 Marker_10 Sample Cell_Id #> 1: 14.37555 14.18484 Sample_1 Cell_1 #> 2: 15.58007 15.56981 Sample_1 Cell_2 #> 3: 14.16156 14.92222 Sample_1 Cell_3 #> 4: 14.26637 15.10761 Sample_1 Cell_4 #> 5: 15.12219 15.64231 Sample_1 Cell_5 #> 6: 15.85313 15.52535 Sample_1 Cell_6 dim(cyto_dat) #> [1] 20000 12"},{"path":"https://phipsonlab.github.io/SuperCellCyto/news/index.html","id":"supercellcyto-010","dir":"Changelog","previous_headings":"","what":"SuperCellCyto 0.1.0","title":"SuperCellCyto 0.1.0","text":"first release SuperCellCyto. also version SuperCellCyto used preprint:","code":"@article{ putri2023supercellcyto, title={SuperCellCyto: enabling efficient analysis of large scale cytometry datasets}, author={Putri, Givanna H and Howitt, George and Marsh-Wakefield, Felix and Ashhurst, Thomas Myles and Phipson, Belinda}, journal={bioRxiv}, pages={2023--08}, year={2023}, publisher={Cold Spring Harbor Laboratory} }"}]