Пример #1
0
def nat(pdbid,chainid):
	
	cmd.view('v', 'store');
	
	object = cmd.get_names()[0]
		
	cmd.fetch(pdbid)
	cmd.select("design_nat","%s and chain %s and not hydro"%(object,"B"))
	cmd.select("native_nat","%s and chain %s and not hydro"%(pdbid,chainid))
	
	cmd.select("other_nat","%s and not chain %s"%(pdbid,chainid))
	cmd.hide("everything","other")
	cmd.hide('(resn HOH)')
	
	cmd.super("design_nat","native_nat")
	
	cmd.select("none")
	cmd.orient(object)
	
	cmd.hide("lines","all");
	cmd.show("sticks","native_nat");
	cmd.show("cartoon","native_nat");

	cmd.system("rm %s.pdb"%(pdbid));
	
	cmd.view('v', 'recall')
Пример #2
0
def na():

    cmd.view('v', 'store')

    object = cmd.get_names()[0]

    pdbid = object[0:4]
    chainid = object[4:5]

    cmd.fetch(pdbid)
    cmd.select("design_na", "%s and chain %s" % (object, "B"))
    cmd.select("native_na", "%s and chain %s" % (pdbid, chainid))

    cmd.select("other_na", "%s and not chain %s" % (pdbid, chainid))
    cmd.hide("everything", "other")
    cmd.hide('(resn HOH)')

    cmd.super("design_na", "native_na")

    cmd.select("none")
    cmd.orient(object)

    cmd.system("rm %s.pdb" % (pdbid))

    cmd.view('v', 'recall')
Пример #3
0
def example():
    cmd.fetch('1d7q', async=0)
    cmd.show_as('sticks')
    with timing():
        rmsf('all')
    with timing():
        spectrumproperty('rmsf', 'blue white red')
Пример #4
0
def uniprot_auto(pdb_id, selection='', withss=0, quiet=1):
    '''
DESCRIPTION

    Like "uniprot_features" but with automatic fetching of UniProtKB accession
    and sequence mapping for given pdb_id from http://www.bioinf.org.uk/pdbsws/

ARGUMENTS

    pdb_id = string: PDB accession ID

    selection = string: atom selection {default: <pdb_id>, will be fetched if
    no such object is loaded}

    withss = 0/1: update secondary structure {default: 0}
    '''
    from urllib import urlopen

    if len(pdb_id) != 4 or not pdb_id[0].isdigit():
        print ' Error: invalid pdb_id:', pdb_id
        raise CmdException

    if not selection:
        selection = pdb_id
        if pdb_id not in cmd.get_names('all'):
            cmd.fetch(pdb_id, async=0)

    sele_chains = cmd.get_chains(selection)
    mappings = {}

    pdb_id = pdb_id.lower()
    url = 'http://www.bioinf.org.uk/cgi-bin/pdbsws/query.pl?plain=1&qtype=pdb&all=yes&id=' + pdb_id

    try:
        for line in urlopen(url):
            if not line.startswith(pdb_id):
                continue

            chain = line[5]
            resno = line[20:25].strip()
            acc = line[27:36].strip()
            number = line[40:50].strip()

            if not acc or not number:
                continue

            if chain not in mappings:
                mappings[chain] = acc, resid_mapper()

            if mappings[chain][0] != acc and chain in sele_chains:
                raise ValueError('multiple accessions per chain not supported')

            mappings[chain][1][int(number)] = resno
    except Exception as e:
        print ' Error:', e
        raise CmdException

    for chain, (acc, sm) in mappings.iteritems():
        uniprot_features(acc, '(%s) and chain %s' % (selection, chain),
                withss, 'feature_' + chain + '_', sm, quiet)
Пример #5
0
def na():

    cmd.view('v', 'store')

    object = cmd.get_names()[0]

    if object[0] == 'd':
        pdbid = object[1:5]
        chainid = object[5:6]
    else:
        pdbid = object[0:4]
        chainid = object[4:5]

    cmd.fetch(pdbid)
    cmd.select("design_na", "%s and chain %s and not hydro" % (object, "B"))
    cmd.select("native_na", "%s and chain %s and not hydro" % (pdbid, chainid))

    cmd.select("other_na", "%s and not chain %s" % (pdbid, chainid))
    cmd.hide("everything", "other")
    cmd.hide('(resn HOH)')

    cmd.super("native_na", "design_na")

    cmd.hide("lines", "all")
    cmd.show("sticks", "native_na")
    cmd.show("cartoon", "native_na")

    cmd.select("none")
    cmd.orient(object)

    pdbid = pdbid.lower()
    cmd.system("rm %s.pdb" % (pdbid))

    cmd.view('v', 'recall')
Пример #6
0
	def load(self):
		self.manager.d = self
		self.manager.m = None
		self.manager.m = None # to also set prevm = None		
		# cmd.delete(self.manager.prevd.obj)
		# cmd.delete(self.manager.prevd.pid)
		# print self.manager.d.obj
		# print self.manager.prevd.obj		
		# sys.exit()
		cmd.delete("all")
		cmd.load(self.getloadname(),self.obj,1)
		cmd.remove(self.obj+" and not chain A")
		cmd.fetch(self.pid)
		cmd.remove("het or hydro")
		cmd.color('gray',self.pid+' and elem C')
		self.scores['rms'] = cmd.align(self.pid,self.obj+" and chain A")[0]
		cmd.hide('ev')
		cmd.show('lines')
		cmd.show("car")
		#cmd.disable(self.pid)
		redopent(self.obj)
		self.recalc_design_pos()
		self.read_data_dir('avg_deg')
		self.read_data_dir('ddG')
		self.read_data_dir('rot_boltz')
		self.read_bup()
		self.read_tot_scores()
		self.read_res_scores()
		cmd.orient(self.obj+" or pnt*")
		self.manager.m = self.remembermm
		if self.manager.m: self.manager.m.focus()
		if self.remembermv: cmd.set_view(self.remembermv)
Пример #7
0
def na():
	
	cmd.view('v', 'store');
	
	object = cmd.get_names()[0]
	
	pdbid = object[0:4]
	chainid = object[4:5]
	
	cmd.fetch(pdbid)
	cmd.select("design_na","%s and chain %s"%(object,"B"))
	cmd.select("native_na","%s and chain %s"%(pdbid,chainid))
	
	cmd.select("other_na","%s and not chain %s"%(pdbid,chainid))
	cmd.hide("everything","other")
	cmd.hide('(resn HOH)')
	
	cmd.super("design_na","native_na")
	
	cmd.select("none")
	cmd.orient(object)
	
	cmd.system("rm %s.pdb"%(pdbid));
	
	cmd.view('v', 'recall')
def map_interaction_freq_to_structure(pdb,
                                      chain,
                                      interaction_freq_file,
                                      exp_rep_id,
                                      threshold=0.0):

    ### Background coloring settings
    cmd.bg_color("white")
    cmd.fetch(pdb)
    cmd.hide()
    cmd.show("cartoon")
    cmd.cartoon("loop")
    cmd.color("white", pdb)
    cmd.set("dash_gap", 0)
    cmd.set("dash_width", 5)

    ### Extract interaction frequency information
    interaction_freq_info_list = getInteractionFreqList(
        pdb, interaction_freq_file, exp_rep_id, threshold)

    ### Color interactions by frequency
    print("color interactions by frequency")
    for gpcrdb_pair, resid1, resid2, freq in interaction_freq_info_list:
        cmd.distance(
            "%s" % (gpcrdb_pair),
            "%s and resi %d and name CA and chain %s" % (pdb, resid1, chain),
            "%s and resi %d and name CA and chain %s" % (pdb, resid2, chain))
        mapped_col = freq_to_grayscale(freq)
        cmd.set("dash_color", mapped_col, gpcrdb_pair)
        cmd.hide("labels")
Пример #9
0
    def plot(self, outfile):
        ctrl_id, case_id, snp_df_sub = self.score_on_var()
        df = pd.merge(snp_df_sub, self.snps2aa, on='id')

        #pymol.finish_launching()
        cmd.reinitialize()
        cmd.fetch(self.pdb)
        cmd.alter(self.pdb, 'b = 0.5')
        cmd.show_as('cartoon', self.pdb)
        cmd.color('white', self.pdb)

        for i, row in df.iterrows():
            resi = row['structure_position']
            chain = row['chain']
            pheno = row['es']
            selec = 'snp%s' % i
            selec_atom = 'snp_atom%s' % i
            cmd.select(selec,
                       'name ca and resi %s and chain %s' % (resi, chain))
            cmd.create(selec_atom, selec)
            cmd.set("sphere_scale", 0.8)
            cmd.show('sphere', selec_atom)
            cmd.alter(selec_atom, 'b=%s' % pheno)
            cmd.spectrum("b",
                         "blue_white_red",
                         selec_atom,
                         maximum=1.0,
                         minimum=0.0)
        cmd.bg_color("white")
        cmd.zoom()
        cmd.orient()
        cmd.save('%s.pse' % outfile)
        cmd.png('%s.png' % outfile, width=2400, height=2400, dpi=300, ray=1)
Пример #10
0
def na():
	
	cmd.view('v', 'store');
	
	
	object = cmd.get_names()[0]

	if object[0] == 'd':
		pdbid = object[1:5]
		chainid = object[5:6]
	else:
		pdbid = object[0:4]
		chainid = object[4:5]
	
	cmd.fetch(pdbid)
	cmd.select("design_na","%s and chain %s and not hydro"%(object,"B"))
	cmd.select("native_na","%s and chain %s and not hydro"%(pdbid,chainid))
	
	cmd.select("other_na","%s and not chain %s"%(pdbid,chainid))
	cmd.hide("everything","other")
	cmd.hide('(resn HOH)')
	
	cmd.super("native_na","design_na")
	
	cmd.hide("lines","all");
	cmd.show("sticks","native_na");
	cmd.show("cartoon","native_na");
	
	cmd.select("none")
	cmd.orient(object)
	
	pdbid = pdbid.lower()
	cmd.system("rm %s.pdb"%(pdbid));
	
	cmd.view('v', 'recall')
