# Visualizing top expressed genes

I have a spreadsheet of CPM values

I want to visualize the top 20 genes expressed across my samples

This is how my data look like

> head(b[1:5,1:5])
30566-001 - CPM 30566-002 - CPM 30566-003 - CPM 30566-004 - CPM 30566-005 - CPM
hsa-miR-548ap-3p               0               0               0               0               0
hsa-miR-548t-3p                0               0               0               0               0
hsa-miR-548e-3p                0               0               0               0               0
hsa-miR-548az-3p               0               0               0               0               0
hsa-miR-548f-3p                0               0               0               0               0
> dim(b)
[1] 2632   42
>


How I can do that?

• Just make a heatmap? Nov 25 '21 at 15:03
• Then from a data frame with 2632 genes, how I select a list of genes for heatmap? Because a heatmap with 2632 genes is not clear while my main purpose is to shows a list of highly expressed genes across my samples Nov 25 '21 at 15:07
• select the N genes with the highest average expression across all samples? Nov 25 '21 at 15:14

Gene selection is entirely on you and on the question you ask. Most expressed genes would be selected by rowMeans or rowMedians or even rowSums but this is not very informative as digital expression levels (=counts) is influenced by many technical factors and there is (to my knowledge) no direct link to biological relevance.
Alternatively, you can select by genes that vary a lot between experimental groups. Naively that could be the rowwise variance (rowVars) or standard deviation of the logCPMs (use logscale, otherwise variance is a function of the expression level) or the output of a differential analysis. Ideally plug the raw counts into DESeq2 or similar frameworks. If you only have CPMs then you probably want to feed the logCPMs into limma-trend pipeline, see for a discussion on ways to get going with normalized counts for differential expression in this Bioconductor thread.