Mercurial > repos > immport-devteam > fcs_summary
diff FCSstats.R @ 1:d2749aa59d20 draft default tip
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/fcs_summary commit 72efaa6d006ddda6c8eed10ec9ba541cbdecf3a8"
author | azomics |
---|---|
date | Mon, 22 Jun 2020 17:33:38 -0400 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FCSstats.R Mon Jun 22 17:33:38 2020 -0400 @@ -0,0 +1,58 @@ +#!/usr/bin/Rscript --vanilla +# FCS Summary Statistic Module for Galaxy +# FlowCore +###################################################################### +# Copyright (c) 2016 Northrop Grumman. +# All rights reserved. +###################################################################### +# +# Version 1 +# Cristel Thomas +# +# + +library(flowCore) + +getMarkerNames <- function(input, output) { + fcs <- read.FCS(input, transformation=F) + + ## marker names + channels <- colnames(fcs) + markers <- as.vector(pData(parameters(fcs))$desc) + df <- data.frame(channels, markers) + fcs_summary <- capture.output(summary(fcs)) + fcs_dim <- capture.output(dim(fcs)) + fcs_markers <- capture.output(df) + + + sink(output) + cat(fcs_dim, sep="\n") + cat("\n\n=========================\n") + cat("== FCS SUMMARY ==\n") + cat("=========================\n") + cat(fcs_summary, sep="\n") + cat("\n\n=========================\n") + cat("== MARKERS IN FCS ==\n") + cat("=========================\n") + cat(fcs_markers, sep="\n") + sink() +} + +checkFCS <- function(input_file, output_file) { + isValid <- F + # Check file beginning matches FCS standard + tryCatch({ + isValid <- isFCSfile(input_file) + }, error = function(ex) { + print (paste(" ! Error in isFCSfile", ex)) + }) + + if (isValid) { + getMarkerNames(input_file, output_file) + } else { + print (paste(input_file, "does not meet FCS standard")) + } +} + +args <- commandArgs(trailingOnly = TRUE) +checkFCS(args[1], args[2])