Commit 872cbe33 authored by Holger Brandl's avatar Holger Brandl

cont khan pipeline

parent 7d7d969c
...@@ -48,43 +48,44 @@ md_report("tophat_mapping_report", open=F) ...@@ -48,43 +48,44 @@ md_report("tophat_mapping_report", open=F)
export -f TophatMappingReport export -f TophatMappingReport
## replaced with cs_bowtie_qc
#### Bowtie Mapping Report from the logs #### Bowtie Mapping Report from the logs
Bowtie2MappingReport(){ #Bowtie2MappingReport(){
#
echo ' #echo '
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/core_commons.R")
devtools::source_url("https://dl.dropboxusercontent.com/u/113630701/datautils/R/ggplot_commons.R") #devtools::source_url("https://dl.dropboxusercontent.com/u/113630701/datautils/R/ggplot_commons.R")
#
logSuffix=".logs" #logSuffix=".logs"
parseAlgnSummary <- function(alignSummary){ #parseAlgnSummary <- function(alignSummary){
#alignSummary="./H2Az_Rep1_Lane1_Lib4454.bowtie.log" # #alignSummary="./H2Az_Rep1_Lane1_Lib4454.bowtie.log"
algnData <- readLines(alignSummary) # algnData <- readLines(alignSummary)
#
data.frame( # data.frame(
condition=trimEnd(basename(alignSummary), logSuffix), # condition=trimEnd(basename(alignSummary), logSuffix),
num_reads=as.numeric(str_split_fixed(algnData[3], " ", 2)[1]), # num_reads=as.numeric(str_split_fixed(algnData[3], " ", 2)[1]),
unique_mappers=as.numeric(str_split_fixed(str_trim(algnData[6]), " ", 2)[1]), # unique_mappers=as.numeric(str_split_fixed(str_trim(algnData[6]), " ", 2)[1]),
mapping_efficiency=as.numeric(str_replace(str_split_fixed(algnData[8], " ", 2)[1], "%", "")), # mapping_efficiency=as.numeric(str_replace(str_split_fixed(algnData[8], " ", 2)[1], "%", "")),
multi_mappers=as.numeric(str_split_fixed(str_trim(algnData[7]), " ", 2)[1]) # multi_mappers=as.numeric(str_split_fixed(str_trim(algnData[7]), " ", 2)[1])
) # )
} #}
#
mapStats <- ldply(list.files(".", logSuffix, full.names=TRUE, recursive=T), parseAlgnSummary, .progress="text") #mapStats <- ldply(list.files(".", logSuffix, full.names=TRUE, recursive=T), parseAlgnSummary, .progress="text")
write.delim(mapStats, file="mapStats.txt") #write.delim(mapStats, file="mapStats.txt")
#
ggplot(melt(mapStats), 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)) #ggplot(melt(mapStats), 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") #ggsave2(w=10, h=10, p="mapstats")
#
ggplot(mapStats, aes(condition, mapping_efficiency)) + geom_bar(stat="identity") +coord_flip() + ylim(0,100) + ggtitle("mapping efficiency") #ggplot(mapStats, aes(condition, mapping_efficiency)) + geom_bar(stat="identity") +coord_flip() + ylim(0,100) + ggtitle("mapping efficiency")
ggsave2(p="mapstats") #ggsave2(p="mapstats")
ggplot(mapStats, aes(condition, num_reads)) + geom_bar(stat="identity") + coord_flip() + ggtitle("read counts") #ggplot(mapStats, aes(condition, num_reads)) + geom_bar(stat="identity") + coord_flip() + ggtitle("read counts")
ggsave2(p="mapstats") #ggsave2(p="mapstats")
#
ggplot(mapStats, aes(condition, unique_mappers)) + geom_bar(stat="identity") + coord_flip() + ggtitle("unique alignment") + scale_fill_discrete() #ggplot(mapStats, aes(condition, unique_mappers)) + geom_bar(stat="identity") + coord_flip() + ggtitle("unique alignment") + scale_fill_discrete()
ggsave2(p="mapstats") #ggsave2(p="mapstats")
' | R --vanilla #' | R --vanilla
} #}
export -f Bowtie2MappingReport #export -f Bowtie2MappingReport
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment