Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
datautils
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
datautils
Commits
fefcca04
Commit
fefcca04
authored
10 years ago
by
Holger Brandl
Browse files
Options
Downloads
Patches
Plain Diff
finished new tophat mapping report
parent
eab0b134
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bash/bioinfo_utils.sh
+42
-4
42 additions, 4 deletions
bash/bioinfo_utils.sh
bash/test.R
+0
-40
0 additions, 40 deletions
bash/test.R
with
42 additions
and
44 deletions
bash/bioinfo_utils.sh
+
42
−
4
View file @
fefcca04
##
## Tophat Mapping Report from the logs
## Tophat Mapping Report from the logs
TophatMappingReport
(){
## todo replace source with simple R script as for bowtie-report
echo
'
devtools::source_url("http://dl.dropbox.com/u/113630701/rlibs/deepseq/ngs_tools.R")
createMappingReport()
devtools::source_url("https://dl.dropboxusercontent.com/u/113630701/datautils/R/core_commons.R")
devtools::source_url("https://dl.dropboxusercontent.com/u/113630701/datautils/R/ggplot_commons.R")
parseAlgnSummary_T2_0_11 <- function(alignSummary){
#alignSummary="/projects/bioinfo/holger/projects/marta_rnaseq/human_leipzig/mapping/S5382_aRG_1b_rep1/align_summary.txt"
algnData <- readLines(alignSummary)
data.frame(
condition=basename(dirname(alignSummary)),
num_reads=as.numeric(str_match(algnData[2], " ([0-9]*$)")[,2]),
mapped_reads=100*as.numeric(str_match(algnData[3], ":[ ]*([0-9]*) ")[,2][1])
) %>% transform(mapping_efficiency=mapped_reads/num_reads)
}
algnSummary <- ldply(list.files(".", "align_summary.txt", full.names=TRUE, recursive=T), parseAlgnSummary_T2_0_11, .progress="text")
write.delim(algnSummary, file="tophat_mapping_stats.txt")
scale_fill_discrete <- function (...){ scale_color_brewer(..., type = "seq", palette="Set1", "fill", na.value = "grey50") }
projectName=basename(dirname(getwd()))
devtools::source_url("https://raw.githubusercontent.com/holgerbrandl/mdreport/master/R/mdreport-package.r")
md_new(paste("Mapping Summary for ", projectName))
md_plot(ggplot(algnSummary, aes(condition, mapping_efficiency)) + geom_bar(stat="identity") +coord_flip() + ylim(0,100) + ggtitle("mapping efficiency"))
md_plot(ggplot(algnSummary, aes(condition, num_reads)) + geom_bar(stat="identity") + coord_flip() + ggtitle("read counts") +scale_y_continuous(labels=comma))
md_plot(ggplot(algnSummary, aes(condition, mapped_reads)) + geom_bar(stat="identity") + coord_flip() + ggtitle("alignments counts") +scale_y_continuous(labels=comma))
#ggplot(melt(algnSummary), aes(condition, value)) + geom_bar(stat="identity") +facet_wrap(~variable, scales="free") + ggtitle("mapping summary") + scale_y_continuous(labels=comma) + theme(axis.text.x=element_text(angle=90, hjust=0))
#ggsave2(w=10, h=10, p="mapstats")
md_report("tophat_mapping_report", open=F)
'
| R
-q
--vanilla
}
export
-f
TophatMappingReport
...
...
This diff is collapsed.
Click to expand it.
bash/test.R
+
0
−
40
View file @
fefcca04
devtools
::
source_url
(
"https://dl.dropboxusercontent.com/u/113630701/datautils/R/core_commons.R"
)
devtools
::
source_url
(
"https://dl.dropboxusercontent.com/u/113630701/datautils/R/ggplot_commons.R"
)
parseAlgnSummary_T2_0_11
<-
function
(
alignSummary
){
#alignSummary="/projects/bioinfo/holger/projects/marta_rnaseq/human_leipzig/mapping/S5382_aRG_1b_rep1/align_summary.txt"
algnData
<-
readLines
(
alignSummary
)
data.frame
(
condition
=
basename
(
dirname
(
alignSummary
)),
num_reads
=
as.numeric
(
str_match
(
algnData
[
2
],
" ([0-9]*$)"
)[,
2
]),
mapped_reads
=
100
*
as.numeric
(
str_match
(
algnData
[
3
],
":[ ]*([0-9]*) "
)[,
2
][
1
])
)
%>%
transform
(
mapping_efficiency
=
mapped_reads
/
num_reads
)
}
algnSummary
<-
ldply
(
list.files
(
"."
,
"align_summary.txt"
,
full.names
=
TRUE
,
recursive
=
T
),
parseAlgnSummary_T2_0_11
,
.progress
=
"text"
)
write.delim
(
algnSummary
,
file
=
"tophat_mapping_stats.txt"
)
scale_fill_discrete
<-
function
(
...
){
scale_color_brewer
(
...
,
type
=
"seq"
,
palette
=
"Set1"
,
"fill"
,
na.value
=
"grey50"
)
}
projectName
=
basename
(
dirname
(
getwd
()))
ggplot
(
algnSummary
,
aes
(
condition
,
mapping_efficiency
))
+
geom_bar
(
stat
=
"identity"
)
+
coord_flip
()
+
ylim
(
0
,
100
)
+
ggtitle
(
concat
(
"mapping efficiency in "
,
projectName
))
ggsave2
(
width
=
12
)
ggplot
(
algnSummary
,
aes
(
condition
,
num_reads
))
+
geom_bar
(
stat
=
"identity"
)
+
coord_flip
()
+
ggtitle
(
concat
(
"read counts in"
,
projectName
))
+
scale_y_continuous
(
labels
=
comma
)
ggsave2
(
width
=
12
)
ggplot
(
algnSummary
,
aes
(
condition
,
mapped_reads
))
+
geom_bar
(
stat
=
"identity"
)
+
coord_flip
()
+
ggtitle
(
concat
(
"alignments in"
,
projectName
))
+
scale_y_continuous
(
labels
=
comma
)
ggsave2
(
width
=
12
)
ggplot
(
melt
(
algnSummary
),
aes
(
condition
,
value
))
+
geom_bar
(
stat
=
"identity"
)
+
facet_wrap
(
~
variable
,
scales
=
"free"
)
+
ggtitle
(
"mapping summary"
)
+
scale_y_continuous
(
labels
=
comma
)
+
theme
(
axis.text.x
=
element_text
(
angle
=
90
,
hjust
=
0
))
ggsave2
(
w
=
10
,
h
=
10
,
p
=
"mapstats"
)
This diff is collapsed.
Click to expand it.
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