# Hierarchical clustering for outlier detection - single cell RNASeq & WGCNA

I wish to conduct WGCNA on a single cell RNASeq dataset and, when choosing the optimal beta parameter after running pickSoftThreshold am presented with a rather strange plot:

I have normalized the data using NormalizeData in Seurat using the LogNormalize method.

One of my colleagues suggested using hclust as a method for outlier detection to see potential cells/samples that could be excluded. I think this makes sense however I haven't found much information on such procedures besides the following paper: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5845381/.

My question would be, is this procedure just be as simple as running a hierarchical clustering on the data and seeing which samples cluster by themselves (and then removing those based on a minimum cluster size criteria) or is their more to it? Also, for those familiar with WGCNA, why does the scale-free topolgy plot generate such strange looking values, is this indicative of outliers being present in the data?

For outlier identification I suggest using the sample network approach developed by Oldham et al. It basically amounts to constructing a inter-sample connectivity (assuming normalizedData contains the log-normalized data with genes in colunms and samples in rows)

k = colSums(cor(t(normalizedData))),

scaling the connectivities

Z.k = scale(k)

and then removing samples with high negative Z.k (e.g. Z.k < -4).

A slightly different approach is based on euclidean distances rather than correlations,

Z.k = scale(as.matrix(dist(normalizedData)))

and removing samples with high positive Z.k (since distance is a measure of dissimilarity).

Regarding the scale-free topology fit plot, I wouldn't worry about it too much, the fit index sometimes jumps around a bit. It certainly does not look like you have strong outliers or very heterogeneous data. But it is always a good idea to plot the sample clustering tree to check (1) that there are no strong clusters, and (2) that the outlier identification did something reasonable.

• Thanks for your response ! I will check out the paper, looks interesting. Jul 23 '19 at 15:29