Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
ngs_tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bioinfo
ngs_tools
Commits
49891eaf
Commit
49891eaf
authored
8 years ago
by
Holger Brandl
Browse files
Options
Downloads
Patches
Plain Diff
use abs.max for gene aggregation
parent
b31b589b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
common/cp_enrichment.R
+31
-16
31 additions, 16 deletions
common/cp_enrichment.R
with
31 additions
and
16 deletions
common/cp_enrichment.R
+
31
−
16
View file @
49891eaf
...
...
@@ -20,14 +20,14 @@ Options:
opts
<-
docopt
(
doc
,
commandArgs
(
TRUE
))
## does not work when spining
# opts <- docopt(doc, "--overlay_expr_data ../plot_score_matrix.txt ../degs_by_contrast.txt contrast" )
devtools
::
source_url
(
"https://raw.githubusercontent.com/holgerbrandl/datautils/v1.2
2
/R/core_commons.R"
)
devtools
::
source_url
(
"https://raw.githubusercontent.com/holgerbrandl/datautils/v1.2
2
/R/ggplot_commons.R"
)
devtools
::
source_url
(
"https://raw.githubusercontent.com/holgerbrandl/datautils/v1.2
2
/R/bio/diffex_commons.R"
)
devtools
::
source_url
(
"https://raw.githubusercontent.com/holgerbrandl/datautils/v1.2
5
/R/core_commons.R"
)
devtools
::
source_url
(
"https://raw.githubusercontent.com/holgerbrandl/datautils/v1.2
5
/R/ggplot_commons.R"
)
devtools
::
source_url
(
"https://raw.githubusercontent.com/holgerbrandl/datautils/v1.2
5
/R/bio/diffex_commons.R"
)
require_auto
(
knitr
)
require_auto
(
DT
)
loadpack
(
knitr
)
loadpack
(
DT
)
require_auto
(
clusterProfiler
)
loadpack
(
clusterProfiler
)
#devtools::session_info() # nice!
...
...
@@ -370,14 +370,15 @@ l_ply(term_barplot_files$file, function(pngFile){ cat(paste0("<img src='", pngFi
## todo why is tidyr not processing an empty dataframe
keggPathways
<-
enrResults
%>%
filter
(
ontology
==
"kegg"
)
%$%
ac
(
ID
)
%>%
unique
()
# %>% head(3) ## todo remove debug head
##+ results='asis'
#if(!exists("keggPathways") | nrow(keggPathways)==0){
# cat("No enriched pathways found")
#}
require_auto
(
pathview
)
require_auto
(
png
)
require_auto
(
naturalsort
)
loadpack
(
pathview
)
loadpack
(
png
)
loadpack
(
naturalsort
)
# keggPathways <- keggPathways[1]
...
...
@@ -406,11 +407,22 @@ pwPlotDir <-".pathways"
dir.create
(
pwPlotDir
)
#Toxoplasmose debugging of 11796
#c(11796,11797,11798) %>%
# clusterProfiler::bitr(fromType="ENTREZID", toType="ENSEMBL", annoDb="org.Mm.eg.db") %>%
# set_names("entrez_gene_id", "ensembl_gene_id" ) %>%
# inner_join( sliceData %>% add_rownames("ensembl_gene_id") )
# session::save.session(".pview_debug.dat");
# session::restore.session(".pview_debug.dat");
plot_pathway
<-
function
(
pathwayID
,
sliceData
){
# pathwayID="mmu04015"; sliceData <- sliceData
# pathwayID="mmu05145"; sliceData <- sliceData
# browser()
# echo("processing pathway", pathwayID)
pv.out
<-
pathview
(
pv.out
<-
pathview
(
# gene.data = sliceData %>% add_rownames("ensembl_gene_id") %>% tbl_df %>% filter(ensembl_gene_id %in% c("ENSMUSG00000073901", "ENSMUSG00000032000", "ENSMUSG00000021025")) %>% column2rownames("ensembl_gene_id"),
gene.data
=
sliceData
,
pathway.id
=
pathwayID
,
species
=
keggOrCode
,
...
...
@@ -418,7 +430,7 @@ plot_pathway <- function(pathwayID, sliceData){
# out.suffix = pathwayID,
multi.state
=
ncol
(
sliceData
)
>
1
,
# kegg.native=F,
#
node.sum = "m
ean
", # the method name to calculate node summary given that multiple genes or compounds are mapped to it
node.sum
=
"m
ax.abs
"
,
# the method name to calculate node summary given that multiple genes or compounds are mapped to it
limit
=
list
(
gene
=
c
(
-4
,
4
)),
gene.idtype
=
"ensembl"
)
...
...
@@ -434,10 +446,7 @@ plot_pathway <- function(pathwayID, sliceData){
system
(
paste
(
"rm"
,
paste0
(
pathwayID
,
".xml"
),
paste0
(
pathwayID
,
".png"
)))
## interactive plotting
# ima <- readPNG(outfile)
# plot.new()
# lim <- par()
# rasterImage(ima, lim$usr[1], lim$usr[3], lim$usr[2], lim$usr[4])
# ima <- readPNG(figuresPlotFile); plot.new(); lim <- par(); rasterImage(ima, lim$usr[1], lim$usr[3], lim$usr[2], lim$usr[4]);
pv.out
$
plotfile
=
figuresPlotFile
pv.out
$
pathway_id
=
pathwayID
...
...
@@ -507,13 +516,19 @@ makeTooltip <- function(entrez_id){
#</style>
#")
pathwayName
<-
function
(
pathwayID
,
enrResults
)
enrResults
%>%
filter
(
ontology
==
"kegg"
)
%>%
filter
(
ID
==
pathwayID
)
%$%
Description
#
## todo add tooltips with additinal info
## http://stackoverflow.com/questions/5478940/how-to-create-a-html-tooltip-on-top-of-image-map
## extended version with clickable links
createImgMap
<-
function
(
plotData
){
#browser()
warning
(
"compiling overlay toolips..."
)
# cat(paste0("pathway:", plotData$pathway_id) # todo rather show the pathway name here and create anhor list on top of section
# pathwayName("mmu05145", enrResults)
cat
(
paste0
(
"<h3>"
,
pathwayName
(
plotData
$
pathway_id
,
enrResults
),
"</h3>"
))
#pngFile="mmu04015.pathview.png"
#plotData <- pathwayPlots[[1]]
#plotData <- unlist(pathwayPlots)
...
...
This diff is collapsed.
Click to expand it.
brandl
@brandl
mentioned in commit
4f5a6abe
·
8 years ago
mentioned in commit
4f5a6abe
mentioned in commit 4f5a6abe1c9447550fd00591c483acec372308fd
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment