# HG changeset patch
# User azomics
# Date 1592860941 14400
# Node ID 1d5e530c8a5eeffb751150da733603c39ce78694
# Parent dc00746654dce5f0a9de08cedd71610dd620ae1e
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/extract_fcs_keywords commit f0a40d58aec0a657b60df338c79dc1ee8e510aa0"
diff -r dc00746654dc -r 1d5e530c8a5e FCSKeyword.R
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/FCSKeyword.R Mon Jun 22 17:22:21 2020 -0400
@@ -0,0 +1,73 @@
+#!/usr/bin/env Rscript
+# ImmPort FCSKeywords
+######################################################################
+# Copyright (c) 2016 Northrop Grumman.
+# All rights reserved.
+######################################################################
+#
+# Converts the FCS file to text without transformaton
+# To run in R
+# 1) library(flowCore)
+# 2) source("FCSKeyword.R")
+# 3) transformFCS("filename")
+#
+# Version 1.4.1
+# March 2016 -- added lines to run directly from command line
+#
+
+library(flowCore)
+
+#
+# Starting function for processing a FCS file
+#
+extractKeywords <- function(input_file, keyword_file="", debug=FALSE) {
+ #
+ # Generate the file names for the output_file and keyword_file
+ #
+ pieces <- unlist(strsplit(input_file, .Platform$file.sep))
+ filename <- pieces[length(pieces)]
+
+ if (keyword_file == "") {
+ filepieces <- unlist(strsplit(filename, '\\.'))
+ #replace .fcs with .keyword; append .keyword if not ending in .fcs
+ if (filepieces[length(filepieces)] == 'fcs') {
+ filepieces[length(filepieces)] = 'keyword'
+ } else {
+ filepieces[length(filepieces)+1] = 'keyword'
+ }
+ keyword_file <- paste(filepieces, collapse = '.')
+ }
+
+ if (debug) {
+ print (paste("Converting file: ", input_file))
+ print (paste("Original file name: ", filename))
+ print (paste("Output file name: ", output_file))
+ print (paste("Keyword file name: ", keyword_file))
+ }
+ fcs <- read.FCS(input_file, transformation=F)
+ keywords <- keyword(fcs)
+ write.table(as.matrix(keywords), file=keyword_file, quote=F,
+ row.names=T, col.names=F, sep='=', append=F)
+}
+
+# Extract Keywords
+# @param input_file FCS file to be transformed
+# @param keyword_file FCS file keywords ".keywords" extension"
+transformFCS <- function(input_file, keyword_file="", debug=FALSE) {
+ isValid <- F
+ # Check file beginning matches FCS standard
+ tryCatch({
+ isValid = isFCSfile(input_file)
+ }, error = function(ex) {
+ print (paste(" ! Error in isFCSfile", ex))
+ })
+
+ if (isValid) {
+ extractKeywords(input_file, keyword_file, debug)
+ } else {
+ print (paste(input_file, "does not meet FCS standard"))
+ }
+}
+
+args <- commandArgs(TRUE)
+transformFCS(args[1], args[2])
diff -r dc00746654dc -r 1d5e530c8a5e extractKeywords.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/extractKeywords.xml Mon Jun 22 17:22:21 2020 -0400
@@ -0,0 +1,69 @@
+
diff -r dc00746654dc -r 1d5e530c8a5e extract_fcs_keywords/FCSKeyword.R
--- a/extract_fcs_keywords/FCSKeyword.R Mon Feb 27 12:49:02 2017 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-# ImmPort FCSKeywords
-######################################################################
-# Copyright (c) 2016 Northrop Grumman.
-# All rights reserved.
-######################################################################
-#
-# Converts the FCS file to text without transformaton
-# To run in R
-# 1) library(flowCore)
-# 2) source("FCSKeyword.R")
-# 3) transformFCS("filename")
-#
-# Version 1.4.1
-# March 2016 -- added lines to run directly from command line
-#
-
-library(flowCore)
-
-#
-# Starting function for processing a FCS file
-#
-extractKeywords <- function(input_file, keyword_file="", debug=FALSE) {
- #
- # Generate the file names for the output_file and keyword_file
- #
- pieces <- unlist(strsplit(input_file, .Platform$file.sep))
- filename <- pieces[length(pieces)]
-
- if (keyword_file == "") {
- filepieces <- unlist(strsplit(filename, '\\.'))
- #replace .fcs with .keyword; append .keyword if not ending in .fcs
- if (filepieces[length(filepieces)] == 'fcs') {
- filepieces[length(filepieces)] = 'keyword'
- } else {
- filepieces[length(filepieces)+1] = 'keyword'
- }
- keyword_file <- paste(filepieces, collapse = '.')
- }
-
- if (debug) {
- print (paste("Converting file: ", input_file))
- print (paste("Original file name: ", filename))
- print (paste("Output file name: ", output_file))
- print (paste("Keyword file name: ", keyword_file))
- }
- fcs <- read.FCS(input_file, transformation=F)
- keywords <- keyword(fcs)
- write.table(as.matrix(keywords), file=keyword_file, quote=F,
- row.names=T, col.names=F, sep='=', append=F)
-}
-
-# Extract Keywords
-# @param input_file FCS file to be transformed
-# @param keyword_file FCS file keywords ".keywords" extension"
-transformFCS <- function(input_file, keyword_file="", debug=FALSE) {
- isValid <- F
- # Check file beginning matches FCS standard
- tryCatch({
- isValid = isFCSfile(input_file)
- }, error = function(ex) {
- print (paste(" ! Error in isFCSfile", ex))
- })
-
- if (isValid) {
- extractKeywords(input_file, keyword_file, debug)
- } else {
- print (paste(input_file, "does not meet FCS standard"))
- }
-}
-
-args <- commandArgs(TRUE)
-transformFCS(args[2], args[3])
diff -r dc00746654dc -r 1d5e530c8a5e extract_fcs_keywords/extractKeywords.xml
--- a/extract_fcs_keywords/extractKeywords.xml Mon Feb 27 12:49:02 2017 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-
diff -r dc00746654dc -r 1d5e530c8a5e extract_fcs_keywords/test-data/out.tabular
--- a/extract_fcs_keywords/test-data/out.tabular Mon Feb 27 12:49:02 2017 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,220 +0,0 @@
-APPLY COMPENSATION=TRUE
-AUTOBS=TRUE
-$BEGINANALYSIS=0
-$BEGINDATA=4305
-$BEGINSTEXT=0
-$BTIM=10:59:24
-$BYTEORD=4,3,2,1
-COCKTAIL ID=Lot 35286
-CREATOR=BD FACSDiva Software Version 6.1.3
-CST BASELINE DATE=10/27/2011 10:45:28 AM
-CST BEADS LOT ID=18360
-CST SETUP DATE=01/25/2012 10:07:54 AM
-CST SETUP STATUS=SUCCESS
-$CYT=FORTESSA (LSRII)
-CYTNUM=H1773014
-CYTOMETER CONFIG CREATE DATE=01/15/2010 10:41:45 AM
-CYTOMETER CONFIG NAME=MASTER Configuration 01-10
-$DATATYPE=F
-$DATE=16-APR-2013
-$ENDANALYSIS=0
-$ENDDATA=4824
-$ENDSTEXT=0
-$ETIM=11:02:17
-EXPERIMENT NAME=LYOPLATE EXP 041613
-EXPORT TIME=17-APR-2013-09:37:47
-EXPORT USER NAME=FlowU19P1
-FCSversion=3
-$FIL=12828_1_T REG.fcs
-FILENAME=/home/galaxy/immport-galaxy/database/files/000/dataset_951.dat
-flowCore_$P10Rmax=262143
-flowCore_$P10Rmin=-111
-flowCore_$P11Rmax=262143
-flowCore_$P11Rmin=-111
-flowCore_$P12Rmax=262143
-flowCore_$P12Rmin=-111
-flowCore_$P13Rmax=262143
-flowCore_$P13Rmin=0
-flowCore_$P1Rmax=262143
-flowCore_$P1Rmin=-111
-flowCore_$P2Rmax=262143
-flowCore_$P2Rmin=0
-flowCore_$P3Rmax=262143
-flowCore_$P3Rmin=-111
-flowCore_$P4Rmax=262143
-flowCore_$P4Rmin=0
-flowCore_$P5Rmax=262143
-flowCore_$P5Rmin=-111
-flowCore_$P6Rmax=262143
-flowCore_$P6Rmin=-111
-flowCore_$P7Rmax=262143
-flowCore_$P7Rmin=-111
-flowCore_$P8Rmax=262143
-flowCore_$P8Rmin=-111
-flowCore_$P9Rmax=262143
-flowCore_$P9Rmin=-111
-FSC ASF=0.75
-GUID=b95e2ce8-2c89-419f-9917-b86181233086
-$INST=BIIR
-INSTITUTE=BIIR
-LASER1ASF=0.91
-LASER1DELAY=0.00
-LASER1NAME=Blue
-LASER2ASF=0.98
-LASER2DELAY=59.85
-LASER2NAME=Green
-LASER3ASF=0.76
-LASER3DELAY=38.02
-LASER3NAME=Red
-LASER4ASF=0.96
-LASER4DELAY=21.05
-LASER4NAME=Violet
-$MODE=L
-$NEXTDATA=0
-$OP=FlowU19P1
-OPERATOR=KK
-ORIGINALGUID=b95e2ce8-2c89-419f-9917-b86181233086
-$P10B=32
-P10BS=2580
-P10DISPLAY=LOG
-$P10E=0,0
-$P10G=1.0
-P10MS=0
-$P10N=V500-A
-$P10R=262144
-$P10S=HLA-DR
-$P10V=518
-$P11B=32
-P11BS=4535
-P11DISPLAY=LOG
-$P11E=0,0
-$P11G=1.0
-P11MS=0
-$P11N=PE-A
-$P11R=262144
-$P11S=CD25
-$P11V=552
-$P12B=32
-P12BS=856
-P12DISPLAY=LOG
-$P12E=0,0
-$P12G=1.0
-P12MS=0
-$P12N=PE-Cy7-A
-$P12R=262144
-$P12S=CCR4
-$P12V=548
-$P13B=32
-P13BS=0
-$P13E=0,0
-$P13G=0.01
-P13MS=0
-$P13N=Time
-$P13R=262144
-$P13S=
-$P1B=32
-P1BS=0
-P1DISPLAY=LIN
-$P1E=0,0
-$P1G=1.0
-P1MS=0
-$P1N=FSC-A
-$P1R=262144
-$P1S=
-$P1V=270
-$P2B=32
-P2BS=0
-P2DISPLAY=LIN
-$P2E=0,0
-$P2G=1.0
-P2MS=0
-$P2N=FSC-H
-$P2R=262144
-$P2S=
-$P2V=270
-$P3B=32
-P3BS=0
-P3DISPLAY=LIN
-$P3E=0,0
-$P3G=1.0
-P3MS=0
-$P3N=SSC-A
-$P3R=262144
-$P3S=
-$P3V=295
-$P4B=32
-P4BS=0
-P4DISPLAY=LIN
-$P4E=0,0
-$P4G=1.0
-P4MS=0
-$P4N=SSC-H
-$P4R=262144
-$P4S=
-$P4V=295
-$P5B=32
-P5BS=2481
-P5DISPLAY=LOG
-$P5E=0,0
-$P5G=1.0
-P5MS=0
-$P5N=APC-A
-$P5R=262144
-$P5S=CD127
-$P5V=630
-$P6B=32
-P6BS=1788
-P6DISPLAY=LOG
-$P6E=0,0
-$P6G=1.0
-P6MS=0
-$P6N=APC-H7-A
-$P6R=262144
-$P6S=CD45RO
-$P6V=735
-$P7B=32
-P7BS=3936
-P7DISPLAY=LOG
-$P7E=0,0
-$P7G=1.0
-P7MS=0
-$P7N=FITC-A
-$P7R=262144
-$P7S=LIVE
-$P7V=570
-$P8B=32
-P8BS=2019
-P8DISPLAY=LOG
-$P8E=0,0
-$P8G=1.0
-P8MS=0
-$P8N=PerCP-Cy5-5-A
-$P8R=262144
-$P8S=CD4
-$P8V=518
-$P9B=32
-P9BS=5452
-P9DISPLAY=LOG
-$P9E=0,0
-$P9G=1.0
-P9MS=0
-$P9N=V450-A
-$P9R=262144
-$P9S=CD3
-$P9V=380
-$PAR=13
-PROJECT #=
-PROJECT NAME=Lyoplate
-SAMPLE ID=12828
-SAMPLE TYPE=PBMC frozen
-SPILL=c(1, 0.0067379445170813, 0.0010783895436113, 0.102144814292574, 0.000101211278412214, 0.000652683357261773, 0.00182247839595363, 0.000577691677250781, 0.202015783876003, 1, 0.00222910936570335, 0.139363365250402, 0, 0, 0.000545240559240861, 0.336431027409918, 0, 0, 1, 0, 0.00668187695651775, 0.0406011491912338, 0.000913908302803783, 0.00220095872247462, 0.0119306783002532, 0.000223058031772544, 0.165872313856347, 1, 0.000242930913850066, 0.00270538171399042, 0.109681715733056, 0.00852060469666518,
-0.000415952526118246, 0.000274558421533846, 0.00722997160274543, 0.00330843124258504, 1, 0.0401369777624418, 0.000114293981812179, 0.000232181416368999, 0.000260324906555768, 7.85220538064485e-05, 0.0759670373604685, 0, 0.760397293276194, 1, 8.17114175730858e-05, 0.000165858901439273, 5.26276753201359e-05, 0, 0.581890441342821, 0.000423034819434245, 0, 0.000135799571265989, 1, 0.0826011942722407, 0.00750627934931762, 0.0319900905590346, 0.00535275217478571, 0.0443177036646392, 0, 0, 0.00509974622089483,
-1)
-$SRC=12828_1
-$SYS=Windows XP 5.1
-THRESHOLD=FSC,5000
-$TIMESTEP=0.01
-$TOT=10
-transformation=applied
-TUBE NAME=T REG
-WINDOW EXTENSION=10.00
diff -r dc00746654dc -r 1d5e530c8a5e extract_fcs_keywords/test-data/testfcs1.fcs
Binary file extract_fcs_keywords/test-data/testfcs1.fcs has changed
diff -r dc00746654dc -r 1d5e530c8a5e test-data/out.tabular
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/out.tabular Mon Jun 22 17:22:21 2020 -0400
@@ -0,0 +1,220 @@
+APPLY COMPENSATION=TRUE
+AUTOBS=TRUE
+$BEGINANALYSIS=0
+$BEGINDATA=4305
+$BEGINSTEXT=0
+$BTIM=10:59:24
+$BYTEORD=4,3,2,1
+COCKTAIL ID=Lot 35286
+CREATOR=BD FACSDiva Software Version 6.1.3
+CST BASELINE DATE=10/27/2011 10:45:28 AM
+CST BEADS LOT ID=18360
+CST SETUP DATE=01/25/2012 10:07:54 AM
+CST SETUP STATUS=SUCCESS
+$CYT=FORTESSA (LSRII)
+CYTNUM=H1773014
+CYTOMETER CONFIG CREATE DATE=01/15/2010 10:41:45 AM
+CYTOMETER CONFIG NAME=MASTER Configuration 01-10
+$DATATYPE=F
+$DATE=16-APR-2013
+$ENDANALYSIS=0
+$ENDDATA=4824
+$ENDSTEXT=0
+$ETIM=11:02:17
+EXPERIMENT NAME=LYOPLATE EXP 041613
+EXPORT TIME=17-APR-2013-09:37:47
+EXPORT USER NAME=FlowU19P1
+FCSversion=3
+$FIL=12828_1_T REG.fcs
+FILENAME=/home/galaxy/immport-galaxy/database/files/000/dataset_951.dat
+flowCore_$P10Rmax=262143
+flowCore_$P10Rmin=-111
+flowCore_$P11Rmax=262143
+flowCore_$P11Rmin=-111
+flowCore_$P12Rmax=262143
+flowCore_$P12Rmin=-111
+flowCore_$P13Rmax=262143
+flowCore_$P13Rmin=0
+flowCore_$P1Rmax=262143
+flowCore_$P1Rmin=-111
+flowCore_$P2Rmax=262143
+flowCore_$P2Rmin=0
+flowCore_$P3Rmax=262143
+flowCore_$P3Rmin=-111
+flowCore_$P4Rmax=262143
+flowCore_$P4Rmin=0
+flowCore_$P5Rmax=262143
+flowCore_$P5Rmin=-111
+flowCore_$P6Rmax=262143
+flowCore_$P6Rmin=-111
+flowCore_$P7Rmax=262143
+flowCore_$P7Rmin=-111
+flowCore_$P8Rmax=262143
+flowCore_$P8Rmin=-111
+flowCore_$P9Rmax=262143
+flowCore_$P9Rmin=-111
+FSC ASF=0.75
+GUID=b95e2ce8-2c89-419f-9917-b86181233086
+$INST=BIIR
+INSTITUTE=BIIR
+LASER1ASF=0.91
+LASER1DELAY=0.00
+LASER1NAME=Blue
+LASER2ASF=0.98
+LASER2DELAY=59.85
+LASER2NAME=Green
+LASER3ASF=0.76
+LASER3DELAY=38.02
+LASER3NAME=Red
+LASER4ASF=0.96
+LASER4DELAY=21.05
+LASER4NAME=Violet
+$MODE=L
+$NEXTDATA=0
+$OP=FlowU19P1
+OPERATOR=KK
+ORIGINALGUID=b95e2ce8-2c89-419f-9917-b86181233086
+$P10B=32
+P10BS=2580
+P10DISPLAY=LOG
+$P10E=0,0
+$P10G=1.0
+P10MS=0
+$P10N=V500-A
+$P10R=262144
+$P10S=HLA-DR
+$P10V=518
+$P11B=32
+P11BS=4535
+P11DISPLAY=LOG
+$P11E=0,0
+$P11G=1.0
+P11MS=0
+$P11N=PE-A
+$P11R=262144
+$P11S=CD25
+$P11V=552
+$P12B=32
+P12BS=856
+P12DISPLAY=LOG
+$P12E=0,0
+$P12G=1.0
+P12MS=0
+$P12N=PE-Cy7-A
+$P12R=262144
+$P12S=CCR4
+$P12V=548
+$P13B=32
+P13BS=0
+$P13E=0,0
+$P13G=0.01
+P13MS=0
+$P13N=Time
+$P13R=262144
+$P13S=
+$P1B=32
+P1BS=0
+P1DISPLAY=LIN
+$P1E=0,0
+$P1G=1.0
+P1MS=0
+$P1N=FSC-A
+$P1R=262144
+$P1S=
+$P1V=270
+$P2B=32
+P2BS=0
+P2DISPLAY=LIN
+$P2E=0,0
+$P2G=1.0
+P2MS=0
+$P2N=FSC-H
+$P2R=262144
+$P2S=
+$P2V=270
+$P3B=32
+P3BS=0
+P3DISPLAY=LIN
+$P3E=0,0
+$P3G=1.0
+P3MS=0
+$P3N=SSC-A
+$P3R=262144
+$P3S=
+$P3V=295
+$P4B=32
+P4BS=0
+P4DISPLAY=LIN
+$P4E=0,0
+$P4G=1.0
+P4MS=0
+$P4N=SSC-H
+$P4R=262144
+$P4S=
+$P4V=295
+$P5B=32
+P5BS=2481
+P5DISPLAY=LOG
+$P5E=0,0
+$P5G=1.0
+P5MS=0
+$P5N=APC-A
+$P5R=262144
+$P5S=CD127
+$P5V=630
+$P6B=32
+P6BS=1788
+P6DISPLAY=LOG
+$P6E=0,0
+$P6G=1.0
+P6MS=0
+$P6N=APC-H7-A
+$P6R=262144
+$P6S=CD45RO
+$P6V=735
+$P7B=32
+P7BS=3936
+P7DISPLAY=LOG
+$P7E=0,0
+$P7G=1.0
+P7MS=0
+$P7N=FITC-A
+$P7R=262144
+$P7S=LIVE
+$P7V=570
+$P8B=32
+P8BS=2019
+P8DISPLAY=LOG
+$P8E=0,0
+$P8G=1.0
+P8MS=0
+$P8N=PerCP-Cy5-5-A
+$P8R=262144
+$P8S=CD4
+$P8V=518
+$P9B=32
+P9BS=5452
+P9DISPLAY=LOG
+$P9E=0,0
+$P9G=1.0
+P9MS=0
+$P9N=V450-A
+$P9R=262144
+$P9S=CD3
+$P9V=380
+$PAR=13
+PROJECT #=
+PROJECT NAME=Lyoplate
+SAMPLE ID=12828
+SAMPLE TYPE=PBMC frozen
+SPILL=c(1, 0.0067379445170813, 0.0010783895436113, 0.102144814292574, 0.000101211278412214, 0.000652683357261773, 0.00182247839595363, 0.000577691677250781, 0.202015783876003, 1, 0.00222910936570335, 0.139363365250402, 0, 0, 0.000545240559240861, 0.336431027409918, 0, 0, 1, 0, 0.00668187695651775, 0.0406011491912338, 0.000913908302803783, 0.00220095872247462, 0.0119306783002532, 0.000223058031772544, 0.165872313856347, 1, 0.000242930913850066, 0.00270538171399042, 0.109681715733056, 0.00852060469666518,
+0.000415952526118246, 0.000274558421533846, 0.00722997160274543, 0.00330843124258504, 1, 0.0401369777624418, 0.000114293981812179, 0.000232181416368999, 0.000260324906555768, 7.85220538064485e-05, 0.0759670373604685, 0, 0.760397293276194, 1, 8.17114175730858e-05, 0.000165858901439273, 5.26276753201359e-05, 0, 0.581890441342821, 0.000423034819434245, 0, 0.000135799571265989, 1, 0.0826011942722407, 0.00750627934931762, 0.0319900905590346, 0.00535275217478571, 0.0443177036646392, 0, 0, 0.00509974622089483,
+1)
+$SRC=12828_1
+$SYS=Windows XP 5.1
+THRESHOLD=FSC,5000
+$TIMESTEP=0.01
+$TOT=10
+transformation=applied
+TUBE NAME=T REG
+WINDOW EXTENSION=10.00
diff -r dc00746654dc -r 1d5e530c8a5e test-data/testfcs1.fcs
Binary file test-data/testfcs1.fcs has changed