Commit fdb214a3 authored by Holger Brandl's avatar Holger Brandl

cont cutadapt pe report (still incomplete)

parent 2418d783
......@@ -78,24 +78,24 @@ readSummaryStats <- function(logFile){
# DEBUG logFile=logDataFiles[1]
data.frame(
Run=sub("^([^.]*).*", "\\1", basename(logFile)) %>% tidySamples,
No_of_processed_Reads=(paste("grep -F 'Total read' ", logFile ) %>% pipe() %>% readLines() %>% strsplit( "[^0-9]+") %>% unlist() %>% as.numeric())[2],
No_of_processed_Bases=(paste("grep -F 'Total basepairs processed' ", logFile ) %>% pipe() %>% readLines() %>% strsplit( "[^0-9]+") %>% unlist() %>% as.numeric())[2],
Trimmed_Reads=(paste("grep -F 'Trimmed reads' ", logFile ) %>% pipe() %>% readLines() %>% strsplit( "[^0-9\\.]+") %>% unlist() %>% as.numeric())[3],
Quality_trimmed=(paste("grep -F 'Quality-trimmed' ", logFile ) %>% pipe() %>% readLines() %>% strsplit( "[^0-9\\.]+") %>% unlist() %>% as.numeric())[4],
Trimmed_Bases=(paste("grep -F 'Trimmed bases' ", logFile ) %>% pipe() %>% readLines() %>% strsplit( "[^0-9\\.]+") %>% unlist() %>% as.numeric())[4],
Too_short_Reads=(paste("grep -F 'Too short reads' ", logFile ) %>% pipe() %>% readLines() %>% strsplit( "[^0-9\\.]+") %>% unlist() %>% as.numeric())[3]
No_of_processed_Reads=paste("grep -F 'Total read pairs processed' ", logFile ) %>% pipe() %>% readLines() %>% str_split(fixed(":")) %>% unlist() %>% {.[2]} %>% str_trim %>% str_replace(",", "") %>% as.numeric(),
No_of_processed_Bases=paste("grep -F 'Total basepairs processed' ", logFile ) %>% pipe() %>% readLines() %>% str_replace_all(",", "") %>% strsplit( "[^0-9]+") %>% unlist() %>% as.numeric() %>% {.[2]} ,
# Trimmed_Reads=(paste("grep -F 'Trimmed reads' ", logFile ) %>% pipe() %>% readLines() %>% strsplit( "[^0-9\\.]+") %>% unlist() %>% as.numeric())[3],
Quality_trimmed=paste("grep -F 'Quality-trimmed' ", logFile ) %>% pipe() %>% readLines() %>% str_replace_all(",", "") %>% strsplit( "[^0-9\\.]+") %>% unlist() %>% as.numeric()%>% {.[3]},
# Trimmed_Bases=(paste("grep -F 'Trimmed bases' ", logFile ) %>% pipe() %>% readLines() %>% strsplit( "[^0-9\\.]+") %>% unlist() %>% as.numeric())[4],
Too_short_Reads=paste("grep -F 'too short' ", logFile ) %>% pipe() %>% readLines() %>% str_replace_all(",", "")%>% strsplit( "[^0-9\\.]+") %>% unlist() %>% as.numeric()%>% {.[3]}
)
}
trimmingStats <- logDataFiles %>% map_df(readSummaryStats)
#+ results = 'asis'
trimmingStats %>% head() %>% kable()
trimmingStats %>% table_browser()
write_tsv(trimmingStats, file="cutadapt_summary.trimmingStats.txt")
#' [Trimming Statistics](cutadapt_summary.trimmingStats.txt)
myfun <- function(x) x/100
trimmingStats <- mutate_each(trimmingStats, funs(myfun), Trimmed_Reads, Quality_trimmed, Trimmed_Bases, Too_short_Reads)
# myfun <- function(x) x/100
# trimmingStats <- mutate_each(trimmingStats, funs(myfun), Trimmed_Reads, Quality_trimmed, Trimmed_Bases, Too_short_Reads)
#+ fig.height=nrow(trimmingStats)/3, fig.width=12
require(scales)
......
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