MarioniLab / scran

Clone of the Bioconductor repository for the scran package.
https://bioconductor.org/packages/devel/bioc/html/scran.html
40 stars 22 forks source link

Convenience function for marker selection - unique global markers #39

Closed robertamezquita closed 5 years ago

robertamezquita commented 5 years ago

Some sort of function to do above could be implemented that looks at pairwise lfc's to pick the top "globally unique" markers, to get nice heatmaps in less tries.

Something like this is what I currently do:

## after running findMarkers ...

## Select unique-ish markers
top_markers <- lapply(markers, function(x, lfc_threshold, leniency) {
    ## lfc_threshold = min lfc per cluster
    ## leniency = number of clusters allowed to not meet lfc_threshold
    cols <- grepl('logFC', colnames(x))
    mat <- apply(x[, cols], 2, function(f) { f > 1.25 })
    rowsums <- apply(mat, 1, sum)
    filt <- rowsums > sum(cols) - 3
    rownames(x)[filt]
})

top_markers <- sort(unique(unlist(top_markers)))
top_markers <- top_markers[!grepl('MT-|^RP', top_markers)]
robertamezquita commented 5 years ago

Happy to contribute something towards this if it fits within scran, just submitting to see if it would be within scope or if this might be better left to the user.

LTLA commented 5 years ago

There's pval.type="all" and lfc= options, don't they work for you?

robertamezquita commented 5 years ago

Ah, hadn't noticed that option - needed to look at combineMarkers docs for the "all" option and the explanation of IUT. Thanks!