Mercurial > repos > azomics > flowtext_summary
comparison FCSstats_txt.py @ 0:2916b895840f draft default tip
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowtext_summary commit 2a47c0c1e27462d21098006ba4fe0789b1ed37ec"
| author | azomics |
|---|---|
| date | Mon, 22 Jun 2020 20:32:32 -0400 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:2916b895840f |
|---|---|
| 1 #!/usr/bin/env python | |
| 2 | |
| 3 ###################################################################### | |
| 4 # Copyright (c) 2016 Northrop Grumman. | |
| 5 # All rights reserved. | |
| 6 ###################################################################### | |
| 7 | |
| 8 from __future__ import print_function | |
| 9 import pandas as pd | |
| 10 from argparse import ArgumentParser | |
| 11 | |
| 12 | |
| 13 def get_txt_stats(in_file, out_file): | |
| 14 df = pd.read_table(in_file) | |
| 15 summary = df.describe().round(1) | |
| 16 df1 = summary[1:] | |
| 17 x = summary[:1].values.tolist() | |
| 18 df1.to_csv(out_file, sep="\t") | |
| 19 with open(out_file, "a") as ot: | |
| 20 ot.write("\n\n" + str(int(x[0][0])) + " events\n") | |
| 21 return | |
| 22 | |
| 23 | |
| 24 if __name__ == "__main__": | |
| 25 parser = ArgumentParser( | |
| 26 prog="getTxtStats", | |
| 27 description="Prints summary statistics from given file.") | |
| 28 | |
| 29 parser.add_argument( | |
| 30 '-i', | |
| 31 dest="input_file", | |
| 32 required=True, | |
| 33 help="File location for the text file.") | |
| 34 | |
| 35 parser.add_argument( | |
| 36 '-o', | |
| 37 dest="output_file", | |
| 38 required=True, | |
| 39 help="Name of the output file.") | |
| 40 | |
| 41 args = parser.parse_args() | |
| 42 | |
| 43 get_txt_stats(args.input_file, args.output_file) |
