<p>You rank the fit coefficient rather than the original score matrix. So, given a score matrix, <code>D</code>:</p>

<pre class="lang-r prettyprint-override"><code>D = matrix(c(22,20,9,8,46,22,18,10,3,18,3,29,2,1,5,45,43,47,17,5,14,44,21,36), byrow=T, ncol=6)
cl = c(0,0,0,1,1,1)
s = apply(m, 1, function(x) coef(lm(x~cl))[2]) # [1]
o = rank(s)
o = max(o) - o + 1 # [2]
</code></pre>

<p><code>o</code> is then the rank of each row.</p>

<p>[1] This fits each row as a linear model of <code>cl</code> and extracts the <code>cl</code> coefficient.</p>

<p>[2] This converts the ranking to be the same as shown in the figure. I don't know if this is important, but I would assume so given how GSEA methods tend to work.</p>

CC BY-SA 3.0
2017-08-07T13:32:50.400Z
Thank you for your excellent answer. I just accepted it. Could I pass a R language nine(9) valued phenotype label vector to where you specify cl =  c(0,0,0,1,1,1) or does cl have to be a binary phenotype label? The reason I ask this question is that we have 8 human leukemia groups and 1 healthy normal control group.
Frank
CC BY-SA 3.0
2017-08-07T13:34:26.960Z
The method itself is only designed for two-group comparisons, so if you have more phenotypes you'll either have to do one comparison at a time or come up with a different method (I'm not sure what at multi-factor GSEA output would even mean in such cases).
Devon Ryan
CC BY-SA 3.0
2017-08-07T13:59:04.617Z
Thank you for your reply to my comment. In the original Bioinformatics Stack Exchange question above , I have added some fgseaL source code which calculates the correlation matrix  between the Expression Data Matrix D and the R language variable , labels , which is a vector of gene phenotype labels. Could I ask you to explain the purpose of this fgseaL source code extract?
Frank
CC BY-SA 3.0
2017-08-07T14:03:16.470Z
@Frank Please post that as a new question, though please read the preprint linked to from github first, since I assume that goes over the method.
Devon Ryan
CC BY-SA 3.0
2017-08-07T14:52:11.377Z
I will post the new question later today. Also, I will try out your rank the linear regression fit coefficient method on our data and report the results back to you later today. Thanks.
Frank
CC BY-SA 3.0
2017-08-07T23:43:23.740Z
I tested your rank the linear regression fit coefficient R language algorithm on our data with fgseaL and encountered the diagnostic message Empty data.table (0 rows) of 8 cols: pathway,pval,padj,ES,NES,nMoreExtreme. Could I ask what I did wrong? My R language code is shown at the bottom of my original question. Nonetheless , you are correct about doing two-group comparisons one at a time as I demonstrate at the bottom of my original question.
Frank
CC BY-SA 3.0
2017-08-08T06:41:22.160Z
That's not my algorithm, it's just how to do that step from the paper. You'll get an empty output from the R code you posted whenever everything is filtered out. Whether that makes sense or not is a completely different question.
Devon Ryan
CC BY-SA 3.0
2017-08-08T07:22:09.550Z
Thank you for your comment. What is the name of the paper and page which describes that step?
Frank
CC BY-SA 3.0
2017-08-08T07:23:40.677Z
@Frank It's literally the image in your post and the paper you linked to.
Devon Ryan
CC BY-SA 3.0
2017-08-08T09:03:20.183Z
I don't see any mention of linear regression coefficient  in the paper I linked to. Where did you get that idea? Also, fgseaL expects the mat input to be an matrix of doubles with the raw key value to be sorted while R language rank outputs a vector of integer rank scores. Thank you.
Frank
CC BY-SA 3.0
2017-08-08T09:05:17.577Z
The "inter-class deviation" == "difference between groups" == "coefficient from a linear model". You're mixing and matching methods, you'll have to figure out how to get one to work with the other.
Devon Ryan
CC BY-SA 3.0
2017-08-08T10:53:31.537Z
Is it permissible to perform the two phenotype group comparison using fgseaL without scaling on the input mat or D systematically one group at a time between each of the 8 diseased groups and the normal healthy group rather than using the linear regression coefficient R language source code as illustrated in the original question? Thank you.
Frank
CC BY-SA 3.0
2017-08-08T10:54:04.913Z
@Frank Please post things like that as their own question.
Devon Ryan
CC BY-SA 3.0
2017-08-08T14:52:39.550Z
Why is the fgseaL pval equal to the padj of  0.003940887 when I do the two group comparison between the normal control group and the ALL3m human leukemia disease group of subjects? Thank you.
Frank
CC BY-SA 3.0
2017-08-08T15:03:46.650Z
When I do res<-fgsea(df,correcttest,nperm = 1000,minSize = 1, maxSize=50000) without the phenotype label feature why do I get the error in `[.data.frame`(x, order(x, na.last = na.last, decreasing = decreasing)) , undefined columns selected? Thank you.
Frank
CC BY-SA 3.0
2017-08-08T18:21:18.043Z
Let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/63510/discussion-between-devon-ryan-and-frank).
Devon Ryan
CC BY-SA 3.0
2017-08-13T21:46:20.433Z
Could you please comment on my answer which I just wrote below? Thank you for your help.
Frank
CC BY-SA 3.0
2017-08-07T12:14:39.873Z
2017-08-07T12:14:39.873Z
Devon Ryan
<p>I finally found another answer to my question. Please read this great article in May 12 2017 BioMed Central (BMC) Bioinformatics article titled <a href="https://bmcbioinformatics.biomedcentral.com/articles/10.1186/s12859-017-1674-0" rel="nofollow noreferrer">Ranking metrics in gene set enrichment analysis: do they matter?</a>.</p>

