Mercurial > repos > artbio > sr_bowtie_dataset_annotation
changeset 7:3bddd7ab96e3 draft
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/sr_bowtie_dataset_annotation commit 1010eff91c8ce7415d50adaf2f83ecc278295df8"
author | artbio |
---|---|
date | Sun, 24 Oct 2021 23:52:11 +0000 |
parents | 8829656d6999 |
children | 3519c2de7fac |
files | barplot.r sr_bowtie_dataset_annotation.xml |
diffstat | 2 files changed, 36 insertions(+), 38 deletions(-) [+] |
line wrap: on
line diff
--- a/barplot.r Mon Oct 07 08:40:41 2019 -0400 +++ b/barplot.r Sun Oct 24 23:52:11 2021 +0000 @@ -3,10 +3,13 @@ q("no") } - # load packages that are provided in the conda env -options( show.error.messages=F, - error = function () { cat( geterrmessage(), file=stderr() ); q( "no", 1, F ) } ) +options(show.error.messages = F, + error = function() { + cat(geterrmessage(), file = stderr()) + q("no", 1, F) + } +) loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8") warnings() library(optparse) @@ -14,55 +17,50 @@ library(ggrepel) library(RColorBrewer) - -#Arguments -option_list = list( +option_list <- list( make_option( c("-i", "--input"), default = NA, - type = 'character', + type = "character", help = "Input file that contains count data (no header)" ), make_option( c("-o", "--barplot"), default = NA, - type = 'character', + type = "character", help = "PDF output file" ) ) -opt = parse_args(OptionParser(option_list = option_list), +opt <- parse_args(OptionParser(option_list = option_list), args = commandArgs(trailingOnly = TRUE)) - -## -annotations = read.delim(opt$input, header=F) -colnames(annotations) = c("sample", "class", "percent_of_reads", "total") -annotations$percent=round(annotations$percent_of_reads/annotations$total*100, digits=2) -# ggplot2 plotting +annotations <- read.delim(opt$input, header = F) +colnames(annotations) <- c("sample", "class", "percent_of_reads", "total") +annotations$percent <- round(annotations$percent_of_reads / annotations$total * 100, + digits = 2) +## ggplot2 plotting # Define the number of colors you want -Sasha.Trubetskoy.Palette <- c('#e6194b', '#3cb44b', '#ffe119', '#4363d8', '#f58231', - '#911eb4', '#46f0f0', '#f032e6', '#bcf60c', - '#008080', '#e6beff', '#9a6324', '#fffac8', '#800000', - '#aaffc3', '#808000', '#ffd8b1', '#000075', '#808080') -nb.cols <- 19 # 10 with colorRampPalette -# mycolors <- colorRampPalette(brewer.pal(8, "Paired"))(nb.cols) -mycolors <- Sasha.Trubetskoy.Palette[1:nb.cols] - -ggtitle('Class proportions') -ggplot(annotations, aes(x=total/2, y = percent_of_reads, fill = class, width = total)) + - geom_bar(position="fill", stat="identity") + - facet_wrap(~sample, ncol=3 ) + - geom_label_repel(aes(label = percent), position = position_fill(vjust = 0.5), size=2,show.legend = F) + - coord_polar(theta="y") + +mycolors <- c("#e6194b", "#3cb44b", "#ffe119", "#4363d8", "#f58231", + "#911eb4", "#46f0f0", "#f032e6", "#bcf60c", + "#008080", "#e6beff", "#9a6324", "#fffac8", "#800000", + "#aaffc3", "#808000", "#ffd8b1", "#000075", "#808080") +ggtitle("Class proportions") +ggplot(annotations, aes(x = total / 2, y = percent_of_reads, fill = class, width = total)) + + geom_bar(position = "fill", stat = "identity") + + facet_wrap(~sample, ncol = 3) + + geom_label_repel(aes(label = percent), position = position_fill(vjust = 0.5), + size = 2, show.legend = F) + + coord_polar(theta = "y") + labs(x = "Class fractions (%)") + scale_fill_manual(values = mycolors) + theme(axis.text = element_blank(), axis.ticks = element_blank(), panel.grid = element_blank(), axis.title.y = element_blank(), - legend.position="bottom") + - geom_text(aes(x = total/2, y= .5, label = paste(round(total/1000000, digits=3), "M"), vjust = 4, hjust=-1), size=2) -ggsave(file=opt$barplot, device="pdf") - + legend.position = "bottom") + + geom_text(aes(x = total / 2, y = .5, label = paste(round(total / 1000000, digits = 3), + "M"), + vjust = 4, hjust = -1), size = 2) +ggsave(file = opt$barplot, device = "pdf")
--- a/sr_bowtie_dataset_annotation.xml Mon Oct 07 08:40:41 2019 -0400 +++ b/sr_bowtie_dataset_annotation.xml Sun Oct 24 23:52:11 2021 +0000 @@ -1,10 +1,10 @@ -<tool id="sr_bowtie_dataset_annotation" name="Annotate smRNA dataset" version="2.4.0"> +<tool id="sr_bowtie_dataset_annotation" name="Annotate smRNA dataset" version="2.5.0"> <description>by iterative alignments with sRbowtie</description> <requirements> - <requirement type="package" version="1.1.2">bowtie</requirement> - <requirement type="package" version="1.6.0">r-optparse</requirement> - <requirement type="package" version="3.1.0">r-ggplot2</requirement> - <requirement type="package" version="0.8.0">r-ggrepel</requirement> + <requirement type="package" version="1.3.1">bowtie</requirement> + <requirement type="package" version="1.7.1">r-optparse</requirement> + <requirement type="package" version="3.3.5">r-ggplot2</requirement> + <requirement type="package" version="0.9.1">r-ggrepel</requirement> </requirements> <command detect_errors="exit_code"><![CDATA[ #if $refGenomeSource1.genomeSource == "history":