Пример #11
0
def nat(pdbid, chainid):

    cmd.view('v', 'store')

    object = cmd.get_names()[0]

    cmd.fetch(pdbid)
    cmd.select("design_nat", "%s and chain %s and not hydro" % (object, "B"))
    cmd.select("native_nat",
               "%s and chain %s and not hydro" % (pdbid, chainid))

    cmd.select("other_nat", "%s and not chain %s" % (pdbid, chainid))
    cmd.hide("everything", "other")
    cmd.hide('(resn HOH)')

    cmd.super("design_nat", "native_nat")

    cmd.select("none")
    cmd.orient(object)

    cmd.hide("lines", "all")
    cmd.show("sticks", "native_nat")
    cmd.show("cartoon", "native_nat")

    cmd.system("rm %s.pdb" % (pdbid))

    cmd.view('v', 'recall')
Пример #12
0
def q5():
    '''
    DESCRIPTION

    Question 5:  How many axial stacks of helices does 
    the ribozyme have?
    
    The following commands created the scene for "q5": 
    
    delete all;fetch 3zp8, hammer, async=0;show cartoon, hammer;set_view (-0.5,0.18,-0.85,-0.17,-0.98,-0.11,-0.85,0.09,0.52,0.0,0.0,-167.2,-18.45,10.92,-12.11,126.37,208.02,-20.0);rock;

    To reuse of parts or all of the above commands, copy and paste the commands 
    onto the command line or into a plain text file. 
      
    These commands are sufficient for most editing tasks:  
    To edit code, positon cursor on command line with left mouse button.  
    Control-e moves the cursor to the end of the line, even when it is out of view.
    Control-a moves the cursor to the beginning of the line, even when it is out of view.    
    Up arrow key recalls last line of commands for editing.

    These commands may not be available on all systems:
    Shift-control-a selects everything from the right of the cursor to the end of the line.
    Shift-control-e selects everything to the left of the cursor to the end of the line.
    Command-f moves the cursor to the end of the current word.   
    Command-b moves the cursor to the begining of the current word.
    Control-f moves the cursor to the right by one character.   
    Control-b moves the cursor to the left by one character.
    '''
    cmd.reinitialize()
    cmd.fetch('3zp8', type='pdb', name= 'hammer', async='0')
    cmd.show_as('cartoon','hammer')
    cmd.rock()
    cmd.set_view('(-0.5,0.18,-0.85,-0.17,-0.98,-0.11,-0.85,0.09,0.52,0.0,0.0,-167.2,-18.45,10.92,-12.11,126.37,208.02,-20.0);')
    print('Enter "q5" to make the scene for question 5.')
    print('Enter "help q5" to see question 5 and the commands to make the scene.') 
Пример #13
0
def testFun(filePath):
    import networkx as nx
    cmd.delete("all")
    
    cmd.fetch("1C3W")
    cmd.hide("lines", "all")
    cmd.show("cartoon", "1C3W")
    cmd.color("green", "all")
    
    #------------------------------ cmd.color("yellow", "resi 194 and resn GLU")
    #------------------------------- cmd.show("sticks", "resi 194 and resn GLU")
    highlightRes("GLUA0194", color="yellow")
    highlightRes("GLUA0204", color="yellow")
    
        
    g = loadHbTxt(filePath)
    allNodes = nx.node_connected_component(g, "GLUA0194")
    #===========================================================================
    # print allNodes
    #===========================================================================
    
    accRes = {}
    for line in open("/Users/xzhu/sibyl/BR/1C3W/hydro/def/raw/acc.res"):
        fields = line.split()
        resString = fields[1] + fields[2]
        acc = float(fields[4])
        accRes[resString] = acc
    
    colorThreshold = 0.02
    for eachResidue in accRes.keys():
        if accRes[eachResidue] > colorThreshold:
            if eachResidue in allNodes:
                print eachResidue
                highlightRes(eachResidue)
Пример #14
0
def main(sys_argv=sys.argv):
    #pdbCode = '1XFH'.lower()
    pdbCode = '2NWL'.lower()
    pymol.finish_launching()
    cmd.fetch(pdbCode)
    xml = get_pdbtm_xml(pdbCode)
    chains_dict = get_pdbtm_annotation(pdbCode, xml)
    highlight_molecule(chains_dict, pdbCode.lower())
Пример #15
0
def Mutagenesis(kinase1, model, template,peptide_instance):
    """superposition the model and template, remove template and leave peptide behind """

    """replace peptide with instance peptide"""
    list_name = peptide_instance
    with open(input_data_folder+list_name,'r') as f:
        instances = f.readlines()
    instance = [x.strip() for x in instances]
    print "your peptide: ", instance 
    
    for pep in instance:
        cmd.delete('all')
        cmd.fetch(model)  # model_candidate, ex.chk1,chk2...
        cmd.remove("hetatm") #remove the nonstandard residues
        cmd.fetch(template)  #mutagenesis template, ex.2phk
        peptide_template = cmd.get_fastastr( "/"+template+'//B') #get the peptide from the template and generate another one for mutagenesis 
        peptide_template = peptide_template + 'G' #peptide of 2phk is 7 amino acid long, when our input peptide is 8 aa, we need to plus one character
        
        
        for aa in peptide_template[6:].lower(): #creat template_peptide for mutagenesis

            cmd._alt(aa)
        
        
        firstaa = AAcode_1_to_3(peptide_template[6]) #translate template_peptide to 3 letter
        low_firstaa = firstaa[0].lower()

        cmd.alter(low_firstaa, 'chain = "B"') #select this template_peptide        
        cmd.show_as("cartoon")
        cmd.align(model, template) #superpostion of model and template
        cmd.align(low_firstaa,template) #superpostion of template_peptide and template

        remove_part = "("+template+" and not resn ATP"+")" 
        cmd.select("remove_part",remove_part) 

        
        cmd.remove("remove_part") #remove the template except for ATP, there are only model and template_peptide
        cmd.remove("resn hoh") #remove water
        cmd.wizard("mutagenesis")
        peptide_position = 0

        for i in pep:
            #the peptide_position starting point depends the first position of mutagenesis peptide
            #pymol's peptide start from 1, not 0
            mutagenesis_template = '/'+low_firstaa+ '///' + str(peptide_position + 2) # because of 2phk start at 2nd of peptide
            #mutagenesis_template = '/' + template + '//B/' + str(peptide_position + 2)
            cmd.get_wizard().do_select(mutagenesis_template)  # select peptide position of mutation
            replace_aminoacid = AAcode_1_to_3(pep)[peptide_position]
            cmd.get_wizard().set_mode(replace_aminoacid)  # select which residue want to mutate to
            cmd.get_wizard().apply()
            peptide_position += 1
        filename = kinase1 + '_' + model + 'model_' + template + 'muta_' + pep + '.pdb' #build the canonical name
        cmd.save(filename)
        ATPchange(filename) #change ATP naming to the format of ATP.params
    cmd.wizard(None)
    return
Пример #16
0
def load(type, id):
    # we clear pymol, make filename and path
    quantum_target = []
    target_features = []
    cmd.delete('all')
    file_name = f'{id}.{type}' if type is 'cif' else id
    dataset_path = os.path.join('.', 'datasets', type)
    path = os.path.join(dataset_path, file_name)
    # we load the target
    print(f'load {id} {path}')
    if type is "cif":
        if not os.path.exists(path):
            cmd.fetch(id, path=dataset_path)
        elif os.path.exists(path):
            cmd.load(path)
    elif type is "xyz":
        cmd.load(path)
    elif type is "rxn":
        reactants, products = get_reactants_products(path)
        print(f"{str(reactants)} ---> {str(products)}")
        for product in products:
            product_path = os.path.join('.', 'datasets', 'mol', product)
            cmd.load(product_path)
    # make target
    clean_pymol()
    model = cmd.get_model('all', 1)
    target_positions = get_positions(model)
    quantum_target = get_quantum_target(path) if type is "xyz" else None
    target_features = get_features(model) if type is "rxn" else None
    target_masses = get_masses(model) if type is "rxn" else None
    target_numbers = get_numbers(model) if type is "rxn" else None
    if type is 'rxn':
        cmd.delete('all')
        for reactant in reactants:
            reactant_path = os.path.join('.', 'datasets', 'mol', reactant)
            cmd.load(reactant_path)
        clean_pymol()
        model = cmd.get_model('all', 1)
    # make the model inputs
    if type is 'cif':
        chains = cmd.get_chains('all')
        if random.random() < P_UNDOCK:
            undock(chains, type)
        if random.random() < P_UNFOLD:
            unfold(chains)
    if type is 'rxn':
        names = cmd.get_names('all')
        undock(names, type)
    positions = get_positions(model)
    features = get_features(model)
    masses = get_masses(model)
    numbers = get_numbers(model)
    return make_example(type, id, target_positions, positions, features,
                        masses, numbers, quantum_target, target_features,
                        target_masses, target_numbers)
