Error: Aesthetics must be either length 1 or the same as the data (1): x and xend
1
0
Entering edit mode
yueli7 ▴ 20
@yueli7-8401
Last seen 2.9 years ago
China

Hello,

All the codes are running well.

I tried to plot the enrichment of the GSEA. But it comes out the error.

Thank you in advance for great help!

Best,

Yue

> library(fgsea)
> library(tidyverse)
> library(data.table)
> library(ggplot2)
> setwd("/media/hp/04c65089-71ff-4b33-9a30-c21b8c77eda2/li/HASM_SILAC/finally/DEP")
> #AC6_vs_lacZ
> res<-read.table("AC6_vs_lacZ_fgsea.txt")
> ranks <- deframe(res)
> pathways.kegg<- gmtPathways("c2.cp.kegg.v7.2.symbols.gmt")
> fgseaRes_kegg<- fgsea(pathways = pathways.kegg, stats  = ranks,  minSize = 1,maxSize  = Inf)
Warning message:
In preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam,  :
There are ties in the preranked stats (1.13% of the list).
The order of those tied genes will be arbitrary, which may produce unexpected results.
> fwrite(fgseaRes_kegg, file="AC6_vs_lacZ_kegg.txt", sep="\t", sep2=c("", " ", ""))

> plotEnrichment(pathways.kegg[["KEGG_PYRIMIDINE_METABOLISM"]],
+                exampleRanks) 
 Error: Aesthetics must be either length 1 or the same as the data (1): x and xend
 Run `rlang::last_error()` to see where the error occurred.
 In addition: Warning messages:
1: In max(tops) : no non-missing arguments to max; returning -Inf
2: In min(bottoms) : no non-missing arguments to min; returning Inf
3: In max(tops) : no non-missing arguments to max; returning -Inf
4: In min(bottoms) : no non-missing arguments to min; returning Inf
5: In max(tops) : no non-missing arguments to max; returning -Inf
6: In min(bottoms) : no non-missing arguments to min; returning Inf


> sessionInfo()
R version 4.0.4 (2021-02-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.2 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8   
 [6] LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] parallel  stats4    stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] devtools_2.3.2       usethis_2.0.1        org.Hs.eg.db_3.12.0  AnnotationDbi_1.52.0 IRanges_2.24.1       S4Vectors_0.28.1    
 [7] Biobase_2.50.0       BiocGenerics_0.36.0  BiocParallel_1.24.1  forcats_0.5.1        stringr_1.4.0        dplyr_1.0.4         
[13] purrr_0.3.4          readr_1.4.0          tidyr_1.1.2          tibble_3.1.0         tidyverse_1.3.0      ggplot2_3.3.3       
[19] data.table_1.14.0    fgsea_1.17.1        

loaded via a namespace (and not attached):
 [1] fs_1.5.0            lubridate_1.7.10    bit64_4.0.5         httr_1.4.2          rprojroot_2.0.2     tools_4.0.4        
 [7] backports_1.2.1     utf8_1.1.4          R6_2.5.0            DBI_1.1.1           colorspace_2.0-0    withr_2.4.1        
[13] tidyselect_1.1.0    gridExtra_2.3       prettyunits_1.1.1   processx_3.4.5      bit_4.0.4           curl_4.3           
[19] compiler_4.0.4      cli_2.3.1           rvest_0.3.6         xml2_1.3.2          desc_1.2.0          labeling_0.4.2     
[25] scales_1.1.1        callr_3.5.1         digest_0.6.27       pkgconfig_2.0.3     sessioninfo_1.1.1   dbplyr_2.1.0       
[31] fastmap_1.1.0       rlang_0.4.10        readxl_1.3.1        rstudioapi_0.13     RSQLite_2.2.3       farver_2.0.3       
[37] generics_0.1.0      jsonlite_1.7.2      magrittr_2.0.1      Matrix_1.3-2        Rcpp_1.0.6          munsell_0.5.0      
[43] fansi_0.4.2         lifecycle_1.0.0     stringi_1.5.3       pkgbuild_1.2.0      grid_4.0.4          blob_1.2.1         
[49] crayon_1.4.1        lattice_0.20-41     haven_2.3.1         hms_1.0.0           ps_1.5.0            pillar_1.5.0       
[55] pkgload_1.2.0       fastmatch_1.1-0     reprex_1.0.0        glue_1.4.2          remotes_2.2.0       BiocManager_1.30.10
[61] modelr_0.1.8        vctrs_0.3.6         testthat_3.0.2      cellranger_1.1.0    gtable_0.3.0        assertthat_0.2.1   
[67] cachem_1.0.4        broom_0.7.5         memoise_2.0.0       ellipsis_0.3.1     

` ```

fgsea • 1.6k views
ADD COMMENT
0
Entering edit mode
yueli7 ▴ 20
@yueli7-8401
Last seen 2.9 years ago
China

I knew what I am wrong .

plotEnrichment(pathways.kegg[["KEGG_PYRIMIDINE_METABOLISM"]],   ranks) 

It should be "ranks", not exampleRanks.

ADD COMMENT
0
Entering edit mode

Thank you for posting the answer.

ADD REPLY

Login before adding your answer.

Traffic: 859 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