<p>Also, please read this blog , <a href="http://crazyhottommy.blogspot.com/2016/08/gene-set-enrichment-analysis-gsea.html" rel="nofollow noreferrer">Diving into Genetics and Genomics: Gene Set Enrichment Analysis (GSEA) explained</a>.</p>

<p>After reading these two articles, my choice for the best rapidGSEA local ranking measure is Minimum Significant Difference (i.e., MSD), because it has the best overall false positive rate (i.e., FPR) for larger sample sizes.</p>

<p>Finally, it is important to realize that fgseaL's phenotype labeling can hypothetically be emulated by GSEA with either one of it's sixteen possible ranking metrics or a custom ranking metric.</p>

CC BY-SA 3.0
2017-08-22T14:49:00.440Z
2017-08-23T16:16:10.837Z
2017-08-23T16:16:10.837Z
Frank
<p>This weekend, I  installed the R language packages rapidGSEA and the Broad Institute GSEA , the Nvidia CUDA Toolkit 6.5-- Custom installation option  and MINGW makefiles on my son's Windows 8.1 notebook computer. 
  This step was very tricky to accomplish because I had to maneuver around the "NVIDIA Installer cannot continue. The NVIDIA graphics driver is not compatible with this version of Windows" installation error message which prevents the NVIDIA compilers from being installed correctly.
  My objective is to run rapidGSEA without the CUDA enhancements since I am not using a computer with a NVIDIA GPU.
  I did this step because rapidGSEA and Broad Institute GSEA have a significantly richer set of gene set enrichment analytics than fgseaL as shown below:</p>

<p>The GSEA method takes five default arguments and three optional arguments
GSEA &lt;- function(exprsData, labelList, geneSets, numPermutations, metricString,
                 dumpFileName="", checkInput=TRUE, doublePrecision=FALSE) {...}</p>

<p>exprsData, labelList and geneSets refer to the data obtained in the previous section. numPermutations denotes the number of permutations in the resampling test, metricString denotes the local ranking measure (one of the following):</p>

<pre><code>naive_diff_of_classes
naive_ratio_of_classes
naive_log2_ratio_of_classes
stable_diff_of_classes
stable_ratio_of_classes
stable_log2_ratio_of_classes
onepass_signal2noise
onepass_t_test
twopass_signal2noise
twopass_t_test
stable_signal2noise
stable_t_test
overkill_signal2noise
overkill_t_test
</code></pre>