Пример #17
0
def screenshotProteins():
    # proteinsPath = ".\pdbs"

    # set style parameters
    # cmd.set("ray_opaque_background", 0)
    # cmd.remove("solvent")
    cmd.set("ambient", 0.3)
    cmd.set("antialias", 1)
    cmd.bg_color("white")
    # cmd.set("direct", 1.0)
    # cmd.set("ribbon_radius", 0.2)
    # cmd.set("cartoon_highlight_color", "grey50")
    # cmd.set("ray_trace_mode", 1)
    # cmd.set("stick_radius", 0.2)
    # cmd.set("mesh_radius", 0.02)

    # loop thru folders
    # for dir in os.walk(proteinsPath):
    # proteinPath = dir[0]

    # loop thru pdbs
    # for file in os.listdir(proteinPath):
    # if file.endswith('.pdb'):

    csvFileName = "docked-protein-homomers.csv"

    # to loop through csv

    file = open(csvFileName, "r")
    reader = csv.reader(file, delimiter=",")
    k = 1
    for row in reader:
        for item in row:
            print(k, item)

            cmd.reinitialize()

            # load the pdb file
            cmd.fetch(item, path="./pdbs", type='pdb')
            #pdbPath= "./pdbs/" + item + ".cif"
            #cmd.load(pdbPath)
            color = pickAColor()
            cmd.color(color)
            cmd.show("cartoon")
            cmd.remove("solvent")

            # take a screenshot
            screenshotFileName = item + ".png"
            screenshotPath = os.path.join('screenshots', screenshotFileName)
            cmd.png(screenshotPath, 128, 128, ray=1)

            # clear
            cmd.delete("all")

            k = k + 1
Пример #18
0
    def Btn_DownloadPDB_Clicked(self):

        PdbCode = self.FetchPDB.get()

        try:
            if self.PyMOL:
                cmd.fetch(PdbCode, **{'async': 0})
                cmd.refresh()
        except:
            self.DisplayMessage('  You entered an invalid PDB code.', 1)

        self.FetchPDB.set('')
def analyze_surface_residues(pdb_id):
    print('Analyzing surface residues for', pdb_id)
    cmd.fetch(pdb_id)
    findSurfaceResidues(
        pdb_id, pdb_id=pdb_id, oxygen=True
    )  # Calls on findSurfaceResidues from FindSurfaceResidues.py
    cmd.delete('all')

    # Deletes the .cif file created by PyMol
    path = pdb_id.lower() + '.cif'
    if os.path.exists(path):
        os.remove(path)
Пример #20
0
    def Btn_DownloadPDB_Clicked(self):       

        PdbCode = self.FetchPDB.get()
        
        try:            
            if self.PyMOL:
                cmd.fetch(PdbCode, **{'async': 0})
                cmd.refresh()
        except:
            self.DisplayMessage('  You entered an invalid PDB code.', 1)
            
        self.FetchPDB.set('')
Пример #21
0
def chain_align_save(*args, **kwargs): 
    args = [ast.literal_eval(kvpair) for kvpair in args]
    for pair in args:
        cmd.fetch(str.lower(pair[0]))
        create_subchain_object(pair[0], pair[1])
        cmd.delete(str.lower(pair[0]))
    
    for mobile in [ '{}.{}'.format(model, chain) for (model, chain) in args ][1:]:
        cmd.super(mobile, "{}.{}".format(args[0][0], args[0][1]),reset=1,transform=1,quiet=0)

    cmd.reset()
    cmd.save('alignment.cif')
Пример #22
0
def load(pdb):
    '''
	
	This funciton loads a pdb into the PYMOL environment. 


	'''
    cmd.fetch(str(pdb))

    cmd.remove('solvent')
    cmd.color('green')

    file_name = str(pdb) + '.pdb'
    cmd.save(file_name)
Пример #23
0
def feature3D(args):
    import pymol
    from pymol import cmd, util

    # get parameters
    pdb_id = args.pdb_id
    short_win = args.short_win
    large_win = args.large_win
    contact_threshold = args.contact_threshold
    feature_name = args.feature_name

    # compute features for each residue in a labelled chain
    residues, features, lip_indexes = prot_dataset.generate_test(
        pdb_id,
        short_win=short_win,
        large_win=large_win,
        contact_threshold=contact_threshold)
    # make a dataframe
    df = prot_dataset.as_dataframe(features, lip_indexes)
    # get the array with desired feature
    feature = df[feature_name]

    # Open Pymol (not necessary from pyMOL 2.1)
    pymol.finish_launching()
    # Download the PDB
    cmd.fetch(pdb_id, pdb_id)
    # Hide lines
    cmd.hide("lines", pdb_id)
    # Show ribbon
    cmd.show("cartoon", pdb_id)
    # Set all B-factor to 0.0
    cmd.alter("(all)", "b=0.0")

    # for each residue
    for i in range(0, len(residues)):
        # Residue selection in Pymol syntax
        residue_string = '{}/{}{}/'.format(residues[i].get_full_id()[2],
                                           residues[i].id[1], '')
        # Substitute the B-score with the feature score
        cmd.alter(residue_string, "b={:2f}".format(feature[i]))
        # If the residue is labelled as LIP show it as sphere
        if lip_indexes[i] == 1:
            cmd.show_as(
                "spheres",
                "chain {} and resi {}".format(residues[i].get_full_id()[2],
                                              residues[i].id[1]))

    # color by B-factor values
    cmd.spectrum("b", palette="rainbow", selection="(all)")
Пример #24
0
def init():
    cmd.reinitialize()
    #LOAD FILES AND MAKE THE NECESSARY SELECTIONS FOR ALIGNMENT
    cmd.load("pses/session_chlorine_minus1_merged.pse")
    cmd.do("run axes.py")
    cmd.do("run center_of_mass.py")
    #cmd.load("geometry_complex_Cl.mol")
    cmd.select("circ_complex", "organic")

    cmd.fetch("pdbs/" + pdb)
    cmd.select("water", "resn hoh")
    #select ligand and bindingsite
    cmd.select("ligand", "organic and not circ_complex")
    cmd.select("chain_a", "chain a")
    cmd.select("ligand_a", "ligand and chain_a")
Пример #25
0
def get_rec_plus_lig(pdb_id, lig, rec_file, lig_file, new_chain):
    pymol.finish_launching()
    cmd.delete('all')
    cmd.fetch(pdb_id)
    center_coords_rec(pdb_id)
    cmd.select('lig', 'resn lig')
    stored.list=[]
    cmd.iterate('org', "stored.list.append((chain))")
    chain = list(set(stored.list))[0][0]
    cmd.select('lig', 'resn ' + lig + ' and chain ' + chain)
    cmd.select('rec', 'poly and chain ' + chain)
    cmd.alter('rec', 'chain=\'' + new_chain + '\'')
    cmd.save(lig_file, 'lig')
    cmd.save(rec_file, 'rec')
    os.system('rm *.cif')
Пример #26
0
    def testFetch(self):
        with testing.mkdtemp() as fetch_path:
            names = []
            cmd.set('fetch_path', fetch_path)
            cmd.set('fetch_host', 'pdb pdbe')

            cmd.fetch('1avy', '1avy1', type='pdb1')
            names += ['1avy1']
            self.assertItemsEqual(cmd.get_names(), names)
            self.assertEqual(cmd.count_states('1avy1'), 3)

            cmd.fetch('1avy', type='2fofc')
            names += ['1avy_2fofc']
            self.assertItemsEqual(cmd.get_names(), names)
            self.assertEqual(cmd.get_type('1avy_2fofc'), 'object:map')
Пример #27
0
    def testFetch(self):
        with testing.mkdtemp() as fetch_path:
            names = []
            cmd.set('fetch_path', fetch_path)
            cmd.set('fetch_host', 'pdb pdbe')

            cmd.fetch('1avy', '1avy1', type='pdb1')
            names += ['1avy1']
            self.assertItemsEqual(cmd.get_names(), names)
            self.assertEqual(cmd.count_states('1avy1'), 3)

            cmd.fetch('1avy', type='2fofc')
            names += ['1avy_2fofc']
            self.assertItemsEqual(cmd.get_names(), names)
            self.assertEqual(cmd.get_type('1avy_2fofc'), 'object:map')
Пример #28
0
def q6():
    '''
    DESCRIPTION

    Question 6:  What is the average distance of the Na1044
    ligand bonds? Give the residue numbers of the RNA
    nucleotides and the sodium to identify them. How many
    ligands are from RNA?
   
    The following commands created the scene for "q6":
     
    delete all;fetch 3zp8, hammer, async=0; rock;preset.ball_and_stick("all");distance ligand1, i. 1044, c. A and i. 22 and n. N7;distance ligand2, i. 1044, c. A and i. 21 and n. OP2;distance ligand3, i. 1044, i. 2121;distance ligand4, i. 1044, i. 2120;distance ligand5, i. 1044, i. 2122;distance ligand6, i. 1044, i. 2130;set_view (-0.87,0.18,-0.46,-0.39,-0.81,0.44,-0.29,0.56,0.78,-0.0,0.0,-20.47,-18.05,14.02,-18.89,17.47,23.47,-20.0);

    To reuse of parts or all of the above commands, copy and paste the commands 
    onto the command line or into a plain text file. 
      
    These commands are sufficient for most editing tasks:  
    To edit code, positon cursor on command line with left mouse button.  
    Control-e moves the cursor to the end of the line, even when it is out of view.
    Control-a moves the cursor to the beginning of the line, even when it is out of view.    
    Up arrow key recalls last line of commands for editing.

    These commands may not be available on all systems:
    Shift-control-a selects everything from the right of the cursor to the end of the line.
    Shift-control-e selects everything to the left of the cursor to the end of the line.
    Command-f moves the cursor to the end of the current word.   
    Command-b moves the cursor to the begining of the current word.
    Control-f moves the cursor to the right by one character.   
    Control-b moves the cursor to the left by one character.
    '''
    cmd.reinitialize()
    cmd.fetch('3zp8', type='pdb', name='hammer', async='0')
    cmd.rock()
    cmd.do('preset.ball_and_stick("all")')
    cmd.distance('Sodiumligand1', ' resi 1044', 'chain A and i. 22 and n. N7')
    cmd.distance('Sodiumligand2', 'resi 1044', 'chain A and i. 21 and n. OP2')
    cmd.distance('Sodiumligand3', 'resi 1044', 'resi 2121')
    cmd.distance('Sodiumligand4', 'resi 1044', 'resi 2120')
    cmd.distance('Sodiumligand5', 'resi 1044', 'resi 2122')
    cmd.distance('Sodiumligand6', 'resi 1044', 'resi 2130')
    cmd.do('set label_size, -0.4')
    cmd.set_view(
        '(-0.87,0.18,-0.46,-0.39,-0.81,0.44,-0.29,0.56,0.78,-0.0,0.0,-20.47,-18.05,14.02,-18.89,17.47,23.47,-20.0);'
    )
    print('Enter "q6" to make the scene for question 6.')
    print(
        'Enter "help q6" to see question 6 and the commands to make the scene.'
    )
