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