# standard libraries imports from __future__ import print_function import os, copy from collections import Counter # external libraries imports import numpy as np # pdbparser library imports from pdbparser import pdbparser from pdbparser.Utilities.Collection import get_path from pdbparser.Utilities.Database import __ATOM__ from pdbparser.Utilities.Construct import Micelle, Sheet, Nanotube from pdbparser.Analysis.Structure.SolventAccessibleSurfaceArea import SolventAccessibleSurfaceArea pdbSDS = pdbparser(os.path.join(get_path("pdbparser"), "Data/SDS.pdb")) pdbCTAB = pdbparser(os.path.join(get_path("pdbparser"), "Data/CTAB.pdb")) PDB = Nanotube().construct().get_pdb() PDB = Sheet().construct().get_pdb() PDB = Micelle([pdbSDS], flipPdbs=[True, True], positionsGeneration="symmetric").construct().get_pdb() SASA = SolventAccessibleSurfaceArea(trajectory=PDB, configurationsIndexes=[0], targetAtomsIndexes=PDB.indexes, atomsRadius='vdwRadius', makeContiguous=False, probeRadius=0, resolution=0.5, storeSurfacePoints=True,
several records manipulations, translation, rotation, orientation, ... are tested """ # standard distribution imports from __future__ import print_function import os # pdbparser imports from pdbparser.Utilities.Collection import get_path from pdbparser.log import Logger from pdbparser.pdbparser import pdbparser from pdbparser.Utilities.Geometry import * pdbRESULT = pdbparser() Logger.info("loading sds molecule ...") pdbSDS = pdbparser(os.path.join(get_path("pdbparser"), "Data", "SDS.pdb")) INDEXES = range(len(pdbSDS.records)) # get molecule axis sdsAxis = get_axis(INDEXES, pdbSDS) ## translate to positive quadrant atomToOriginIndex = get_closest_to_origin(INDEXES, pdbSDS) atom = pdbSDS.records[atomToOriginIndex] [minX, minY, minZ] = [atom['coordinates_x'], atom['coordinates_y'], atom['coordinates_z']] translate(INDEXES, pdbSDS, [-1.1 * minX, -1.1 * minY, -1.1 * minZ]) Logger.info("orient molecule along [1,0,0] ...") orient(axis=[1, 0, 0], indexes=INDEXES, pdb=pdbSDS, records_axis=sdsAxis) sdsAxis = [1, 0, 0] pdbRESULT.concatenate(pdbSDS)
import os from pdbparser.pdbparser import pdbparser from pdbparser.Utilities.Collection import get_path from pdbparser.Utilities.Construct import AmorphousSystem from pdbparser.Utilities.Geometry import get_satisfactory_records_indexes, translate, get_geometric_center from pdbparser.Utilities.Modify import delete_records_and_models_records, reset_records_serial_number, reset_sequence_number_per_residue from pdbparser.Utilities.Database import __WATER__ # read thf molecule and translate to the center thfNAGMA = pdbparser(os.path.join(get_path("pdbparser"),"Data/NAGMA.pdb" ) ) center = get_geometric_center(thfNAGMA.indexes, thfNAGMA) translate(thfNAGMA.indexes, thfNAGMA, -center) # create pdbWATER pdbWATER = pdbparser() pdbWATER.records = __WATER__ pdbWATER.set_name("water") # create amorphous pdbWATER = AmorphousSystem(pdbWATER, boxSize=[40,40,40], density = 0.75).construct().get_pdb() center = get_geometric_center(pdbWATER.indexes, pdbWATER) translate(pdbWATER.indexes, pdbWATER, -center) # make hollow hollowIndexes = get_satisfactory_records_indexes(pdbWATER.indexes, pdbWATER, "np.sqrt(x**2 + y**2 + z**2) <= 10") delete_records_and_models_records(hollowIndexes, pdbWATER) # concatenate thfNAGMA.concatenate(pdbWATER, pdbWATER.boundaryConditions) # reset numbering
from __future__ import print_function import os import numpy as np from pdbparser.log import Logger from pdbparser import pdbparser from pdbparser.Utilities.Collection import get_path from pdbparser.Utilities.Selection import NanotubeSelection from pdbparser.Utilities.Information import get_models_records_indexes_by_records_indexes, get_records_indexes_in_attribute_values from pdbparser.Utilities.Modify import * from pdbparser.Utilities.Geometry import get_principal_axis, translate, orient # read pdb pdbCNT = pdbparser( os.path.join(get_path("pdbparser"), "Data/nanotubeWaterNAGMA.pdb")) Logger.info("Define models") # define models define_models_by_records_attribute_value(pdbCNT.indexes, pdbCNT) Logger.info("Getting nanotube indexes") # get CNT indexes cntIndexes = get_records_indexes_in_attribute_values(pdbCNT.indexes, pdbCNT, "residue_name", "CNT") Logger.info("Create selection") # create selection sel = NanotubeSelection(pdbCNT, nanotubeIndexes=cntIndexes).select() Logger.info("Get models inside nanotube") # construct models out of residues
import os from pdbparser.pdbparser import pdbparser from pdbparser.Utilities.Construct import AmorphousSystem from pdbparser.Utilities.Collection import get_path # create thf amorphous box pdb = pdbparser(os.path.join(get_path("pdbparser"),"Data/Tetrahydrofuran.pdb" )) #pdb.visualize() #exit() pdb = AmorphousSystem(pdb, boxSize=[48,48,48], recursionLimit = 1000000, insertionNumber=700, density = 0.7, priorities={"boxSize":True, "insertionNumber":False, "density":True}).construct().get_pdb() pdb.export_pdb("thf.pdb")
# standard distribution imports import os # pdbparser imports from pdbparser.Utilities.Collection import get_path from pdbparser import pdbparser from pdbparser.Utilities.Construct import AmorphousSystem from pdbparser.Utilities.Database import __WATER__ # create pdbWATER pdbWATER = pdbparser() pdbWATER.records = __WATER__ pdbWATER.set_name("water") # get pdb molecules pdbDMPC = pdbparser(os.path.join(get_path("pdbparser"), "Data", "DMPC.pdb")) pdbNAGMA = pdbparser(os.path.join(get_path("pdbparser"), "Data", "NAGMA.pdb")) pdbNALMA = pdbparser(os.path.join(get_path("pdbparser"), "Data", "NALMA.pdb")) # construct amorphous system, adding restrictions and existing micelle in universe pdbAMORPH = AmorphousSystem( [pdbWATER, pdbDMPC, pdbNAGMA, pdbNALMA], boxSize=[150, 150, 150], density=0.25, restrictions="np.sqrt(x**2+y**2+z**2)<25").construct() # visualize amorphous system pdbAMORPH.get_pdb().visualize()