Open janstrauss1 opened 4 years ago
Interesting, have not seen this before! I suspect it has to do with some p-values being NA. Could you check your GSAres object and see what $pDistinctDirUp and $pDistinctDirDn are (or $pAdjDistinctDirUp/Dn if using adjusted p-values)? Try setting the ones that are NA to 1. Will this remove the error?
Thanks for your quick response!
I have also already suspected some p-values being NA and checked my input data but there didn't seem to be any NAs in my input data tables.
Regarding my GSAres object, I exported the summary table generated with GSASummaryTable
(my_GSAsummaryTable.xlsx). It seems that there are some NAs including $pDistinctDirUp
and $pDistinctDirDn
for two GO terms.
It also shows up using the following code:
> sum(is.na(gsaRes$pDistinctDirUp))
[1] 2
> sum(is.na(gsaRes$pDistinctDirDn))
[1] 2
> sum(is.na(gsaRes$pAdjDistinctDirUp))
[1] 2
> sum(is.na(gsaRes$pAdjDistinctDirDn))
[1] 2
So I then try to set the NAs to 1 using:
is.na(gsaRes$pDistinctDirUp) <- 1
is.na(gsaRes$pAdjDistinctDirUp) <- 1
is.na(gsaRes$pDistinctDirDn) <- 1
is.na(gsaRes$pAdjDistinctDirDn) <- 1
Unfortunately, I still receive the same error when running:
nw <- networkPlot(gsaRes,
class = "distinct",
direction = "both",
significance=0.01,
overlap = 1,
lay = 4, # numerical between 1-5 to set the default layout
label = "names",
ncharLabel=Inf,
cexLabel=1.1
)
Strangely, when checking my GSASummaryTable
again (after having tried to set NAs to 1 using above code) some additional NA are introduced for the GO term in the first row?!
> sum(is.na(gsaRes$pDistinctDirUp))
[1] 3
> sum(is.na(gsaRes$pDistinctDirDn))
[1] 3
> sum(is.na(gsaRes$pAdjDistinctDirUp))
[1] 3
> sum(is.na(gsaRes$pAdjDistinctDirDn))
[1] 3
I assume that is.na
is not properly working on the GSAres object?
Any ideas how to get rid of the NAs?
Many thanks for your help! Jan
Just to add to my previous comment.
It really seems that is.na(gsaRes$p...) <- 1
introduces an NA at the very first row instead of replacing NA with 1.
I seem to have found a (at least temporary) solution to solve the error.
Replacing NAs in my GSAres
object by the following code seems to fix the error when using the networkPlot
function with class = "distinct"
and direction = "both"
> gsaRes$pDistinctDirUp[is.na(gsaRes$pDistinctDirUp)] <- 1
> sum(is.na(gsaRes$pDistinctDirUp))
[1] 0
Interestingly, networkPlot
seems to work fine with only replacing NAs in my gsaRes$pDistinctDirUp
by above code without replacing NAs in gsaRes$pDistinctDirDn
!
In other words, calling the networkPlot
function with class = "distinct"
and direction = "both"
after the following code works fine:
> gsaRes$pDistinctDirUp[is.na(gsaRes$pDistinctDirUp)] <- 1
> sum(is.na(gsaRes$pDistinctDirUp))
[1] 0
> sum(is.na(gsaRes$pDistinctDirDn))
[1] 2
However, interesting is that the error still seems to remain when calling the newer networkPlot2
function instead of networkPlot
(even when I replace NA in both, gsaRes$pDistinctDirUp
and gsaRes$pDistinctDirDn
with 1).
Strangely, for the networkPlot2
function with class = "distinct"
and direction = "both"
, the error seems to disappear only when replacing NA with 1 in both, p-values and adjusted p-values, using following code:
> gsaRes$pDistinctDirUp[is.na(gsaRes$pDistinctDirUp)] <- 1
> sum(is.na(gsaRes$pDistinctDirUp))
[1] 0
> gsaRes$pDistinctDirDn[is.na(gsaRes$pDistinctDirDn)] <- 1
> sum(is.na(gsaRes$pDistinctDirDn))
[1] 0
> gsaRes$pAdjDistinctDirUp[is.na(gsaRes$pAdjDistinctDirUp)] <- 1
> sum(is.na(gsaRes$pAdjDistinctDirUp))
[1] 0
> gsaRes$pAdjDistinctDirDn[is.na(gsaRes$pAdjDistinctDirDn)] <- 1
> sum(is.na(gsaRes$pAdjDistinctDirDn))
[1] 0
Any ideas about this behaviour? Many thanks in advance, Jan
Dear @varemo,
I currently run into the following error when trying to plot
networkPlot
ornetworkPlot2
withclass = "distinct"
anddirection = "both"
for a larger set of 5712 genes?Yet, it works fine when I plot
networkPlot
ornetworkPlot2
usingclass = "distinct"
but specifying a single direction (direction = "up"
ordirection = "down"
).Strangely, I don't encounter such issues when I run the same code but with a smaller (similar) data set of 968 genes?!
I'm a bit puzzled. Any ideas where the error might be?
Many thanks in advance,
Jan