CC BY-SA 3.0
2017-08-14T06:47:53.083Z
Glad you got it working. Not sure what else I'm supposed to comment on here.
Devon Ryan
CC BY-SA 3.0
2017-08-14T17:11:53.317Z
@Devon Ryan, If metricString denotes the local ranking measure we are requesting that rapidGSEA use when it is invoked, which metricString value should I choose so that rapidGSEA operates in a manner most closely resembling fgseaL? Thank you.
Frank
CC BY-SA 3.0
2017-08-15T07:11:26.800Z
Don't try to make one work like the other. If you start making your own method then you have to get it through peer review. It doesn't appear you have the background necessary to do that. Use rapidGSEA or fgseaL, stop trying to merge them.
Devon Ryan
CC BY-SA 3.0
2017-08-13T21:44:02.207Z
2017-08-13T21:52:33.080Z
2017-08-13T21:52:33.080Z
Frank
<p>I wish to adapt the r language function fgseaL, <a href="https://github.com/ctlab/fgsea" rel="noreferrer">https://github.com/ctlab/fgsea</a> , to perform rapidGSEA, <a href="https://bmcbioinformatics.biomedcentral.com/articles/10.1186/s12859-016-1244-x" rel="noreferrer">https://bmcbioinformatics.biomedcentral.com/articles/10.1186/s12859-016-1244-x</a> , computation of inter-class  deviation per gene and the subsequent gene rank sorting operation on 9 different phenotype labels as illustrated in the diagram immediately below:</p>

<p><a href="https://i.sstatic.net/kXvmr.gif" rel="noreferrer"><img src="https://i.sstatic.net/kXvmr.gif" alt="enter image description here"></a></p>

<p>I thought of applying the R-language rank() function on the Expression Data Matrix D. If that is not correct, what sequence of R language commands should we
apply to the Expression Data Matrix D to calculate a key value sorted deviation measure  across 8 labeled human leukemia groups and a healthy labeled normal control group prior to running fgseaL? </p>

<p>I show below how fgseaL finds the correlation matrix between the R language variable , mat, which corresponds to the Expression Data Matrix D and the R language variable , labels , which is a vector of gene phenotype labels</p>

<pre><code>    tmatSc &lt;- scale(t(mat))
    labelsSc &lt;- scale(labels)[, 1]

    minSize &lt;- max(minSize, 1)

    pathwaysFiltered &lt;- lapply(pathways, function(p) { as.vector(na.omit(fmatch(p, rownames(mat)))) })
    pathwaysSizes &lt;- sapply(pathwaysFiltered, length)

    toKeep &lt;- which(minSize &lt;= pathwaysSizes &amp; pathwaysSizes &lt;= maxSize)
    m &lt;- length(toKeep)

    if (m == 0) {
        return(data.table(pathway=character(),
                          pval=numeric(),
                          padj=numeric(),
                          ES=numeric(),
                          NES=numeric(),
                          nMoreExtreme=numeric(),
                          size=integer(),
                          leadingEdge=list()))
    }

    pathwaysFiltered &lt;- pathwaysFiltered[toKeep]
    pathwaysSizes &lt;- pathwaysSizes[toKeep]

    corRanks &lt;- var(tmatSc, labelsSc)[,1]
    ranksOrder &lt;- order(corRanks, decreasing=T)
    ranksOrderInv &lt;- invPerm(ranksOrder)
    stats &lt;- corRanks[ranksOrder]

    pathwaysReordered &lt;- lapply(pathwaysFiltered, function(x) ranksOrderInv[x])

    gseaStatRes &lt;- do.call(rbind,
                           lapply(pathwaysReordered, calcGseaStat,
                                  stats=stats,
                                  returnLeadingEdge=TRUE))

I found a problem with the algorithm shown immediately below.
correcttest &lt;- data.frame(names = row.names(normal))
correcttest &lt;- cbind(correcttest3, normal)
correcttest &lt;- cbind(correcttest3, ALL3m)
rownames(correcttest) &lt;- correcttest$names
correcttest$names &lt;- NULL
correctlabelnormal &lt;- rep(0:0, 73)
correctlabelALL3m &lt;- rep(1:1, 122)
correctlabel &lt;- as.vector(c(correctlabelnormal,correctlabelALL3m))
s &lt;- apply(correcttest, 1, function(x) coef(lm(x~correctlabel))[2])
o &lt;- rank(s)
o &lt;- max(o) - o + 1
res &lt;- fgseaL(df,o,correctlabel,nperm = 2000,minSize = 1, maxSize=50000)
empty data table (0 rows) of 8 columns:   pathway,pval,padj,ES,NES,nMoreExtreme,size

