Esempio n. 1
0
                for res2 in struct.residues[left:i + 1]:
                    for atom in res2.atoms:
                        colors[atom.idx, :] = np.array(
                            [216.0 / 255.0, 179.0 / 255.0, 101.0 / 255.0])
    return colors


if __name__ == '__main__':

    mols = "b2 b2_a a2a a2a_a".split()
    numbers = "A) B) C) D) E) F) G) H)".split()
    fig = plt.figure(1, figsize=(8, 12))

    for i, mol in enumerate(mols):

        xray = gpcr_lib.load_xray(mol)
        pdb = xray.pdbfile

        # Make colour pattern due to pattern
        colors = _make_cra_colors(pdb)
        colors = _make_ccm_colors(pdb, colors)

        a = fig.add_subplot(len(mols), 2, i * 2 + 1, aspect="equal")
        xray.plot(a,
                  "low",
                  reverseY=False,
                  sidechain=True,
                  colorscheme=colors,
                  drawchol=False)
        a.text(-35, 33, numbers[(i * 2)])
        a.text(-25, 25, "Intra.", size=14)
Esempio n. 2
0
    parser.add_argument('-p',
                        '--probes',
                        nargs="+",
                        type=float,
                        help="the probe sizes",
                        default=[1.4, 1.8, 2.2, 2.6, 3.0])
    args = parser.parse_args()

    mols = "b2 b2_a a2a a2a_a".split()
    numbers = "A) B) C) D) E) F) G) H)".split()
    fig = plt.figure(1, figsize=(8, 12))

    # Setup and calculate the partition for each molecule
    parts = [None] * len(mols)
    for i, mol in enumerate(mols):
        xray, aastruct = gpcr_lib.load_xray(mol, loadsigma=True, loadaa=True)
        parts[i] = StructurePartition(xray, aastruct, args.npies)
        parts[i].calc_surf(args.probes)
        parts[i].calc_fractal()
        parts[i].clean_up()

    # Find the lowest and maxium fractal among the different molecules
    minval = min(2.0, [p.minval for p in parts])
    maxval = np.around(max([p.maxval for p in parts]), 1)
    # Plot each of the pie charts
    for i, (part, mol) in enumerate(zip(parts, mols)):
        part.minval = minval
        part.maxval = maxval
        a1 = fig.add_subplot(len(mols), 2, i * 2 + 1)
        a2 = fig.add_subplot(len(mols), 2, i * 2 + 2)
        restocolor = gpcr_lib.read_rescontacts(args.folder, mol)
Esempio n. 3
0
import calc_surf

if __name__ == '__main__' :

    # Command-line input
    parser = argparse.ArgumentParser(description="Analysing residue exposure")
    parser.add_argument('-f','--folder', help="the  folder with the residue contacts")
    parser.add_argument('-p','--probe',type=float,help="the probe size",default=2.4)
    parser.add_argument('-c','--percentile',type=float,help="the percentile to consider",default=50)
    args = parser.parse_args()

    mols = "b2 b2_a a2a a2a_a".split()

    data = {}
    for mol in mols:
        xray, aastruct = gpcr_lib.load_xray(mol, loadsigma=True, loadaa=True)
        radii = np.asarray([calc_surf.bornradii[atom.element().upper()] for atom in aastruct.atoms])
        xyzrname = calc_surf.write_xyzr(aastruct.xyz,radii)
        surf = calc_surf.calc_surf(xyzrname, aastruct.xyz.shape[0], args.probe)
        res, contactprob = gpcr_lib.read_rescontacts(args.folder, mol, percentile=args.percentile, returnprobs=True)
        print len(res)
        mdata = {}
        for tres, s in zip(xray.template.residues, surf):
            if tres in res :
                mdata[tres] = (s[0], contactprob[res==tres][0])
        data[mol] = mdata
        with open("ses_%s"%mol,"w") as f :
            for s, r in zip(surf,xray.template.residues):
                f.write("%d %.3f\n"%(r, s[0]))

    diff = []
Esempio n. 4
0
  # If user specified only one mol, assume the same for the other densities
  if len(args.mol) == 1 : args.mol.append(args.mol[0])
  
  # Make up pre-defined labels
  labels = [args.label[0]+"/"+gpcr_lib.side_name["low"]]
  labels.append(args.label[1]+"/"+gpcr_lib.side_name["low"])
  labels.append(args.label[0]+"/"+gpcr_lib.side_name["upp"])
  labels.append(args.label[1]+"/"+gpcr_lib.side_name["upp"])
  labels.append(args.label[0]+"/mid("+gpcr_lib.side_name["low"]+")")
  labels.append(args.label[0]+"/mid("+gpcr_lib.side_name["upp"]+")")
  labels.append(args.label[1]+"/mid("+gpcr_lib.side_name["low"]+")")
  labels.append(args.label[1]+"/mid("+gpcr_lib.side_name["upp"]+")")
  
  # Read the densities and Xray structures from file
  densities1 = gpcr_lib.standard_read_and_process(args.files1,args.density[0],countnam[0])
  xray1      = gpcr_lib.load_xray(args.mol[0])
  densities2 = gpcr_lib.standard_read_and_process(args.files2,args.density[1],countnam[1])
  xray2      = gpcr_lib.load_xray(args.mol[1])

  # Write out the processed densities to file for debugging
  densities1.write(args.plot,args.out+"_savez1.npz")
  densities2.write(args.plot,args.out+"_savez2.npz")

  # Introduce a cut-off when plotting averages
  if args.plot == "average" :
    densities1.cutoff_av(cutoff=0.15)
    densities2.cutoff_av(cutoff=0.15)    
 
  # Find the maximum and minimum values
  if args.max is None :
    maxval = max(densities1.max(args.plot),densities2.max(args.plot))
