diff options
Diffstat (limited to 'gn3/computations')
-rw-r--r-- | gn3/computations/heatmap.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gn3/computations/heatmap.py b/gn3/computations/heatmap.py index da13ceb..2f92048 100644 --- a/gn3/computations/heatmap.py +++ b/gn3/computations/heatmap.py @@ -229,3 +229,11 @@ def retrieve_strains_and_values(orders, strainlist, traits_data_list): values = [] return rets + +def generate_traits_file(strains, trait_values, traits_filename): + header = "Traits\t{}\n".format("\t".join(strains)) + data = [header] + [ + "T{}\t{}\n".format(i+1, "\t".join([str(i) for i in t])) + for i,t in enumerate(trait_values)] + with open(traits_filename, "w") as outfile: + outfile.writelines(data) |