#!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' Align a list of molecules using `super` command in PyMol. The first item in the list is considered as the reference. ''' import pymolPy3 import pyrotein as pr import os import colorsimple as cs from loaddata import load_xlsx # Specify chains to process... fl_chain = "chains.comp.xlsx" lines = load_xlsx(fl_chain) drc = "pdb" # Define atoms used for distance matrix analysis... peptide = ["N", "CA", "C", "O"] # Specify the range of atoms from rhodopsin... nterm = 1 cterm = 322 len_peptide = (cterm - nterm + 1) * len(peptide) # Start pymol pm = pymolPy3.pymolPy3() ## pm("bg white") # Get the color palette... color_items = [i[4] for i in lines]
gp("plot \\") gp(f"'-' using 1:2 with points pointtype 7 linecolor rgb 'blue',\\") gp("") for i, v in enumerate(omega.reshape(-1)): v *= 180 / np.pi gp(f"{i} {v}") gp("e") gp("unset multiplot") gp("exit") # [[[ ANALYZE PDB ENTRIES ]]] # Specify chains to process... fl_chain = "chains.comp.xlsx" lines = load_xlsx(fl_chain, sheet="DesKC", splitchain=True) # Select residues... nterm = 170 cterm = 206 ## cterm = 200 sample_per_rise = 1 num_turn = (cterm - nterm + 1) # Consider offset... offterm = 4 nterm_aux = nterm - offterm cterm_aux = cterm + offterm num_turn += offterm * 2 # The range to highlight...
# User defined range... nterm, cterm = 1, 322 len_seg = cterm - nterm + 1 super_seg = super_seq[nseqi:nseqi + len_seg] # Load constant -- atomlabel... label_dict = pr.atom.constant_atomlabel() aa_dict = pr.atom.constant_aminoacid_code() # Calculate the total length of distance matrix... len_dmat = np.sum([len(label_dict[aa_dict[i]]) for i in super_seg]) # [[[ ANALYZE PDB ENTRIES ]]] # Specify chains to process... fl_chain = "chains.comp.xlsx" lines = load_xlsx(fl_chain, sheet="Sheet1") drc = "pdb" ## dmats = np.zeros((len(lines), len_dmat, len_dmat)) len_lower_tri = (len_dmat * len_dmat - len_dmat) // 2 dmats = np.zeros((len(lines), len_lower_tri)) # Process each entry... for i_fl, line in enumerate(lines[:]): # Unpack parameters _, pdb, chain, species = line[:4] print(f"Processing {pdb}_{chain}") # Read coordinates from a PDB file... fl_pdb = f"{pdb}.pdb" pdb_path = os.path.join(drc, fl_pdb)
def reverse_sign(u, vh, rank, index_from_zero = True): # Comply with the convention (1-based index) rank_in_data = rank if index_from_zero else rank - 1 # Reverse sign... u[:, rank_in_data] = - u[:, rank_in_data] vh[rank_in_data, :] = -vh[rank_in_data, :] return None # Specify chains to process... fl_chain = "rhodopsin.db.xlsx" lines = load_xlsx(fl_chain, sheet = "total", splitchain = True) # Load upstream data... u = np.load("u.seq.npy") s = np.load("s.seq.npy") vh = np.load("vh.seq.npy") len_seq = np.load("len_seq.npy") # Allow positive value that fits the distance in nature (optinal)... reverse_sign(u, vh, 1, index_from_zero = False) ## reverse_sign(u, vh, 2, index_from_zero = False) ## reverse_sign(u, vh, 4, index_from_zero = False) ## reverse_sign(u, vh, 6, index_from_zero = False) # Calculate the weighted coefficients... # The following is a computational equivalence to c = RMS(u @ s, axis = 0) @ vh