def handle_model(self): """Creates a model is model is not set. Loads a model from a string. Or assign a model to self.model.out_folder Calling this function results in self.model to be and htmd.model.Model class """ from htmd.model import Model from htmd.molecule.molecule import Molecule if not self.model: from IDP_htmd.IDP_analysis import analyze_folder print("Creating new analysis") self.write_parameters() self.model = analyze_folder(self.input_folder, self.out_folder, self.skip, self.metrics, self.cluster, self.tica, self.ticadim, self.ticalag, self.modellag, self.modelunits, self.macronum, self.bulk_split, self.fes, self.rg_analysis, self.save_model, self.data_fstep) if isinstance(self.model, str): try: print("Loading model") model = Model() model.load(self.model) self.model = model except: print("Could not load the model") return if isinstance(self.model, Model): print("Model loaded") self.mol = Molecule(self.model.data.simlist[0].molfile)
mt = ModelAnalysis("/workspace8/excitome/adaptiveRun/O75376_MOR_58/", "/home/pablo/testModel/") mt.metrics = [ MetricDistance( sel1="noh and protein", sel2="noh and protein", metric="contacts", threshold=5, groupsel1="residue", groupsel2="residue") ] model = Model() model.load("/home/pablo/testModel/model.dat") mt.model = model mt.handle_model() mt.sasa_variation() # mt.model = "/home/pablo/testModel/model.dat" # mt.plot_dihedral = "2_dihedral" # mt.macronum = 4 # mt.plot_contacts = [ # ('all_contacts', 'noh and protein', 5), # ('backbone', 'noh and backbone', 5), # ('sidechain', 'noh and sidechain', 4), # ] # mt.write_parameters() # mt.generate_html_summary() # mt.perfom_analysis()
if __name__ == "__main__": from htmd.model import getStateStatistic from htmd.projections.metric import MetricData from htmd.projections.metricdistance import MetricDistance from htmd.model import Model from htmd.molecule.molecule import Molecule import numpy as np data = MetricData() data.load( "/workspace8/p27_sj403/10-11-2018_p27_short_sj403/analysis/17_11_2018/testing.dat" ) model = Model() model.load( "/workspace8/p27_sj403/10-11-2018_p27_short_sj403/analysis/17_11_2018/model.dat" ) mol = Molecule(model.data.simlist[0].molfile) mean_dat = getStateStatistic(model, data, range(model.macronum)) met = MetricDistance(sel1="noh and protein or resname MOL", sel2="noh and protein or resname MOL", groupsel1="residue", groupsel2="residue", metric="distances", pbc=False) mapping = met.getMapping(mol) contact_plot(mean_dat, mol, rows=2, cols=2, model=model,