Пример #29
0
def getnative():
    v = cmd.get_view()
    nats = []
    for obj in cmd.get_object_list():
        if len(obj) == 4:
            nats.append(obj)
            continue
        pid = obj[:4]
        if pid in nats:
            continue
        print "fetching native", pid
        cmd.fetch(pid)
        cmd.remove(pid + " and not chain A")
        cmd.remove(pid + " and resn HOH")
        cmd.align(pid, obj)
    cmd.set_view(v)
Пример #30
0
def load_spike_structure():
    cmd.delete('all')

    cmd.set('fetch_path', 'pdbs')
    cmd.fetch(pdb_name, name=pdb_name)

    # Get rid of water/hydrogens in the structure
    cmd.remove('solvent')
    cmd.remove('hydrogens')

    # Clean up the rest... remove all non-protein atoms (PyMOL 2.1+ only)
    cmd.remove('(not polymer.protein)')

    # Hide cartoon and show surface
    cmd.hide('cartoon')
    cmd.show('surface')
Пример #31
0
def q8():
    '''
    DESCRIPTION

    Question 8:  Find the unusual base pair between A21 and
    G36. What is the length of the H-bonds between the bases
    (ignore the H atoms in the distance measurement)? List
    the distance with the residue name, residue number, and
    atom name. What additional H-bond occurs between a base
    in this base pair and a ribose ring of one of the two
    nucleotides in this base pair? 
   
    The following commands created the scene for "q8": 
    
    fetch 3zp8, hammer, async=0;hide everything;show ribbon;show sticks, resi 21 or resi 36;set_view (-0.9,-0.19,0.39,0.39,-0.74,0.55,0.19,0.65,0.74,0.0,0.0,-37.58,-21.66,15.71,-23.32,35.42,39.74,-20.0);rock; 

    To reuse of parts or all of the above commands, copy and paste the commands 
    onto the command line or into a plain text file. 
      
    These commands are sufficient for most editing tasks:  
    To edit code, positon cursor on command line with left mouse button.  
    Control-e moves the cursor to the end of the line, even when it is out of view.
    Control-a moves the cursor to the beginning of the line, even when it is out of view.    
    Up arrow key recalls last line of commands for editing.

    These commands may not be available on all systems:
    Shift-control-a selects everything from the right of the cursor to the end of the line.
    Shift-control-e selects everything to the left of the cursor to the end of the line.
    Command-f moves the cursor to the end of the current word.   
    Command-b moves the cursor to the begining of the current word.
    Control-f moves the cursor to the right by one character.   
    Control-b moves the cursor to the left by one character.
    '''
    cmd.reinitialize()
    cmd.fetch('3zp8', type='pdb', name='hammer', async='0')
    cmd.show_as('ribbon', 'hammer')
    cmd.rock()
    cmd.hide('everything')
    cmd.show_as('ribbon', 'all')
    cmd.show_as('sticks', 'resi 21 or resi 36')
    cmd.set_view(
        '(-0.9,-0.19,0.39,0.39,-0.74,0.55,0.19,0.65,0.74,0.0,0.0,-37.58,-21.66,15.71,-23.32,35.42,39.74,-20.0);'
    )
    print('Enter "q8" to make the scene for question 8.')
    print(
        'Enter "help q8" to see question 8 and the commands to make the scene.'
    )
Пример #32
0
def highlight_membrane(pdbCode, loaded=0, db=DB_ID_PDBTM, color=1):
    loaded = int(loaded)
    color = int(color)
    if not loaded:
        cmd.fetch(pdbCode[0:4])

    if db==DB_ID_PDBTM:
        xml = get_pdbtm_xml(pdbCode[0:4])
        chains_dict = get_pdbtm_annotation(pdbCode[0:4], xml)
    else:
        if db==DB_ID_OPM:
            opm_file = get_opm_file(pdbCode[0:4])
            chains_dict = get_opm_annotation(opm_file)
        else:
            print 'Unkown database supplied: %s. Exiting' % (db)
            exit(1)
    highlight_molecule(chains_dict, pdbCode[0:4].lower(), loaded, pdbCode[4:5], color)
Пример #33
0
    def align(self, target, pse=None):

        if pse is not None:
            cmd.load(pse)
            self.load
            cmd.align('{}'.format(self.pdb), '{}'.format(target))

        elif os.path.exists(target):
            cmd.load('{}'.format(target))
            self.load
            target_pdb = os.path.basename(target).split(".")[0]
            cmd.align('{}'.format(self.pdb), '{}'.format(target_pdb))

        else:
            cmd.fetch('{}'.format(target))
            self.load
            cmd.align('{}'.format(self.pdb), '{}'.format(target))
Пример #34
0
def q4():
    '''
    DESCRIPTION

    Question 4:  What the dihedral angle about the disulfide
    bond between MRG81 of chain F and Cys258 of chain C?
    This is a cross link between the protein and the DNA. Is
    this a cis or trans conformation of the bonds about the
    S--S bond? Is this conformation energetically favorable
    or unfavorable? 
    
    The following commands created the scene for "q4": 
 
    delete all; fetch 3v6d, HIVrt, async=0;preset.ball_and_stick("(c. C and i. 258) or (c. F and i. 817 )");set_view (0.21,-0.91,0.34,-0.84,0.01,0.54,-0.5,-0.4,-0.77,0.0,-0.0,-38.82,-39.67,-55.1,10.96,36.31,41.34,-20.0); 

    To reuse of parts or all of the above commands, copy and paste the commands 
    onto the command line or into a plain text file. 
      
    These commands are sufficient for most editing tasks:  
    To edit code, positon cursor on command line with left mouse button.  
    Control-e moves the cursor to the end of the line, even when it is out of view.
    Control-a moves the cursor to the beginning of the line, even when it is out of view.    
    Up arrow key recalls last line of commands for editing.

    These commands may not be available on all systems:
    Shift-control-a selects everything from the right of the cursor to the end of the line.
    Shift-control-e selects everything to the left of the cursor to the end of the line.
    Command-f moves the cursor to the end of the current word.   
    Command-b moves the cursor to the begining of the current word.
    Control-f moves the cursor to the right by one character.   
    Control-b moves the cursor to the left by one character.
    '''
    cmd.reinitialize()
    cmd.fetch('3v6d', type='pdb', name='HIVrt', async='0')
    cmd.do(
        "preset.ball_and_stick(selection='(chain C and resi 258) or (chain F and resi 817 )')"
    )
    cmd.set_view(
        '(0.21,-0.91,0.34,-0.84,0.01,0.54,-0.5,-0.4,-0.77,0.0,-0.0,-38.82,-39.67,-55.1,10.96,36.31,41.34,-20.0);'
    )
    cmd.rock()
    print('Enter "q4" to make the scene for question 4.')
    print(
        'Enter "help q4" to see question 4 and the commands to make the scene.'
    )
Пример #35
0
def results3D(args):
    import pymol
    from pymol import cmd, util

    # get path adn pdb id
    path = main_folder_path + args.path

    # check if result file exists else print error
    if not isfile(path):
        print "File \"{}\" has not been found.".format(path)
        return

    # open file
    file = open(path, 'r')
    # get the header
    header = file.next()
    #extract pdb id from header
    pdb_id = header.replace('>', '').replace('\n', '')

    # Open Pymol (not necessary from pyMOL 2.1)
    pymol.finish_launching()
    # fetch pdb id
    cmd.fetch(pdb_id, pdb_id)
    # Hide lines
    cmd.hide("lines", pdb_id)
    # Show ribbon
    cmd.show("cartoon", pdb_id)
    # Set all B-factor to 0.0
    cmd.alter("(all)", "b=0.0")

    # for each line in the file
    for line in file:
        # split the line
        identifier, prob, binary_prob = line.split()
        model, chain, index, insertion_code, name = identifier.split('/')
        # Residue selection in Pymol syntax
        residue_string = '{}/{}{}/'.format(chain, index, '')
        # Substitute the B-score with the LIP score
        cmd.alter(residue_string, "b={:2f}".format(float(prob)))

    # color all residues by their B-factor
    cmd.spectrum("b", palette="rainbow", selection="(all)")
    # close file
    file.close()
    return
Пример #36
0
def fetch_and_name_chains(cif_id):
    '''
DESCRIPTION

    1. Fecth a cif structure from the pdb
    2. Rename the cif file accoring to its 4-letter PDB-code followed by its Genus species name
    3. Create a PyMOL object for each of its chains and name them according to whats on the PDB

    '''

    polymers = pypdb.get_all_info(cif_id)['polymer']

    taxonomy = set()
    chain_to_name = {}
    for poly in range(len(polymers)):
        taxonomy.add(polymers[poly]['Taxonomy']['@name'])
        polymer_description = polymers[poly]['polymerDescription'][
            '@description'].split(',')[0]
        entry_name = re.sub('\(|\)', '', polymer_description)
        chain = polymers[poly]['chain']['@id']
        name = re.sub('ribosomal\s|protein\s|60S\s|40S\s|subunit\s|\sprotein',
                      '',
                      entry_name,
                      flags=re.IGNORECASE)
        chain_to_name[name] = chain

    if len(taxonomy) > 1:
        print('multiple species in structure')
        exit

    for organism in taxonomy:
        Genus_species = organism.replace(' ', '_')
        ge_sp = organism.split()
        GeSp = ge_sp[0][:2] + ge_sp[1][0].capitalize() + ge_sp[1][1]

    cmd.fetch(cif_id, cif_id + '_' + GeSp)
    os.rename(cif_id + '.cif', cif_id + '_' + Genus_species + '.cif')
    #    os.remove(cif_id+'.cif') # Not sure why this isn't working

    for obj_name in chain_to_name:
        cmd.create(
            GeSp + '_' + cif_id + '_' + obj_name,
            cif_id + '_' + GeSp + ' and chain ' + chain_to_name[obj_name])

    cmd.show_as('cartoon')
