Function to convert a matrix within a Giotto object into a
format that can be used with runDWLSDeconv
for deconvolution.
A vector of cell types for parameter cell_type_vector
can be created
from the cell metadata (pDataDT
).
makeSignMatrixDWLS(
gobject,
spat_unit = NULL,
feat_type = NULL,
expression_values = c("normalized", "scaled", "custom"),
reverse_log = TRUE,
log_base = 2,
sign_gene,
cell_type_vector,
cell_type = NULL
)
Giotto object of single cell
spatial unit
feature type to use
expression values to use
reverse a log-normalized expression matrix
the logarithm base (default = 2)
all of DE genes (signature)
vector with cell types (length = ncol(matrix))
deprecated, use cell_type_vector
matrix
g <- GiottoData::loadGiottoMini("visium")
#> 1. read Giotto object
#> 2. read Giotto feature information
#> 3. read Giotto spatial information
#> 3.1 read Giotto spatial shape information
#> 3.2 read Giotto spatial centroid information
#> 3.3 read Giotto spatial overlap information
#> 4. read Giotto image information
#> python already initialized in this session
#> active environment : '/usr/bin/python3'
#> python version : 3.10
#> checking default envname 'giotto_env'
#> a system default python environment was found
#> Using python path:
#> "/usr/bin/python3"
sign_gene <- c(
"Bcl11b", "Lmo1", "F3", "Cnih3", "Ppp1r3c", "Rims2", "Gfap",
"Gjc3", "Chrna4", "Prkcd", "Prr18", "Grb14", "Tprn", "Clic1", "Olig2",
"Hrh3", "Tmbim1", "Carhsp1", "Tmem88b", "Ugt8a", "Arpp19", "Lamp5",
"Galnt6", "Hlf", "Hs3st2", "Tbr1", "Myl4", "Cygb", "Ttc9b", "Ipcef1"
)
makeSignMatrixDWLS(
gobject = g, sign_gene = sign_gene,
cell_type_vector = pDataDT(g)[["leiden_clus"]]
)
#> 2 5 1 3 6 7 4
#> Hlf 15.612139 15.639836 17.289286 18.085075 15.590006 13.0911268 16.1614840
#> Tmbim1 8.238466 7.297166 6.295740 6.598698 5.778630 4.2988518 6.1472273
#> Clic1 2.555001 1.699371 1.608139 2.355958 1.532120 1.7371642 1.2714976
#> Arpp19 34.226990 34.751065 39.918072 26.214104 29.486079 21.8031661 35.8142335
#> Ttc9b 37.988382 39.757988 43.483655 35.357501 39.197628 30.7511418 40.3445195
#> Carhsp1 9.037082 7.562448 7.148536 8.693395 7.701865 6.5048646 5.6097201
#> Cygb 5.033126 5.970012 4.881844 6.481376 4.536956 5.1795806 9.9685711
#> Gfap 19.359064 22.497971 18.515361 17.468031 20.023940 18.2270851 14.3347857
#> Prkcd 29.132857 25.888866 28.667508 35.812287 26.944743 22.9811272 24.4304872
#> Cnih3 4.391298 7.081227 6.769247 5.724159 2.501816 7.1957853 6.9410098
#> Grb14 18.561536 15.944916 13.237951 15.434521 14.330902 14.7991346 11.5074834
#> Lamp5 8.039409 8.360183 10.982578 5.394880 4.112144 7.8228692 9.1375601
#> Chrna4 5.863853 6.754572 7.197508 6.218107 6.287905 4.7264213 6.5607985
#> F3 3.664557 4.491230 4.394594 4.409756 5.641713 0.0000000 5.1901999
#> Ugt8a 12.761762 11.392545 10.760604 10.665797 11.788462 3.1177049 8.5396165
#> Tbr1 10.119032 9.479038 11.944705 8.603522 6.859176 5.5427087 9.6442050
#> Lmo1 5.920985 8.538887 7.550751 8.817733 5.745929 16.2616205 10.2925223
#> Galnt6 1.930852 2.186347 1.424085 1.521922 2.742209 0.8462623 0.6724375
#> Rims2 8.524852 8.923649 8.502274 8.267409 4.855526 5.6659708 8.7311138
#> Hrh3 8.945496 6.412411 8.662706 8.705689 4.682818 5.1288043 7.1990442
#> Olig2 4.859662 4.138353 3.747277 3.310557 4.429896 8.5977174 2.9351523
#> Hs3st2 4.115165 3.752086 4.417017 3.922424 2.997097 1.3225788 3.3773065
#> Bcl11b 8.588378 13.631705 10.417711 9.368310 11.161096 15.7205218 9.4341857
#> Tprn 5.163912 3.637867 3.678293 4.552003 4.276440 3.0696147 2.7105584
#> Prr18 10.810102 9.064444 8.191267 7.427373 10.876162 4.7834087 8.4026438
#> Gjc3 7.444795 8.172781 7.022191 6.823548 7.526957 2.3928261 6.7058993
#> Myl4 4.875748 6.543057 8.925158 3.968603 5.552218 1.8164845 4.8371193
#> Ipcef1 6.638709 5.388968 8.147932 4.878385 6.033192 6.7458541 5.5517694
#> Ppp1r3c 3.850227 3.369046 3.764599 3.371323 2.506437 0.5347594 3.9979613
#> Tmem88b 14.354927 10.894625 12.007654 12.527327 11.732343 6.3072160 9.9666388