diff options
-rw-r--r-- | scripts/makeReport.py | 206 |
1 files changed, 180 insertions, 26 deletions
diff --git a/scripts/makeReport.py b/scripts/makeReport.py index cab6b78..c83928d 100644 --- a/scripts/makeReport.py +++ b/scripts/makeReport.py @@ -74,8 +74,17 @@ for ligand in natural_ligands: tableBody = [] tableHeaders = ["No.", "Res.", "AA", "Dist", "Ligand Atom", "Proton Atom"] i = 1 - for x in doc.report.bindingsite[ligand].interactions.hydrophobic_interactions.hydrophobic_interaction: - l = [i,x.resnr.cdata,x.restype.cdata,x.dist.cdata,x.ligcarbonidx.cdata,x.protcarbonidx.cdata] + for x in doc.report.bindingsite[ + ligand + ].interactions.hydrophobic_interactions.hydrophobic_interaction: + l = [ + i, + x.resnr.cdata, + x.restype.cdata, + x.dist.cdata, + x.ligcarbonidx.cdata, + x.protcarbonidx.cdata, + ] i += 1 tableBody.append(l) print(tabulate(tableBody, headers=tableHeaders), end="\n\n") @@ -84,10 +93,32 @@ for ligand in natural_ligands: else: print("## Hydrogen Bonds", end="\n\n") tableBody = [] - tableHeaders = ["No.","Res.","AA","Dist H-A","Dist D-A","Don Angle","Protisdon?","Sidechain?","D. Atom","A. Atom",] + tableHeaders = [ + "No.", + "Res.", + "AA", + "Dist H-A", + "Dist D-A", + "Don Angle", + "Protisdon?", + "Sidechain?", + "D. Atom", + "A. Atom", + ] i = 1 - for x in doc.report.bindingsite[ligand].interactions.hydrogen_bonds.hydrogen_bond: - l = [i,x.resnr.cdata,x.restype.cdata,x.dist_h_a.cdata,x.dist_d_a.cdata,x.don_angle.cdata,x.protisdon.cdata,x.sidechain.cdata] + for x in doc.report.bindingsite[ + ligand + ].interactions.hydrogen_bonds.hydrogen_bond: + l = [ + i, + x.resnr.cdata, + x.restype.cdata, + x.dist_h_a.cdata, + x.dist_d_a.cdata, + x.don_angle.cdata, + x.protisdon.cdata, + x.sidechain.cdata, + ] l.append((x.donoridx.cdata + "[" + x.donortype.cdata + "]")) l.append((x.acceptoridx.cdata + "[" + x.acceptortype.cdata + "]")) i += 1 @@ -98,7 +129,10 @@ for ligand in natural_ligands: print("## Ligand Interactions", end="\n\n") try: - if doc.report.bindingsite[indexForUNL].interactions.hydrophobic_interactions.cdata== "": + if ( + doc.report.bindingsite[indexForUNL].interactions.hydrophobic_interactions.cdata + == "" + ): print("No Hydrophobic Interactions Found", end="\n\n") else: print("**Hydrophobic Interactions Found**", end="\n\n") @@ -107,7 +141,10 @@ except AttributeError: fallback = 1 if fallback == 0: - if doc.report.bindingsite[indexForUNL].interactions.hydrophobic_interactions.cdata== "": + if ( + doc.report.bindingsite[indexForUNL].interactions.hydrophobic_interactions.cdata + == "" + ): print("No Hydrophobic Interactions Found", end="\n\n") else: print("**Hydrophobic Interactions Found**", end="\n\n") @@ -132,7 +169,10 @@ if fallback == 0: else: print("**Pi Stacks Found**", end="\n\n") ps = 1 - if doc.report.bindingsite[indexForUNL].interactions.pi_cation_interactions.cdata== "": + if ( + doc.report.bindingsite[indexForUNL].interactions.pi_cation_interactions.cdata + == "" + ): print("No Pi Cation Interactions Found", end="\n\n") else: print("**Pi Cation Interactions Found**", end="\n\n") @@ -196,8 +236,17 @@ if fallback == 0: tableBody = [] tableHeaders = ["No.", "Res.", "AA", "Dist", "Ligand Atom", "Proton Atom"] i = 1 - for x in doc.report.bindingsite[indexForUNL].interactions.hydrophobic_interactions.hydrophobic_interaction: - l = [i,x.resnr.cdata,x.restype.cdata,x.dist.cdata,x.ligcarbonidx.cdata,x.protcarbonidx.cdata] + for x in doc.report.bindingsite[ + indexForUNL + ].interactions.hydrophobic_interactions.hydrophobic_interaction: + l = [ + i, + x.resnr.cdata, + x.restype.cdata, + x.dist.cdata, + x.ligcarbonidx.cdata, + x.protcarbonidx.cdata, + ] i += 1 tableBody.append(l) print(tabulate(tableBody, headers=tableHeaders), end="\n\n") @@ -205,10 +254,32 @@ if fallback == 0: if hb == 1: print("## Hydrogen Bonds", end="\n\n") tableBody = [] - tableHeaders = ["No.","Res.","AA","Dist H-A","Dist D-A","Don Angle","Protisdon?","Sidechain?","D. Atom","A. Atom"] + tableHeaders = [ + "No.", + "Res.", + "AA", + "Dist H-A", + "Dist D-A", + "Don Angle", + "Protisdon?", + "Sidechain?", + "D. Atom", + "A. Atom", + ] i = 1 - for x in doc.report.bindingsite[indexForUNL].interactions.hydrogen_bonds.hydrogen_bond: - l = [i,x.resnr.cdata,x.restype.cdata,x.dist_h_a.cdata,x.dist_d_a.cdata,x.don_angle.cdata,x.protisdon.cdata,x.sidechain.cdata] + for x in doc.report.bindingsite[ + indexForUNL + ].interactions.hydrogen_bonds.hydrogen_bond: + l = [ + i, + x.resnr.cdata, + x.restype.cdata, + x.dist_h_a.cdata, + x.dist_d_a.cdata, + x.don_angle.cdata, + x.protisdon.cdata, + x.sidechain.cdata, + ] l.append((x.donoridx.cdata + "[" + x.donortype.cdata + "]")) l.append((x.acceptoridx.cdata + "[" + x.acceptortype.cdata + "]")) i += 1 @@ -219,10 +290,27 @@ if fallback == 0: if sb == 1: print("## Salt Bridges", end="\n\n") tableBody = [] - tableHeaders = ["Index","Residue","AA","Distance","Protein positive?","Ligand Group","Ligand Atoms"] + tableHeaders = [ + "Index", + "Residue", + "AA", + "Distance", + "Protein positive?", + "Ligand Group", + "Ligand Atoms", + ] i = 1 - for x in doc.report.bindingsite[indexForUNL].interactions.salt_bridges.salt_bridge: - l = [i,x.resnr.cdata,x.restype.cdata,x.dist.cdata,x.protispos.cdata,x.lig_group.cdata] + for x in doc.report.bindingsite[ + indexForUNL + ].interactions.salt_bridges.salt_bridge: + l = [ + i, + x.resnr.cdata, + x.restype.cdata, + x.dist.cdata, + x.protispos.cdata, + x.lig_group.cdata, + ] atoms = [] for y in x.lig_idx_list.idx: atoms.append(y.cdata) @@ -236,8 +324,17 @@ if fallback == 0: tableBody = [] tableHeaders = ["Index", "Residue", "AA", "Distance", "Prot charged?", "Atoms"] i = 1 - for x in doc.report.bindingsite[indexForUNL].interactions.pi_cation_interactions.pi_cation_interaction: - l = [i,x.resnr.cdata,x.restype.cdata,x.dist.cdata,x.offset.cdata,x.protcharged.cdata] + for x in doc.report.bindingsite[ + indexForUNL + ].interactions.pi_cation_interactions.pi_cation_interaction: + l = [ + i, + x.resnr.cdata, + x.restype.cdata, + x.dist.cdata, + x.offset.cdata, + x.protcharged.cdata, + ] atoms = [] for y in x.lig_idx_list.idx: atoms.append(y.cdata) @@ -251,8 +348,19 @@ elif fallback == 1: tableBody = [] tableHeaders = ["No.", "Res.", "AA", "Dist", "Ligand Atom", "Proton Atom"] i = 1 - for x in doc.report.bindingsite.interactions.hydrophobic_interactions.hydrophobic_interaction: - l = [i,x.resnr.cdata,x.restype.cdata,x.dist.cdata,x.ligcarbonidx.cdata,x.protcarbonidx.cdata] + for ( + x + ) in ( + doc.report.bindingsite.interactions.hydrophobic_interactions.hydrophobic_interaction + ): + l = [ + i, + x.resnr.cdata, + x.restype.cdata, + x.dist.cdata, + x.ligcarbonidx.cdata, + x.protcarbonidx.cdata, + ] i += 1 tableBody.append(l) print(tabulate(tableBody, headers=tableHeaders), end="\n\n") @@ -260,10 +368,30 @@ elif fallback == 1: if hb == 1: print("## Hydrogen Bonds", end="\n\n") tableBody = [] - tableHeaders = ["No.","Res.","AA","Dist H-A","Dist D-A","Don Angle","Protisdon?","Sidechain?","D. Atom","A. Atom"] + tableHeaders = [ + "No.", + "Res.", + "AA", + "Dist H-A", + "Dist D-A", + "Don Angle", + "Protisdon?", + "Sidechain?", + "D. Atom", + "A. Atom", + ] i = 1 for x in doc.report.bindingsite.interactions.hydrogen_bonds.hydrogen_bond: - l = [i,x.resnr.cdata,x.restype.cdata,x.dist_h_a.cdata,x.dist_d_a.cdata,x.don_angle.cdata,x.protisdon.cdata,x.sidechain.cdata] + l = [ + i, + x.resnr.cdata, + x.restype.cdata, + x.dist_h_a.cdata, + x.dist_d_a.cdata, + x.don_angle.cdata, + x.protisdon.cdata, + x.sidechain.cdata, + ] l.append((x.donoridx.cdata + "[" + x.donortype.cdata + "]")) l.append((x.acceptoridx.cdata + "[" + x.acceptortype.cdata + "]")) i += 1 @@ -274,10 +402,25 @@ elif fallback == 1: if sb == 1: print("## Salt Bridges", end="\n\n") tableBody = [] - tableHeaders = ["Index","Residue","AA","Distance","Protein positive?","Ligand Group","Ligand Atoms"] + tableHeaders = [ + "Index", + "Residue", + "AA", + "Distance", + "Protein positive?", + "Ligand Group", + "Ligand Atoms", + ] i = 1 for x in doc.report.bindingsite.interactions.salt_bridges.salt_bridge: - l = [i,x.resnr.cdata,x.restype.cdata,x.dist.cdata,x.protispos.cdata,x.lig_group.cdata] + l = [ + i, + x.resnr.cdata, + x.restype.cdata, + x.dist.cdata, + x.protispos.cdata, + x.lig_group.cdata, + ] atoms = [] for y in x.lig_idx_list.idx: atoms.append(y.cdata) @@ -291,8 +434,19 @@ elif fallback == 1: tableBody = [] tableHeaders = ["Index", "Residue", "AA", "Distance", "Prot charged?", "Atoms"] i = 1 - for x in doc.report.bindingsite.interactions.pi_cation_interactions.pi_cation_interaction: - l = [i,x.resnr.cdata,x.restype.cdata,x.dist.cdata,x.offset.cdata,x.protcharged.cdata] + for ( + x + ) in ( + doc.report.bindingsite.interactions.pi_cation_interactions.pi_cation_interaction + ): + l = [ + i, + x.resnr.cdata, + x.restype.cdata, + x.dist.cdata, + x.offset.cdata, + x.protcharged.cdata, + ] atoms = [] for y in x.lig_idx_list.idx: atoms.append(y.cdata) |