Mercurial > repos > artbio > mapping_quality_stats
comparison mapping_quality_stats.r @ 0:f00479673d47 draft
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mapping_quality_stats commit e4b37874b820a2ac48732667128a08e5755b7c4b
author | artbio |
---|---|
date | Wed, 15 Jun 2022 10:43:07 +0000 |
parents | |
children | ce2d8f611a51 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f00479673d47 |
---|---|
1 ## Setup R error handling to go to stderr | |
2 options(show.error.messages = FALSE, | |
3 error = function() { | |
4 cat(geterrmessage(), file = stderr()) | |
5 q("no", 1, FALSE) | |
6 } | |
7 ) | |
8 | |
9 | |
10 warnings() | |
11 library(optparse) | |
12 library(ggplot2) | |
13 | |
14 option_list <- list( | |
15 make_option(c("-i", "--input"), type = "character", help = "Path to tabular file"), | |
16 make_option(c("-o", "--output"), type = "character", help = "path to the pdf plot") | |
17 ) | |
18 | |
19 parser <- OptionParser(usage = "%prog [options] file", option_list = option_list) | |
20 args <- parse_args(parser) | |
21 | |
22 # data frame implementation | |
23 table <- read.delim(args$input, header = TRUE) | |
24 colnames(table) <- c("MAPQ", "Counts") | |
25 | |
26 | |
27 # Barplot | |
28 pdf(file = args$output) | |
29 ggplot(table, aes(x = MAPQ, y = Counts)) + | |
30 geom_bar(stat = "identity") | |
31 devname <- dev.off() |