Mercurial > repos > proteore > proteore_pathview_mapping
changeset 15:da82872f5c80 draft
planemo upload commit 63302cb49d4f0f4dbc9ae141d20704822588f54e-dirty
| author | proteore |
|---|---|
| date | Mon, 12 Nov 2018 10:54:25 -0500 |
| parents | be8115c73b0d |
| children | 682041ae727d |
| files | kegg_pathways_visualization.R kegg_pathways_visualization.xml |
| diffstat | 2 files changed, 15 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/kegg_pathways_visualization.R Fri Nov 09 05:22:50 2018 -0500 +++ b/kegg_pathways_visualization.R Mon Nov 12 10:54:25 2018 -0500 @@ -64,6 +64,11 @@ return(x) } +kegg_to_geneID <- function(vector){ + vector <- sapply(vector, function(x) unlist(strsplit(x,":"))[2],USE.NAMES = F) + return (vector) +} + clean_bad_character <- function(string) { string <- gsub("X","",string) return(string) @@ -79,7 +84,7 @@ #return a summary from the mapping with pathview in a vector mapping_summary <- function(pv.out,species,id,id_type){ - mapped <- pv.out$plot.data.gene$kegg.names[which(pv.out$plot.data.gene$all.mapped!='')] + mapped <- unique(pv.out$plot.data.gene$kegg.names[which(pv.out$plot.data.gene$all.mapped!='')]) nb_mapped <- length(mapped) nb_kegg_id <- length(unique(pv.out$plot.data.gene$kegg.names)) ratio = round((nb_mapped/nb_kegg_id)*100, 2) @@ -87,11 +92,11 @@ pathway_id = paste(species,id,sep="") pathway_name = as.character(pathways_list[pathways_list[,1]==pathway_id,][2]) - if (id_type=="geneid"){ + if (id_type=="geneid" || id_type=="keggid") { row <- c(pathway_id,pathway_name,length(unique(geneID)),nb_kegg_id,nb_mapped,ratio,paste(mapped,collapse=";")) names(row) <- c("KEGG pathway ID","pathway name","nb of Entrez gene ID used","nb of Entrez gene ID mapped", "nb of Entrez gene ID in the pathway", "ratio of Entrez gene ID mapped (%)","Entrez gene ID mapped") - }else if (id_type=="uniprotid"){ + } else if (id_type=="uniprotid") { row <- c(pathway_id,pathway_name,length(unique(uniprotID)),length(unique(geneID)),nb_mapped,nb_kegg_id,ratio,paste(mapped,collapse=";"),paste(mapped2geneID[which(mapped2geneID[,2] %in% mapped)],collapse=";")) names(row) <- c("KEGG pathway ID","pathway name","nb of Uniprot_AC used","nb of Entrez gene ID used","nb of Entrez gene ID mapped", "nb of Entrez gene ID in the pathway", "ratio of Entrez gene ID mapped (%)","Entrez gene ID mapped","uniprot_AC mapped") @@ -194,12 +199,16 @@ } } -##### map uniprotID to entrez geneID +##### map uniprotID to entrez geneID and kegg to geneID if (id_type == "uniprotid") { uniprotID = tab[,ncol] mapped2geneID = id2eg(ids = uniprotID, category = "uniprot", org = org[[species]], pkg.name = NULL) geneID = mapped2geneID[,2] tab = cbind(tab,geneID) +}else if (id_type == "keggid"){ + keggID = tab[,ncol] + geneID = kegg_to_geneID(keggID) + tab = cbind(tab,geneID) }else if (id_type == "geneid"){ colnames(tab)[ncol] <- "geneID" }
--- a/kegg_pathways_visualization.xml Fri Nov 09 05:22:50 2018 -0500 +++ b/kegg_pathways_visualization.xml Mon Nov 12 10:54:25 2018 -0500 @@ -1,4 +1,4 @@ -<tool id="kegg_pathways_visualization" name="KEGG pathways" version="2018.11.09.1"> +<tool id="kegg_pathways_visualization" name="KEGG pathways" version="2018.11.12"> <description>map visualisation (PathView)</description> <requirements> <requirement type="package" version="1.18.0">bioconductor-pathview</requirement> @@ -148,7 +148,7 @@ <param name="id_type" type="select" label="Select your identifiers type :"> <option value="uniprotID">Uniprot Accession number</option> <option value="geneID">Entrez gene ID</option> - <!--option value="keggid">KEGG genes ID</option--> + <option value="keggid">KEGG genes ID</option> </param> <conditional name="input" > <param name="ids" type="select" label="Enter your identifiers (Uniprot AC or Entrez gene ID)" help="Copy/paste or ID list from a file (e.g. table)" >
