This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Find the most frequently appeared genes in a list of pathways and genes

Hello everyone

I have a list of pathways and genes involved in those pathways as follow (the real list is much longer):

enter image description here

I want to see which genes appear most frequently in these pathways. Do you know how to do that in R or recommend any tools?

Thank you very much

pathway most frequent dominant gene

Paste your data as text, please.

2 answers

You can use R packages tidyr and dplyr for this.

# First import into R
table.file <- read.table("your.file.txt", header = T, sep = "\t", stringsAsFactors = F)

library(tidyr)

# Get your genes in separate rows
table.genes.sep <- separate_rows(table.file, Submitted.entities.found, sep = ";")

library(dplyr)

# use dplyr to count genes and sort
table.genes.count <- table.genes.sep %>% count(Submitted.entities.found, sort = TRUE)

Something like this, which will display most frequent 10 gene names:

head(names(table(unlist(strsplit(table.file$Submitted.entities.found, sep = ";")))), n = 10)

Log in to answer this question.