Mercurial > repos > azomics > flowtext_summary
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FCSstats_txt.py Mon Jun 22 20:32:32 2020 -0400 @@ -0,0 +1,43 @@ +#!/usr/bin/env python + +###################################################################### +# Copyright (c) 2016 Northrop Grumman. +# All rights reserved. +###################################################################### + +from __future__ import print_function +import pandas as pd +from argparse import ArgumentParser + + +def get_txt_stats(in_file, out_file): + df = pd.read_table(in_file) + summary = df.describe().round(1) + df1 = summary[1:] + x = summary[:1].values.tolist() + df1.to_csv(out_file, sep="\t") + with open(out_file, "a") as ot: + ot.write("\n\n" + str(int(x[0][0])) + " events\n") + return + + +if __name__ == "__main__": + parser = ArgumentParser( + prog="getTxtStats", + description="Prints summary statistics from given file.") + + parser.add_argument( + '-i', + dest="input_file", + required=True, + help="File location for the text file.") + + parser.add_argument( + '-o', + dest="output_file", + required=True, + help="Name of the output file.") + + args = parser.parse_args() + + get_txt_stats(args.input_file, args.output_file)