diff options
author | deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com> | 2020-07-07 14:55:17 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-07 14:55:17 +0000 |
commit | 0d135d611506e81d322596c7827b08bbfd3b7c08 (patch) | |
tree | a281b8e1f140ad3de77d818747fce03bcfa5b77b /plip/basic/remote.py | |
parent | 7059ee2a4ced23e467741cc846eb185886ffca38 (diff) |
Format code with Blackdeepsource-transform-b65b5545
Diffstat (limited to 'plip/basic/remote.py')
-rw-r--r-- | plip/basic/remote.py | 132 |
1 files changed, 86 insertions, 46 deletions
diff --git a/plip/basic/remote.py b/plip/basic/remote.py index 0c67f6f..18de4b7 100644 --- a/plip/basic/remote.py +++ b/plip/basic/remote.py @@ -1,14 +1,23 @@ from collections import namedtuple -hbonds_info = namedtuple('hbonds_info', 'ldon_id lig_don_id prot_acc_id pdon_id prot_don_id lig_acc_id') -hydrophobic_info = namedtuple('hydrophobic_info', 'bs_ids lig_ids pairs_ids') -halogen_info = namedtuple('halogen_info', 'don_id acc_id') -pistack_info = namedtuple('pistack_info', 'proteinring_atoms, proteinring_center ligandring_atoms ' - 'ligandring_center type') -pication_info = namedtuple('pication_info', 'ring_center charge_center ring_atoms charge_atoms, protcharged') -sbridge_info = namedtuple('sbridge_info', 'positive_atoms negative_atoms positive_center negative_center protispos') -wbridge_info = namedtuple('wbridge_info', 'don_id acc_id water_id protisdon') -metal_info = namedtuple('metal_info', 'metal_id, target_id location') +hbonds_info = namedtuple( + "hbonds_info", "ldon_id lig_don_id prot_acc_id pdon_id prot_don_id lig_acc_id" +) +hydrophobic_info = namedtuple("hydrophobic_info", "bs_ids lig_ids pairs_ids") +halogen_info = namedtuple("halogen_info", "don_id acc_id") +pistack_info = namedtuple( + "pistack_info", + "proteinring_atoms, proteinring_center ligandring_atoms " "ligandring_center type", +) +pication_info = namedtuple( + "pication_info", "ring_center charge_center ring_atoms charge_atoms, protcharged" +) +sbridge_info = namedtuple( + "sbridge_info", + "positive_atoms negative_atoms positive_center negative_center protispos", +) +wbridge_info = namedtuple("wbridge_info", "don_id acc_id water_id protisdon") +metal_info = namedtuple("metal_info", "metal_id, target_id location") class VisualizerData: @@ -21,7 +30,7 @@ class VisualizerData: # General Information self.lig_members = sorted(pli.ligand.members) - self.sourcefile = pcomp.sourcefiles['pdbcomplex'] + self.sourcefile = pcomp.sourcefiles["pdbcomplex"] self.corrected_pdb = pcomp.corrected_pdb self.pdbid = mol.pymol_name self.hetid = ligand.hetid @@ -39,57 +48,88 @@ class VisualizerData: # Hydrophobic Contacts # Contains IDs of contributing binding site, ligand atoms and the pairings - hydroph_pairs_id = [(h.bsatom_orig_idx, h.ligatom_orig_idx) for h in pli.hydrophobic_contacts] - self.hydrophobic_contacts = hydrophobic_info(bs_ids=[hp[0] for hp in hydroph_pairs_id], - lig_ids=[hp[1] for hp in hydroph_pairs_id], - pairs_ids=hydroph_pairs_id) + hydroph_pairs_id = [ + (h.bsatom_orig_idx, h.ligatom_orig_idx) for h in pli.hydrophobic_contacts + ] + self.hydrophobic_contacts = hydrophobic_info( + bs_ids=[hp[0] for hp in hydroph_pairs_id], + lig_ids=[hp[1] for hp in hydroph_pairs_id], + pairs_ids=hydroph_pairs_id, + ) # Hydrogen Bonds # #@todo Don't use indices, simplify this code here hbonds_ldon, hbonds_pdon = pli.hbonds_ldon, pli.hbonds_pdon hbonds_ldon_id = [(hb.a_orig_idx, hb.d_orig_idx) for hb in hbonds_ldon] hbonds_pdon_id = [(hb.a_orig_idx, hb.d_orig_idx) for hb in hbonds_pdon] - self.hbonds = hbonds_info(ldon_id=[(hb.a_orig_idx, hb.d_orig_idx) for hb in hbonds_ldon], - lig_don_id=[hb[1] for hb in hbonds_ldon_id], - prot_acc_id=[hb[0] for hb in hbonds_ldon_id], - pdon_id=[(hb.a_orig_idx, hb.d_orig_idx) for hb in hbonds_pdon], - prot_don_id=[hb[1] for hb in hbonds_pdon_id], - lig_acc_id=[hb[0] for hb in hbonds_pdon_id]) + self.hbonds = hbonds_info( + ldon_id=[(hb.a_orig_idx, hb.d_orig_idx) for hb in hbonds_ldon], + lig_don_id=[hb[1] for hb in hbonds_ldon_id], + prot_acc_id=[hb[0] for hb in hbonds_ldon_id], + pdon_id=[(hb.a_orig_idx, hb.d_orig_idx) for hb in hbonds_pdon], + prot_don_id=[hb[1] for hb in hbonds_pdon_id], + lig_acc_id=[hb[0] for hb in hbonds_pdon_id], + ) # Halogen Bonds - self.halogen_bonds = [halogen_info(don_id=h.don_orig_idx, acc_id=h.acc_orig_idx) - for h in pli.halogen_bonds] + self.halogen_bonds = [ + halogen_info(don_id=h.don_orig_idx, acc_id=h.acc_orig_idx) + for h in pli.halogen_bonds + ] # Pistacking - self.pistacking = [pistack_info(proteinring_atoms=pistack.proteinring.atoms_orig_idx, - proteinring_center=pistack.proteinring.center, - ligandring_atoms=pistack.ligandring.atoms_orig_idx, - ligandring_center=pistack.ligandring.center, - type=pistack.type) for pistack in pli.pistacking] + self.pistacking = [ + pistack_info( + proteinring_atoms=pistack.proteinring.atoms_orig_idx, + proteinring_center=pistack.proteinring.center, + ligandring_atoms=pistack.ligandring.atoms_orig_idx, + ligandring_center=pistack.ligandring.center, + type=pistack.type, + ) + for pistack in pli.pistacking + ] # Pi-cation interactions - self.pication = [pication_info(ring_center=picat.ring.center, - charge_center=picat.charge.center, - ring_atoms=picat.ring.atoms_orig_idx, - charge_atoms=picat.charge.atoms_orig_idx, - protcharged=picat.protcharged) - for picat in pli.pication_paro + pli.pication_laro] + self.pication = [ + pication_info( + ring_center=picat.ring.center, + charge_center=picat.charge.center, + ring_atoms=picat.ring.atoms_orig_idx, + charge_atoms=picat.charge.atoms_orig_idx, + protcharged=picat.protcharged, + ) + for picat in pli.pication_paro + pli.pication_laro + ] # Salt Bridges - self.saltbridges = [sbridge_info(positive_atoms=sbridge.positive.atoms_orig_idx, - negative_atoms=sbridge.negative.atoms_orig_idx, - positive_center=sbridge.positive.center, - negative_center=sbridge.negative.center, - protispos=sbridge.protispos) - for sbridge in pli.saltbridge_lneg + pli.saltbridge_pneg] + self.saltbridges = [ + sbridge_info( + positive_atoms=sbridge.positive.atoms_orig_idx, + negative_atoms=sbridge.negative.atoms_orig_idx, + positive_center=sbridge.positive.center, + negative_center=sbridge.negative.center, + protispos=sbridge.protispos, + ) + for sbridge in pli.saltbridge_lneg + pli.saltbridge_pneg + ] # Water Bridgese('wbridge_info', 'don_id acc_id water_id protisdon') - self.waterbridges = [wbridge_info(don_id=wbridge.d_orig_idx, - acc_id=wbridge.a_orig_idx, - water_id=wbridge.water_orig_idx, - protisdon=wbridge.protisdon) for wbridge in pli.water_bridges] + self.waterbridges = [ + wbridge_info( + don_id=wbridge.d_orig_idx, + acc_id=wbridge.a_orig_idx, + water_id=wbridge.water_orig_idx, + protisdon=wbridge.protisdon, + ) + for wbridge in pli.water_bridges + ] # Metal Complexes - self.metal_complexes = [metal_info(metal_id=metalc.metal_orig_idx, - target_id=metalc.target_orig_idx, - location=metalc.location) for metalc in pli.metal_complexes] + self.metal_complexes = [ + metal_info( + metal_id=metalc.metal_orig_idx, + target_id=metalc.target_orig_idx, + location=metalc.location, + ) + for metalc in pli.metal_complexes + ] |