Hello, My name is Ruba I am a PhD student and I am analyzing Bulk RNAseq data for my project. I wanted to use the heatplot to visualize KEGG enrichment analysis and see the connection between genes and related pathways, at first the plot showed all the genes overlapping so I couldn't differentiate any of it similar to the problem listed here How can I limit the number of displayed genes in heatplot I tried the proposed solution but I don't want the genes to be chosen randomly, what I wanted to do is to selcet 10 from each pathway which is most upregulated/downregulated like
top_n(10,wt = -abs(logFC))
I tried to integrate something using the stringr package and building on the code that choose randomly 5 samples and make it chosse the top 10 genes according to the highest absolute value of logFC but I didn't get anywhere, could anybody help with that?
#the code that choose 5 random genes
> random.core.genes <- sapply(
lapply(
str_split(as.data.frame(readable_gene_names)[ ,"core_enrichment"] , "/") ,
sample, size=5), ## 5=number of random genes to select
paste, collapse="/")
looking forward to hearing from you!
Best,
Ruba