I found the binary phenotype labeled group fgseaL test results below looked satisfactory.    
correcttest &lt;- data.frame(names = row.names(normal))
correcttest &lt;- cbind(correcttest3, normal)
correcttest &lt;- cbind(correcttest3, ALL3m)
rownames(correcttest) &lt;- correcttest$names
correcttest$names &lt;- NULL
correctlabelnormal &lt;- rep(0:0, 73)
correctlabelALL3m &lt;- rep(1:1, 122)
correctlabel &lt;- as.vector(c(correctlabelnormal,correctlabelALL3m))
fgseaL(df,correcttest,correctlabel,nperm = 2000,minSize = 1, maxSize=50000)
       pathway        pval        padj         ES       NES nMoreExtreme  size
1: Gene.Symbol 0.003940887 0.003940887 -0.2460126 -1.180009            3 45714
                                 leadingEdge
1: AKIRIN2,LRRC20,HSPA5,HSPA5,DTWD2,ZFYVE28,
</code></pre>

<p>Thank you for your consideration.</p>

CC BY-SA 3.0
2017-08-08T10:14:02.033Z
It might be worth to use the package provided by the authors in [github](https://github.com/gravitino/cudaGSEA). This way you don't need to implement it again
llrs
CC BY-SA 3.0
2017-08-08T10:54:55.580Z
@Llopis, Thank you for the good suggestion. I will try installing it later today..
Frank
CC BY-SA 3.0
2017-08-12T14:49:40.657Z
@Llopis, Can we run rapidGSEA without the CUDA enhancemnets since I am not using a computer with a NVIDIA cpu? Thank you.
Frank
CC BY-SA 3.0
2017-08-12T18:11:02.797Z
I think you could be able to do so, but I am not the maintainer neither the author of the code. You could also check the source code. But that probably is better to check and ask as another question
llrs
CC BY-SA 3.0
2017-08-12T19:09:43.973Z
@Llopis, How do I install the NVIDIA c++ compiler to compile cudaGSEA? I already installed the NVIDIA CUDA Toolkit. Thank you.
Frank
CC BY-SA 3.0
2017-08-12T20:25:38.323Z
@Llopis, There is a Makefile in github gravitino/cudaGSEA/src. What should I do with it if I am running Windows? Thanks
Frank
CC BY-SA 3.0
2017-08-12T22:29:36.860Z
@Llopis, When I perform the base install of the  NVIDIA CUDA Toolkit on Windows 8.1, I get a diagnostic message , "NVIDIA Installer cannot continue. The NVIDIA graphics driver is not compatible with this version of Windows". What should one do here to make nvcc compile okay? Thank you.
Frank
CC BY-SA 3.0
2017-08-13T08:43:25.790Z
if you have a problem don't hesitate to ask a *new* question on a *new thread*.
llrs
CC BY-SA 3.0
2017-08-13T10:52:59.707Z
@Llopis, May we continue this discussion in chat?
Frank
CC BY-SA 3.0
2017-08-13T18:40:12.440Z
No, if you have a new question post it as such
llrs
CC BY-SA 3.0
2017-08-13T21:45:27.657Z
@Llopis, Could you please comment on my answer which I just wrote below? Thank you for your help.
Frank
CC BY-SA 3.0
2017-08-14T09:27:04.090Z
It is not a question where I need clarification to answer it, so I won't comment it. Please if you have a new question post it as such. I will stop paying attention to this question an answers.
llrs
<r><genomics><gsea>
How to adapt the fgseaL function to perform rapidGSEA computation of gene ranks across 9 different phenotype labels?
# How to adapt the fgseaL function to perform rapidGSEA computation of gene ranks across 9 different phenotype labels?

(Asked by: username_0 on 2017-08-06)

I wish to adapt the r language function fgseaL, https://github.com/ctlab/fgsea , to perform rapidGSEA, https://bmcbioinformatics.biomedcentral.com/articles/10.1186/s12859-016-1244-x , computation of inter-class  deviation per gene and the subsequent gene rank sorting operation on 9 different phenotype labels as illustrated in the diagram immediately below:

I thought of applying the R-language rank() function on the Expression Data Matrix D. If that is not correct, what sequence of R language commands should we
apply to the Expression Data Matrix D to calculate a key value sorted deviation measure  across 8 labeled human leukemia groups and a healthy labeled normal control group prior to running fgseaL? 
I show below how fgseaL finds the correlation matrix between the R language variable , mat, which corresponds to the Expression Data Matrix D and the R language variable , labels , which is a vector of gene phenotype labels
    tmatSc <- scale(t(mat))
    labelsSc <- scale(labels)[, 1]

    minSize <- max(minSize, 1)

    pathwaysFiltered <- lapply(pathways, function(p) { as.vector(na.omit(fmatch(p, rownames(mat)))) })
    pathwaysSizes <- sapply(pathwaysFiltered, length)

    toKeep <- which(minSize <= pathwaysSizes & pathwaysSizes <= maxSize)
    m <- length(toKeep)

    if (m == 0) {
        return(data.table(pathway=character(),
                          pval=numeric(),
                          padj=numeric(),
                          ES=numeric(),
                          NES=numeric(),
                          nMoreExtreme=numeric(),
                          size=integer(),
                          leadingEdge=list()))
    }

    pathwaysFiltered <- pathwaysFiltered[toKeep]
    pathwaysSizes <- pathwaysSizes[toKeep]

    corRanks <- var(tmatSc, labelsSc)[,1]
    ranksOrder <- order(corRanks, decreasing=T)
    ranksOrderInv <- invPerm(ranksOrder)
    stats <- corRanks[ranksOrder]

    pathwaysReordered <- lapply(pathwaysFiltered, function(x) ranksOrderInv[x])

    gseaStatRes <- do.call(rbind,
                           lapply(pathwaysReordered, calcGseaStat,
                                  stats=stats,
                                  returnLeadingEdge=TRUE))

I found a problem with the algorithm shown immediately below.
correcttest <- data.frame(names = row.names(normal))
correcttest <- cbind(correcttest3, normal)
correcttest <- cbind(correcttest3, ALL3m)
rownames(correcttest) <- correcttest$names
correcttest$names <- NULL
correctlabelnormal <- rep(0:0, 73)
correctlabelALL3m <- rep(1:1, 122)
correctlabel <- as.vector(c(correctlabelnormal,correctlabelALL3m))
s <- apply(correcttest, 1, function(x) coef(lm(x~correctlabel))[2])
o <- rank(s)
o <- max(o) - o + 1
res <- fgseaL(df,o,correctlabel,nperm = 2000,minSize = 1, maxSize=50000)
empty data table (0 rows) of 8 columns:   pathway,pval,padj,ES,NES,nMoreExtreme,size

I found the binary phenotype labeled group fgseaL test results below looked satisfactory.    
correcttest <- data.frame(names = row.names(normal))
correcttest <- cbind(correcttest3, normal)
correcttest <- cbind(correcttest3, ALL3m)
rownames(correcttest) <- correcttest$names
correcttest$names <- NULL
correctlabelnormal <- rep(0:0, 73)
correctlabelALL3m <- rep(1:1, 122)
correctlabel <- as.vector(c(correctlabelnormal,correctlabelALL3m))
fgseaL(df,correcttest,correctlabel,nperm = 2000,minSize = 1, maxSize=50000)
       pathway        pval        padj         ES       NES nMoreExtreme  size
1: Gene.Symbol 0.003940887 0.003940887 -0.2460126 -1.180009            3 45714
                                 leadingEdge
1: AKIRIN2,LRRC20,HSPA5,HSPA5,DTWD2,ZFYVE28,

Thank you for your consideration.

**Tags:** r, genomics, gsea
> **Comments:**
> **username_1**: It might be worth to use the package provided by the authors in [github](https://github.com/gravitino/cudaGSEA). This way you don't need to implement it again  
> **username_0**: @Llopis, Thank you for the good suggestion. I will try installing it later today..  
> **username_0**: @Llopis, Can we run rapidGSEA without the CUDA enhancemnets since I am not using a computer with a NVIDIA cpu? Thank you.  
> **username_1**: I think you could be able to do so, but I am not the maintainer neither the author of the code. You could also check the source code. But that probably is better to check and ask as another question  
> **username_0**: @Llopis, How do I install the NVIDIA c++ compiler to compile cudaGSEA? I already installed the NVIDIA CUDA Toolkit. Thank you.  
> **username_0**: @Llopis, There is a Makefile in github gravitino/cudaGSEA/src. What should I do with it if I am running Windows? Thanks  
> **username_0**: @Llopis, When I perform the base install of the  NVIDIA CUDA Toolkit on Windows 8.1, I get a diagnostic message , "NVIDIA Installer cannot continue. The NVIDIA graphics driver is not compatible with this version of Windows". What should one do here to make nvcc compile okay? Thank you.  
> **username_1**: if you have a problem don't hesitate to ask a *new* question on a *new thread*.  
> **username_0**: @Llopis, May we continue this discussion in chat?  
> **username_1**: No, if you have a new question post it as such  
> **username_0**: @Llopis, Could you please comment on my answer which I just wrote below? Thank you for your help.  
> **username_1**: It is not a question where I need clarification to answer it, so I won't comment it. Please if you have a new question post it as such. I will stop paying attention to this question an answers.  

---

## 3 answers

### Answer by username_2 on 2017-08-07. Score: 2 | Accepted answer

You rank the fit coefficient rather than the original score matrix. So, given a score matrix, D:
D = matrix(c(22,20,9,8,46,22,18,10,3,18,3,29,2,1,5,45,43,47,17,5,14,44,21,36), byrow=T, ncol=6)
cl = c(0,0,0,1,1,1)
s = apply(m, 1, function(x) coef(lm(x~cl))[2]) # [1]
o = rank(s)
o = max(o) - o + 1 # [2]

o is then the rank of each row.
[1] This fits each row as a linear model of cl and extracts the cl coefficient.
[2] This converts the ranking to be the same as shown in the figure. I don't know if this is important, but I would assume so given how GSEA methods tend to work.

> **Comments:**
> **username_0**: Thank you for your excellent answer. I just accepted it. Could I pass a R language nine(9) valued phenotype label vector to where you specify cl =  c(0,0,0,1,1,1) or does cl have to be a binary phenotype label? The reason I ask this question is that we have 8 human leukemia groups and 1 healthy normal control group.  
> **username_2**: The method itself is only designed for two-group comparisons, so if you have more phenotypes you'll either have to do one comparison at a time or come up with a different method (I'm not sure what at multi-factor GSEA output would even mean in such cases).  
> **username_0**: Thank you for your reply to my comment. In the original Bioinformatics Stack Exchange question above , I have added some fgseaL source code which calculates the correlation matrix  between the Expression Data Matrix D and the R language variable , labels , which is a vector of gene phenotype labels. Could I ask you to explain the purpose of this fgseaL source code extract?  
> **username_2**: @Frank Please post that as a new question, though please read the preprint linked to from github first, since I assume that goes over the method.  
> **username_0**: I will post the new question later today. Also, I will try out your rank the linear regression fit coefficient method on our data and report the results back to you later today. Thanks.  
> **username_0**: I tested your rank the linear regression fit coefficient R language algorithm on our data with fgseaL and encountered the diagnostic message Empty data.table (0 rows) of 8 cols: pathway,pval,padj,ES,NES,nMoreExtreme. Could I ask what I did wrong? My R language code is shown at the bottom of my original question. Nonetheless , you are correct about doing two-group comparisons one at a time as I demonstrate at the bottom of my original question.  
> **username_2**: That's not my algorithm, it's just how to do that step from the paper. You'll get an empty output from the R code you posted whenever everything is filtered out. Whether that makes sense or not is a completely different question.  
> **username_0**: Thank you for your comment. What is the name of the paper and page which describes that step?  
> **username_2**: @Frank It's literally the image in your post and the paper you linked to.  
> **username_0**: I don't see any mention of linear regression coefficient  in the paper I linked to. Where did you get that idea? Also, fgseaL expects the mat input to be an matrix of doubles with the raw key value to be sorted while R language rank outputs a vector of integer rank scores. Thank you.  
> **username_2**: The "inter-class deviation" == "difference between groups" == "coefficient from a linear model". You're mixing and matching methods, you'll have to figure out how to get one to work with the other.  
> **username_0**: Is it permissible to perform the two phenotype group comparison using fgseaL without scaling on the input mat or D systematically one group at a time between each of the 8 diseased groups and the normal healthy group rather than using the linear regression coefficient R language source code as illustrated in the original question? Thank you.  
> **username_2**: @Frank Please post things like that as their own question.  
> **username_0**: Why is the fgseaL pval equal to the padj of  0.003940887 when I do the two group comparison between the normal control group and the ALL3m human leukemia disease group of subjects? Thank you.  
> **username_0**: When I do res<-fgsea(df,correcttest,nperm = 1000,minSize = 1, maxSize=50000) without the phenotype label feature why do I get the error in `[.data.frame`(x, order(x, na.last = na.last, decreasing = decreasing)) , undefined columns selected? Thank you.  
> **username_2**: Let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/63510/discussion-between-devon-ryan-and-frank).  
> **username_0**: Could you please comment on my answer which I just wrote below? Thank you for your help.  

