# HG changeset patch # User azomics # Date 1592862791 14400 # Node ID b73fc4860906f8d03f6c3fb85202d53c508f1b0a "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/ggcyto_1d_density_plots commit b32c86c02e138aa291c869b31351c4970300fbb4" diff -r 000000000000 -r b73fc4860906 FCS1Dplotggcyto.R --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FCS1Dplotggcyto.R Mon Jun 22 17:53:11 2020 -0400 @@ -0,0 +1,88 @@ +#!/usr/bin/Rscript +# 1D Density Plot Module for Galaxy +# ggcyto +###################################################################### +# Copyright (c) 2016 Northrop Grumman. +# All rights reserved. +###################################################################### +# +# Version 1 +# Cristel Thomas +# +# + +library(ggcyto) + +generate1Dplot <- function(input, output, flag_pdf=FALSE, trans_method="None", + factor="", log_w=0.5, log_t=262144, log_m=4.5) { + fcsfs <- read.flowSet(input, transformation=F) + h <- 800 + w <- 1200 + if ("colnames" %in% names(attributes(fcsfs)) && length(fcsfs@colnames)>12){ + h <- 1200 + w <- 1600 + } + p <- autoplot(fcsfs[[1]]) + if (trans_method == "arcsinh") { + p <- p + scale_x_flowCore_fasinh(a = 0, b = factor, c = 0) + geom_density(fill="steelblue", alpha=0.5) + } else if (trans_method == "logicle") { + p <- p + scale_x_logicle(w=log_w, t=log_t, m=log_m) + geom_density(fill="paleturquoise", alpha=0.5) + } + + if (flag_pdf) { + pdf(output, useDingbats=FALSE, onefile=TRUE) + print({ + p + }) + dev.off() + } else { + png(output, type="cairo", height=h, width=w) + print({ + p + }) + dev.off() + } +} + +checkFCS <- function(input_file, output_file, flag_pdf=FALSE, trans_met="None", + factor="", w=0.5, t=262144, m=4.5) { + isValid <- F + # Check file beginning matches FCS standard + tryCatch({ + isValid <- isFCSfile(input_file) + }, error = function(ex) { + print (paste(" ! Error in isFCSfile", ex)) + }) + + if (isValid) { + generate1Dplot(input_file, output_file, flag_pdf, trans_met, + factor, w, t, m) + } else { + print (paste(input_file, "does not meet FCS standard")) + } +} + +args <- commandArgs(trailingOnly = TRUE) +flag_pdf <- FALSE +trans_method <- "None" +scaling_factor <- 1 / 150 +w <- 0.5 +t <- 262144 +m <- 4.5 + +if (args[3] == "PDF"){ + flag_pdf <- TRUE +} + +if (args[4]!="None"){ + trans_method <- args[4] + if (args[4] == "arcsinh"){ + scaling_factor <- 1 / as.numeric(args[5]) + } else if (args[4] == "logicle"){ + w <- args[5] + t <- args[6] + m <- args[7] + } +} + +checkFCS(args[1], args[2], flag_pdf, trans_method, scaling_factor, w, t, m) diff -r 000000000000 -r b73fc4860906 FCS1Dplotggcyto.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FCS1Dplotggcyto.xml Mon Jun 22 17:53:11 2020 -0400 @@ -0,0 +1,119 @@ + + for FCS file + + bioconductor-ggcyto + + r-ggplot2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 10.1186/1471-2105-10-106 + + diff -r 000000000000 -r b73fc4860906 test-data/graph.pdf Binary file test-data/graph.pdf has changed diff -r 000000000000 -r b73fc4860906 test-data/graph.png Binary file test-data/graph.png has changed diff -r 000000000000 -r b73fc4860906 test-data/graph1.png Binary file test-data/graph1.png has changed diff -r 000000000000 -r b73fc4860906 test-data/graph2.png Binary file test-data/graph2.png has changed diff -r 000000000000 -r b73fc4860906 test-data/testfcs1.fcs Binary file test-data/testfcs1.fcs has changed