diff options
author | Navan Chauhan <navanchauhan@gmail.com> | 2020-08-08 16:12:49 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-08 16:12:49 +0530 |
commit | 134a361253245ae832a588dc0971284554f13013 (patch) | |
tree | f63c0cea91ce71cd6ff078f2cc51cc84adfe3c59 | |
parent | 9293e1b17b6a727f6e743883dab3cc94e6828c6c (diff) |
Update makeReport.py
-rw-r--r-- | scripts/makeReport.py | 196 |
1 files changed, 26 insertions, 170 deletions
diff --git a/scripts/makeReport.py b/scripts/makeReport.py index 2a32d29..cab6b78 100644 --- a/scripts/makeReport.py +++ b/scripts/makeReport.py @@ -74,16 +74,8 @@ 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 = [] - l.append(i) - l.append(x.resnr.cdata) - l.append(x.restype.cdata) - l.append(x.dist.cdata) - l.append(x.ligcarbonidx.cdata) - l.append(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") @@ -92,31 +84,10 @@ 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 = [] - l.append(i) - l.append(x.resnr.cdata) - l.append(x.restype.cdata) - l.append(x.dist_h_a.cdata) - l.append(x.dist_d_a.cdata) - l.append(x.don_angle.cdata) - l.append(x.protisdon.cdata) - l.append(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 @@ -127,10 +98,7 @@ 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") @@ -139,10 +107,7 @@ 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") @@ -167,10 +132,7 @@ 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") @@ -234,16 +196,8 @@ 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 = [] - l.append(i) - l.append(x.resnr.cdata) - l.append(x.restype.cdata) - l.append(x.dist.cdata) - l.append(x.ligcarbonidx.cdata) - l.append(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") @@ -251,31 +205,10 @@ 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 = [] - l.append(i) - l.append(x.resnr.cdata) - l.append(x.restype.cdata) - l.append(x.dist_h_a.cdata) - l.append(x.dist_d_a.cdata) - l.append(x.don_angle.cdata) - l.append(x.protisdon.cdata) - l.append(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 @@ -286,26 +219,10 @@ 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 = [] - l.append(i) - l.append(x.resnr.cdata) - l.append(x.restype.cdata) - l.append(x.dist.cdata) - l.append(x.protispos.cdata) - l.append(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) @@ -319,16 +236,8 @@ 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 = [] - l.append(i) - l.append(x.resnr.cdata) - l.append(x.restype.cdata) - l.append(x.dist.cdata) - l.append(x.offset.cdata) - l.append(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) @@ -342,18 +251,8 @@ 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 = [] - l.append(i) - l.append(x.resnr.cdata) - l.append(x.restype.cdata) - l.append(x.dist.cdata) - l.append(x.ligcarbonidx.cdata) - l.append(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") @@ -361,29 +260,10 @@ 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 = [] - l.append(i) - l.append(x.resnr.cdata) - l.append(x.restype.cdata) - l.append(x.dist_h_a.cdata) - l.append(x.dist_d_a.cdata) - l.append(x.don_angle.cdata) - l.append(x.protisdon.cdata) - l.append(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 @@ -394,24 +274,10 @@ 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 = [] - l.append(i) - l.append(x.resnr.cdata) - l.append(x.restype.cdata) - l.append(x.dist.cdata) - l.append(x.protispos.cdata) - l.append(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) @@ -425,18 +291,8 @@ 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 = [] - l.append(i) - l.append(x.resnr.cdata) - l.append(x.restype.cdata) - l.append(x.dist.cdata) - l.append(x.offset.cdata) - l.append(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) |