comparison PDAUG_Peptide_Data_Plotting/PDAUG_Peptide_Data_Plotting.py @ 0:c3f0b3a6339e draft

"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit a9bd83f6a1afa6338cb6e4358b63ebff5bed155e"
author jay
date Wed, 28 Oct 2020 01:47:48 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:c3f0b3a6339e
1 from modlamp.plot import helical_wheel
2 from modlamp.plot import plot_pde
3 from modlamp.plot import plot_violin
4 from modlamp.plot import plot_aa_distr
5 import pandas as pd
6 import argparse
7 import sys, os
8
9
10
11 parser = argparse.ArgumentParser(description='Deployment tool')
12 subparsers = parser.add_subparsers()
13
14 HelWhl = subparsers.add_parser('HelWhl')
15
16 HelWhl.add_argument("-I","--InFile", required=True, default=None, help="Input data file")
17 HelWhl.add_argument("-C","--colorcoding", required=False, default='rainbow', help="available: , charge, polar, simple, amphipathic, none")
18 HelWhl.add_argument("-L","--lineweights", required=False, default=True, help="(boolean) defines whether connection lines decrease in thickness along the sequence")
19 HelWhl.add_argument("-F","--filename", required=False, default="out.png", help="")
20 HelWhl.add_argument("-s","--seq", required=False, default=False, help="")
21 HelWhl.add_argument("-M","--movment", required=False, default=False, help="")
22 HelWhl.add_argument("-O", "--OutFile", required=False, default="out.png", help="OutFile")
23
24
25 PltPde = subparsers.add_parser('PltPde')
26 PltPde.add_argument("-I","--InFile", required=True, default=None, help="Input data file")
27 PltPde.add_argument("-l", "--ClmList", required=True, default=None, help="")
28 PltPde.add_argument("-F","--filename", required=False, default="out.png", help="filename where to safe the plot. default = None > show the plot")
29 PltPde.add_argument("-O", "--OutFile", required=False, default="out.png", help="OutFile")
30
31 PltVio = subparsers.add_parser('PltVio')
32 PltVio.add_argument("-I","--InFile", required=True, default=None, help="Input data file")
33 PltVio.add_argument("-l", "--ClmList", required=True, default=None, help="Column list")
34 PltVio.add_argument("-C","--colors", required=False, default=None, help='Data to be plotted')
35 PltVio.add_argument("-B","--bp", required=False, default=False, help="Print a box blot inside violin")
36 PltVio.add_argument("-T","--title", required=False, default=None, help="Title of the plot.")
37 PltVio.add_argument("-a","--axlabels", required=False, default=None, help="list containing the axis labels for the plot")
38 PltVio.add_argument("-M","--y_max", required=False, default=1, help='y-axis maximum.')
39 PltVio.add_argument("-m","--y_min", required=False, default=0, help="y-axis minimum.")
40 PltVio.add_argument("-O", "--OutFile", required=False, default="out.png", help="OutFile")
41
42
43 PltAaDis = subparsers.add_parser('PltAaDis')
44 PltAaDis.add_argument("-I","--InFile", required=True, default=None, help="Input data file")
45 PltAaDis.add_argument("-O", "--OutFile", required=False, default="out.png", help="OutFile")
46
47 args = parser.parse_args()
48
49
50 if sys.argv[1] == 'HelWhl':
51
52 f = open(args.InFile)
53 lines = f.readlines()
54 sequence = lines[1].strip('\n')
55
56 if args.movment == 'true':
57 mvt = True
58 else:
59 mvt = False
60
61 if args.seq == 'true':
62 sq = True
63 else:
64 sq = False
65
66 if args.lineweights == 'true':
67 lw = True
68 else:
69 lw = False
70
71 helical_wheel(sequence, colorcoding=args.colorcoding, lineweights=args.lineweights, filename=args.OutFile, seq=args.seq, moment=mvt)
72
73
74 elif sys.argv[1] == 'PltPde':
75
76 df = pd.read_csv(args.InFile, sep="\t")
77
78 data = df[args.ClmList.split(',')].as_matrix().T
79
80 plot_pde(data, filename=args.OutFile)
81
82 elif sys.argv[1] == 'PltVio':
83
84 df = pd.read_csv(args.InFile, sep="\t")
85
86 data = df[args.ClmList.split(',')].as_matrix().T
87
88 c = ['#0B486B']*len(args.ClmList.split(','))
89
90 plot_violin(data, colors=c, bp=True, filename=args.OutFile)
91
92
93 elif sys.argv[1] == 'PltAaDis':
94
95 f = open(args.InFile)
96 lines = f.readlines()
97
98 sequences = []
99
100 for line in lines:
101 if '>' in line:
102 pass
103 else:
104 sequences.append(line.strip('\n'))
105
106 plot_aa_distr(sequences, color='#0B486B', filename=args.OutFile)
107
108
109
110
111
112
113
114
115