testClustering-scRNAseq: testClustering

testClustering,scRNAseq-methodR Documentation

testClustering

Description

This function generates a single clustering iteration of CONCLUS to check whether the chosen parameters of tSNE and dbscan are suitable for your data.

Usage

testClustering(theObject, dbscanEpsilon=1.4, minPts=5,
                perplexities=30, PCs=4, randomSeed=42, width=7, height=7,
                cores=2, writeOutput=FALSE, fileTSNE="test_tSNE.pdf",
                fileDist="distance_graph.pdf",
                fileClust="test_clustering.pdf", silent=FALSE, plotKNN=TRUE,
                ...)

Arguments

theObject

An Object of class scRNASeq for which the count matrix was normalized. See ?normaliseCountMatrix.

dbscanEpsilon

Single value for the distance parameter of dbscan. Default = 1.4. See ?runDBSCAN for more details.

minPts

Single value for the minimum no. of points parameter of dbscan. Default = 5. See ?runDBSCAN for more details.

perplexities

A single value of perplexity (t-SNE parameter). Default = 30. See ?generateTSNECoordinates for details.

PCs

Single value of first principal components. Default=4. See ?generateTSNECoordinates for details.

randomSeed

Default is 42. Seeds used to generate the tSNE.

width

Width of the pdf file. Default=7. See ?pdf for details.

height

Height of the pdf file. Default=7. See ?pdf for details.

cores

Maximum number of jobs that CONCLUS can run in parallel. Default is 1.

writeOutput

If TRUE, write the results of the test to the output directory defined in theObject in the sub-directory 'test_clustering'. Default = FALSE.

fileTSNE

Name of the pdf file for tSNE. Default="test_tSNE.pdf".

fileDist

Name of the pdf file for NN distance. Default="distance_graph.pdf"

fileClust

Name of the pdf file for dbscan. Default="test_clustering.pdf"

silent

If TRUE, do not plot graphics. Default=FALSE.

plotKNN

If TRUE, output the kNN plot on graphics. Default=TRUE.

...

Options for generating the pdf files. See ?pdf for a list.

Details

The TestClustering function runs one clustering round out of the 84 (default) rounds that CONCLUS normally performs. This step can be useful to determine if the default DBSCAN parameters are suitable for your dataset. By default, they are dbscanEpsilon = c(1.3, 1.4, 1.5) and minPts = c(3,4). If the dashed horizontal line in the k-NN distance plot lays on the "knee" of the curve, it means that optimal epsilon is equal to the intersection of the line to the y-axis. In our example, optimal epsilon is 1.4 for 5-NN distance where 5 corresponds to MinPts.

In the "test_clustering" folder under outputDirectory, the three plots will be saved where one corresponds to the "distance_graph.pdf", another one to "test_tSNE.pdf", and the last one will be saved as "test_clustering.pdf".

Value

A ggplot object of the tSNE and the dbscan clustering.

Author(s)

Ilyess RACHEDI, based on code by Konstantin CHUKREV and Nicolas DESCOSTES.

See Also

normaliseCountMatrix runDBSCAN pdf

Examples

## Object containing the results of previous steps
load(system.file("extdata/scrFull.Rdat", package="conclus"))

## Test the clustering writing pdfs to test_clustering folder
## These parameters are tweaked to fit our example data and reduce
## computing time, please consider using the default parameters or
## adjusted to your dataset.
testClustering(scr, dbscanEpsilon=380, minPts=2, perplexities=2, PCs=4,
                silent=TRUE, writeOutput=TRUE)

## Removing the written results
unlink("YourOutputDirectory/", recursive = TRUE)


ilyessr/conclus documentation built on April 8, 2022, 1:43 p.m.