Sum of rows for GSEA analysis
0
0
Entering edit mode
2.6 years ago

Hi,

I have an issue which looks like easy to solve, but I'm stuck. I have a dataframe composed of columns (significant pathways retrieved from GSEA) and rows (entrez gene ids). In this data frame there are 1 if a gene is present in a pathway or 0 when not. This is my data frame:

                      Path_A      Path_B       Path_C
Gene_1                   0           1            0
Gene_2                   1           1            0
Gene_3                   0           0            1
Gene_4                   1           1            1

I want to sum the rows (genes) to calculate how many times a gene is present in distinct pathways, and thus get something like this:

                      Path_A      Path_B       Path_C
Gene_1                   0           1            0
Gene_2                   2           2            0
Gene_3                   0           0            1
Gene_4                   3           3            3

I have figured out that uising rowsum() might solve my issue. However, when checking R documentation for the function I had some troubles and I couldn't retrieve my desired output.

Is there any way to perform this sum?

Thanks in advance!

GSEA leading-edge R fGSEA • 948 views
ADD COMMENT
1
Entering edit mode
ADD REPLY
0
Entering edit mode

Thanks for your response. I've checked the rowSums() function combined with dplyr to solve my issue.

ADD REPLY
0
Entering edit mode

Did that work?

ADD REPLY
0
Entering edit mode

I'm still working on it

ADD REPLY

Login before adding your answer.

Traffic: 1850 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6