Пример #37
0
def q6():
    '''
    DESCRIPTION

    Question 6:  What is the average distance of the Na1044
    ligand bonds? Give the residue numbers of the RNA
    nucleotides and the sodium to identify them. How many
    ligands are from RNA?
   
    The following commands created the scene for "q6":
     
    delete all;fetch 3zp8, hammer, async=0; rock;preset.ball_and_stick("all");distance ligand1, i. 1044, c. A and i. 22 and n. N7;distance ligand2, i. 1044, c. A and i. 21 and n. OP2;distance ligand3, i. 1044, i. 2121;distance ligand4, i. 1044, i. 2120;distance ligand5, i. 1044, i. 2122;distance ligand6, i. 1044, i. 2130;set_view (-0.87,0.18,-0.46,-0.39,-0.81,0.44,-0.29,0.56,0.78,-0.0,0.0,-20.47,-18.05,14.02,-18.89,17.47,23.47,-20.0);

    To reuse of parts or all of the above commands, copy and paste the commands 
    onto the command line or into a plain text file. 
      
    These commands are sufficient for most editing tasks:  
    To edit code, positon cursor on command line with left mouse button.  
    Control-e moves the cursor to the end of the line, even when it is out of view.
    Control-a moves the cursor to the beginning of the line, even when it is out of view.    
    Up arrow key recalls last line of commands for editing.

    These commands may not be available on all systems:
    Shift-control-a selects everything from the right of the cursor to the end of the line.
    Shift-control-e selects everything to the left of the cursor to the end of the line.
    Command-f moves the cursor to the end of the current word.   
    Command-b moves the cursor to the begining of the current word.
    Control-f moves the cursor to the right by one character.   
    Control-b moves the cursor to the left by one character.
    '''
    cmd.reinitialize()
    cmd.fetch('3zp8', type='pdb', name= 'hammer', async='0')
    cmd.rock()
    cmd.do('preset.ball_and_stick("all")')
    cmd.distance('Sodiumligand1',' resi 1044', 'chain A and i. 22 and n. N7')
    cmd.distance('Sodiumligand2', 'resi 1044', 'chain A and i. 21 and n. OP2')
    cmd.distance('Sodiumligand3', 'resi 1044', 'resi 2121')
    cmd.distance('Sodiumligand4', 'resi 1044', 'resi 2120')
    cmd.distance('Sodiumligand5', 'resi 1044', 'resi 2122')
    cmd.distance('Sodiumligand6', 'resi 1044', 'resi 2130')
    cmd.do('set label_size, -0.4')
    cmd.set_view('(-0.87,0.18,-0.46,-0.39,-0.81,0.44,-0.29,0.56,0.78,-0.0,0.0,-20.47,-18.05,14.02,-18.89,17.47,23.47,-20.0);')   
    print('Enter "q6" to make the scene for question 6.')
    print('Enter "help q6" to see question 6 and the commands to make the scene.') 
Пример #38
0
def q8():
    '''
    DESCRIPTION

    Question 8:  Find the unusual base pair between A21 and
    G36. What is the length of the H-bonds between the bases
    (ignore the H atoms in the distance measurement)? List
    the distance with the residue name, residue number, and
    atom name. What additional H-bond occurs between a base
    in this base pair and a ribose ring of one of the two
    nucleotides in this base pair? 
   
    The following commands created the scene for "q8": 
    
    fetch 3zp8, hammer, async=0;hide everything;show ribbon;show sticks, resi 21 or resi 36;set_view (-0.9,-0.19,0.39,0.39,-0.74,0.55,0.19,0.65,0.74,0.0,0.0,-37.58,-21.66,15.71,-23.32,35.42,39.74,-20.0);rock; 

    To reuse of parts or all of the above commands, copy and paste the commands 
    onto the command line or into a plain text file. 
      
    These commands are sufficient for most editing tasks:  
    To edit code, positon cursor on command line with left mouse button.  
    Control-e moves the cursor to the end of the line, even when it is out of view.
    Control-a moves the cursor to the beginning of the line, even when it is out of view.    
    Up arrow key recalls last line of commands for editing.

    These commands may not be available on all systems:
    Shift-control-a selects everything from the right of the cursor to the end of the line.
    Shift-control-e selects everything to the left of the cursor to the end of the line.
    Command-f moves the cursor to the end of the current word.   
    Command-b moves the cursor to the begining of the current word.
    Control-f moves the cursor to the right by one character.   
    Control-b moves the cursor to the left by one character.
    '''
    cmd.reinitialize()
    cmd.fetch('3zp8', type='pdb', name= 'hammer', async='0')
    cmd.show_as('ribbon', 'hammer')
    cmd.rock()
    cmd.hide('everything')
    cmd.show_as( 'ribbon','all') 
    cmd.show_as('sticks', 'resi 21 or resi 36')
    cmd.set_view('(-0.9,-0.19,0.39,0.39,-0.74,0.55,0.19,0.65,0.74,0.0,0.0,-37.58,-21.66,15.71,-23.32,35.42,39.74,-20.0);')
    print('Enter "q8" to make the scene for question 8.')
    print('Enter "help q8" to see question 8 and the commands to make the scene.') 
Пример #39
0
 def load_pdb(self, num_proteins_seen, screenshotting, pdb_file_name=""): # use pymol wiki
     cmd.delete("all") # prevent memory issues
     # choose a pdb id
     if num_proteins_seen > len(self.pedagogy):
         self.pdb_file_name = random.sample(self.pedagogy, 1)[0]
     elif (num_proteins_seen < len(self.pedagogy) and pdb_file_name == ""):
         self.pdb_file_name = self.pedagogy[num_proteins_seen]
     # fetch or load pdb
     self.pdb_file_path = "./pdbs/"+self.pdb_file_name+".pdb"
     if not os.path.exists(self.pdb_file_path):
         cmd.fetch(self.pdb_file_name, path="./inputs/pdbs", type="pdb")
     elif os.path.exists(self.pdb_file_path):
         cmd.load(self.pdb_file_path)
     cmd.remove("solvent")
     # summarize
     print(self.params.run_time_stamp, " is loading ", num_proteins_seen, self.pdb_file_path)
     print("")
     num_atoms = cmd.count_atoms("all")
     print("noise mean", self.params.noise_mean, "noise scale", self.params.noise_scale)
     # convert pdb2tensor
     original_model = cmd.get_model('all', 1)
     original_coords_list = cmd.get_model('all', 1).get_coord_list()
     original = tf.convert_to_tensor(np.array(original_coords_list), dtype=tf.float32)
     chains = cmd.get_chains()
     if (screenshotting):
         self.current_pdb_screenshot_path = self.params.screenshot_folder_path + "/" + self.pdb_file_name + "-" + str(num_proteins_seen) + "/"
         os.makedirs(self.current_pdb_screenshot_path)
         prepare_pymol()
         take_screenshot(self.params, self.pdb_file_name, num_proteins_seen, "0")
     num_steps = random.randint(self.params.min_steps_in_undock, self.params.max_steps_in_undock)
     self.undock(num_proteins_seen, screenshotting, num_steps, chains)
     undocked_coords_list = cmd.get_model('all', 1).get_coord_list()
     undocked = tf.convert_to_tensor(np.array(undocked_coords_list), dtype=tf.float32)
     # calculate center of mass dict
     self.center_of_mass_dict = AttrDict()
     self.center_of_mass_dict["all"] = cmd.centerofmass("all")
     for chain in chains:
         self.center_of_mass_dict[chain] = cmd.centerofmass("chain {}".format(chain))
     features = np.array([self.extract(atom) for atom in original_model.atom])
     features = tf.convert_to_tensor(features, dtype=tf.float32)
     #outputs
     output_tuple = (self.center_of_mass_dict, num_steps, undocked, features, original, chains)
     return output_tuple
Пример #40
0
def main():
    parser=argparse.ArgumentParser()
    parser.add_argument('-p', action='store', required=True, dest='pdbfile',
                    help='pathfile is a textfile of name of pdb')
    parser.add_argument('-l', action='store', required=True, dest='loop',
                    help='loop is an int number')
    parser.add_argument('-c', action='store', required=True, dest='chain',
                    help='the chain number is needed')
    parser.add_argument('-c1', action='store', required=True, dest='chain1',
                    help='the chain number is needed')
    inputs=parser.parse_args()
    pdbfile=inputs.pdbfile
    removechains='not chain '+inputs.chain+'+'+inputs.chain1
    removechain='chain '+inputs.chain
    loop=int(inputs.loop)
    print "loop is %s "% loop
    dirname=os.getcwd()+'/interface_analyzer/pdbdata/'+pdbfile
    pdbfileselect=pdbfile.split('.')
    savefile=os.getcwd()+'/interface_analyzer/pdbdata/'+pdbfileselect[0]+'_antigen.pdb'
    print "remove antibody of complex,so can caculate the value of antigen sasa "
    pymol.finish_launching()
    if loop!=0:
        pymol.cmd.reinitialize()
    cmd.fetch(pdbfileselect[0],async=0)
    #cmd.select('targetfile',pdbfileselect[0])                                          
    #cmd.save(dirname,(('targetfile')))                                                 
    #cmd.delete(all)
    #cmd.load(dirname)
    cmd.remove(removechains)
    #cmd.remove('solvent')
    #cmd.remove('hydrogens')
    #cmd.remove('hetatm')
    cmd.select('target1',pdbfileselect[0])
    cmd.save(dirname,(('target1')))
    cmd.remove('solvent')
    cmd.remove('hydrogens')
    cmd.remove('not '+removechain)
    cmd.select('target',pdbfileselect[0])
    cmd.save(savefile,(('target')))
    cmd.delete(all)
    cmd.sync()
    cmd.quit()
    print "remove the antibody of complex have done"
