aboutsummaryrefslogtreecommitdiff
path: root/plip/visualization/visualize.py
diff options
context:
space:
mode:
authordeepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>2020-07-07 14:55:17 +0000
committerGitHub <noreply@github.com>2020-07-07 14:55:17 +0000
commit0d135d611506e81d322596c7827b08bbfd3b7c08 (patch)
treea281b8e1f140ad3de77d818747fce03bcfa5b77b /plip/visualization/visualize.py
parent7059ee2a4ced23e467741cc846eb185886ffca38 (diff)
Format code with Blackdeepsource-transform-b65b5545
Diffstat (limited to 'plip/visualization/visualize.py')
-rw-r--r--plip/visualization/visualize.py62
1 files changed, 37 insertions, 25 deletions
diff --git a/plip/visualization/visualize.py b/plip/visualization/visualize.py
index 4cd7a14..a551798 100644
--- a/plip/visualization/visualize.py
+++ b/plip/visualization/visualize.py
@@ -20,54 +20,63 @@ def visualize_in_pymol(plcomplex):
lig_members = plcomplex.lig_members
chain = plcomplex.chain
if config.PEPTIDES:
- vis.ligname = 'PeptideChain%s' % plcomplex.chain
+ vis.ligname = "PeptideChain%s" % plcomplex.chain
if config.INTRA is not None:
- vis.ligname = 'Intra%s' % plcomplex.chain
+ vis.ligname = "Intra%s" % plcomplex.chain
ligname = vis.ligname
hetid = plcomplex.hetid
metal_ids = plcomplex.metal_ids
- metal_ids_str = '+'.join([str(i) for i in metal_ids])
+ metal_ids_str = "+".join([str(i) for i in metal_ids])
########################
# Basic visualizations #
########################
- start_pymol(run=True, options='-pcq', quiet=not config.VERBOSE and not config.SILENT)
+ start_pymol(
+ run=True, options="-pcq", quiet=not config.VERBOSE and not config.SILENT
+ )
vis.set_initial_representations()
cmd.load(plcomplex.sourcefile)
- current_name = cmd.get_object_list(selection='(all)')[0]
- logger.debug(f'setting current_name to {current_name} and pdbid to {pdbid}')
+ current_name = cmd.get_object_list(selection="(all)")[0]
+ logger.debug(f"setting current_name to {current_name} and pdbid to {pdbid}")
cmd.set_name(current_name, pdbid)
- cmd.hide('everything', 'all')
+ cmd.hide("everything", "all")
if config.PEPTIDES:
- cmd.select(ligname, 'chain %s and not resn HOH' % plcomplex.chain)
+ cmd.select(ligname, "chain %s and not resn HOH" % plcomplex.chain)
else:
- cmd.select(ligname, 'resn %s and chain %s and resi %s*' % (hetid, chain, plcomplex.position))
- logger.debug(f'selecting ligand for PDBID {pdbid} and ligand name {ligname}')
- logger.debug(f'resn {hetid} and chain {chain} and resi {plcomplex.position}')
+ cmd.select(
+ ligname,
+ "resn %s and chain %s and resi %s*" % (hetid, chain, plcomplex.position),
+ )
+ logger.debug(f"selecting ligand for PDBID {pdbid} and ligand name {ligname}")
+ logger.debug(f"resn {hetid} and chain {chain} and resi {plcomplex.position}")
# Visualize and color metal ions if there are any
if not len(metal_ids) == 0:
vis.select_by_ids(ligname, metal_ids, selection_exists=True)
- cmd.show('spheres', 'id %s and %s' % (metal_ids_str, pdbid))
+ cmd.show("spheres", "id %s and %s" % (metal_ids_str, pdbid))
# Additionally, select all members of composite ligands
if len(lig_members) > 1:
for member in lig_members:
resid, chain, resnr = member[0], member[1], str(member[2])
- cmd.select(ligname, '%s or (resn %s and chain %s and resi %s)' % (ligname, resid, chain, resnr))
-
- cmd.show('sticks', ligname)
- cmd.color('myblue')
- cmd.color('myorange', ligname)
- cmd.util.cnc('all')
+ cmd.select(
+ ligname,
+ "%s or (resn %s and chain %s and resi %s)"
+ % (ligname, resid, chain, resnr),
+ )
+
+ cmd.show("sticks", ligname)
+ cmd.color("myblue")
+ cmd.color("myorange", ligname)
+ cmd.util.cnc("all")
if not len(metal_ids) == 0:
- cmd.color('hotpink', 'id %s' % metal_ids_str)
- cmd.hide('sticks', 'id %s' % metal_ids_str)
- cmd.set('sphere_scale', 0.3, ligname)
+ cmd.color("hotpink", "id %s" % metal_ids_str)
+ cmd.hide("sticks", "id %s" % metal_ids_str)
+ cmd.set("sphere_scale", 0.3, ligname)
cmd.deselect()
vis.make_initial_selections()
@@ -91,9 +100,9 @@ def visualize_in_pymol(plcomplex):
vis.additional_cleanup()
if config.DNARECEPTOR:
# Rename Cartoon selection to Line selection and change repr.
- cmd.set_name('%sCartoon' % plcomplex.pdbid, '%sLines' % plcomplex.pdbid)
- cmd.hide('cartoon', '%sLines' % plcomplex.pdbid)
- cmd.show('lines', '%sLines' % plcomplex.pdbid)
+ cmd.set_name("%sCartoon" % plcomplex.pdbid, "%sLines" % plcomplex.pdbid)
+ cmd.hide("cartoon", "%sLines" % plcomplex.pdbid)
+ cmd.show("lines", "%sLines" % plcomplex.pdbid)
if config.PEPTIDES:
filename = "%s_PeptideChain%s" % (pdbid.upper(), plcomplex.chain)
@@ -104,7 +113,10 @@ def visualize_in_pymol(plcomplex):
if config.PYMOL:
vis.save_session(config.OUTPATH, override=filename)
else:
- filename = '%s_%s' % (pdbid.upper(), "_".join([hetid, plcomplex.chain, plcomplex.position]))
+ filename = "%s_%s" % (
+ pdbid.upper(),
+ "_".join([hetid, plcomplex.chain, plcomplex.position]),
+ )
if config.PYMOL:
vis.save_session(config.OUTPATH)
if config.PICS: