scDHA | R Documentation |

The main function to perform dimension deduction and clustering.

```
scDHA(
data = data,
k = NULL,
method = "scDHA",
sparse = FALSE,
n = 5000,
ncores = 10L,
gen_fil = TRUE,
do.clus = TRUE,
sample.prob = NULL,
seed = NULL
)
```

`data` |
Gene expression matrix, with rows represent samples and columns represent genes. |

`k` |
Number of clusters, leave as default for auto detection. Has no effect when |

`method` |
Method used for clustering. It can be "scDHA" or "louvain". The default setting is "scDHA". |

`sparse` |
Boolen variable indicating whether data is a sparse matrix. The input must be a non negative sparse matrix. |

`n` |
Number of genes to keep after feature selection step. |

`ncores` |
Number of processor cores to use. |

`gen_fil` |
Boolean variable indicating whether to perform scDHA gene filtering before performing dimension deduction and clustering. |

`do.clus` |
Boolean variable indicating whether to perform scDHA clustering. If |

`sample.prob` |
Probability used for classification application only. Leave this parameter as default, no user input is required. |

`seed` |
Seed for reproducibility. |

List with the following keys:

cluster - A numeric vector containing cluster assignment for each sample. If

`do.clus = False`

, this values is always`NULL`

.latent - A matrix representing compressed data from the input data, with rows represent samples and columns represent latent variables.

```
library(scDHA)
#Load example data (Goolam dataset)
data('Goolam'); data <- t(Goolam$data); label <- as.character(Goolam$label)
#Log transform the data
data <- log2(data + 1)
if(torch::torch_is_installed()) #scDHA need libtorch installed
{
#Generate clustering result, the input matrix has rows as samples and columns as genes
result <- scDHA(data, ncores = 2, seed = 1)
#The clustering result can be found here
cluster <- result$cluster
}
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.