Пример #41
0
def q7():
    '''
    DESCRIPTION

    Question 7:  Measure the longest dimension and the
    shortest dimension of the ribozyme. Enter "rock" to 
    stop the rocking motion. What is the ratio of
    the longest dimension to the shortest dimension? Is it
    globular like a protein?  
    
    The following commands created the scene for "q7": 

    delete all;fetch 3zp8, hammer, async=0;show ribbon, hammer;set_view (0.62,0.14,0.78,0.13,-0.99,0.07,0.78,0.05,-0.63,-0.0,-0.0,-169.8,-16.43,9.44,-9.63,143.54,196.05,-20.0); rock;

    To reuse of parts or all of the above commands, copy and paste the commands 
    onto the command line or into a plain text file. 
      
    These commands are sufficient for most editing tasks:  
    To edit code, positon cursor on command line with left mouse button.  
    Control-e moves the cursor to the end of the line, even when it is out of view.
    Control-a moves the cursor to the beginning of the line, even when it is out of view.    
    Up arrow key recalls last line of commands for editing.

    These commands may not be available on all systems:
    Shift-control-a selects everything from the right of the cursor to the end of the line.
    Shift-control-e selects everything to the left of the cursor to the end of the line.
    Command-f moves the cursor to the end of the current word.   
    Command-b moves the cursor to the begining of the current word.
    Control-f moves the cursor to the right by one character.   
    Control-b moves the cursor to the left by one character.
    '''
    cmd.reinitialize()
    cmd.fetch('3zp8', type='pdb', name='hammer', async='0')
    cmd.show_as('ribbon', 'hammer')
    cmd.rock()
    cmd.set_view(
        '(0.62,0.14,0.78,0.13,-0.99,0.07,0.78,0.05,-0.63,-0.0,-0.0,-169.8,-16.43,9.44,-9.63,143.54,196.05,-20.0);'
    )
    print('Enter "q7" to make the scene for question 7.')
    print(
        'Enter "help q7" to see question 7 and the commands to make the scene.'
    )
Пример #42
0
def load(type, id, screenshot=False):
    # we clear pymol, make filename and path
    cmd.delete('all')
    file_name = f'{id}.{type}' if type is 'cif' else id
    dataset_path = os.path.join(DATASETS_ROOT, type)
    path = os.path.join(dataset_path, file_name)
    # we load the target
    print(f'load {id} {path}')
    if type is "cif":
        if not os.path.exists(path):
            cmd.fetch(id, path=dataset_path)
        elif os.path.exists(path):
            cmd.load(path)
    # make target
    clean_pymol()
    model = cmd.get_model('all', 1)
    target = get_positions(model)
    # make the model inputs
    if screenshot:
        prepare_pymol()
        take_screenshot("0")
    chains = cmd.get_chains('all')
    if len(chains) == 0:
        return False
    if random.random() < P_UNDOCK:
        print('undocking')
        undock(chains, type)
    if random.random() < P_UNFOLD:
        print('unfolding')
        unfold(chains)
    model = cmd.get_model('all', 1)
    positions = get_positions(model)
    if positions.shape[0] > MAX_ATOMS:
        print(f"{positions.shape[0]} IS TOO MANY ATOMS")
        return False
    features = get_features(model)
    masses = get_masses(model)
    numbers = get_numbers(model)
    features = tf.concat([features, masses, numbers], -1)
    target = tf.concat([target, features], -1)
    return make_example(id, target, positions, features, masses)
Пример #43
0
def q3():
    '''
    DESCRIPTION

    Question 3: In which groove of the DNA 
    is the protein making the most contacts? 
    Is this unusual? 
    
    The following commands created the scene for "q3": 
    
    delete all; fetch 3v6d, HIVrt, async=0; show cartoon, c. A or c. B;hide lines, c. A or c. B;set_view (0.53,-0.06,-0.84,0.82,-0.21,0.53,-0.21,-0.98,-0.07,-0.0,-0.0,-192.99,-29.84,8.42,47.76,178.27,207.7,-20.0);rock;

    To reuse of parts or all of the above commands, copy and paste the commands 
    onto the command line or into a plain text file. 
      
    These commands are sufficient for most editing tasks:  
    To edit code, positon cursor on command line with left mouse button.  
    Control-e moves the cursor to the end of the line, even when it is out of view.
    Control-a moves the cursor to the beginning of the line, even when it is out of view.    
    Up arrow key recalls last line of commands for editing.

    These commands may not be available on all systems:
    Shift-control-a selects everything from the right of the cursor to the end of the line.
    Shift-control-e selects everything to the left of the cursor to the end of the line.
    Command-f moves the cursor to the end of the current word.   
    Command-b moves the cursor to the begining of the current word.
    Control-f moves the cursor to the right by one character.   
    Control-b moves the cursor to the left by one character.
    '''
    cmd.reinitialize()
    cmd.fetch('3v6d', type='pdb', name='HIVrt', async='0')
    cmd.show_as("cartoon", "c. A or c. B")
    cmd.hide("lines", "c. A or c. B")
    cmd.rock()
    cmd.set_view(
        '(0.53,-0.06,-0.84,0.82,-0.21,0.53,-0.21,-0.98,-0.07,-0.0,-0.0,-192.99,-29.84,8.42,47.76,178.27,207.7,-20.0);'
    )
    print('Enter "q3" to make the scene for question 3.')
    print(
        'Enter "help q3" to see question 3 and the commands to make the scene.'
    )
def beautify_images(protein_name, residue_sets):
    cmd.delete("all")

    cmd.fetch(protein_name, async_=0)
    cmd.color(
        "0xFFFFFF"
    )  # colors the entire protein white (so that the predictions can be colored)

    cmd.hide("lines")
    cmd.hide("spheres")
    cmd.show("cartoon")

    sphere_size = f"vdw={SPHERE_SIZE}"  # the size of the rendered sphere

    for res_set in residue_sets:
        cmd.color(res_set.color,
                  res_set.selection_string)  # colors annotated blue
        cmd.show("spheres", res_set.selection_string)
        cmd.alter(res_set.selection_string,
                  sphere_size)  # changes the sphere size

    cmd.rebuild()  # rerenders the spheres to the new size

    # cmd.color(annotated.color, annotated.selection_string) # colors annotated blue
    # cmd.color(wrong.color, wrong.selection_string) # colors wrongly predicted red
    # cmd.color(correct.color, correct.selection_string) # colors correctly predicted green

    # cmd.show("spheres", annotated.selection_string)
    # cmd.show("spheres", correct.selection_string)
    # cmd.show("spheres", wrong.selection_string)

    # cmd.alter(wrong.selection_string, sphere_size)    # changes the sphere size
    # cmd.alter(correct.selection_string, sphere_size)
    # cmd.alter(annotated.selection_string, sphere_size)
    # cmd.rebuild() # rerenders the spheres to the new size

    cmd.remove("resn hoh")  # removes the HOH's from image
    cmd.orient(residue_sets[0].selection_string)
    cmd.zoom(complete=1)
    cmd.set("depth_cue", "0")  # removes shadows of depth
    cmd.center(protein_name)
Пример #45
0
    def testFetchLocal(self):
        try:
            import urllib.parse as urlparse
        except ImportError:
            import urlparse

        # PyMOL 1.8.6 adds full URLs, remove them
        import pymol
        pdbpaths = pymol.importing.hostPaths['pdb']
        pdbpaths[:] = [p for p in pdbpaths if '://' not in p]

        with testing.mkdtemp() as fetch_path:
            names = []
            cmd.set('fetch_path', fetch_path)
            cmd.set(
                'fetch_host',
                urlparse.urlunsplit(
                    ['file', '',
                     self.datafile('pdb.mirror'), '', '']))

            cmd.fetch('1avy', type='pdb')
            names += ['1avy']
            self.assertItemsEqual(cmd.get_names(), names)

            cmd.fetch('1avyB', type='pdb')
            names += ['1avyB']
            self.assertItemsEqual(cmd.get_names(), names)
            self.assertEqual(cmd.get_chains('1avyB'), ['B'])

            cmd.fetch('1aq5', type='pdb', multiplex=1)
            names += ['1aq5_%04d' % (i + 1) for i in range(20)]
            self.assertItemsEqual(cmd.get_names(), names)
Пример #46
0
    def testFetchLocal(self):
        try:
            import urllib.parse as urlparse
        except ImportError:
            import urlparse

        # PyMOL 1.8.6 adds full URLs, remove them
        import pymol
        pdbpaths = pymol.importing.hostPaths['pdb']
        pdbpaths[:] = [p for p in pdbpaths if '://' not in p]

        with testing.mkdtemp() as fetch_path:
            names = []
            cmd.set('fetch_path', fetch_path)
            cmd.set('fetch_host', urlparse.urlunsplit(['file', '',
                self.datafile('pdb.mirror'), '', '']))

            cmd.fetch('1avy', type='pdb')
            names += ['1avy']
            self.assertItemsEqual(cmd.get_names(), names)

            cmd.fetch('1avyB', type='pdb')
            names += ['1avyB']
            self.assertItemsEqual(cmd.get_names(), names)
            self.assertEqual(cmd.get_chains('1avyB'), ['B'])

            cmd.fetch('1aq5', type='pdb', multiplex=1)
            names += ['1aq5_%04d' % (i+1) for i in range(20)]
            self.assertItemsEqual(cmd.get_names(), names)
