Mercurial > repos > immport-devteam > flow_overview
annotate flowstatlib.py @ 1:b5453d07f740 draft default tip
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
author | azomics |
---|---|
date | Wed, 29 Jul 2020 17:03:53 -0400 |
parents | |
children |
rev | line source |
---|---|
1
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
1 ###################################################################### |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
2 # Copyright (c) 2016 Northrop Grumman. |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
3 # All rights reserved. |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
4 ###################################################################### |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
5 import pandas as pd |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
6 from scipy.stats import gmean |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
7 from argparse import ArgumentParser |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
8 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
9 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
10 def gen_overview_stats(file_name): |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
11 flow_stats = {} |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
12 fcs = pd.read_table(file_name) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
13 (events, columns) = fcs.shape |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
14 flow_stats['fcs'] = fcs |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
15 flow_stats['events'] = events |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
16 flow_stats['columns'] = columns - 1 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
17 flow_stats['data'] = fcs.iloc[:, :-1] |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
18 flow_stats['population'] = fcs.iloc[:, -1:].iloc[:, 0] |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
19 flow_stats['population_freq'] = flow_stats['population'].value_counts() |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
20 flow_stats['population_sample'] = (flow_stats['population_freq'] * (20000/float(events))).round(decimals=0) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
21 flow_stats['population_freq_sort'] = flow_stats['population_freq'].sort_index() |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
22 flow_stats['population_per'] = (flow_stats['population'].value_counts(normalize=True) * 100).round(decimals=2) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
23 flow_stats['population_per_sort'] = flow_stats['population_per'].sort_index() |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
24 flow_stats['population_all'] = pd.concat([flow_stats['population_freq_sort'], flow_stats['population_per_sort']], axis=1) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
25 flow_stats['population_all'].columns = ['Count', 'Percentage'] |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
26 flow_stats['min'] = flow_stats['data'].values.min() |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
27 flow_stats['max'] = flow_stats['data'].values.max() |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
28 flow_stats['markers'] = list(flow_stats['data'].columns) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
29 flow_stats['mfi'] = fcs.groupby('Population').mean().round(decimals=2) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
30 flow_stats['mfi_pop'] = pd.merge(flow_stats['mfi'], flow_stats['population_all'], left_index=True, right_index=True) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
31 flow_stats['mfi_pop']['Population'] = flow_stats['mfi_pop'].index |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
32 flow_stats['gmfi'] = fcs.groupby('Population').agg(lambda x: gmean(list(x))).round(decimals=2) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
33 flow_stats['gmfi_pop'] = pd.merge(flow_stats['gmfi'], flow_stats['population_all'], left_index=True, right_index=True) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
34 flow_stats['gmfi_pop']['Population'] = flow_stats['gmfi_pop'].index |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
35 flow_stats['mdfi'] = fcs.groupby('Population').median().round(decimals=2) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
36 flow_stats['mdfi_pop'] = pd.merge(flow_stats['mdfi'], flow_stats['population_all'], left_index=True, right_index=True) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
37 flow_stats['mdfi_pop']['Population'] = flow_stats['mdfi_pop'].index |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
38 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
39 # |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
40 # If the number of events is less than 20000, then return |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
41 # the complete data set, |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
42 # Otherwise sample the data to only return 20000 events. |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
43 if events <= 20000: |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
44 flow_stats['sample'] = fcs |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
45 else: |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
46 fcs_np = fcs.values |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
47 sample_data = [] |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
48 pop_found = {} |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
49 for i in range(0, events): |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
50 population_number = fcs_np[i][columns-1] |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
51 if population_number in pop_found: |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
52 if pop_found[population_number] < flow_stats['population_sample'][population_number]: |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
53 pop_found[population_number] += 1 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
54 sample_data.append(fcs_np[i]) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
55 else: |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
56 pop_found[population_number] = 1 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
57 sample_data.append(fcs_np[i]) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
58 flow_stats['sample'] = pd.DataFrame(sample_data) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
59 flow_stats['sample'].columns = fcs.columns |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
60 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
61 flow_stats['sample_data'] = flow_stats['sample'].iloc[:, :-1] |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
62 flow_stats['sample_population'] = flow_stats['sample'].iloc[:, -1:].iloc[:, 0] |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
63 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
64 return flow_stats |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
65 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
66 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
67 if __name__ == '__main__': |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
68 parser = ArgumentParser( |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
69 prog="flowstats", |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
70 description="Gets statistics on FLOCK run") |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
71 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
72 parser.add_argument( |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
73 '-i', |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
74 dest="input_file", |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
75 required=True, |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
76 help="File locations for flow clr file.") |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
77 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
78 parser.add_argument( |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
79 '-o', |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
80 dest="out_file", |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
81 required=True, |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
82 help="Path to the directory for the output file.") |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
83 args = parser.parse_args() |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
84 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
85 flow_stats = gen_overview_stats(args.input_file) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
86 with open(args.out_file, "w") as outf: |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
87 outf.write("Events: ", flow_stats['events']) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
88 outf.write("Min: ", flow_stats['min']) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
89 outf.write("Max: ", flow_stats['max']) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
90 outf.write("Columns: ", flow_stats['columns']) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
91 outf.write("Markers: ", flow_stats['markers']) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
92 outf.write("Population: ", flow_stats['population']) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
93 outf.write("Population Freq: ", flow_stats['population_freq']) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
94 outf.write("Population Sample: ", flow_stats['population_sample']) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
95 outf.write("Population Per: ", flow_stats['population_per']) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
96 outf.write("Sample Data contains ", len(flow_stats['sample']), " events") |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
97 outf.write("MIF_POP ", flow_stats['mfi_pop']) |