comparison PDAUG_Uversky_Plot/PDAUG_Uversky_Plot.py @ 0:0973f093d98f draft

"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit a9bd83f6a1afa6338cb6e4358b63ebff5bed155e"
author jay
date Wed, 28 Oct 2020 02:31:40 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:0973f093d98f
1 import matplotlib
2 matplotlib.use('Agg')
3 import os
4 import sys
5 sys.path.insert(0, os.path.abspath('..'))
6 from quantiprot.utils.io import load_fasta_file
7 from quantiprot.utils.feature import Feature, FeatureSet
8 from quantiprot.utils.sequence import compact
9 from quantiprot.metrics.aaindex import get_aa2charge, get_aa2hydropathy
10 from quantiprot.metrics.basic import average, average_absolute
11 from matplotlib import pyplot as plt
12
13
14
15 def Run_Uverskey(Fasta1, Fasta2, OutFile):
16
17
18 amyload_seq = load_fasta_file(Fasta1)
19 disprot_seq = load_fasta_file(Fasta2)
20
21 net_abs_charge = Feature(get_aa2charge(default=0)).then(average_absolute)
22 mean_hydropathy = Feature(get_aa2hydropathy(default=0)).then(average)
23
24 uversky_fs = FeatureSet("uversky")
25 uversky_fs.add(mean_hydropathy, name="mean_hydropathy")
26 uversky_fs.add(net_abs_charge, name="net_abs_charge")
27
28 amyload_uversky_seq = uversky_fs(amyload_seq)
29 disprot_uversky_seq = uversky_fs(disprot_seq)
30
31
32 amyload_data_x = amyload_uversky_seq.columns(feature="mean_hydropathy")[0]
33 amyload_data_y = amyload_uversky_seq.columns(feature="net_abs_charge")[0]
34 plt.plot(amyload_data_x, amyload_data_y,'.', label="Amyload")
35
36 disprot_data = compact(disprot_uversky_seq).columns()
37 plt.plot(disprot_data[0], disprot_data[1],'.', label="Disprot")
38
39 plt.plot([-0.78, 0.835], [0.0, 0.5],'k')
40 plt.xlabel("mean hydrophobicity")
41 plt.ylabel("net abs charge")
42 plt.legend()
43
44 plt.savefig(OutFile)
45
46
47
48 if __name__=="__main__":
49
50 import argparse
51
52 parser = argparse.ArgumentParser()
53 parser.add_argument("-f1", "--Fasta1", required=True, default=None, help="pep file")
54 parser.add_argument("-f2", "--Fasta2", required=True, default=None, help="out put file name for str Descriptors")
55 parser.add_argument("--OutFile", required=False, help="HTML out file", default="out.png")
56
57
58
59 args = parser.parse_args()
60
61 Run_Uverskey(args.Fasta1, args.Fasta2, args.OutFile)