---

### Answer by username_0 on 2017-08-22. Score: 3

I finally found another answer to my question. Please read this great article in May 12 2017 BioMed Central (BMC) Bioinformatics article titled [Ranking metrics in gene set enrichment analysis: do they matter?](https://bmcbioinformatics.biomedcentral.com/articles/10.1186/s12859-017-1674-0).

Also, please read this blog , [Diving into Genetics and Genomics: Gene Set Enrichment Analysis (GSEA) explained](http://crazyhottommy.blogspot.com/2016/08/gene-set-enrichment-analysis-gsea.html).

After reading these two articles, my choice for the best rapidGSEA local ranking measure is Minimum Significant Difference (i.e., MSD), because it has the best overall false positive rate (i.e., FPR) for larger sample sizes.

Finally, it is important to realize that fgseaL's phenotype labeling can hypothetically be emulated by GSEA with either one of it's sixteen possible ranking metrics or a custom ranking metric.


---

### Answer by username_0 on 2017-08-13. Score: 0

This weekend, I  installed the R language packages rapidGSEA and the Broad Institute GSEA , the Nvidia CUDA Toolkit 6.5-- Custom installation option  and MINGW makefiles on my son's Windows 8.1 notebook computer. 
  This step was very tricky to accomplish because I had to maneuver around the "NVIDIA Installer cannot continue. The NVIDIA graphics driver is not compatible with this version of Windows" installation error message which prevents the NVIDIA compilers from being installed correctly.
  My objective is to run rapidGSEA without the CUDA enhancements since I am not using a computer with a NVIDIA GPU.
  I did this step because rapidGSEA and Broad Institute GSEA have a significantly richer set of gene set enrichment analytics than fgseaL as shown below:
The GSEA method takes five default arguments and three optional arguments
GSEA <- function(exprsData, labelList, geneSets, numPermutations, metricString,
                 dumpFileName="", checkInput=TRUE, doublePrecision=FALSE) {...}
exprsData, labelList and geneSets refer to the data obtained in the previous section. numPermutations denotes the number of permutations in the resampling test, metricString denotes the local ranking measure (one of the following):
naive_diff_of_classes
naive_ratio_of_classes
naive_log2_ratio_of_classes
stable_diff_of_classes
stable_ratio_of_classes
stable_log2_ratio_of_classes
onepass_signal2noise
onepass_t_test
twopass_signal2noise
twopass_t_test
stable_signal2noise
stable_t_test
overkill_signal2noise
overkill_t_test

> **Comments:**
> **username_2**: Glad you got it working. Not sure what else I'm supposed to comment on here.  
> **username_0**: @Devon Ryan, If metricString denotes the local ranking measure we are requesting that rapidGSEA use when it is invoked, which metricString value should I choose so that rapidGSEA operates in a manner most closely resembling fgseaL? Thank you.  
> **username_2**: Don't try to make one work like the other. If you start making your own method then you have to get it through peer review. It doesn't appear you have the background necessary to do that. Use rapidGSEA or fgseaL, stop trying to merge them.  

---