Пример #47
0
    def testFetchLocal(self):
        try:
            import urllib.parse as urlparse
        except ImportError:
            import urlparse
        with testing.mkdtemp() as fetch_path:
            names = []
            cmd.set('fetch_path', fetch_path)
            cmd.set(
                'fetch_host',
                urlparse.urlunsplit(
                    ['file', '',
                     self.datafile('pdb.mirror'), '', '']))

            cmd.fetch('1avy', type='pdb')
            names += ['1avy']
            self.assertItemsEqual(cmd.get_names(), names)

            cmd.fetch('1avyB', type='pdb')
            names += ['1avyB']
            self.assertItemsEqual(cmd.get_names(), names)
            self.assertEqual(cmd.get_chains('1avyB'), ['B'])

            cmd.fetch('1aq5', type='pdb', multiplex=1)
            names += ['1aq5_%04d' % (i + 1) for i in range(20)]
            self.assertItemsEqual(cmd.get_names(), names)
Пример #48
0
def q4():
    '''
    DESCRIPTION

    Question 4:  What the dihedral angle about the disulfide
    bond between MRG81 of chain F and Cys258 of chain C?
    This is a cross link between the protein and the DNA. Is
    this a cis or trans conformation of the bonds about the
    S--S bond? Is this conformation energetically favorable
    or unfavorable? 
    
    The following commands created the scene for "q4": 
 
    delete all; fetch 3v6d, HIVrt, async=0;preset.ball_and_stick("(c. C and i. 258) or (c. F and i. 817 )");set_view (0.21,-0.91,0.34,-0.84,0.01,0.54,-0.5,-0.4,-0.77,0.0,-0.0,-38.82,-39.67,-55.1,10.96,36.31,41.34,-20.0); 

    To reuse of parts or all of the above commands, copy and paste the commands 
    onto the command line or into a plain text file. 
      
    These commands are sufficient for most editing tasks:  
    To edit code, positon cursor on command line with left mouse button.  
    Control-e moves the cursor to the end of the line, even when it is out of view.
    Control-a moves the cursor to the beginning of the line, even when it is out of view.    
    Up arrow key recalls last line of commands for editing.

    These commands may not be available on all systems:
    Shift-control-a selects everything from the right of the cursor to the end of the line.
    Shift-control-e selects everything to the left of the cursor to the end of the line.
    Command-f moves the cursor to the end of the current word.   
    Command-b moves the cursor to the begining of the current word.
    Control-f moves the cursor to the right by one character.   
    Control-b moves the cursor to the left by one character.
    '''
    cmd.reinitialize()
    cmd.fetch('3v6d',type='pdb',name='HIVrt',async='0')
    cmd.do("preset.ball_and_stick(selection='(chain C and resi 258) or (chain F and resi 817 )')")
    cmd.set_view('(0.21,-0.91,0.34,-0.84,0.01,0.54,-0.5,-0.4,-0.77,0.0,-0.0,-38.82,-39.67,-55.1,10.96,36.31,41.34,-20.0);')
    cmd.rock()
    print('Enter "q4" to make the scene for question 4.')
    print('Enter "help q4" to see question 4 and the commands to make the scene.') 
Пример #49
0
def q7():
    '''
    DESCRIPTION

    Question 7:  Measure the longest dimension and the
    shortest dimension of the ribozyme. Enter "rock" to 
    stop the rocking motion. What is the ratio of
    the longest dimension to the shortest dimension? Is it
    globular like a protein?  
    
    The following commands created the scene for "q7": 

    delete all;fetch 3zp8, hammer, async=0;show ribbon, hammer;set_view (0.62,0.14,0.78,0.13,-0.99,0.07,0.78,0.05,-0.63,-0.0,-0.0,-169.8,-16.43,9.44,-9.63,143.54,196.05,-20.0); rock;

    To reuse of parts or all of the above commands, copy and paste the commands 
    onto the command line or into a plain text file. 
      
    These commands are sufficient for most editing tasks:  
    To edit code, positon cursor on command line with left mouse button.  
    Control-e moves the cursor to the end of the line, even when it is out of view.
    Control-a moves the cursor to the beginning of the line, even when it is out of view.    
    Up arrow key recalls last line of commands for editing.

    These commands may not be available on all systems:
    Shift-control-a selects everything from the right of the cursor to the end of the line.
    Shift-control-e selects everything to the left of the cursor to the end of the line.
    Command-f moves the cursor to the end of the current word.   
    Command-b moves the cursor to the begining of the current word.
    Control-f moves the cursor to the right by one character.   
    Control-b moves the cursor to the left by one character.
    '''
    cmd.reinitialize()
    cmd.fetch('3zp8', type='pdb', name= 'hammer', async='0')
    cmd.show_as('ribbon', 'hammer')
    cmd.rock()
    cmd.set_view('(0.62,0.14,0.78,0.13,-0.99,0.07,0.78,0.05,-0.63,-0.0,-0.0,-169.8,-16.43,9.44,-9.63,143.54,196.05,-20.0);')
    print('Enter "q7" to make the scene for question 7.')
    print('Enter "help q7" to see question 7 and the commands to make the scene.') 
Пример #50
0
def q3():
    '''
    DESCRIPTION

    Question 3: In which groove of the DNA 
    is the protein making the most contacts? 
    Is this unusual? 
    
    The following commands created the scene for "q3": 
    
    delete all; fetch 3v6d, HIVrt, async=0; show cartoon, c. A or c. B;hide lines, c. A or c. B;set_view (0.53,-0.06,-0.84,0.82,-0.21,0.53,-0.21,-0.98,-0.07,-0.0,-0.0,-192.99,-29.84,8.42,47.76,178.27,207.7,-20.0);rock;

    To reuse of parts or all of the above commands, copy and paste the commands 
    onto the command line or into a plain text file. 
      
    These commands are sufficient for most editing tasks:  
    To edit code, positon cursor on command line with left mouse button.  
    Control-e moves the cursor to the end of the line, even when it is out of view.
    Control-a moves the cursor to the beginning of the line, even when it is out of view.    
    Up arrow key recalls last line of commands for editing.

    These commands may not be available on all systems:
    Shift-control-a selects everything from the right of the cursor to the end of the line.
    Shift-control-e selects everything to the left of the cursor to the end of the line.
    Command-f moves the cursor to the end of the current word.   
    Command-b moves the cursor to the begining of the current word.
    Control-f moves the cursor to the right by one character.   
    Control-b moves the cursor to the left by one character.
    '''
    cmd.reinitialize()
    cmd.fetch('3v6d', type='pdb', name= 'HIVrt', async='0')
    cmd.show_as("cartoon","c. A or c. B") 
    cmd.hide("lines","c. A or c. B") 
    cmd.rock()
    cmd.set_view('(0.53,-0.06,-0.84,0.82,-0.21,0.53,-0.21,-0.98,-0.07,-0.0,-0.0,-192.99,-29.84,8.42,47.76,178.27,207.7,-20.0);')
    print('Enter "q3" to make the scene for question 3.')
    print('Enter "help q3" to see question 3 and the commands to make the scene.') 
Пример #51
0
def q2():
    '''
    DESCRIPTION

    Question 2: Look along the helical axis of the DNA. 
    Is the DNA helix bent?
    
    The following commands created the scene for "q2": 

    delete all; fetch 3v6d, HIVrt, async=0; rock;show cartoon, c. P or c. T;set_view (0.61,0.29,-0.73,0.78,-0.37,0.51,-0.12,-0.88,-0.45,-0.0,-0.0,-192.99,-29.84,8.42,47.76,178.27,207.7,-20.0);  
    
    To reuse of parts or all of the above commands, copy and paste the commands 
    onto the command line or into a plain text file. 
      
    These commands are sufficient for most editing tasks:  
    To edit code, positon cursor on command line with left mouse button.  
    Control-e moves the cursor to the end of the line, even when it is out of view.
    Control-a moves the cursor to the beginning of the line, even when it is out of view.    
    Up arrow key recalls last line of commands for editing.

    These commands may not be available on all systems:
    Shift-control-a selects everything from the right of the cursor to the end of the line.
    Shift-control-e selects everything to the left of the cursor to the end of the line.
    Command-f moves the cursor to the end of the current word.   
    Command-b moves the cursor to the begining of the current word.
    Control-f moves the cursor to the right by one character.   
    Control-b moves the cursor to the left by one character.

    '''
    cmd.reinitialize()
    cmd.fetch('3v6d',type='pdb',name='HIVrt',async='0')
    cmd.rock()
    cmd.show_as("cartoon","chain P or chain T")
    cmd.set_view('(0.61,0.29,-0.73,0.78,-0.37,0.51,-0.12,-0.88,-0.45,-0.0, 0.0,-192.99,-29.84,8.42,47.76,178.27,207.7,-20.0);')
    print('Enter "q2" to make the scene for question 2.')    
    print('Enter "help q2" to see question 2 and the commands to make the scene.')
