Passed
Push — master ( 916dbc...eb3cd1 )
by Marcin
01:54 queued 11s
created

build.rna_tools.tools.plotting.rna_plot_heatmap   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 32
dl 0
loc 49
rs 10
c 0
b 0
f 0
wmc 1

1 Function

Rating   Name   Duplication   Size   Complexity  
A get_parser() 0 10 1
1
#!/usr/bin/env python
2
# -*- coding: utf-8 -*-
3
"""
4
5
"""
6
from __future__ import print_function
7
8
import argparse
9
import matplotlib.pyplot as plt  # to start
10
import matplotlib
11
12
import pandas as pd
13
import matplotlib.pyplot as plt
14
import seaborn as sns 
15
16
17
def get_parser():
18
    parser = argparse.ArgumentParser(
19
        description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
20
21
    #parser.add_argument('-', "--", help="", default="")
22
23
    parser.add_argument("-v", "--verbose",
24
                        action="store_true", help="be verbose")
25
    parser.add_argument("file", help="", default="") # nargs='+')
26
    return parser
27
28
29
if __name__ == '__main__':
30
    parser = get_parser()
31
    args = parser.parse_args()
32
33
    matplotlib.rcParams['lines.linewidth'] = 10
34
    plt.figure(figsize=(3,3))
35
    df = pd.read_csv(args.file,
36
                     sep=' ', index_col=False)#, index=False)
37
    df = df.set_index(df.columns)
38
    print(df)
39
    #df = df.drop('Unnamed: 15', axis=1)
40
    g = sns.clustermap(df, cmap="bwr", annot=True)#, linecolor = 'black', 
41
                           #linewidths=.3)#, vmin=-6, vmax=+6) # , 
42
    for a in g.ax_row_dendrogram.collections:
43
        a.set_linewidth(1)
44
        a.set_color('orange')
45
    for a in g.ax_col_dendrogram.collections:
46
        a.set_linewidth(1)
47
        a.set_color('orange')
48
    plt.savefig('_tmp.png', dpi=300)
49