changeset 0:1d926a8daa92 draft

Uploaded
author immport-devteam
date Mon, 27 Feb 2017 12:53:11 -0500
parents
children d2749aa59d20
files fcs_summary/FCSstats.R fcs_summary/FCSstats.xml fcs_summary/test-data/summary.txt fcs_summary/test-data/testfcs1.fcs
diffstat 4 files changed, 170 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fcs_summary/FCSstats.R	Mon Feb 27 12:53:11 2017 -0500
@@ -0,0 +1,57 @@
+# 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[2], args[3])
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fcs_summary/FCSstats.xml	Mon Feb 27 12:53:11 2017 -0500
@@ -0,0 +1,73 @@
+<tool id="get_fcs_stats" name="Get summary" version="1.0">
+  <description>of FCS files.</description>
+  <requirements>
+    <requirement type="package" version="3.3.0">r</requirement>
+     <requirement type="package" version="1.38.2">bioconductor-flowcore</requirement>
+  </requirements>
+  <stdio>
+    <exit_code range="2:" level="fatal" description="See stderr for more details." />
+  </stdio>
+  <command><![CDATA[
+      Rscript --slave --vanilla $__tool_directory__/FCSstats.R --args "${input}" "${output}"
+  ]]>
+  </command>
+  <inputs>
+    <param format="fcs" name="input" type="data" label="FCS file"/>
+  </inputs>
+  <outputs>
+    <data format="txt" name="output" label="Summary statisitics of ${input.name}"/>
+  </outputs>
+  <tests>
+    <test>
+      <param name="input" value="testfcs1.fcs"/>
+      <output name="output" file="summary.txt"/>
+    </test>
+  </tests>
+  <help><![CDATA[
+   This tool generates a summary of a FCS file and list of markers.
+
+-----
+
+**Input file**
+
+This tool uses valid FCS files as input.
+
+**Output file**
+
+FCS file summary includes number of events, list of markers and parameters, and summary statistics for each.
+
+-----
+
+**Example**
+
+*Output*::
+
+       events parameters
+        20000          6
+
+
+   =========================
+   ==     FCS SUMMARY     ==
+   =========================
+           FSC-H SSC-H FL1-H FL2-H  FL3-H  FL4-H
+   Min.      261    23   0.0   0.0    0.0    0.0
+   1st Qu.   371   120 129.0 153.0  257.0  252.0
+   Median    432   196 206.0 237.0  432.0  331.0
+   Mean      512   476 284.8 236.7  433.2  372.3
+   3rd Qu.   657  1023 499.0 297.0  628.0  510.0
+   Max.     1023  1023 729.0 925.0 1023.0 1023.0
+
+
+   =========================
+   ==    MARKERS IN FCS   ==
+   =========================
+     channels         markers
+   1    FSC-H Forward Scatter
+   2    SSC-H    Side Scatter
+   3    FL1-H        FITC CD4
+   4    FL2-H         PE CD25
+   5    FL3-H          PP CD3
+   6    FL4-H      APC CD45RA
+  ]]>
+  </help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fcs_summary/test-data/summary.txt	Mon Feb 27 12:53:11 2017 -0500
@@ -0,0 +1,40 @@
+    events parameters 
+        10         13 
+
+
+=========================
+==     FCS SUMMARY     ==
+=========================
+         FSC-A  FSC-H  SSC-A  SSC-H   APC-A APC-H7-A  FITC-A PerCP-Cy5-5-A
+Min.      9081   8811  10500  10120  -76.00    168.0   55.51         19.11
+1st Qu.  22040  17990  35210  33090  -50.92    432.4  219.50         69.84
+Median   55080  50380  60520  56110  123.90   1412.0  312.60        190.20
+Mean     69950  58340  67560  57540  553.30   3196.0  758.60       1227.00
+3rd Qu. 100700  90200 100500  71740  232.20   3797.0 1198.00        678.40
+Max.    170500 136000 138000 114000 2955.00  12540.0 2421.00       9038.00
+          V450-A   V500-A   PE-A PE-Cy7-A  Time
+Min.       -7.68     7.68 -12.74   -11.76 0.000
+1st Qu.   147.80   315.80   6.86    46.55 0.025
+Median    638.90  5000.00 168.10   196.50 0.150
+Mean     1956.00  7151.00 180.30   434.20 0.130
+3rd Qu.  1275.00 11500.00 252.10   766.90 0.200
+Max.    12950.00 24690.00 620.30  1694.00 0.300
+
+
+=========================
+==    MARKERS IN FCS   ==
+=========================
+        Channels Markers
+1          FSC-A    <NA>
+2          FSC-H    <NA>
+3          SSC-A    <NA>
+4          SSC-H    <NA>
+5          APC-A   CD127
+6       APC-H7-A  CD45RO
+7         FITC-A    LIVE
+8  PerCP-Cy5-5-A     CD4
+9         V450-A     CD3
+10        V500-A  HLA-DR
+11          PE-A    CD25
+12      PE-Cy7-A    CCR4
+13          Time    <NA>
Binary file fcs_summary/test-data/testfcs1.fcs has changed