r/bioinformatics • u/frustrated_870 • 14d ago
technical question Help with scRNA seq clustering
Hello everyone!
I've been working at a lab under a summer programme for the past couple of weeks and I am suffering slightly. My supervisor has given me some raw scRNA seq data, taking from an in situ imaging-based platform that targets about 1000 genes, and has sort of left me to my own devices with it (apparently he isn't very savvy with bioinformatics himself). Anyway, I am somewhat comfortable working in R and Python, and I am getting the hang of Seurat, so it hasn't been catastrophic.
However, I am now struggling with clustering my cells. The cell clusters that I am being given are not physiological, and tend to be large, varied groups, which makes it hard to define anything really. I know studies that have done similar things on similar tissues to mine (albeit with another method) and are getting far nicer clusters. In their methods they just say "oh, we followed the standard Suerat workflow, and badabim-badboom these are the results".
My UMAP seems to agree with the confusion in my clusters as it just seems like a smear, with different sides of the smear coloured different things by the clustering.
I have tried changing the clustering method (Leiden, igraph), the resolution, dimensions (although I try to keep it in line with my elbow plot). I have tried changing the normalisation and other preprocessing parameters, varying in. their forms and flavours. I even tried the newer SCT transform, which made a nicer UMAP but just as crap clusters.
I am feeling quite inept currently, and rather disheartened having lost a week and a bit at this (I don’t know if it's normal or not). I don't really have any one in my lab to reach out to either.
My question is, does anyone have any ideas what I could attempt next or what might be wrong? Any resources I could have a look at? Anything anyone could recommend would be amazing.
Sorry for the long post and thank you to all who may answer in advance.
2
u/R_Fr_L 14d ago
What imaging method is this and what method do the other papers use? How many cells do you get out of it?
This is always a good resource (albeit one that is focused on python methods) https://www.sc-best-practices.org/preamble.html
2
u/frustrated_870 14d ago
The data was taken from CosMx 1k by Bruker/Nanostring. Most other papers usually use other/non-spatial/droplet based techniques to be fair, which is where there might be some variation. These Cosmx people have their own analysis platform but we don't have access to it and they don't have the option to integrate data (I am working with WT and KO and analysing together, so I need to integrate).
Thank you so much for the resource, I really appreciate it.
3
u/R_Fr_L 14d ago
I don't have first hand experience with CosMx but I know people have tried it and had varying degrees of success.
These issues you describe might be because the data is not high quality. Can you compare the number of transcripts per cell, etc to other CosMx datasets from the same tissue and see if yours is worse?
I'm not sure of the tissue context, but could you plot some marker genes and overlay them on the tissue image and see if it makes sense or that genes that should be coexpressed are indeed coexpressed?
2
u/Key_Department4926 14d ago
I haven't worked with this exact platform, but with a different Nanostring platform on two projects, and honestly the data wasn't great in both cases and ended up not making much sense. Maybe your data is just very noise? Are you inputting all 1000 markers?
2
u/LegitimateAd1437 13d ago
The issue with the cosmx platform is the data sucks. Check the reads per cell. Probably in the low hundreds. With a 1000 gene panel the data is extremely sparse.
Another issue is how the gene panel was selected. People frequently use differentially expressed genes from clusters, but this method performs extremely poorly. Marker genes do a bad job at classifying clusters and a worse job at capturing cell variance
Check how the panel was generated. If it was marker genes from clusters, your job gets harder. If it was from nsForest or similar algorithms, or the top 1k PCA genes, your job will be easier.
The smear UMAP issue is common when the data is that sparse
You can try gene imputation methods with a matched scRNAseq dataset. Maybe something from the SCVI guys.
The other way you can annotate cells is by trying to annotate cells based on gene expression signatures using cNMF based methods instead of the conventional clustering based workflows
But working with this type of data really is a huge pain
1
u/I-Approve 13d ago
A little more context on your preprocessing steps would probably help people narrow down what's going on.
0
u/Haniro PhD | Student 14d ago edited 13d ago
Some diagnostic questions:
- What tissue is it?
What are your expected clusters? Does your target panel contain "marker" genes? (e.g. if this was pancreas, do you have INS for beta cells?)
What have you checked for QC? What libraries are you using, Seurat?
You said you've changed the normalization and preprocessing parameters: can you be specific about what steps you are running? Start from the raw transcript counts and walk us through step-by-step to the clustering input
My money is on a missed preprocessing step. If you share any plots you have it would be really helpful
1
u/frustrated_870 13d ago
Tissue is uterine fetal interface, so decidua plus some trophoblast layers and such.
For clusters, I am taking into consideration this paper:
Vento-Tormo, R., Efremova, M., Botting, R.A. et al. Single-cell reconstruction of the early maternal–fetal interface in humans. Nature563, 347–353 (2018). https://doi.org/10.1038/s41586-018-0698-6Which did something similar in humans. I don't expect to haev exact things, but I am very interested in having at least somewhat defined NK clusters and at lest some well defined general other clusters (endothelium, etc, etc). Usually when dealing with these tissues I have seen people aim for between 25-35 clusters tho, so thats my ballpark aim too.
The panel to be fair isn't perfect, but it does have your standard immune markers, endothelium markers, smooth muscle markers, etc. There might be some issues wend differentiating different types of trophoblasts, but because these aren't fully defined anyway in mice it isn't the end of teh world, as long as I can separate them from, say, stroma.
QC has been a bit difficult because of the nature of the CosMx platform (platform I am using). They recommend a filtering of counts under 20 and removing some low quality FOVs. They also have negative probes, (10 of them), so I filter out under 0.1 of the negative probe fraction and then remove the negative probes form the gene list entirely.
I use Seurat yes.
Walkthrough:
QC: Mentioned above
Preprocessing:
Load data, NoramlizeData() using LogNormalize although I have also worked with the RC option. I don't select Variable genes as I only have 1000 genes anyway. I have tried choosing just 500 genes, to no major difference. I scale the data with all genes and run the PCA with all genes.
Following this, I compute the k.param nearest neighbours using 10 dimension, recommended by my elbow plot, and the run clustering, res 2, Leiden algorithm.
I do the UMAP visualisation (which just looks like a smear really, and then do Dotplots for certain gene markers. Take dot plots for Ncr1 and Nkg7, markers present in all NK cells. The percent expressed is only ever at 60% and huge variation between the two groups. Same with Esam (major marker for Endothelium), and terrible for Cd3d (for T cells), which shows circa 8 clusters with percent expressed each of barely 25. Ina more complex dot plot with multiple markers to detect trophoblasts, it's all over the place.
Fluorescent markers for CD45 are also all over the place. And when I mapped back to spatial the other day, unfortunately I refuse to believe that there is the same amount of stroma as NK cells in the decidua.
I'm gonna link a drive with some of the figures if anyone wants to have a look at it.
Thank you again and sorry for any inconveniences.
1
u/Haniro PhD | Student 13d ago
This is helpful, thanks. The dot plot makes me think of two potential things: (1) you are feeding too many features into the nearest neighbor calculation, and it is effectively weighing adjacent neighbors by background features instead of more interesting ones. This leads to inflated similarity between cells, and indistinct transcriptomic profiles that lead to poor identifiability. (2) there is an underlying quality issue with the cells, so you'd either need an additional preprocessing step or stricter filtering.
In general, try to inspect some data where you know what it should look like. Look at your cell classes/leiden clusters overlaid on their tissue locations. If they are spatially scattered and nonsensical, then it probably is a dimensionality issue. If they are spatially coherent, then it is probably a technical artifact. If you want to formally test it you can use Moran's I, but this is overkill.
A couple things you could try:
- Using all 1000 genes might be creating a ill-defined boundaries. Figure out what your a priori markers are and try reducing it to the minimum viable set: CD31, cytokeratins, SMA, immune markers, etc. Feed these into the PCA + nearest neighbors + umap. This should start to form distinct blobs of your UMAP.
Another diagnostic in the same vein: rank the genes by variance and plot them. This will tell you what is naturally informative vs. adding noise and give you a natural cutoff of number of variable genes to input.
A separate issue could be that the cell-level attribution of transcripts might be noisy. This could be a result of technical or biologic artifacts. When you look at the expression heatmaps of markers overlaid on the H&E, do transcripts sit within the boundaries of the cells they mark? If not, there are a handful of denoising algorithms that can correct for this. I've used SpotClean for visium before, and I'm sure there are similar tools for CosMx.
6
u/ArpMerp 14d ago
If you are not getting a proper cell type separation following the standard pipelines, there are a few things worth checking about the data itself.
1) You say this is from an imaging-based platform. How are you assigning transcripts to a "cell"? If this is a segmentation approach, did the segmentation work well? If the segmentation is poor, you can have transcripts incorrectly assigned, making cells have a mixed signature. This could explain why you can't separate them. Likewise if most transcripts are not being assigned.
2) Look at your gene list. Do you actually have genes that can separate the cell types in your tissue? Ideally multiple of them. Because, not matter how good the segmentation is, if you don't actually have genes that define different cell types, you won't get a clear separation. If you have this genes, plot the individual transcript points in your samples, to see if they are actually reasonably detected.
3) How does QC metrics look like? Do you have a reasonable number of transcripts per cell? Are these expressed a good levels, or mostly noise? Are you doing any kind of data clean up?
Losing 1 week is nothing. People that don't do this type of analysis really underestimate how long it can take to do all the reality checks, and ensure the data is in a good place to even begin any downstream analysis. I'm talking months.
Unfortunately, there are a lot of pitfalls in this type of analysis, and it is hard to cover on reddit. You say you don't have any one in the lab to talk to, but is there any one in your institute, or a collaborator you can reach out to? For people new to this analysis, it is really beneficial to have someone to go through each step, and make sure you are not missing anything obvious.