# HG changeset patch # User immport-devteam # Date 1488217277 18000 # Node ID e88c99a4fb36800792b99300e1920aebe19dbead Uploaded diff -r 000000000000 -r e88c99a4fb36 check_headers/getHeaders.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/check_headers/getHeaders.py Mon Feb 27 12:41:17 2017 -0500 @@ -0,0 +1,50 @@ +#!/usr/bin/env python +###################################################################### +# Copyright (c) 2016 Northrop Grumman. +# All rights reserved. +###################################################################### +from __future__ import print_function +import sys + +from argparse import ArgumentParser + + +def print_headers(files, filenames, outfile): + with open(outfile, "w") as outf: + for i, eachfile in enumerate(files): + with open(eachfile, "r") as ef: + headers = ef.readline() + outf.write("\t".join([filenames[i], headers])) + return + + +if __name__ == "__main__": + parser = ArgumentParser( + prog="GetHeaders", + description="Gets the headers of all files in given set.") + + parser.add_argument( + '-i', + dest="input_files", + required=True, + action='append', + help="File location for the text files.") + + parser.add_argument( + '-n', + dest="file_names", + required=True, + action='append', + help="File names.") + + parser.add_argument( + '-o', + dest="output_file", + required=True, + help="Name of the output file.") + + args = parser.parse_args() + input_files = [f for f in args.input_files] + file_names = [fn for fn in args.file_names] + print_headers(input_files, file_names, args.output_file) + sys.exit(0) diff -r 000000000000 -r e88c99a4fb36 check_headers/getHeaders.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/check_headers/getHeaders.xml Mon Feb 27 12:41:17 2017 -0500 @@ -0,0 +1,67 @@ + + of any set of flowtext files. + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r e88c99a4fb36 check_headers/test-data/input1.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/check_headers/test-data/input1.txt Mon Feb 27 12:41:17 2017 -0500 @@ -0,0 +1,10 @@ +Forward Scatter Side Scatter FITC CD4 PE CCR3 PP CD8 APC CCR4 +449 157 551 129 169 292 +894 1023 199 277 320 227 +262 73 437 69 0 146 +340 115 509 268 0 74 +316 76 50 0 60 129 +394 144 83 138 335 194 +383 139 499 0 0 224 +800 1023 239 284 288 280 +388 97 534 111 83 177 diff -r 000000000000 -r e88c99a4fb36 check_headers/test-data/input2.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/check_headers/test-data/input2.txt Mon Feb 27 12:41:17 2017 -0500 @@ -0,0 +1,10 @@ +Forward Scatter Side Scatter FITC CD4 PE CXCR3 PP CD8 APC CCR5 +363 76 550 200 0 127 +372 126 519 44 51 148 +1023 1023 289 401 362 254 +770 1023 175 361 225 237 +384 111 525 121 0 138 +602 578 385 286 222 131 +788 1023 216 310 270 294 +420 211 552 479 0 62 +668 1019 73 193 227 132 diff -r 000000000000 -r e88c99a4fb36 check_headers/test-data/input3.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/check_headers/test-data/input3.txt Mon Feb 27 12:41:17 2017 -0500 @@ -0,0 +1,10 @@ +Forward Scatter Side Scatter FITC CD4 PE CD25 PP CD3 APC CD45RA +289 56 438 0 626 480 +352 153 30 147 483 386 +383 190 156 228 734 408 +261 62 432 121 598 555 +451 120 537 338 568 201 +373 104 3 110 621 584 +418 105 561 0 610 562 +358 185 0 292 641 327 +733 970 139 227 293 259 diff -r 000000000000 -r e88c99a4fb36 check_headers/test-data/output.tabular --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/check_headers/test-data/output.tabular Mon Feb 27 12:41:17 2017 -0500 @@ -0,0 +1,3 @@ +input1.txt Forward Scatter Side Scatter FITC CD4 PE CCR3 PP CD8 APC CCR4 +input2.txt Forward Scatter Side Scatter FITC CD4 PE CXCR3 PP CD8 APC CCR5 +input3.txt Forward Scatter Side Scatter FITC CD4 PE CD25 PP CD3 APC CD45RA