Mercurial > repos > immport-devteam > fcs_summary
comparison 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 |
comparison
equal
deleted
inserted
replaced
0:1d926a8daa92 | 1:d2749aa59d20 |
---|---|
1 #!/usr/bin/Rscript --vanilla | |
2 # FCS Summary Statistic Module for Galaxy | |
3 # FlowCore | |
4 ###################################################################### | |
5 # Copyright (c) 2016 Northrop Grumman. | |
6 # All rights reserved. | |
7 ###################################################################### | |
8 # | |
9 # Version 1 | |
10 # Cristel Thomas | |
11 # | |
12 # | |
13 | |
14 library(flowCore) | |
15 | |
16 getMarkerNames <- function(input, output) { | |
17 fcs <- read.FCS(input, transformation=F) | |
18 | |
19 ## marker names | |
20 channels <- colnames(fcs) | |
21 markers <- as.vector(pData(parameters(fcs))$desc) | |
22 df <- data.frame(channels, markers) | |
23 fcs_summary <- capture.output(summary(fcs)) | |
24 fcs_dim <- capture.output(dim(fcs)) | |
25 fcs_markers <- capture.output(df) | |
26 | |
27 | |
28 sink(output) | |
29 cat(fcs_dim, sep="\n") | |
30 cat("\n\n=========================\n") | |
31 cat("== FCS SUMMARY ==\n") | |
32 cat("=========================\n") | |
33 cat(fcs_summary, sep="\n") | |
34 cat("\n\n=========================\n") | |
35 cat("== MARKERS IN FCS ==\n") | |
36 cat("=========================\n") | |
37 cat(fcs_markers, sep="\n") | |
38 sink() | |
39 } | |
40 | |
41 checkFCS <- function(input_file, output_file) { | |
42 isValid <- F | |
43 # Check file beginning matches FCS standard | |
44 tryCatch({ | |
45 isValid <- isFCSfile(input_file) | |
46 }, error = function(ex) { | |
47 print (paste(" ! Error in isFCSfile", ex)) | |
48 }) | |
49 | |
50 if (isValid) { | |
51 getMarkerNames(input_file, output_file) | |
52 } else { | |
53 print (paste(input_file, "does not meet FCS standard")) | |
54 } | |
55 } | |
56 | |
57 args <- commandArgs(trailingOnly = TRUE) | |
58 checkFCS(args[1], args[2]) |