Entering edit mode
                    kevinvdburg
        
    
        •
    
    0
        @kevinvdburg-21994
        Last seen 6.1 years ago
        
    i get the message that none of my genes are mapped to the pathways. I've looked around and found some buggs in my code but this one still is in it.
library(dplyr)
library(DESeq2)
countData <- read.csv("N:/_AppSense_/Desktop/Transcriptoomanalyse/pathway_analyse/RUN_1/Humaan/featurecounts_RUN1.csv", sep = ";", row.names=1) %>%
  dplyr::select(-length) %>%
  as.matrix()
countData <- countData[rowSums(countData)>1, ]
head(countData)
colData <- read.csv("N:/_AppSense_/Desktop/Transcriptoomanalyse/pathway_analyse/RUN_1/Humaan/metadata_Humaan_RUN1.csv", sep = ";",row.names = 1)
colData
dds <- DESeqDataSetFromMatrix(countData=countData,
                              colData=colData,
                              design=~condition)
dds <- DESeq(dds)
dds
res <- results(dds, contrast=c("condition", "control", "infected"))
res <- res[order(res$pvalue),]
summary(res)
library("AnnotationDbi")
library("org.Hs.eg.db")
columns(org.Hs.eg.db)
res$symbol <- mapIds(org.Hs.eg.db,
                     keys=row.names(res),
                     column="SYMBOL",
                     keytype="ENSEMBL",
                     multiVals="first")
res$entrez <- mapIds(org.Hs.eg.db,
                     keys=row.names(res),
                     column="ENTREZID",
                     keytype="ENSEMBL",
                     multiVals="first")
res$name <- mapIds(org.Hs.eg.db,
                   keys=row.names(res),
                   column="GENENAME",
                   keytype="ENSEMBL",
                   multiVals="first")
head(res, 10)
##########################
#### PATHWAY ANALYSIS ####
library(pathview)
library(gage)
library(gageData)
data(kegg.sets.hs)
data(sigmet.idx.hs)
kegg.sets.hs <- kegg.sets.hs[sigmet.idx.hs]
head(kegg.sets.hs, 3)
foldchanges <- res$log2FoldChange
names(foldchanges) <- res$entrez
head(foldchanges)
keggres <- gage(foldchanges, gsets=kegg.sets.hs, same.dir=TRUE)
lapply(keggres, head)
keggrespathways <- data.frame(id=rownames(keggres$greater), keggres$greater) %>%
  tbl_df() %>%
  filter(row_number()<=5) %>%
  .$id %>%
  as.character()
keggrespathways
keggresids <- substr(keggrespathways, start=1, stop=8)
keggresids
###########################
#### PLOTTING FUNCTION ####
setwd("N:/_AppSense_/Desktop/Transcriptoomanalyse/pathway_analyse/RUN_1/Humaan/Image/")
plot_pathway <- function(pid) pathview(gene.data=foldchanges, pathway.id=pid, species="hsa", new.signature=FALSE)
tmp <- sapply(keggresids, function(pid) pathview(gene.data=foldchanges, pathway.id=pid, species="hsa"))
the error info:
Warning: None of the genes or compounds mapped to the pathway!
Argument gene.idtype or cpd.idtype may be wrong.
'select()' returned 1:1 mapping between keys and columns
Info: Working in directory N:/_AppSense_/Desktop/Transcriptoomanalyse/pathway_analyse/RUN_1/Humaan/Image
Info: Writing image file hsa00232.pathview.png
the session Info:
R version 3.6.0 (2019-04-26)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
Matrix products: default
locale:
[1] LC_COLLATE=Dutch_Netherlands.1252  LC_CTYPE=Dutch_Netherlands.1252    LC_MONETARY=Dutch_Netherlands.1252
[4] LC_NUMERIC=C                       LC_TIME=Dutch_Netherlands.1252    
attached base packages:
[1] parallel  stats4    stats     graphics  grDevices utils     datasets  methods   base     
other attached packages:
 [1] gageData_2.22.0             gage_2.34.0                 pathview_1.24.0             DESeq2_1.24.0              
 [5] SummarizedExperiment_1.14.1 DelayedArray_0.10.0         BiocParallel_1.18.1         matrixStats_0.55.0         
 [9] GenomicRanges_1.36.1        GenomeInfoDb_1.20.0         dplyr_0.8.3                 org.Hs.eg.db_3.8.2         
[13] AnnotationDbi_1.46.1        IRanges_2.18.2              S4Vectors_0.22.1            Biobase_2.44.0             
[17] BiocGenerics_0.30.0        
loaded via a namespace (and not attached):
 [1] httr_1.4.1             bit64_0.9-7            splines_3.6.0          Formula_1.2-3          assertthat_0.2.1      
 [6] latticeExtra_0.6-28    blob_1.2.0             GenomeInfoDbData_1.2.1 sessioninfo_1.1.1      pillar_1.4.2          
[11] RSQLite_2.1.2          backports_1.1.4        lattice_0.20-38        glue_1.3.1             digest_0.6.21         
[16] RColorBrewer_1.1-2     XVector_0.24.0         checkmate_1.9.4        colorspace_1.4-1       htmltools_0.3.6       
[21] Matrix_1.2-17          XML_3.98-1.20          pkgconfig_2.0.2        genefilter_1.66.0      zlibbioc_1.30.0       
[26] purrr_0.3.2            xtable_1.8-4           scales_1.0.0           htmlTable_1.13.2       tibble_2.1.3          
[31] annotate_1.62.0        KEGGREST_1.24.0        ggplot2_3.2.1          withr_2.1.2            nnet_7.3-12           
[36] lazyeval_0.2.2         cli_1.1.0              survival_2.44-1.1      magrittr_1.5           crayon_1.3.4          
[41] KEGGgraph_1.44.0       memoise_1.1.0          foreign_0.8-71         graph_1.62.0           tools_3.6.0           
[46] data.table_1.12.2      stringr_1.4.0          locfit_1.5-9.1         munsell_0.5.0          cluster_2.1.0         
[51] Biostrings_2.52.0      compiler_3.6.0         rlang_0.4.0            grid_3.6.0             RCurl_1.95-4.12       
[56] rstudioapi_0.10        htmlwidgets_1.3        bitops_1.0-6           base64enc_0.1-3        gtable_0.3.0          
[61] DBI_1.0.0              R6_2.4.0               gridExtra_2.3          knitr_1.25             bit_1.1-14            
[66] zeallot_0.1.0          Hmisc_4.2-0            Rgraphviz_2.28.0       stringi_1.4.3          Rcpp_1.0.2            
[71] png_0.1-7              vctrs_0.2.0            geneplotter_1.62.0     rpart_4.1-15           acepack_1.4.1         
[76] tidyselect_0.2.5       xfun_0.9              
                    
                
                
You have shown a bunch of code, much of which isn't pertinent. Your goal is to give us enough information to help you, but this isn't it (if you were in my shoes, reading your post, how much informative content do you really think there is?).
Ideally you would give a self-contained example that fails. This is often helps you answer the question yourself, because it forces you to look at your data and might help you figure things out yourself.
It seems like the failure occurs at the last step. If you
dputthe first bit of keggresids and the first bit of fold changes, then people could try running that step and maybe figure out what is happening.``
If that is all the genes that you have, then you will find it difficult to enrich any pathways. Go through each line of your code and check each of:
...then debug the issue