Esempio n. 5
0
if __name__ == '__main__' :

  # Command-line input
  parser = argparse.ArgumentParser(description="Plotting fractal pies")
  parser.add_argument('-n','--npies',type=int,help="the number of pies",default=12)
  parser.add_argument('-p','--probes',nargs="+",type=float,help="the probe sizes",default=[2.0,2.5,3.0,3.5])
  args = parser.parse_args()
  
  mols = "b2 b2_a a2a a2a_a".split()
  numbers = "A) B) C) D) E) F) G) H)".split()
  fig = plt.figure(1,figsize=(8,12))

  # Setup and calculate the partition for each molecule
  parts = [None]*len(mols)
  for i,mol in enumerate(mols) :
    xray = gpcr_lib.load_xray(mol,loadsigma=True)
    parts[i] = StructurePartition(xray,args.npies)
    parts[i].calc_surf(args.probes)
    parts[i].calc_fractal()
    parts[i].clean_up()

  # Find the lowest and maxium fractal among the different molecules
  minval = min(2.0,[p.minval for p in parts])
  maxval = np.around(max([p.maxval for p in parts]),1)
  # Plot each of the pie charts
  for i,part in enumerate(parts) :
    part.minval = minval
    part.maxval = maxval
    a1 = fig.add_subplot(len(mols),2,i*2+1)
    a2 = fig.add_subplot(len(mols),2,i*2+2)
    part.plot([a1,a2],numbers[(i*2):(i+1)*2])    
Esempio n. 6
0
  # Setup a parser of the command-line arguments
  parser = argparse.ArgumentParser(description="Plotting pairs of GPCR densities")
  parser.add_argument('-f','--files',nargs="+",help="a list of input files.",default=[])
  parser.add_argument('-o','--out',help="the output png-file.",default="densities_series")
  parser.add_argument('-d','--density',help="the name of the densities.")
  parser.add_argument('-m','--mol',choices=["b2","a2a","b2_a","a2a_a"],help="the protein molecules")
  parser.add_argument('-p','--plot',choices=["dg","average"],help="the density to plot",default="dg")
  parser.add_argument('-r','--replacement',nargs=4,help="the replacement strings",default=["densities2","densities3","densities4","densities5"])
  parser.add_argument('-l','--label',nargs=4,help="the labels of the densities",default=[r'$10 \mu s$',r'$20 \mu s$',r'$30 \mu s$',r'$40 \mu s$'])
  parser.add_argument('--max',type=float)
  parser.add_argument('--min',type=float)
  args = parser.parse_args()
  
  # Read Xray structure and densities
  xray      = gpcr_lib.load_xray(args.mol)
  densities = [gpcr_lib.standard_read_and_process(args.files,args.density)]
  for r in args.replacement[1:] :
    filenames = [f.replace(args.replacement[0],r) for f in args.files]
    densities.append(gpcr_lib.standard_read_and_process(filenames,args.density))

  if args.plot == "average" :
    for d in densities : d.cutoff_av(cutoff=0.15)  

  if args.max is None :
    maxval = max(*[d.max(args.plot) for d in densities])
  else :
    maxval = args.max
  if args.min is None :
    minval = min(*[d.min(args.plot) for d in densities])
  else :
Esempio n. 7
0
    # Command-line input
    parser = argparse.ArgumentParser(
        description="Analyzing GPCR grid interactions")
    parser.add_argument('-p',
                        '--top',
                        help="a topology file",
                        default="system.top")
    parser.add_argument('-m',
                        '--mol',
                        choices=["b2", "a2a", "b2_a", "a2a_a"],
                        help="the protein molecule")
    args = parser.parse_args()

    # Read a Xrya structure file
    xray = gpcr_lib.load_xray(args.mol, loadsigma=True)
    pdb = xray.pdbfile

    # Remove cholesterols at the end
    while pdb.residues[-1].resname == "CHOL":
        for atom in pdb.residues[-1].atoms:
            pdb.atoms.remove(atom)
        del pdb.residues[-1]
    pdb.xyz = np.array([atom.xyz for atom in pdb.atoms])

    # Read a Gromacs topology file
    top = gmx.TopFile(args.top)

    # Store away all interesting LJ parameter pairs
    roh_type = "SP1"  #"SC1"
    roh_pairs = []
