Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config file colormap fix #1

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed lintools/analysis/__init__.pyc
Binary file not shown.
Binary file removed lintools/analysis/hbonds.pyc
Binary file not shown.
Binary file removed lintools/analysis/residence_time.pyc
Binary file not shown.
Binary file removed lintools/data.pyc
Binary file not shown.
Binary file removed lintools/figure.pyc
Binary file not shown.
25 changes: 8 additions & 17 deletions lintools/lintools.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

from argparse import ArgumentParser
import os
import shutil
Expand Down Expand Up @@ -38,13 +37,12 @@ class Lintools(object):
* end_frame * - end frame(s) for trajectory analysis (can be different for each trajectory)
* skip * - number of frames to skip (can be different for each trajectory)
* analysis_cutoff * - a fraction of time a residue has to fullfil the analysis parameters for (default - 0.3)
* sasa * - set this to 1 to turn on solvent accessible surface area calculation (currently only works across whole trajectory)
* diagram_type * - string of the selected diagram type (e.g. "amino" or "clocks")
* output_name * - name of the folder with results and the final SVG file

"""
__version__ = "06.2018"
def __init__(self,topology,trajectory,mol_file,ligand,offset,cutoff,start_frame,end_frame,skip,analysis_cutoff,sasa,diagram_type,output_name,cfg):
__version__ = "09.2016"
def __init__(self,topology,trajectory,mol_file,ligand,offset,cutoff,start_frame,end_frame,skip,analysis_cutoff,diagram_type,output_name,cfg):
"""Defines the input variables."""
self.topology = os.path.abspath(topology)
try:
Expand All @@ -69,7 +67,6 @@ def __init__(self,topology,trajectory,mol_file,ligand,offset,cutoff,start_frame,
self.end = end_frame
self.skip = skip
self.analysis_cutoff = analysis_cutoff
self.sasa = sasa
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ShadSBCB could you comment on why this is being removed?

self.diagram_type = diagram_type
self.output_name = output_name
def data_input_and_res_time_analysis(self):
Expand All @@ -93,17 +90,16 @@ def analysis_of_prot_lig_interactions(self):
"""
self.hbonds = HBonds(self.topol_data,self.trajectory,self.start,self.end,self.skip,self.analysis_cutoff,distance=3)
self.pistacking = PiStacking(self.topol_data,self.trajectory,self.start,self.end,self.skip, self.analysis_cutoff)
if self.sasa==1:
self.sasa = SASA(self.topol_data,self.trajectory)
self.sasa = SASA(self.topol_data,self.trajectory)
self.lig_descr = LigDescr(self.topol_data)
if self.trajectory!=[]:
self.rmsf = RMSF_measurements(self.topol_data,self.topology,self.trajectory,self.ligand,self.start,self.end,self.skip)
self.salt_bridges = SaltBridges(self.topol_data,self.trajectory,self.lig_descr,self.start,self.end,self.skip,self.analysis_cutoff)
def plot_residues(self):
def plot_residues(self, colormap):
"""
Calls Plot() that plots the residues with the required diagram_type.
"""
self.plots = Plots(self.topol_data,self.diagram_type)
self.plots = Plots(self.topol_data, self.diagram_type, colormap)
def draw_figure(self,data_for_color=None, data_for_size=None, data_for_clouds=None, rot_bonds=None, color_for_clouds="Blues", color_type_color="viridis"):
"""
Draws molecule through Molecule() and then puts the final figure together with
Expand Down Expand Up @@ -149,7 +145,6 @@ def write_config_file(self, cfg):
'offset': self.offset,
'distance cutoff': self.cutoff,
'analysis cutoff': self.analysis_cutoff,
'sasa': self.sasa,
'diagram type': self.diagram_type,
'output name': self.output_name},
'representation':{
Expand All @@ -173,7 +168,6 @@ def remove_files(self):
if os.path.isfile(f)==True:
os.remove(f)


if __name__ == '__main__':

#################################################################################################################
Expand All @@ -188,16 +182,13 @@ def remove_files(self):
parser.add_argument('-o', '--outname', dest = "output_name", help='Name for output folder and file')
parser.add_argument('-c', '--cutoff', dest = "cutoff", default = 3.5, help='Cutoff distance in angstroms.')
parser.add_argument('-ac', '--analysis_cutoff', dest = "analysis_cutoff", default=0.3, help='Analysis cutoff - a feature has to appear for at least a fraction of the simulation to be plotted.')
parser.add_argument('-sasa', '--sasa', dest = "sasa", default = 0, help='Perform solvent accessible surface area (sasa) calculation')

args = parser.parse_args()

####################################################################################################################



if args.config!=None:
#If config file exists, args.will be ingnored
#If config file exists, args.will be ignored
print "#####################################################################"
print "WARNING"
print "The arguments from command line will be ignored,"
Expand All @@ -209,7 +200,7 @@ def remove_files(self):
cfg = yaml.load(ymlfile)
## Check config file input - mainly topology and output file, also handling bad input

lintools = Lintools(cfg['input']['topology'],cfg['input']['trajectory'],cfg['input']['mol file'],cfg['input']['ligand'],cfg['input']['offset'],float(cfg['input']['distance cutoff']),cfg['input']['traj start'],cfg['input']['traj end'],cfg['input']['traj skip'],cfg['input']['analysis cutoff'],cfg['input']['sasa'],cfg['input']['diagram type'],cfg['input']['output name'],cfg=True)
lintools = Lintools(cfg['input']['topology'],cfg['input']['trajectory'],cfg['input']['mol file'],cfg['input']['ligand'],cfg['input']['offset'],float(cfg['input']['distance cutoff']),cfg['input']['traj start'],cfg['input']['traj end'],cfg['input']['traj skip'],cfg['input']['analysis cutoff'],cfg['input']['diagram type'],cfg['input']['output name'],cfg=True)
lintools.save_files()
lintools.data_input_and_res_time_analysis()
lintools.analysis_of_prot_lig_interactions()
Expand Down Expand Up @@ -281,7 +272,7 @@ def find_diagram_type():
ligand_name = find_ligand_name()
diagram_type = find_diagram_type()

lintools = Lintools(args.topology,args.trajectory,None,ligand_name,0,args.cutoff,args.start_frame,args.end_frame,args.skip,float(args.analysis_cutoff),args.sasa,diagram_type,args.output_name,cfg=False)
lintools = Lintools(args.topology,args.trajectory,None,ligand_name,0,args.cutoff,args.start_frame,args.end_frame,args.skip,float(args.analysis_cutoff),diagram_type,args.output_name,cfg=False)
lintools.save_files()
lintools.data_input_and_res_time_analysis()
lintools.analysis_of_prot_lig_interactions()
Expand Down
Binary file removed lintools/molecule.pyc
Binary file not shown.
32 changes: 19 additions & 13 deletions lintools/plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from matplotlib import pylab
import numpy


class Plots(object):
"""
This module plots the residue data.
Expand All @@ -23,21 +22,28 @@ class Plots(object):
"""
__version__ = "09.2016"
matplotlib.rcParams['svg.fonttype'] = 'none'
matplotlib.rcParams['font.weight']=900
matplotlib.rcParams['font.weight'] = 900
matplotlib.rcParams['text.usetex'] = False
matplotlib.rcParams['patch.linewidth'] = 0
def __init__(self, topology_data_object,diagram_type,colormap='summer'):
def __init__(self, topology_data_object, diagram_type, colormap='summer'):
self.topology_data = topology_data_object
self.colors_amino_acids = {"acidic":"#D9774B", "basic":"#889DCC",
"aromatic":"#9FC74A", "polar":"#D06AC1",
"hydrophobic":"#6AC297","lipids":"#ffff99",
"water":"turquoise","ions":"gold"}
self.amino_acids = {"ASP":"acidic","GLU":"acidic","LYS":"basic","ARG":"basic",
"PHE":"aromatic","TYR":"aromatic","TRP":"aromatic","SER":"polar",
"THR":"polar","ASN":"polar","GLN":"polar","CYS":"polar",
"HIS":"polar","ALA":"hydrophobic","VAL":"hydrophobic",
"ILE":"hydrophobic","LEU":"hydrophobic","MET":"hydrophobic","GLY":"hydrophobic","PRO":"hydrophobic",
"PC":"lipids","HOH":"water","SOL":"water"}
self.colors_amino_acids = {"acidic": "#D9774B", "basic": "#889DCC",
"aromatic": "#9FC74A", "polar": "#D06AC1",
"hydrophobic": "#6AC297",
"lipids": "#ffff99", "water": "turquoise",
"ions": "gold"}
self.amino_acids = {"ASP": "acidic","GLU": "acidic","LYS": "basic",
"ARG": "basic", "PHE": "aromatic",
"TYR": "aromatic", "TRP": "aromatic",
"SER": "polar", "THR": "polar", "ASN": "polar",
"GLN": "polar", "CYS": "polar", "HIS": "polar",
"ALA": "hydrophobic", "VAL": "hydrophobic",
"ILE": "hydrophobic", "LEU": "hydrophobic",
"MET": "hydrophobic", "GLY": "hydrophobic",
"PRO": "hydrophobic", "PC": "lipids",
"HOH": "water", "SOL": "water"}
# Let's try to fix this so that default config works
self.colormap = colormap
if diagram_type == "amino":
self.plot_amino_diagrams()
if diagram_type == "domains":
Expand Down
Binary file removed lintools/plots.pyc
Binary file not shown.