Пример #52
0
def q1():
    '''
    DESCRIPTION

    Question 1: Explain how AZT terminates extension of the DNA chain. 
    
    The following commands created the scene for "q1": 
    
    delete all; fetch 3v6d, HIVrt, async=0; rock;preset.ball_and_stick("c. P and i. 822");set_view (-0.99,-0.1,0.06,0.09,-0.39,0.92,-0.07,0.92,0.39,0.0,0.0,-29.2,-10.56,24.72,39.27,23.02,35.38,-20.0); 

    To reuse of parts or all of the above commands, copy and paste the commands 
    onto the command line or into a plain text file. 
      
    These commands are sufficient for most editing tasks:  
    To edit code, positon cursor on command line with left mouse button.  
    Control-e moves the cursor to the end of the line, even when it is out of view.
    Control-a moves the cursor to the beginning of the line, even when it is out of view.    
    Up arrow key recalls last line of commands for editing.

    These commands may not be available on all systems:
    Shift-control-a selects everything from the right of the cursor to the end of the line.
    Shift-control-e selects everything to the left of the cursor to the end of the line.
    Command-f moves the cursor to the end of the current word.   
    Command-b moves the cursor to the begining of the current word.
    Control-f moves the cursor to the right by one character.   
    Control-b moves the cursor to the left by one character.
    '''
    cmd.reinitialize()
    cmd.fetch('3v6d', type='pdb', name='HIVrt',async='0')
    cmd.rock()
    preset.ball_and_stick('c. P and i. 822')
    cmd.set_view('(-0.99,-0.1,0.06,0.09,-0.39,0.92,-0.07,\
    0.92,0.39,0.0,0.0,-29.2,-10.56,24.72,39.27,\
    23.02,35.38,-20.0)') 
    print('Enter "q1" to set scene for question 1.')
    print('Enter "help q1" for more information.') 
Пример #53
0
 def callback(*args):
     code = var_code.get()
     type = get_trunc(var_type)
     if type == 'pdb':
         code += var_chain.get()
     try:
         result = cmd.fetch(code, type=type)
         if result == -1:
             raise CmdException('You entered an invalid pdb code: ' + code)
     except CmdException as e:
         import tkMessageBox
         tkMessageBox.showerror('Error', str(e), parent=self)
         return
     cmd.log('fetch %s, type=%s, async=0\n' % (code, type))
     if not var_keep.get():
         self.destroy()
Пример #54
0
    def __init__(self, app):
        import tkSimpleDialog
        import tkMessageBox
        import urllib
        import gzip
        import os
        import string

        pdbCode = tkSimpleDialog.askstring('PDB Loader Service',
                                                      'Please enter a 4-digit pdb code:',
                                                      parent=app.root)
        
        if pdbCode: # None is returned for user cancel
            result = cmd.fetch(pdbCode)

            if result==-1:
                tkMessageBox.showerror('Invalid Code',
                                       'You entered an invalid pdb code: ' + pdbCode,
                                       parent=app.root)
Пример #55
0
    def testFetchLocal(self):
        import urlparse
        with testing.mkdtemp() as fetch_path:
            names = []
            cmd.set('fetch_path', fetch_path)
            cmd.set('fetch_host', urlparse.urlunsplit(['file', '',
                self.datafile('pdb.mirror'), '', '']))

            cmd.fetch('1avy')
            names += ['1avy']
            self.assertItemsEqual(cmd.get_names(), names)

            cmd.fetch('1avyB')
            names += ['1avyB']
            self.assertItemsEqual(cmd.get_names(), names)
            self.assertEqual(cmd.get_chains('1avyB'), ['B'])

            cmd.fetch('1aq5', multiplex=1)
            names += ['1aq5_%04d' % (i+1) for i in range(20)]
            self.assertItemsEqual(cmd.get_names(), names)
Пример #56
0
            obj.extend( [ NORMAL] + n0 )
            if not hand:
                obj.extend( [ VERTEX ] + v0 + [ VERTEX ] + v1 )
            else:
                obj.extend( [ VERTEX ] + v1 + [ VERTEX ] + v0 )

        obj.extend( [END] )

# then we load it into PyMOL

cmd.load_cgo(obj,'cgo06')
                            
# position haemolysin through pore
if 1:
    
    cmd.fetch("7ahl",async=0)

    cmd.transform_selection("7ahl",
                            (0.70349078502033213, 0.19033556773811347, -0.68474258132841503, -11.993190038310882,
                             -0.15869362855324043, 0.98121371667870472, 0.10970571819737528, -29.939406659327624,
                             0.69276001846262825, 0.03148755047390385, 0.72048024614206196, -26.250180846754432,
                             0.0, 0.0, 0.0, 1.0))
                            
    cmd.show_as("cartoon","7ahl")
    cmd.do("util.cbc")
    cmd.set_view((\
    -0.589197695,   -0.440498680,    0.677344978,\
     0.574851871,   -0.817646086,   -0.031699535,\
     0.567794442,    0.370693058,    0.734975874,\
     0.000004128,   -0.000099868, -651.343872070,\
    -4.874452114,    8.360315323,   11.387301445,\
Пример #57
0
            target.send(hand)
        else:
            target.send(None)

@coroutine
def select_all():
    previous_hand = None
    while True:
        hand = (yield)
        if hand and not previous_hand:
            cmd.select('all')
        elif previous_hand and not hand:
            cmd.select('none')
        previous_hand = hand

cmd.fetch('1rx1')
cmd.orient()

listener = PymolListener(
    broadcaster([
        hands_splitter(
            pinch_filter(
                broadcaster([
                    hand_rotator(),
                    select_all()]
                ))
        ),
        multi_hands_filter(
            frame_scaler()
        )
    ]))
Пример #58
0
import pymol
from pymol import cmd
#pymol.pymol_argv = [ 'pymol', '-qc'] #  Quiet / no GUI
pymol.finish_launching()

cmd.fetch('1TUP', async=False)

cmd.disable('all')
cmd.enable('1TUP')
cmd.hide('all')
cmd.show('sphere', 'name zn')

cmd.show('surface', 'chain A+B+C')
cmd.show('cartoon', 'chain E+F')
cmd.scene('S0', action='store', view=0, frame=0, animate=-1)

cmd.show('cartoon')
cmd.hide('surface')

cmd.scene('S1', action='store', view=0, frame=0, animate=-1)

cmd.hide('cartoon', 'chain A+B+C')
cmd.show('mesh', 'chain A')
cmd.show('sticks', 'chain A+B+C')
cmd.scene('S2', action='store', view=0, frame=0, animate=-1)

cmd.set('ray_trace_mode', 0)
cmd.mset(1, 500)


cmd.frame(0)
Пример #59
0
    Then enter the name of an alias from the list above, for example: 
    
    site11
    
    To reuse of parts or all of the above commands, copy and paste the commands 
    onto the command line or into a plain text file. 
      
    These commands are sufficient for most editing tasks:  
    To edit code, positon cursor on command line with left mouse button.  
    Control-e moves the cursor to the end of the line, even when it is out of view.
    Control-a moves the cursor to the beginning of the line, even when it is out of view.    
    Up arrow key recalls last line of commands for editing.

    These commands may not be available on all systems:
    Shift-control-a selects everything from the right of the cursor to the end of the line.
    Shift-control-e selects everything to the left of the cursor to the end of the line.
    Command-f moves the cursor to the end of the current word.   
    Command-b moves the cursor to the begining of the current word.
    Control-f moves the cursor to the right by one character.   
    Control-b moves the cursor to the left by one character.
    """
cmd.extend('wtT4L',wtT4L)
print(wtT4L.__doc__)
cmd.bg_color("white")
cmd.fetch(code="3fa0", name="wtT4L",state = 0,async='0')
cmd.alias('site11', 'zoom resi 11; preset.technical("wtT4L")') 
cmd.alias('site31', 'preset.ball_and_stick("wtT4L");@S3_File.pml;set_view (0.31,-0.93,0.21,0.92,0.24,-0.29,0.22,0.28,0.93,-0.09,-0.05,-9.88,37.55,10.06,30.09,20.0,23.82,-20.0);')
cmd.alias('site96', 'preset.technical("wtT4L");set_view (-0.75,-0.65,0.11,0.62,-0.75,-0.22,0.22,-0.1,0.97,0.0,-0.0,-32.32,29.16,-1.45,6.77,27.32,37.32,-20.0);') 
cmd.alias('site99', 'preset.ball_and_stick("wtT4L");color bluewhite, i. 99; set_view (-0.24,-0.95,-0.21,0.51,0.07,-0.85,0.83,-0.32,0.46,0.03,-0.5,-5.37,22.35,-18.6,18.83,29.89,37.68,-20.0);') 
cmd.alias('site145', 'preset.technical("wtT4L");set_view (0.02,-0.63,-0.78,0.37,0.73,-0.56,0.93,-0.27,0.24,0.19,-0.3,-0.0,24.28,2 .24,13.53,15.23,21.26,-20.0);')
Пример #60
0
            obj.extend( [ NORMAL] + n0 )
            if not hand:
                obj.extend( [ VERTEX ] + v0 + [ VERTEX ] + v1 )
            else:
                obj.extend( [ VERTEX ] + v1 + [ VERTEX ] + v0 )

        obj.extend( [END] )

# then we load it into PyMOL

cmd.load_cgo(obj,'cgo06')
                            
# position haemolysin through pore
if 1:
    
    cmd.fetch("7ahl")

    cmd.transform_selection("7ahl",
                            (0.70349078502033213, 0.19033556773811347, -0.68474258132841503, -11.993190038310882,
                             -0.15869362855324043, 0.98121371667870472, 0.10970571819737528, -29.939406659327624,
                             0.69276001846262825, 0.03148755047390385, 0.72048024614206196, -26.250180846754432,
                             0.0, 0.0, 0.0, 1.0))
                            
    cmd.show_as("cartoon","7ahl")
    cmd.do("util.cbc")
    cmd.set_view((\
    -0.589197695,   -0.440498680,    0.677344978,\
     0.574851871,   -0.817646086,   -0.031699535,\
     0.567794442,    0.370693058,    0.734975874,\
     0.000004128,   -0.000099868, -651.343872070,\
    -4.874452114,    8.360315323,   11.387301445,\