Esempio n. 8
0
        '--replacement',
        nargs=4,
        help="the replacement strings",
        default=["densities2", "densities3", "densities4", "densities5"])
    parser.add_argument(
        '-l',
        '--label',
        nargs=4,
        help="the labels of the densities",
        default=[r'$10 \mu s$', r'$20 \mu s$', r'$30 \mu s$', r'$40 \mu s$'])
    parser.add_argument('--max', type=float)
    parser.add_argument('--min', type=float)
    args = parser.parse_args()

    # Read Xray structure and densities
    xray = gpcr_lib.load_xray(args.mol)
    densities = [gpcr_lib.standard_read_and_process(args.files, args.density)]
    for r in args.replacement[1:]:
        filenames = [f.replace(args.replacement[0], r) for f in args.files]
        densities.append(
            gpcr_lib.standard_read_and_process(filenames, args.density))

    if args.plot == "average":
        for d in densities:
            d.cutoff_av(cutoff=0.15)

    if args.max is None:
        maxval = max(*[d.max(args.plot) for d in densities])
    else:
        maxval = args.max
    if args.min is None:
Esempio n. 9
0
        print "CCM: "+" ".join(res2.resname for res2 in struct.residues[left:i+1])
        for res2 in struct.residues[left:i+1] :
          for atom in res2.atoms :  
            colors[atom.idx,:] = np.array([216.0/255.0,179.0/255.0,101.0/255.0])
  return colors

if __name__ == '__main__' :


  mols = "b2 b2_a a2a a2a_a".split()
  numbers = "A) B) C) D) E) F) G) H)".split()
  fig = plt.figure(1,figsize=(8,12))
  
  for i,mol in enumerate(mols) :
  
    xray = gpcr_lib.load_xray(mol)
    pdb = xray.pdbfile

    # Make colour pattern due to pattern
    colors = _make_cra_colors(pdb)
    colors = _make_ccm_colors(pdb,colors)

    a = fig.add_subplot(len(mols),2,i*2+1,aspect="equal")
    xray.plot(a,"low",reverseY=False,sidechain=True,colorscheme=colors,drawchol=False)
    a.text(-35,33,numbers[(i*2)])
    a.text(-25,25,"Intra.",size=14)
    a.set_xticklabels([])
    a.set_yticklabels([])
    a.set_xlim((-30,30))
    a.set_ylim((-30,30))
    if i == 0 :
Esempio n. 10
0
  f.write('object "regular positions regular connections" class field\n')
  f.write('component "positions" value 1\n')
  f.write('component "connections" value 2\n')
  f.write('component "data" value 3\n')
  f.close()

if __name__ == '__main__' :

  # Command-line input
  parser = argparse.ArgumentParser(description="Analyzing GPCR grid interactions")
  parser.add_argument('-p','--top',help="a topology file",default="system.top")
  parser.add_argument('-m','--mol',choices=["b2","a2a","b2_a","a2a_a"],help="the protein molecule")
  args = parser.parse_args()

  # Read a Xrya structure file
  xray = gpcr_lib.load_xray(args.mol,loadsigma=True)
  pdb = xray.pdbfile

  # Remove cholesterols at the end
  while pdb.residues[-1].resname == "CHOL" :
    for atom in pdb.residues[-1].atoms :
      pdb.atoms.remove(atom)
    del pdb.residues[-1]
  pdb.xyz = np.array([atom.xyz for atom in pdb.atoms])

  # Read a Gromacs topology file
  top = gmx.TopFile(args.top)

  # Store away all interesting LJ parameter pairs
  roh_type = "SP1"  #"SC1"
  roh_pairs = []
Esempio n. 11
0
    parser.add_argument('-p',
                        '--probes',
                        nargs="+",
                        type=float,
                        help="the probe sizes",
                        default=[2.0, 2.5, 3.0, 3.5])
    args = parser.parse_args()

    mols = "b2 b2_a a2a a2a_a".split()
    numbers = "A) B) C) D) E) F) G) H)".split()
    fig = plt.figure(1, figsize=(8, 12))

    # Setup and calculate the partition for each molecule
    parts = [None] * len(mols)
    for i, mol in enumerate(mols):
        xray = gpcr_lib.load_xray(mol, loadsigma=True)
        parts[i] = StructurePartition(xray, args.npies)
        parts[i].calc_surf(args.probes)
        parts[i].calc_fractal()
        parts[i].clean_up()

    # Find the lowest and maxium fractal among the different molecules
    minval = min(2.0, [p.minval for p in parts])
    maxval = np.around(max([p.maxval for p in parts]), 1)
    # Plot each of the pie charts
    for i, part in enumerate(parts):
        part.minval = minval
        part.maxval = maxval
        a1 = fig.add_subplot(len(mols), 2, i * 2 + 1)
        a2 = fig.add_subplot(len(mols), 2, i * 2 + 2)
        part.plot([a1, a2], numbers[(i * 2):(i + 1) * 2])