Mercurial > repos > jay > pdaug_peptide_core_functions
comparison PDAUG_Sequence_Property_Based_Descriptors/PDAUG_Sequence_Property_Based_Descriptors.py @ 5:48eedcb9bfa7 draft
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit ac4353ca5c0ac9ce60df9f4bf160ed08b99fbee3"
author | jay |
---|---|
date | Thu, 28 Jan 2021 04:02:31 +0000 |
parents | e743e76b8991 |
children |
comparison
equal
deleted
inserted
replaced
4:3d57bd786f9a | 5:48eedcb9bfa7 |
---|---|
41 | 41 |
42 df = pd.DataFrame(lines) | 42 df = pd.DataFrame(lines) |
43 | 43 |
44 return df | 44 return df |
45 | 45 |
46 def Decriptor_generator(InFile, Lamda, Weight, DesType, Out_file): | 46 def Decriptor_generator(infile, lamda, weight, maxlag, destype, out_file): |
47 | 47 |
48 list_pep_name = [] | 48 list_pep_name = [] |
49 f = open(InFile) | 49 f = open(infile) |
50 lines = f.readlines() | 50 lines = f.readlines() |
51 | 51 |
52 for line in lines: | 52 for line in lines: |
53 if ">" in line: | 53 if ">" in line: |
54 pass | 54 pass |
60 for seq in list_pep_name: | 60 for seq in list_pep_name: |
61 | 61 |
62 protein = PyPro() | 62 protein = PyPro() |
63 protein.ReadProteinSequence(seq) | 63 protein.ReadProteinSequence(seq) |
64 | 64 |
65 if DesType == 'PAAC': | 65 |
66 DS = protein.GetPAAC(lamda=int(Lamda), weight=float(Weight)) | 66 if destype == "GetAAComp": |
67 DS = protein.GetAAComp() | |
67 df = pd.DataFrame(DS, index=[0]) | 68 df = pd.DataFrame(DS, index=[0]) |
68 elif DesType == 'APAAC': | 69 elif destype == "GetDPComp": |
69 DS = protein.GetAPAAC(lamda=int(Lamda), weight=float(Weight)) | 70 DS = protein.GetDPComp() |
70 df = pd.DataFrame(DS, index=[0]) | 71 df = pd.DataFrame(DS, index=[0]) |
71 elif DesType == 'CTD': | 72 elif destype == "GetTPComp": |
73 DS = protein.GetTPComp() | |
74 df = pd.DataFrame(DS, index=[0]) | |
75 elif destype == "GetMoreauBrotoAuto": | |
76 DS = protein.GetMoreauBrotoAuto() | |
77 df = pd.DataFrame(DS, index=[0]) | |
78 elif destype =="GetMoranAuto": | |
79 DS = protein.GetMoranAuto() | |
80 df = pd.DataFrame(DS, index=[0]) | |
81 elif destype =="GetGearyAuto": | |
82 DS = protein.GetGearyAuto() | |
83 df = pd.DataFrame(DS, index=[0]) | |
84 elif destype == "GetCTD": | |
72 DS = protein.GetCTD() | 85 DS = protein.GetCTD() |
73 df = pd.DataFrame(DS, index=[0]) | 86 df = pd.DataFrame(DS, index=[0]) |
74 elif DesType == 'DPComp': | 87 elif destype == "GetPAAC": |
75 DS = protein.GetDPComp() | 88 DS = protein.GetPAAC(lamda=int(lamda), weight=float(weight)) |
76 df = pd.DataFrame(DS, index=[0]) | 89 df = pd.DataFrame(DS, index=[0]) |
77 elif DesType == 'GearyAuto': | 90 elif destype == "GetAPAAC": |
78 DS = protein.GetGearyAuto() | 91 DS = protein.GetAPAAC(lamda=int(lamda), weight=float(weight)) |
79 df = pd.DataFrame(DS, index=[0]) | 92 df = pd.DataFrame(DS, index=[0]) |
80 elif DesType == 'MoranAuto': | 93 elif destype =="GetSOCN": |
81 DS = protein.GetMoranAuto() | 94 DS = protein.GetSOCN(maxlag=int(maxlag)) |
82 df = pd.DataFrame(DS, index=[0]) | 95 df = pd.DataFrame(DS, index=[0]) |
83 elif DesType == 'MoreauBrotoAuto': | 96 elif destype =="GetQSO": |
84 DS = protein.GetMoreauBrotoAuto() | 97 DS = protein.GetQSO(maxlag=int(maxlag), weight=float(weight)) |
85 df = pd.DataFrame(DS, index=[0]) | 98 df = pd.DataFrame(DS, index=[0]) |
86 elif DesType == 'QSO': | 99 elif destype == "GetTriad": |
87 DS = protein.GetQSO() | 100 DS = protein.GetTriad() |
88 df = pd.DataFrame(DS, index=[0]) | 101 df = pd.DataFrame(DS, index=[0]) |
89 elif DesType == 'SOCN': | 102 elif destype == "All": |
90 DS = protein.GetSOCN() | 103 DS1 = protein.GetAAComp() |
91 df = pd.DataFrame(DS, index=[0]) | 104 DS2 = protein.GetDPComp() |
92 elif DesType == 'TPComp': | 105 DS3 = protein.GetTPComp() |
93 DS = protein.GetTPComp() | 106 DS4 = protein.GetMoreauBrotoAuto() |
94 df = pd.DataFrame(DS, index=[0]) | 107 DS5 = protein.GetMoranAuto() |
95 elif DesType == 'All': | 108 DS6 = protein.GetGearyAuto() |
96 DS_1 = protein.GetPAAC(lamda=int(Lamda), weight=float(Weight)) | 109 DS7 = protein.GetCTD() |
97 DS_2 = protein.GetAPAAC(lamda=int(Lamda), weight=float(Weight)) | 110 DS8 = protein.GetPAAC(lamda=int(lamda), weight=float(weight)) |
98 DS_3 = protein.GetCTD() | 111 DS9 = protein.GetAPAAC(lamda=int(lamda), weight=float(weight)) |
99 DS_4 = protein.GetDPComp() | 112 DS10 = protein.GetSOCN(maxlag=int(maxlag)) |
100 DS_5 = protein.GetGearyAuto() | 113 DS11 = protein.GetQSO(maxlag=int(maxlag), weight=float(weight)) |
101 DS_6 = protein.GetMoranAuto() | 114 DS12 = protein.GetTriad() |
102 DS_7 = protein.GetMoreauBrotoAuto() | |
103 DS_8 = protein.GetQSO() | |
104 DS_9 = protein.GetSOCN() | |
105 DS_10 = protein.GetTPComp() | |
106 | 115 |
107 DS = {} | 116 DS = {} |
108 | 117 |
109 for D in (DS_1, DS_2, DS_3, DS_4, DS_5, DS_6, DS_7, DS_8, DS_9, DS_10): | 118 for D in (DS1,DS2,DS3,DS4,DS5,DS6,DS7,DS8,DS9,DS10,DS11,DS12): |
119 print(D) | |
110 DS.update(D) | 120 DS.update(D) |
111 | |
112 df = pd.DataFrame(DS, index=[0]) | 121 df = pd.DataFrame(DS, index=[0]) |
113 | 122 |
114 if DesType == 'BinaryDescriptor': | 123 if destype == 'BinaryDescriptor': |
115 out_df = BinaryDescriptor(list_pep_name) | 124 out_df = BinaryDescriptor(list_pep_name) |
116 else: | 125 else: |
117 out_df = pd.concat([out_df, df], axis=0) | 126 out_df = pd.concat([out_df, df], axis=0) |
118 | 127 |
119 | 128 |
120 out_df.to_csv(Out_file, index=False, sep='\t') | 129 out_df.to_csv(out_file, index=False, sep='\t') |
121 | 130 |
122 | 131 |
123 if __name__=="__main__": | 132 if __name__=="__main__": |
124 | 133 |
125 | 134 |
139 | 148 |
140 parser.add_argument("-w", "--Weight", | 149 parser.add_argument("-w", "--Weight", |
141 required=False, | 150 required=False, |
142 default=0.5, | 151 default=0.5, |
143 help="pep file") | 152 help="pep file") |
144 | 153 |
154 parser.add_argument("-m", "--MaxLag", | |
155 required=False, | |
156 default=10, | |
157 help="pep file") | |
158 | |
145 parser.add_argument("-t", "--DesType", | 159 parser.add_argument("-t", "--DesType", |
146 required=True, | 160 required=True, |
147 default=None, | 161 default=None, |
148 help="out put file name for str Descriptors") | 162 help="out put file name for str Descriptors") |
149 | 163 |
151 required=False, | 165 required=False, |
152 default="Out.tsv", | 166 default="Out.tsv", |
153 help="Path to target tsv file") | 167 help="Path to target tsv file") |
154 | 168 |
155 args = parser.parse_args() | 169 args = parser.parse_args() |
156 Decriptor_generator(args.InFile, args.Lamda, args.Weight, args.DesType, args.Out_file) | 170 Decriptor_generator(args.InFile, args.Lamda, args.Weight, args.MaxLag, args.DesType, args.Out_file) |
157 | 171 |
158 | 172 |