Mercurial > repos > immport-devteam > flow_overview
annotate genFlowOverview.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 #!/usr/bin/env python |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
3 ###################################################################### |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
4 # 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
|
5 # 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
|
6 ###################################################################### |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
7 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
8 # version 1.1 - August 2017 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
9 # added upper limit to nb of clusters (40) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
10 # |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
11 import sys |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
12 import os |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
13 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
|
14 import logging |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
15 import fileinput |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
16 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
17 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
|
18 from jinja2 import Environment, FileSystemLoader |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
19 from collections import defaultdict |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
20 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
21 from color_palette import color_palette |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
22 from flowstatlib import gen_overview_stats |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
23 import matplotlib as mpl |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
24 mpl.use('Agg') |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
25 import matplotlib.pyplot as plt |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
26 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
27 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
28 profile_key = { |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
29 "1": "-", |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
30 "2": "lo", |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
31 "3": "+", |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
32 "4": "hi" |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
33 } |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
34 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
35 |
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 CL functions |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
37 def run_flowCL(phenotype, output_txt, output_pdf, tool): |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
38 run_command = " ". join(["Rscript --slave --vanilla", tool, output_txt, |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
39 phenotype]) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
40 os.system(run_command) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
41 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
42 get_graph = " ".join(["mv flowCL_results/*.pdf", output_pdf]) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
43 os.system(get_graph) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
44 return |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
45 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
46 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
47 def generate_flowCL_query(list_markers, list_types): |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
48 if (len(list_markers) != len(list_types)): |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
49 return("pb with headers") |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
50 query = [] |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
51 # go through both lists, remove fsc/ssc |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
52 for i in range(1, len(list_markers)): |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
53 if not list_markers[i].startswith("FSC") and not list_markers[i].startswith("SSC"): |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
54 query.append(list_markers[i].upper()) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
55 query.append(profile_key[list_types[i]]) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
56 # return concatenated string |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
57 return("".join(query)) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
58 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
59 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
60 def translate_profiles(input_file, tool_dir, html_dir): |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
61 tool = "/".join([tool_dir, "getOntology.R"]) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
62 html_table = "".join([html_dir, "/CLprofiles.txt"]) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
63 score_table = "".join(["cp ", input_file, " ", html_dir, "/scores.txt"]) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
64 os.system(score_table) |
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 # read profile |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
67 with open(input_file, "r") as flock_profiles, open(html_table, "w") as out: |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
68 headers = flock_profiles.readline() |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
69 headers = headers.strip() |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
70 markers = headers.split("\t")[:-2] |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
71 counter = 0 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
72 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
73 out.write("Population\tFlowCL Query\tNb Results\tLink to PDF\t") |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
74 out.write("Top Result Label\tTop Result Score\tTop Result CL\n") |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
75 queries = {} |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
76 # create marker query for each population |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
77 for lines in flock_profiles: |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
78 lines = lines.strip("\n") |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
79 pop_profile = lines.split("\t")[:-2] |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
80 flowcl_query = generate_flowCL_query(markers, pop_profile) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
81 counter += 1 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
82 nb_results = "0" |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
83 top_label = "no_match" |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
84 top_score = "NA" |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
85 top_CL = "NA" |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
86 pdf_link = "NA" |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
87 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
88 # check if query was run before |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
89 if flowcl_query not in queries: |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
90 # create filenames for results & graphs |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
91 txt = "".join(["flowcl_pop", str(counter).zfill(2), ".txt"]) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
92 text_result = "/".join([html_dir, txt]) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
93 graph = "".join(["flowcl_pop", str(counter).zfill(2), ".pdf"]) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
94 graph_output = "/".join([html_dir, graph]) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
95 # run flowCL for each marker profile |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
96 run_flowCL(flowcl_query, text_result, graph_output, tool) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
97 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
98 # test that text file exists if not results are all NAs: |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
99 if os.path.isfile(text_result): |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
100 with open(text_result, "r") as res: |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
101 for line in res: |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
102 if line.startswith("Score"): |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
103 data = line.split(") ") |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
104 top_score = data[2][:-2] |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
105 tot_results = len(data) - 2 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
106 nb_results = str(tot_results) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
107 if tot_results == 5: |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
108 if len(data[6].split("+")) > 1: |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
109 nb_results = "5+" |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
110 elif line.startswith("Cell ID"): |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
111 prep_link = line.split(") ")[1][:-2] |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
112 cl = prep_link.replace("_", ":") |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
113 link = "".join(['<a href="http://www.immport-labs.org/immport-ontology/public/home/home/', cl, '" target="_blank">']) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
114 top_CL = "".join([link, prep_link, "</a>"]) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
115 elif line.startswith("Cell Label"): |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
116 top_label = line.split(") ")[1][:-2] |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
117 pdf_link = "".join(['<a href="', graph, '" target="_blank">PDF</a>']) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
118 tmpflowcl_query = "".join(['<a href="', txt, '" target="_blank">', flowcl_query, '</a>']) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
119 queries[flowcl_query] = { |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
120 "query": tmpflowcl_query, |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
121 "results": nb_results, |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
122 "pdf": pdf_link, |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
123 "label": top_label, |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
124 "score": top_score, |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
125 "CL": top_CL |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
126 } |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
127 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
128 # write query results to CLprofiles.txt |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
129 out.write("\t".join([pop_profile[0], |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
130 queries[flowcl_query]["query"], |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
131 queries[flowcl_query]["results"], |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
132 queries[flowcl_query]["pdf"], |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
133 queries[flowcl_query]["label"], |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
134 queries[flowcl_query]["score"], |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
135 queries[flowcl_query]["CL"]]) + "\n") |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
136 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
137 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
138 # boxplots data massaging |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
139 def panel_to_json_string(df): |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
140 # from http://stackoverflow.com/questions/28078118/merge-many-json-strings-with-python-pandas-inputs |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
141 def __merge_stream(key, stream): |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
142 return '"' + key + '"' + ': ' + stream + ', ' |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
143 try: |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
144 if 'Unnamed: 0' in df.columns: |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
145 df = df.drop(['Unnamed: 0'], 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
|
146 stream = '{' |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
147 for index, subdf in df.groupby(level=0): |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
148 stream += __merge_stream(index, df.loc[index, :, :].droplevel(0).to_json()) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
149 # take out extra last comma |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
150 stream = stream[:-2] |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
151 # add the final paren |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
152 stream += '}' |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
153 except: |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
154 logging.exception('Panel Encoding did not work') |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
155 return stream |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
156 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
157 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
158 def get_outliers(group, upper, lower): |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
159 cat = group.name |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
160 out = {} |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
161 for marker in group: |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
162 # skip population since upper and lower don't contain it, since it was made after a group by Population |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
163 if marker != 'Population': |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
164 out[marker] = group[(group[marker] > upper.loc[cat][marker]) | (group[marker] < lower.loc[cat][marker])][marker] |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
165 return out |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
166 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
167 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
168 def get_boxplot_stats(all_data, mfi_file, output_json): |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
169 # modified code from http://bokeh.pydata.org/en/latest/docs/gallery/boxplot.html |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
170 # Get initial MFI values |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
171 mfi = pd.read_table(mfi_file) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
172 mfi = mfi.set_index('Population') |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
173 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
174 df = pd.read_table(all_data) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
175 # check if ever some pops not in cs_files |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
176 missing_pop = [x for x in mfi.index if x not in set(df.Population)] |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
177 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
178 if (missing_pop): |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
179 zeros = {} |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
180 for m in df.columns: |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
181 zeros[m] = [0 for x in missing_pop] |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
182 tmpdf = pd.DataFrame(zeros) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
183 tmpdf.Population = missing_pop |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
184 df = df.append(tmpdf) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
185 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
186 pops = df.groupby('Population') |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
187 q1 = pops.quantile(q=0.25) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
188 q2 = pops.quantile(q=0.5) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
189 q3 = pops.quantile(q=0.75) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
190 iqr = q3 - q1 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
191 upper = q3 + 1.5*iqr |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
192 lower = q1 - 1.5*iqr |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
193 resampled = False |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
194 # get outliers |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
195 out = pops.apply(get_outliers, upper, lower).dropna() |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
196 outliers = defaultdict(dict) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
197 for population in set(df.Population): |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
198 for marker in df.columns: |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
199 if marker != 'Population': |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
200 tmp_outliers = list(out[population][marker]) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
201 if (len(list(out[population][marker]))> 100): |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
202 tmp_outliers = list(out[population][marker].sample(n=100)) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
203 resampled = True |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
204 outliers[population][marker] = tmp_outliers |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
205 outdf = pd.DataFrame(outliers) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
206 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
207 data = pd.concat({'q1': q1, |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
208 'q2': q2, |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
209 'q3': q3, |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
210 'upper': upper, |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
211 'lower': lower, |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
212 'outliers': outdf.T, |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
213 'mfi': mfi}, keys=['q1','q2','q3','upper','lower','outliers','mfi']) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
214 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
215 with open(output_json, "w") as js_all: |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
216 js_all.write(panel_to_json_string(data)) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
217 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
218 return resampled |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
219 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
220 # html generation |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
221 def gen_flow_overview(args): |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
222 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
|
223 if len(set(flow_stats['population'])) > 40: |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
224 nbpop = str(len(set(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
|
225 sys.stderr.write("There are " + nbpop + " in the 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
|
226 sys.exit(3) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
227 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
228 os.mkdir(args.output_directory) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
229 html_template = "genOverview.template" |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
230 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
231 if args.scores: |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
232 translate_profiles(args.scores, args.tool_directory, args.output_directory) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
233 html_template = "genOverviewCL.template" |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
234 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
235 env = Environment(loader=FileSystemLoader(args.tool_directory + "/templates")) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
236 template = env.get_template(html_template) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
237 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
238 real_directory = args.output_directory.replace("/job_working_directory", "") |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
239 context = {'outputDirectory': real_directory} |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
240 overview = template.render(**context) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
241 with open(args.output_file, "w") as f: |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
242 f.write(overview) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
243 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
244 flow_sample_file_name = args.output_directory + "/flow.sample" |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
245 with open(flow_sample_file_name, "w") as flow_sample_file: |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
246 flow_stats['sample'].to_csv(flow_sample_file, sep="\t", index=False, float_format='%.0f') |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
247 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
248 flow_mfi_file_name = args.output_directory + "/flow.mfi" |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
249 with open(flow_mfi_file_name, "w") as flow_mfi_file: |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
250 flow_stats[args.mfi_calc].to_csv(flow_mfi_file, sep="\t", float_format='%.0f') |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
251 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
252 mpop = "_".join([args.mfi_calc, "pop"]) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
253 flow_mfi_pop_file_name = args.output_directory + "/flow.mfi_pop" |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
254 with open(flow_mfi_pop_file_name, "w") as flow_mfi_pop_file: |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
255 flow_stats[mpop].to_csv(flow_mfi_pop_file, sep="\t", index=False, float_format="%.2f") |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
256 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
257 # box plot data |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
258 boxplot_data = args.output_directory + "/boxplotData.json" |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
259 resampled = get_boxplot_stats(args.input_file, flow_mfi_file_name, boxplot_data) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
260 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
261 # Generate the Images -- eventually we should change that over to D3 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
262 fcm = flow_stats['sample_data'].values |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
263 colors = [] |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
264 for i, j in enumerate(flow_stats['sample_population']): |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
265 colors.append(color_palette[j]) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
266 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
267 for i in range(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
|
268 for j in range(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
|
269 file_name = "m" + str(i) + "_m" + str(j) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
270 ax = plt.subplot(1, 1, 1) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
271 plt.subplots_adjust(left=0.0, bottom=0.0, right=1.0, top=1.0, wspace=0.0, hspace=0.0) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
272 plt.scatter(fcm[:, i], fcm[:, j], s=1, c=colors, edgecolors='none') |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
273 plt.axis([0, 1024, 0, 1024]) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
274 plt.xticks([]) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
275 plt.yticks([]) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
276 F = plt.gcf() |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
277 F.set_size_inches(1, 1) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
278 F.set_dpi(90) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
279 png_file = file_name + "_90X90.png" |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
280 F.savefig(args.output_directory + "/" + png_file) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
281 plt.clf() |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
282 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
283 flow_overview_file_name = args.output_directory + "/flow.overview" |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
284 with open(flow_overview_file_name, "w") as flow_overview_file: |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
285 flow_overview_file.write("<table>\n") |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
286 flow_overview_file.write("<tr><td> </td>\n") |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
287 for i in range(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
|
288 flow_overview_file.write("<td>" + flow_stats['markers'][i] + "</td>\n") |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
289 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
290 for i in range(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
|
291 flow_overview_file.write("<tr>\n") |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
292 flow_overview_file.write("<td>" + flow_stats['markers'][i] + "</td>\n") |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
293 for j in range(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
|
294 file_name = "m" + str(j) + "_m" + str(i) |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
295 image_file = file_name + "_90X90.png" |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
296 flow_overview_file.write('<td><img src="' + image_file + '"/></td>') |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
297 flow_overview_file.write("</tr>\n") |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
298 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
299 flow_overview_file.write("</table>\n</body>\n<html>\n") |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
300 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
301 if resampled: |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
302 to_find = '<div id="outlierWarning" style="display:none;">' |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
303 to_replace = '<div id="outlierWarning">' |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
304 ## yay python 2.7 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
305 ro = fileinput.input(args.output_file, inplace=True, backup=".bak") |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
306 for roline in ro: |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
307 print(roline.replace(to_find, to_replace), end='') |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
308 ro.close() |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
309 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
310 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
311 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
|
312 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
|
313 prog="genOverview", |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
314 description="Generate an overview plot of Flow results.") |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
315 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
316 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
|
317 '-i', |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
318 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
|
319 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
|
320 help="File location for the Flow Text file.") |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
321 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
322 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
|
323 '-o', |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
324 dest="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
|
325 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
|
326 help="File location for the HTML 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
|
327 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
328 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
|
329 '-d', |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
330 dest="output_directory", |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
331 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
|
332 help="Directory location for the Flow Plot.") |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
333 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
334 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
|
335 '-M', |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
336 dest="mfi_calc", |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
337 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
|
338 help="what to calculate for centroids.") |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
339 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
340 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
|
341 '-p', |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
342 dest="scores", |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
343 help="File location for FLOCK population scores.") |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
344 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
345 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
|
346 '-t', |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
347 dest="tool_directory", |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
348 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
|
349 help="Location of the Tool Directory.") |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
350 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
351 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
|
352 |
b5453d07f740
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flow_overview commit 65373effef15809f3db0e5f9603ef808f4110aa3"
azomics
parents:
diff
changeset
|
353 gen_flow_overview(args) |